Commit 4d5adf1c by liuzhanxin

fix

parent 03e8028f
<template>
<view class="top-container" >
<view class="detailtext"><text class="titletext">整改项详情</text><text class="contenttext">{{description}}</text></view>
<view class="detailtext"><text class="titletext">位置</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletextlong">整改项照片</text></view>
<view v-if="imgUrl.length==0" class="detailtext"><text class="remind">未上传整改项照片</text></view>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in imgUrl" :key="index">
<button class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
</view>
<view class="top-container">
<view class="detailtext"><text class="titletext">整改项详情</text><text class="contenttext">{{description}}</text></view>
<view class="detailtext"><text class="titletext">位置</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{roomName}}</text></view>
<view class="detailtext"><text class="titletextlong">整改项照片</text></view>
<view v-if="imgUrl.length==0" class="detailtext"><text class="remind">未上传整改项照片</text></view>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in imgUrl" :key="index">
<button class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
imgUrl:[],
roomName:"",
description:"",
detailData:{}
imgUrl: [],
roomName: "",
description: "",
detailData: {}
}
},
methods: {
onLoad() {
var that = this
uni.$on('rectificationListData',function(data){
console.log("@@@@@@@@@@@@@@@"+JSON.stringify(data))
var detailData = data[0]
that.roomName = JSON.parse(detailData.room).name
that.description = detailData.description;
that.detailData = detailData;
that.imgUrl = JSON.parse(detailData.images)
that.$forceUpdate();
})
},
onUnload(){
uni.$off('rectificationListData',function(data){
})
methods: {
onLoad() {
var that = this
uni.$on('rectificationListData', function(data) {
console.log("@@@@@@@@@@@@@@@" + JSON.stringify(data))
var detailData = data[0]
that.roomName = JSON.parse(detailData.room).name
that.description = detailData.description;
that.detailData = detailData;
that.imgUrl = JSON.parse(detailData.images)
that.$forceUpdate();
})
},
onUnload() {
uni.$off('rectificationListData', function(data) {
})
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
},
},
/*上拉加载的回调 */
upCallback(page) {
},
onNavigationBarButtonTap(){
uni.navigateTo({
url:"../Security-Check/index?mod=put"
})
uni.$emit("rectificationEdit",[this.detailData])
},
onNavigationBarButtonTap() {
uni.navigateTo({
url: "../Security-Check/index?mod=put"
})
uni.$emit("rectificationEdit", [this.detailData])
},
}
}
</script>
<style>
.top-container {
display: flex;
flex-direction: column;
width: 100%;
padding-left: 20rpx;
margin-top: 10rpx;
margin-bottom: 20rpx;
}
.title {
font-size: 16px;
color: #333333;
}
.containter{
display: flex;
width: 100%;
background-color: #F5F5F5;
padding: 20rpx;
}
.statuspic{
width:80rpx;
height:80rpx;
}
.titletext{
font-size:28rpx;
color: #666666;
margin-right: 78rpx;
flex:1
}
.titletextlong{
font-size:28rpx;
color: #666666;
margin-right: 50rpx;
flex:1
}
.contenttext{
font-size:28rpx;
color: #333333;
flex:3
}
.pic {
width:80rpx;
height:80rpx;
}
.remind {
font-size:32rpx;
color: #CDCDCD;
}
.detailtext {
display: flex;
flex-direction: row;
margin-top: 20rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
padding: 0;
<style>
.top-container {
display: flex;
flex-direction: column;
width: 100%;
padding-left: 20rpx;
margin-top: 10rpx;
margin-bottom: 20rpx;
}
.title {
font-size: 16px;
color: #333333;
}
.containter {
display: flex;
width: 100%;
background-color: #F5F5F5;
padding: 20rpx;
}
.statuspic {
width: 80rpx;
height: 80rpx;
}
.titletext {
font-size: 28rpx;
color: #666666;
margin-right: 78rpx;
flex: 1
}
.titletextlong {
font-size: 28rpx;
color: #666666;
margin-right: 50rpx;
flex: 1
}
.contenttext {
font-size: 28rpx;
color: #333333;
flex: 3
}
.pic {
width: 80rpx;
height: 80rpx;
}
.remind {
font-size: 32rpx;
color: #CDCDCD;
}
.detailtext {
display: flex;
flex-direction: row;
margin-top: 20rpx;
}
.camera-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
padding: 0;
}
</style>
</style>
<template>
<Mescroll style="background-color: #F5F5F5;" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<view style="width: auto;background-color: #FFFFFF;">
<image class="statuspic" :src="news.imgsrc">
<view class="top-container" >
<text class="title">{{news.description}}</text>
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{JSON.parse(news.check_scope).name}}</text></view>
<view class="detailtext"><text class="titletext">负责人</text><text class="contenttext">{{news.manager?JSON.parse(news.manager).name:""}}</text></view>
<view class="detailtext"><text class="titletext">创建人</text><text class="contenttext">{{news.creator?JSON.parse(news.creator).name:""}}</text></view>
<view class="detailtext"><text class="titletextlong">创建时间</text><text class="contenttext">{{news.createTime}}</text></view>
<view class="detailtext"><text class="titletextlong">检查任务</text><text class="contenttext">{{news.check_task_code_name?news.check_task_code_name:""}}</text></view>
</view>
</view>
</view>
<Drawer mode="left" :visible="showDrawer" @close="closeDrawer">
<view class="d-container">
<view style="width: 100%; height:100%;padding:10px">
<view hover-class="hover" @click="close" style="width: auto;display: flex;flex-direction: row; justify-content: flex-end;padding-right: 20px;">
<image class="tip" src="../../static/rectification-item/close.png">
</view>
<text style="font-size: 24px; line-height:33px;margin-top: 50px;">过滤条件</text>
<view class="item" hover-class="hover" @click="showStatusPicker">
<text class="title" style="margin-top: 30upx;">状态</text>
<view class="selcontent">
<text class="datacontent">{{curStatus.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showTaskPicker">
<text class="title" style="margin-top: 30upx;">检查任务</text>
<view class="selcontent">
<text class="datacontent">{{curTask.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showLabPicker">
<text class="title" style="margin-top: 30upx;">实验室</text>
<view class="selcontent">
<text class="datacontent">{{curLab.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="datetime" hover-class="hover" @click="showStartTimePicker">
<text class="title" style="margin-left: 15upx;" >开始日期</text>
<view class="selcontent-time">
<text class="datacontent">{{startTime!=""?startTime:"请选择开始时间"}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="datetime" hover-class="hover" @click="showEndTimePicker">
<text class="title" style="margin-left: 15upx;">结束日期</text>
<view class="selcontent-time">
<text class="datacontent">{{endTime !=""?endTime:"请选择开始时间"}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 80px;">
<view hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext" >提交</text>
</view>
</view>
</view>
</view>
</Drawer>
<Picker
:mode="pickerMod"
@confirm="onConfirm"
ref="picker"
themeColor="#f00"
:selectList="itemList"
></Picker>
</Mescroll>
</template>
<script>
import Mescroll from "../../components/mescroll-uni/mescroll-body.vue"
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import Drawer from '@/components/uni-drawer/uni-drawer.vue'
import Picker from "@/components/w-picker/w-picker.vue";
const sortFunction = (x,y)=>{
if(x.created > y.created){
return -1;
}else {
return 1;
}
}
export default {
mixins: [MescrollMixin],
data() {
return {
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [],
upOption: {
use: false,
},
showDrawer:false,
drawer:{status:"fckkk"},
itemList:[],
statusData : [{label:"待确定",value:"unconfirmed"}, {label:"待处理",value:"pend"}, {label:"待整改",value:"correct"},{label:"整改中",value:"processed"},{label:"已处理",value:"finish"}, {label:'已取消',value:'cancel'}],
curType:"",
labData:[],
taskData:[],
filterBody:"",
pickerMod:"selector",
curTask:{},
curStatus:{},
curLab:{},
startTime:"",
endTime:"",
}
},
components: {
Drawer,
Picker,
Mescroll
},
methods: {
closeDrawer(){
},
close(){
this.showDrawer = false;
},
onNavigationBarButtonTap(){
this.showDrawer = true;
},
onLoad() {
this.loadData();
this.getTaskList();
this.getLabList();
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
},
/*上拉加载的回调 */
upCallback(page) {
},
/*获取列表*/
loadData(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/dangers?page_number=1&page_size=200'+this.filterBody,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
data.map((opt)=>{
opt.createTime = this.GLOBALUTIL.moment(opt.created).format("YYYY-MM-DD HH:mm:ss")
opt.imgsrc = this.handleStatus(opt)
})
data.sort(sortFunction);
this.dataList = data;
// console.log(JSON.stringify(data))
}
})
},
handleStatus(opt) {
switch (opt.status) {
case 'unconfirmed':
return "../../static/rectification-item/daiqueding.png"
case 'pend':
return "../../static/rectification-item/daichuli.png"
case 'correct':
return "../../static/rectification-item/daizhenggai.png"
case 'processed':
return "../../static/rectification-item/zhenggaizhong.png"
case 'finish':
return "../../static/rectification-item/yiwancheng.png"
case 'cancel':
return "../../static/rectification-item/cancel.png"
default:
return"../../static/rectification-item/daiqueding.png"
}
},
goDetail(data){
uni.navigateTo({
url:"./detail"
})
uni.$emit("rectificationListData",[data])
},
showStatusPicker(){
this.curType = "status"
this.pickerMod = "selector";
this.itemList = this.statusData;
this.$refs.picker.show()
},
showTaskPicker(){
this.curType = "task"
this.pickerMod = "selector";
this.itemList = this.taskData;
this.$refs.picker.show()
},
showLabPicker(){
this.curType = "lab"
this.pickerMod = "selector";
this.itemList = this.labData;
this.$refs.picker.show()
},
showStartTimePicker(){
this.curType = "startTime";
this.pickerMod = "date";
this.$refs.picker.show()
},
showEndTimePicker(){
this.curType = "endTime";
this.pickerMod = "date";
this.$refs.picker.show()
},
onConfirm(data){
console.log(JSON.stringify(data))
if(this.curType == "status"){
this.curStatus = {"name":data.checkArr.label,value:data.checkArr.value}
}else if(this.curType == "task"){
this.curTask = {"name":data.checkArr.label,value:data.checkArr.value}
}else if(this.curType == "lab"){
this.curLab = {"name":data.checkArr.label,value:data.checkArr.value}
}
else if(this.curType == "startTime"){
this.startTime = data.result
}else{
this.endTime = data.result
}
//this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
},
getTaskList(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
console.log(data.length)
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.taskData = itemList;
}
})
},
getLabList(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/education-manage/v1/experiment-centers?page_number=1&page_size=100&_=1539337073882',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.labData = itemList;
}
})
},
onSubmitClick(){
this.filterBody = "";
if(this.curTask.value){
this.filterBody = this.filterBody +'&check_task_id='+this.curTask.value
}
if(this.curLab.value){
this.filterBody = this.filterBody +'&check_scope='+this.curLab.value
}
if(this.curStatus.value){
this.filterBody = this.filterBody +'&status='+this.curStatus.value
}
if(this.startTime){
this.filterBody = this.filterBody+'&check_start_date='+this.startTime
}
if(this.endTime){
this.filterBody = this.filterBody+'&check_end_date='+this.endTime
}
this.showDrawer = false;
this.loadData();
}
}
}
</script>
<style>
/*说明*/
.notice{
font-size: 30upx;
padding: 40upx 0;
border-bottom: 1upx solid #eee;
text-align: center;
}
/*展示上拉加载的数据列表*/
.news-li{
widht:auto;
font-size: 32upx;
padding-top: 20upx;
padding-left: 20upx;
padding-right: 20upx;
padding-bottom: 0upx;
background-color: #F5F5F5;
}
.news-li .new-content{
font-size: 28upx;
margin-top: 10upx;
margin-left: 20upx;
color: #666;
}
.icon {
width:20upx;
height:20upx;
margin-right: 20upx;
}
.top-container {
display: flex;
flex-direction: column;
width: auto;
padding-left: 50upx;
margin-top: -35upx;
padding-bottom: 30upx;
}
.status {
width:170upx;
height:35upx;
background-color: rgba(242,115,115,0.10);
border-radius: 50upx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35upx;
}
.status-text{
color: #F27373;
font-size: 11px;
}
.hover{
opacity: 0.7;
}
.title {
font-size: 16px;
color: #333333;
}
.des {
font-weight:200;
font-size:14px;
color:#676767
}
.detail {
font-size:14px;
}
.type {
font-size:14px;
}
.statuspic{
width:80upx;
height:80upx;
}
.titletext{
font-size:28upx;
color: #666666;
margin-right: 78upx;
}
.titletextlong{
font-size:28upx;
color: #666666;
margin-right: 50upx;
}
.contenttext{
font-size:28upx;
color: #333333;
},
.selcontent {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 20px;
}
.selcontent-time {
display: flex;
flex-direction: row;
align-items: center;
}
.item {
border-bottom: 1upx solid #D0D0D0;
width: auto;
margin-top: 20upx;
margin-left: 20upx;
margin-right: 40upx;
padding-bottom: 10upx;
}
.datacontent {
width: 100%;
font-size: 16px;
color: #4F4F4F;
}
.hover {
opacity: 0.7;
}
.tip {
width: 30upx;
height:30upx
}
.submit-button {
display: flex;
width:500upx;
height:60upx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15upx;
margin-left: 0;
margin-right: 0;
margin-bottom: 40upx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.d-container {
width: 600upx;
}
.datetime{
width: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top:20px;
}
.detailtext{
padding-right: 20px;
}
<template>
<Mescroll style="background-color: #F5F5F5;" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption"
@down="downCallback" @up="upCallback">
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<view style="width: auto;background-color: #FFFFFF;">
<image class="statuspic" :src="news.imgsrc">
<view class="top-container">
<text class="title">{{news.description}}</text>
<view class="detailtext"><text class="titletext">实验室</text><text class="contenttext">{{JSON.parse(news.check_scope).name}}</text></view>
<view class="detailtext"><text class="titletext">负责人</text><text class="contenttext">{{news.manager?JSON.parse(news.manager).name:""}}</text></view>
<view class="detailtext"><text class="titletext">创建人</text><text class="contenttext">{{news.creator?JSON.parse(news.creator).name:""}}</text></view>
<view class="detailtext"><text class="titletextlong">创建时间</text><text class="contenttext">{{news.createTime}}</text></view>
<view class="detailtext"><text class="titletextlong">检查任务</text><text class="contenttext">{{news.check_task_code_name?news.check_task_code_name:""}}</text></view>
</view>
</view>
</view>
<Drawer mode="left" :visible="showDrawer" @close="closeDrawer">
<view class="d-container">
<view style="width: 100%; height:100%;padding:10px">
<view hover-class="hover" @click="close" style="width: auto;display: flex;flex-direction: row; justify-content: flex-end;padding-right: 20px;">
<image class="tip" src="../../static/rectification-item/close.png">
</view>
<text style="font-size: 24px; line-height:33px;margin-top: 50px;">过滤条件</text>
<view class="item" hover-class="hover" @click="showStatusPicker">
<text class="title" style="margin-top: 30upx;">状态</text>
<view class="selcontent">
<text class="datacontent">{{curStatus.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showTaskPicker">
<text class="title" style="margin-top: 30upx;">检查任务</text>
<view class="selcontent">
<text class="datacontent">{{curTask.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showLabPicker">
<text class="title" style="margin-top: 30upx;">实验室</text>
<view class="selcontent">
<text class="datacontent">{{curLab.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="datetime" hover-class="hover" @click="showStartTimePicker">
<text class="title" style="margin-left: 15upx;">开始日期</text>
<view class="selcontent-time">
<text class="datacontent">{{startTime!=""?startTime:"请选择开始时间"}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="datetime" hover-class="hover" @click="showEndTimePicker">
<text class="title" style="margin-left: 15upx;">结束日期</text>
<view class="selcontent-time">
<text class="datacontent">{{endTime !=""?endTime:"请选择开始时间"}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 80px;">
<view hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">提交</text>
</view>
</view>
</view>
</view>
</Drawer>
<Picker :mode="pickerMod" @confirm="onConfirm" ref="picker" themeColor="#f00" :selectList="itemList"></Picker>
</Mescroll>
</template>
<script>
import Mescroll from "../../components/mescroll-uni/mescroll-body.vue"
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import Drawer from '@/components/uni-drawer/uni-drawer.vue'
import Picker from "@/components/w-picker/w-picker.vue";
const sortFunction = (x, y) => {
if (x.created > y.created) {
return -1;
} else {
return 1;
}
}
export default {
mixins: [MescrollMixin],
data() {
return {
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [],
upOption: {
use: false,
},
showDrawer: false,
drawer: {
status: "fckkk"
},
itemList: [],
statusData: [{
label: "待确定",
value: "unconfirmed"
}, {
label: "待处理",
value: "pend"
}, {
label: "待整改",
value: "correct"
}, {
label: "整改中",
value: "processed"
}, {
label: "已处理",
value: "finish"
}, {
label: '已取消',
value: 'cancel'
}],
curType: "",
labData: [],
taskData: [],
filterBody: "",
pickerMod: "selector",
curTask: {},
curStatus: {},
curLab: {},
startTime: "",
endTime: "",
}
},
components: {
Drawer,
Picker,
Mescroll
},
methods: {
closeDrawer() {},
close() {
this.showDrawer = false;
},
onNavigationBarButtonTap() {
this.showDrawer = true;
},
onLoad() {
this.loadData();
this.getTaskList();
this.getLabList();
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
},
/*上拉加载的回调 */
upCallback(page) {
},
/*获取列表*/
loadData() {
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/dangers?page_number=1&page_size=200' + this.filterBody,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
var data = res.data.data;
data.map((opt) => {
opt.createTime = this.GLOBALUTIL.moment(opt.created).format("YYYY-MM-DD HH:mm:ss")
opt.imgsrc = this.handleStatus(opt)
})
data.sort(sortFunction);
this.dataList = data;
// console.log(JSON.stringify(data))
}
})
},
handleStatus(opt) {
switch (opt.status) {
case 'unconfirmed':
return "../../static/rectification-item/daiqueding.png"
case 'pend':
return "../../static/rectification-item/daichuli.png"
case 'correct':
return "../../static/rectification-item/daizhenggai.png"
case 'processed':
return "../../static/rectification-item/zhenggaizhong.png"
case 'finish':
return "../../static/rectification-item/yiwancheng.png"
case 'cancel':
return "../../static/rectification-item/cancel.png"
default:
return "../../static/rectification-item/daiqueding.png"
}
},
goDetail(data) {
uni.navigateTo({
url: "./detail"
})
uni.$emit("rectificationListData", [data])
},
showStatusPicker() {
this.curType = "status"
this.pickerMod = "selector";
this.itemList = this.statusData;
this.$refs.picker.show()
},
showTaskPicker() {
this.curType = "task"
this.pickerMod = "selector";
this.itemList = this.taskData;
this.$refs.picker.show()
},
showLabPicker() {
this.curType = "lab"
this.pickerMod = "selector";
this.itemList = this.labData;
this.$refs.picker.show()
},
showStartTimePicker() {
this.curType = "startTime";
this.pickerMod = "date";
this.$refs.picker.show()
},
showEndTimePicker() {
this.curType = "endTime";
this.pickerMod = "date";
this.$refs.picker.show()
},
onConfirm(data) {
console.log(JSON.stringify(data))
if (this.curType == "status") {
this.curStatus = {
"name": data.checkArr.label,
value: data.checkArr.value
}
} else if (this.curType == "task") {
this.curTask = {
"name": data.checkArr.label,
value: data.checkArr.value
}
} else if (this.curType == "lab") {
this.curLab = {
"name": data.checkArr.label,
value: data.checkArr.value
}
} else if (this.curType == "startTime") {
this.startTime = data.result
} else {
this.endTime = data.result
}
//this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
},
getTaskList() {
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
var data = res.data.data;
console.log(data.length)
var itemList = data.map((opt) => {
return {
label: opt.name,
value: opt.id
};
})
this.taskData = itemList;
}
})
},
getLabList() {
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/education-manage/v1/experiment-centers?page_number=1&page_size=100&_=1539337073882',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
var data = res.data.data;
var itemList = data.map((opt) => {
return {
label: opt.name,
value: opt.id
};
})
this.labData = itemList;
}
})
},
onSubmitClick() {
this.filterBody = "";
if (this.curTask.value) {
this.filterBody = this.filterBody + '&check_task_id=' + this.curTask.value
}
if (this.curLab.value) {
this.filterBody = this.filterBody + '&check_scope=' + this.curLab.value
}
if (this.curStatus.value) {
this.filterBody = this.filterBody + '&status=' + this.curStatus.value
}
if (this.startTime) {
this.filterBody = this.filterBody + '&check_start_date=' + this.startTime
}
if (this.endTime) {
this.filterBody = this.filterBody + '&check_end_date=' + this.endTime
}
this.showDrawer = false;
this.loadData();
}
}
}
</script>
<style>
/*说明*/
.notice {
font-size: 30upx;
padding: 40upx 0;
border-bottom: 1upx solid #eee;
text-align: center;
}
/*展示上拉加载的数据列表*/
.news-li {
widht: auto;
font-size: 32upx;
padding-top: 20upx;
padding-left: 20upx;
padding-right: 20upx;
padding-bottom: 0upx;
background-color: #F5F5F5;
}
.news-li .new-content {
font-size: 28upx;
margin-top: 10upx;
margin-left: 20upx;
color: #666;
}
.icon {
width: 20upx;
height: 20upx;
margin-right: 20upx;
}
.top-container {
display: flex;
flex-direction: column;
width: auto;
padding-left: 50upx;
margin-top: -35upx;
padding-bottom: 30upx;
}
.status {
width: 170upx;
height: 35upx;
background-color: rgba(242, 115, 115, 0.10);
border-radius: 50upx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35upx;
}
.status-text {
color: #F27373;
font-size: 11px;
}
.hover {
opacity: 0.7;
}
.title {
font-size: 16px;
color: #333333;
}
.des {
font-weight: 200;
font-size: 14px;
color: #676767
}
.detail {
font-size: 14px;
}
.type {
font-size: 14px;
}
.statuspic {
width: 80upx;
height: 80upx;
}
.titletext {
font-size: 28upx;
color: #666666;
margin-right: 78upx;
}
.titletextlong {
font-size: 28upx;
color: #666666;
margin-right: 50upx;
}
.contenttext {
font-size: 28upx;
color: #333333;
}
,
.selcontent {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 20px;
}
.selcontent-time {
display: flex;
flex-direction: row;
align-items: center;
}
.item {
border-bottom: 1upx solid #D0D0D0;
width: auto;
margin-top: 20upx;
margin-left: 20upx;
margin-right: 40upx;
padding-bottom: 10upx;
}
.datacontent {
width: 100%;
font-size: 16px;
color: #4F4F4F;
}
.hover {
opacity: 0.7;
}
.tip {
width: 30upx;
height: 30upx
}
.submit-button {
display: flex;
width: 500upx;
height: 60upx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15upx;
margin-left: 0;
margin-right: 0;
margin-bottom: 40upx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
.d-container {
width: 600upx;
}
.datetime {
width: auto;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-top: 20px;
}
.detailtext {
padding-right: 20px;
}
</style>
<template>
<view class="content">
<text class="title"> 实验室名称: {{objectData.name}}</text>
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="location-container" hover-class="hover" @click="showAddressSel">
<text class="location">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
<text class="title" style="margin-top: 30rpx;">整改项详情</text>
<view style="width: 100%;">
<textarea class="detail" :value="description" @blur="changeTextValue" />
</view>
<text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
<view class="photo">
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
<button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text>
</button>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="itemList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
<text class="title"> 实验室名称: {{objectData.name}}</text>
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="location-container" hover-class="hover" @click="showAddressSel">
<text class="location">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
<text class="title" style="margin-top: 30rpx;">整改项详情</text>
<view style="width: 100%;">
<textarea class="detail" :value="description" @blur="changeTextValue" />
</view>
<text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
<view class="photo">
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
<button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text>
</button>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="itemList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</view>
</template>
<script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue"
import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
<script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue"
import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
export default {
data() {
return {
showActionSheet: false,
maskClosable: true,
tips: "请选择",
color: "#9a9a9a",
size: 26,
isCancel: true,
itemList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{},
checkitem:{},
taskId:"",
images:[],
room:{},
description:"",
address:"",
addressType:"",
submitMethod:"POST",
baseBody:{},
submitShow:false,
showActionSheet: false,
maskClosable: true,
tips: "请选择",
color: "#9a9a9a",
size: 26,
isCancel: true,
itemList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{},
checkitem:{},
taskId:"",
images:[],
room:{},
description:"",
address:"",
addressType:"",
submitMethod:"POST",
baseBody:{},
submitShow:false,
}
},
onLoad(option) {
if(option.mod){
this.submitMethod = "PUT"
}
onLoad(option) {
if(option.mod){
this.submitMethod = "PUT"
}
var that = this;
uni.$on('addressSave',function(data){
console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp))
var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
})
uni.$on('safeReportData',function(data){
that.objectData = data[0]
that.checkitem = data[1]
that.taskId = data[2]
that.room = that.objectData
if(that.objectData.type == "site"){
that.addressType = "site";
that.address = that.objectData.name
}
})
uni.$on('rectificationEdit',function(data){
var baseData = data[0];
that.baseBody = baseData;
that.objectData = JSON.parse(baseData.check_scope)
that.checkitem = baseData.check_item
that.taskId = baseData.check_task_id ;
that.description = baseData.description ;
that.images = JSON.parse(baseData.images);
that.room = JSON.parse(baseData.room);
if(that.objectData.type == "site"){
that.addressType = "site";
that.address = that.objectData.name
}
})
uni.$on('securitySubmitPicChange',function(data){
that.images = data[0];
uni.$on('addressSave',function(data){
console.log(JSON.stringify(that.GLOBALUTIL.addressSelectionTemp))
var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
})
uni.$on('safeReportData',function(data){
that.objectData = data[0]
that.checkitem = data[1]
that.taskId = data[2]
that.room = that.objectData
if(that.objectData.type == "site"){
that.addressType = "site";
that.address = that.objectData.name
}
})
uni.$on('rectificationEdit',function(data){
var baseData = data[0];
that.baseBody = baseData;
that.objectData = JSON.parse(baseData.check_scope)
that.checkitem = baseData.check_item
that.taskId = baseData.check_task_id ;
that.description = baseData.description ;
that.images = JSON.parse(baseData.images);
that.room = JSON.parse(baseData.room);
if(that.objectData.type == "site"){
that.addressType = "site";
that.address = that.objectData.name
}
})
uni.$on('securitySubmitPicChange',function(data){
that.images = data[0];
})
},
onUnload(){
var that = this
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('safeReportData',function(data){
})
uni.$off('rectificationEdit',function(data){
})
uni.$off('securitySubmitPicChange',function(data){
})
},
onUnload(){
var that = this
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('safeReportData',function(data){
})
uni.$off('rectificationEdit',function(data){
})
uni.$off('securitySubmitPicChange',function(data){
})
},
methods: {
showAddressSel(){
if(this.addressType == "site"){
return
}
uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4"
})
methods: {
showAddressSel(){
if(this.addressType == "site"){
return
}
uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4"
})
},
onclick: function() {
console.log(this.textvalue)
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
},
onclick: function() {
console.log(this.textvalue)
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
},
onSubmitClick: function() {
this.submitShow = false;
onSubmitClick: function() {
this.submitShow = false;
var body = {
"check_scope":JSON.stringify(this.objectData),
"check_item_id":this.checkitem.id,
......@@ -147,112 +147,112 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
"place":this.objectData.name,
"description":this.description,
"room":JSON.stringify(this.room)
}
if(this.submitMethod == "PUT"){
body = this.baseBody
body.description = this.description
}
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(JSON.stringify(body))
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: this.submitMethod,
data:JSON.stringify(body),
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user' : JSON.stringify(user)
},
success: (res) => {
console.log(JSON.stringify(res))
if(res.statusCode == 200){
if(this.submitMethod == "PUT"){
uni.$emit("rectificationListData",[this.baseBody])
}
this.$refs.popup.open({
type:'success',
content:'提交成功!',
timeout:1000,
isClick:false
});
setTimeout(()=>{
uni.navigateBack({
delta:1
})
},1000)
}
}
})
},
itemClick: function(item) {
var that = this
if(item.index == 0){
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机
success: function (res) {
}
if(this.submitMethod == "PUT"){
body = this.baseBody
body.description = this.description
}
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
console.log(JSON.stringify(body))
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: this.submitMethod,
data:JSON.stringify(body),
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user' : JSON.stringify(user)
},
success: (res) => {
console.log(JSON.stringify(res))
if(res.statusCode == 200){
if(this.submitMethod == "PUT"){
uni.$emit("rectificationListData",[this.baseBody])
}
this.$refs.popup.open({
type:'success',
content:'提交成功!',
timeout:1000,
isClick:false
});
setTimeout(()=>{
uni.navigateBack({
delta:1
})
},1000)
}
}
})
},
itemClick: function(item) {
var that = this
if(item.index == 0){
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}else{
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}
this.closeActionSheet();
},
uploadPic(imgPath){
var user = {};
var that = this;
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => {
return {
name: "file",
uri: value
}
});
uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs,
filePath:imgPath[0],
name:"file",
header: {
'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data',
},
success: (res) => {
var uri = JSON.parse(res.data).data;
that.images.push(uri);
}
})
},
closeActionSheet: function() {
this.showActionSheet = false
},
changeTextValue:function(e){
this.description = e.detail.value;
},
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
},
that.uploadPic(imgPath);
}
});
}else{
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}
this.closeActionSheet();
},
uploadPic(imgPath){
var user = {};
var that = this;
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => {
return {
name: "file",
uri: value
}
});
uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs,
filePath:imgPath[0],
name:"file",
header: {
'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data',
},
success: (res) => {
var uri = JSON.parse(res.data).data;
that.images.push(uri);
}
})
},
closeActionSheet: function() {
this.showActionSheet = false
},
changeTextValue:function(e){
this.description = e.detail.value;
},
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
},
},
components: {
ActionSheet,
AddressSelect,
uniNavBar
},
components: {
ActionSheet,
AddressSelect,
uniNavBar
},
}
</script>
......@@ -280,81 +280,81 @@ import uniNavBar from "@/components/uni-header/uni-nav-bar/uni-nav-bar.vue"
.title {
font-size: 30rpx;
color: #8f8f94;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width:100%;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
padding:0 ;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:100%;
height:300rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.location{
font-size: 34rpx;
color: #000000;
}
.tip {
width: 30rpx;
height:30rpx
}
.hover {
opacity: 0.7;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
width:100%;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
padding:0 ;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:100%;
height:300rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.location{
font-size: 34rpx;
color: #000000;
}
.tip {
width: 30rpx;
height:30rpx
}
.hover {
opacity: 0.7;
}
</style>
<template>
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
@up="upCallback">
<view v-if="isShow" class="news-li" v-for="(item,index) in dataList" :key="index">
<view>
<text>{{index}}.{{item.content}}</text>
</view>
<view style="display: flex;flex-direction: row; width:690rpx;justify-content: space-between;margin-top:20rpx;">
<view style="display: flex;flex-direction: row;justify-content: flex-start;">
<view v-for="(obj,index1) in checkitems" :key="index1">
<view class="item-container" @click="itemClick(index,index1)">
<view :class="item.status==index1? 'selected' :'unselected' "></view>
<text>{{obj.name}}</text>
</view>
</view>
</view>
<view ><image @click="checkItem(item)" class="icon" src="../../static/security-check/safeEdit.png"></view>
<view>
<text>{{index}}.{{item.content}}</text>
</view>
</view>
<button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext">提交</text>
</button>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
<view style="display: flex;flex-direction: row; width:690rpx;justify-content: space-between;margin-top:20rpx;">
<view style="display: flex;flex-direction: row;justify-content: flex-start;">
<view v-for="(obj,index1) in checkitems" :key="index1">
<view class="item-container" @click="itemClick(index,index1)">
<view :class="item.status==index1? 'selected' :'unselected' "></view>
<text>{{obj.name}}</text>
</view>
</view>
</view>
<view>
<image @click="checkItem(item)" class="icon" src="../../static/security-check/safeEdit.png">
</view>
</view>
</view>
<button hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext">提交</text>
</button>
<form-alert v-if="submitShow" name="检查对象" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</mescroll-body>
</template>
......@@ -33,149 +36,150 @@
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
isShow:false,
checkitems:[],
objectData:{},
taskId:"",
checkResult:[],
submitShow:false
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
isShow: false,
checkitems: [],
objectData: {},
taskId: "",
checkResult: [],
submitShow: false
}
},
methods: {
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
},
onLoad() {
var that = this;
uni.$on('sendCheckItem',function(data){
that.objectData = data[0]
that.taskId = data[2];
var content = data[1].children
content.map((opt)=>{
opt.status = 0;
// opt.checkitems = [];
})
that.dataList = content;
})
this.loadData();
},
onUnload(){
uni.$off('sendCheckItem',function(data){
})
methods: {
cancel: function() {
this.submitShow = false;
},
showModal: function() {
this.submitShow = true;
},
onLoad() {
var that = this;
uni.$on('sendCheckItem', function(data) {
that.objectData = data[0]
that.taskId = data[2];
var content = data[1].children
content.map((opt) => {
opt.status = 0;
// opt.checkitems = [];
})
that.dataList = content;
})
this.loadData();
},
onUnload() {
uni.$off('sendCheckItem', function(data) {
})
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
},
},
/*上拉加载的回调 */
upCallback(page) {
},
goDetail(){
uni.navigateTo({
url:"./select-checkobject"
})
},
itemClick(index,status){
this.dataList[index].status = status;
var res = {
name:this.checkitems[status].name,
code:this.checkitems[status].code,
id:this.checkitems[status].id
}
this.checkResult[index].result_type = JSON.stringify(res);
this.$forceUpdate();
console.log(JSON.stringify(this.checkResult))
},
checkItem(item){
uni.navigateTo({
url:"./index"
})
uni.$emit("safeReportData",[this.objectData,item,this.taskId]);
},
loadData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/base-data/v1/dict-items?sort_property=ID&sort_direction=ASC&dict_code=JCJG&page_number=1&page_size=10',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
this.dataList.map((opt)=>{
opt.checkitems = res.data.data;
})
this.checkitems = res.data.data;
this.isShow = true;
// console.log(JSON.stringify(this.objectData))
// console.log(JSON.stringify(this.dataList))
// console.log(JSON.stringify(this.checkitems))
this.checkResult = [];
this.dataList.map((opt)=>{
var res = {
name:this.checkitems[0].name,
id:this.checkitems[0].id,
code:this.checkitems[0].code
}
var item = {
"result_type":JSON.stringify(res),
"check_item_id":opt.id,
"check_list_id":opt.check_list_id,
"check_task_id":this.taskId,
"lab_id":this.objectData.id
}
this.checkResult.push(item)
})
}
})
},
onSubmitClick(){
this.submitShow = false;
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
var body = this.checkResult
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-result',
method: 'POST',
data:JSON.stringify(body),
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user' : JSON.stringify(user)
},
success: (res) => {
console.log(JSON.stringify(res))
if(res.statusCode == 200){
uni.$emit("refreshTaskList")
this.$refs.popup.open({
type:'success',
content:'提交成功!',
timeout:1000,
isClick:false
});
setTimeout(()=>{
uni.navigateBack({
delta:2
})
},1000)
}
}
})
},
goDetail() {
uni.navigateTo({
url: "./select-checkobject"
})
},
itemClick(index, status) {
this.dataList[index].status = status;
var res = {
name: this.checkitems[status].name,
code: this.checkitems[status].code,
id: this.checkitems[status].id
}
this.checkResult[index].result_type = JSON.stringify(res);
this.$forceUpdate();
console.log(JSON.stringify(this.checkResult))
},
checkItem(item) {
uni.navigateTo({
url: "./index"
})
uni.$emit("safeReportData", [this.objectData, item, this.taskId]);
},
loadData() {
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url +
'/base-data/v1/dict-items?sort_property=ID&sort_direction=ASC&dict_code=JCJG&page_number=1&page_size=10',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
this.dataList.map((opt) => {
opt.checkitems = res.data.data;
})
this.checkitems = res.data.data;
this.isShow = true;
// console.log(JSON.stringify(this.objectData))
// console.log(JSON.stringify(this.dataList))
// console.log(JSON.stringify(this.checkitems))
this.checkResult = [];
this.dataList.map((opt) => {
var res = {
name: this.checkitems[0].name,
id: this.checkitems[0].id,
code: this.checkitems[0].code
}
var item = {
"result_type": JSON.stringify(res),
"check_item_id": opt.id,
"check_list_id": opt.check_list_id,
"check_task_id": this.taskId,
"lab_id": this.objectData.id
}
this.checkResult.push(item)
})
}
})
},
onSubmitClick() {
this.submitShow = false;
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
var body = this.checkResult
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/check-result',
method: 'POST',
data: JSON.stringify(body),
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user': JSON.stringify(user)
},
success: (res) => {
console.log(JSON.stringify(res))
if (res.statusCode == 200) {
uni.$emit("refreshTaskList")
this.$refs.popup.open({
type: 'success',
content: '提交成功!',
timeout: 1000,
isClick: false
});
setTimeout(() => {
uni.navigateBack({
delta: 2
})
}, 1000)
}
}
})
}
}
}
......@@ -183,78 +187,91 @@
<style>
/*说明*/
.notice{
.notice {
font-size: 30upx;
padding: 40upx 0;
border-bottom: 1upx solid #eee;
text-align: center;
}
/*展示上拉加载的数据列表*/
.news-li{
display: flex;
.news-li {
display: flex;
flex-direction: column;
font-size: 32upx;
padding: 32upx;
border-bottom: 1upx solid #eee;
width: 100%;
border-bottom: 1upx solid #eee;
width: 100%;
}
.news-li .new-content{
.news-li .new-content {
font-size: 28upx;
margin-top: 10upx;
margin-left: 20upx;
color: #666;
}
.icon {
width:30rpx;
height:30rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.hover{
opacity: 0.7;
}
.item-container{
display: flex;
flex-direction: row;
margin-right: 30rpx;
}
.selected {
width:40rpx;
height:40rpx;
background-color: #00CE47;
},
.unselected {
width:40rpx;
height:40rpx;
background-color: #FFFFFF;
border: 1rpx solid #00CE47 ;
}
.containter{
display: flex;
width: 100%;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
position: absolute;
left: 50%;
bottom: 60rpx;
margin-left: -300rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
</style>
.icon {
width: 30rpx;
height: 30rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.hover {
opacity: 0.7;
}
.item-container {
display: flex;
flex-direction: row;
margin-right: 30rpx;
}
.selected {
width: 40rpx;
height: 40rpx;
background-color: #00CE47;
}
,
.unselected {
width: 40rpx;
height: 40rpx;
background-color: #FFFFFF;
border: 1rpx solid #00CE47;
}
.containter {
display: flex;
width: 100%;
}
.submit-button {
display: flex;
width: 600rpx;
height: 60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
position: absolute;
left: 50%;
bottom: 60rpx;
margin-left: -300rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
</style>
<template>
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback" @up="upCallback">
<mescroll-body class="containter" ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
@up="upCallback">
<view class="news-li" v-for="news in dataList" :key="news.id" hover-class="hover" @click="goDetail(news)">
<view class="top-container" >
<view style="width: 500rpx;"><text class="title">{{news.name}}</text></view>
<view :class="news.color=='finish' ? 'status-finish' : 'status' ">
<text :class="news.color=='finish' ? 'status-finish-text' : 'status-text' ">{{news.taskstatus}}</text>
</view>
</view>
<view style="width: 700rpx;" ><text class="des">{{news.check_point}}</text></view>
<view><image class="icon" src="../../static/security-check/safeTime.png"><text class="detail">{{JSON.parse(news.schedule).startdate}}~{{JSON.parse(news.schedule).enddate}}</text></view>
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="width: 20rpx;margin-right:20rpx;"><image class="icon" src="../../static/security-check/safeSys.png"></view>
<view style="display:flex;flex-direction: row; -webkit-flex-wrap: wrap;flex-wrap: wrap">
<view style="display: flex;margin-right:30px" v-for="(data,index) in JSON.parse(news.check_scope)" :key="index" >
<text class="detail">{{data.name}}</text>
</view>
</view>
</view>
<view><image class="icon" src="../../static/security-check/safePerson.png"><text class="detail">{{news.taskexecutor}}</text></view>
<view class="top-container">
<view style="width: 500rpx;"><text class="title">{{news.name}}</text></view>
<view :class="news.color=='finish' ? 'status-finish' : 'status' ">
<text :class="news.color=='finish' ? 'status-finish-text' : 'status-text' ">{{news.taskstatus}}</text>
</view>
</view>
<view style="width: 700rpx;"><text class="des">{{news.check_point}}</text></view>
<view>
<image class="icon" src="../../static/security-check/safeTime.png"><text class="detail">{{JSON.parse(news.schedule).startdate}}~{{JSON.parse(news.schedule).enddate}}</text>
</view>
<view style="display: flex;flex-direction: row;align-items: center;">
<view style="width: 20rpx;margin-right:20rpx;">
<image class="icon" src="../../static/security-check/safeSys.png">
</view>
<view style="display:flex;flex-direction: row; -webkit-flex-wrap: wrap;flex-wrap: wrap">
<view style="display: flex;margin-right:30px" v-for="(data,index) in JSON.parse(news.check_scope)" :key="index">
<text class="detail">{{data.name}}</text>
</view>
</view>
</view>
<view>
<image class="icon" src="../../static/security-check/safePerson.png"><text class="detail">{{news.taskexecutor}}</text>
</view>
<view><text class="type">{{news.taskTypeTitle}}</text></view>
</view>
</mescroll-body>
......@@ -32,94 +39,96 @@
downOption: {
auto: false //是否在初始化后,自动执行downCallback; 默认true
},
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
dataList: [],
upOption: {
use: false, // 是否启用上拉加载; 默认true
},
}
},
methods: {
onLoad() {
var that = this;
uni.$on('refreshTaskList',function(data){
that.loadData();
})
this.loadData();
},
onUnload(){
uni.$off('refreshTaskList',function(data){
})
methods: {
onLoad() {
var that = this;
uni.$on('refreshTaskList', function(data) {
that.loadData();
})
this.loadData();
},
onUnload() {
uni.$off('refreshTaskList', function(data) {})
},
/*下拉刷新的回调 */
downCallback() {
this.mescroll.endSuccess();
},
},
/*上拉加载的回调 */
upCallback(page) {
},
/*获取列表*/
loadData(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
console.log(JSON.stringify(res))
var data = res.data.data;
data.map((opt)=>{
opt.taskstatus = (this.handleStatus(opt)).text;
opt.color = (this.handleStatus(opt)).color;
var taskexecutor = JSON.parse(opt.excutor);
var taskexecutortext = "";
taskexecutor.map((opt)=>{
taskexecutortext = opt.name +" ";
})
opt.taskexecutor = taskexecutortext;
opt.taskTypeTitle = opt.auto_task?"上级下发":"自建任务"
})
this.dataList = data;
}
})
},
handleStatus(data){
var text = "";
var color = ""
if(data.execute_state){
var check_scope = JSON.parse(data.check_scope);
text = "已完成" + check_scope.length +"/" + check_scope.length;
color = "finish"
}else{
},
/*获取列表*/
loadData() {
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
console.log(JSON.stringify(res))
var data = res.data.data;
data.map((opt) => {
opt.taskstatus = (this.handleStatus(opt)).text;
opt.color = (this.handleStatus(opt)).color;
var taskexecutor = JSON.parse(opt.excutor);
var taskexecutortext = "";
taskexecutor.map((opt) => {
taskexecutortext = opt.name + " ";
})
opt.taskexecutor = taskexecutortext;
opt.taskTypeTitle = opt.auto_task ? "上级下发" : "自建任务"
})
this.dataList = data;
}
})
},
handleStatus(data) {
var text = "";
var color = ""
if (data.execute_state) {
var check_scope = JSON.parse(data.check_scope);
text = "已完成" + check_scope.length + "/" + check_scope.length;
color = "finish"
} else {
var check_scope = JSON.parse(data.check_scope);
var checked = 0;
check_scope.map((opt)=>{
if(opt.execute_state){
check_scope.map((opt) => {
if (opt.execute_state) {
checked++
}
})
if(checked == check_scope.length){
text = "已完成 " + check_scope.length +"/" + check_scope.length;
if (checked == check_scope.length) {
text = "已完成 " + check_scope.length + "/" + check_scope.length;
color = "finish"
}else{
text = '未完成 '+checked+'/'+check_scope.length;
} else {
text = '未完成 ' + checked + '/' + check_scope.length;
color = "unfinish"
}
}
return {text:text,color:color}
},
goDetail(data){
uni.navigateTo({
url:"./select-checkobject?taskId="+data.id
})
}
return {
text: text,
color: color
}
},
goDetail(data) {
uni.navigateTo({
url: "./select-checkobject?taskId=" + data.id
})
}
}
}
......@@ -127,85 +136,99 @@
<style>
/*说明*/
.notice{
.notice {
font-size: 30upx;
padding: 40upx 0;
border-bottom: 1upx solid #eee;
text-align: center;
}
/*展示上拉加载的数据列表*/
.news-li{
.news-li {
font-size: 32upx;
padding: 32upx;
border-bottom: 1upx solid #eee;
width: 100%;
display: flex;
flex-direction: column;
border-bottom: 1upx solid #eee;
width: 100%;
display: flex;
flex-direction: column;
}
.news-li .new-content{
.news-li .new-content {
font-size: 28upx;
margin-top: 10upx;
margin-left: 20upx;
color: #666;
}
.icon {
width:20rpx;
height:20rpx;
margin-right: 20rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.status {
width:170rpx;
height:35rpx;
background-color: rgba(242,115,115,0.10);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35rpx;
}
.status-finish {
width:170rpx;
height:35rpx;
background-color: rgba(47,190,178,0.10);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35rpx;
}
.status-text{
color: #F27373;
font-size: 11px;
}
.status-finish-text{
color: #2FBEB2;
font-size: 11px;
}
.hover{
opacity: 0.7;
}
.title {
font-size: 17px;
font-weight: 300;
}
.des {
font-weight:200;
font-size:14px;
color:#676767
}
.detail {
font-size:14px;
}
.type {
font-size:14px;
}
.containter{
display: flex;
width: 100%;
}
</style>
}
.icon {
width: 20rpx;
height: 20rpx;
margin-right: 20rpx;
}
.top-container {
display: flex;
flex-direction: row;
align-items: center;
}
.status {
width: 170rpx;
height: 35rpx;
background-color: rgba(242, 115, 115, 0.10);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35rpx;
}
.status-finish {
width: 170rpx;
height: 35rpx;
background-color: rgba(47, 190, 178, 0.10);
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 35rpx;
}
.status-text {
color: #F27373;
font-size: 11px;
}
.status-finish-text {
color: #2FBEB2;
font-size: 11px;
}
.hover {
opacity: 0.7;
}
.title {
font-size: 17px;
font-weight: 300;
}
.des {
font-weight: 200;
font-size: 14px;
color: #676767
}
.detail {
font-size: 14px;
}
.type {
font-size: 14px;
}
.containter {
display: flex;
width: 100%;
}
</style>
<template>
<view class="content">
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查对象</text></view>
<view class="location-container" @click="showObjectPicker">
<text class="value">{{selObjectText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查项类型</text></view>
<view class="location-container" @click="showTypePicker">
<text class="value">{{selectItemText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">开始检查</text>
</button>
<Picker
mode="selector"
@confirm="onConfirm"
ref="picker"
themeColor="#f00"
:selectList="itemList"
></Picker>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查对象</text></view>
<view class="location-container" @click="showObjectPicker">
<text class="value">{{selObjectText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<view style="width: 100%;margin-top: 20rpx;"><text class="title">检查项类型</text></view>
<view class="location-container" @click="showTypePicker">
<text class="value">{{selectItemText}}</text>
<image class="arrow-right" src="../../static/common/arrow_right_gray.png">
</view>
<button hover-class="submithover" @click="onSubmitClick" class="submit-button">
<text class="submittext">开始检查</text>
</button>
<Picker mode="selector" @confirm="onConfirm" ref="picker" themeColor="#f00" :selectList="itemList"></Picker>
</view>
</template>
<script>
import Picker from "@/components/w-picker/w-picker.vue";
<script>
import Picker from "@/components/w-picker/w-picker.vue";
export default {
data() {
return {
showActionSheet: false,
itemList: [],
taskId:"",
selObject:"",
selObjectText:"",
selectItem:"",
selectItemText:"",
objectarr:[],
itemarr:[],
curType:"object",
objectData:[],
itemData:[]
showActionSheet: false,
itemList: [],
taskId: "",
selObject: "",
selObjectText: "",
selectItem: "",
selectItemText: "",
objectarr: [],
itemarr: [],
curType: "object",
objectData: [],
itemData: []
}
},
onLoad(option) {
onLoad(option) {
this.taskId = option.taskId
this.loadTaskObject();
},
methods: {
itemClick: function() {
},
closeActionSheet: function() {
this.showActionSheet = false
},
onConfirm(data){
if(this.curType == "object"){
this.selObject = data.checkArr.value;
this.selObjectText = data.checkArr.label;
this.itemarr = [];
this.selectItem = "";
this.selectItemText = "";
this.loadItemData();
}else{
this.selectItem = data.checkArr.value;
this.selectItemText = data.checkArr.label;
}
},
onSubmitClick(){
var objectData = this.findObjectData();
var itemData = this.findItemData();
uni.navigateTo({
url:"security-checkitem"
})
uni.$emit("sendCheckItem",[objectData,itemData,this.taskId]);
},
showObjectPicker(){
this.itemList = this.objectarr;
this.curType = "object"
this.$refs.picker.show()
},
showTypePicker(){
if(this.selObject == ""){
return
}
this.itemList = this.itemarr;
this.curType = "item";
this.$refs.picker.show()
},
loadTaskObject(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.taskId,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.objectData = data;
var itemList = data.map((opt)=>{
var status = opt.execute_state?"(已完成)":""
return {label:opt.name+status,value:opt.id};
})
this.objectarr = itemList;
this.itemList = itemList;
}
})
},
loadItemData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.taskId+"?check_site_id="+this.selObject,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.itemData = data;
var itemList = data.map((opt)=>{
var status = opt.execute_state?"(已完成)":""
return {label:opt.content+status,value:opt.id};
})
this.itemarr = itemList;
}
})
},
findObjectData(){
var obj = {};
this.objectData.map((opt)=>{
if(opt.id == this.selObject){
obj = opt;
}
})
return obj;
},
findItemData(){
var obj = {};
this.itemData.map((opt)=>{
if(opt.id == this.selectItem){
obj = opt;
}
})
return obj;
}
},
components: {
Picker
itemClick: function() {
},
closeActionSheet: function() {
this.showActionSheet = false
},
onConfirm(data) {
if (this.curType == "object") {
this.selObject = data.checkArr.value;
this.selObjectText = data.checkArr.label;
this.itemarr = [];
this.selectItem = "";
this.selectItemText = "";
this.loadItemData();
} else {
this.selectItem = data.checkArr.value;
this.selectItemText = data.checkArr.label;
}
},
onSubmitClick() {
var objectData = this.findObjectData();
var itemData = this.findItemData();
uni.navigateTo({
url: "security-checkitem"
})
uni.$emit("sendCheckItem", [objectData, itemData, this.taskId]);
},
showObjectPicker() {
this.itemList = this.objectarr;
this.curType = "object"
this.$refs.picker.show()
},
showTypePicker() {
if (this.selObject == "") {
return
}
this.itemList = this.itemarr;
this.curType = "item";
this.$refs.picker.show()
},
loadTaskObject() {
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/check-task-scope/' + this.taskId,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
var data = res.data;
this.objectData = data;
var itemList = data.map((opt) => {
var status = opt.execute_state ? "(已完成)" : ""
return {
label: opt.name + status,
value: opt.id
};
})
this.objectarr = itemList;
this.itemList = itemList;
}
})
},
loadItemData() {
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url + '/safety/v1/check-task-lists/' + this.taskId + "?check_site_id=" + this.selObject,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user': JSON.stringify(user)
},
body: null,
success: (res) => {
var data = res.data;
this.itemData = data;
var itemList = data.map((opt) => {
var status = opt.execute_state ? "(已完成)" : ""
return {
label: opt.content + status,
value: opt.id
};
})
this.itemarr = itemList;
}
})
},
findObjectData() {
var obj = {};
this.objectData.map((opt) => {
if (opt.id == this.selObject) {
obj = opt;
}
})
return obj;
},
findItemData() {
var obj = {};
this.itemData.map((opt) => {
if (opt.id == this.selectItem) {
obj = opt;
}
})
return obj;
}
},
components: {
Picker
},
}
</script>
......@@ -186,79 +186,92 @@ import Picker from "@/components/w-picker/w-picker.vue";
.title {
font-size: 30rpx;
color: #8f8f94;
color: #8f8f94;
width: 100%;
}
.loginbtn {
width: 180rpx;
height: 200rpx;
}
.login-hover {
width: 200rpx;
height: 200rpx;
background-color: #00CE47;
}
.testview {
width: 209rpx;
height: 200rpx;
background-color: linear-gradient(red, yellow, blue);
}
.location-container {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
width: 100%;
height: 60rpx;
border-bottom: 1rpx solid #898989;
}
.arrow-right {
width: 40rpx;
height: 40rpx;
}
.camera-button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 200rpx;
height: 200rpx;
}
.camera {
width: 50rpx;
height: 50rpx;
}
.submit-button {
display: flex;
width: 600rpx;
height: 60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover {
opacity: 0.7;
}
.detail {
width: 400rpx;
height: 100rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.value {
font-size: 30rpx;
color: #000000;
width: 100%;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
width: 100%;
height: 60rpx;
border-bottom: 1rpx solid #898989;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-top: 80rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:400rpx;
height:100rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.value {
font-size: 30rpx;
color: #000000;
width: 100%;
}
</style>
<template>
<view style="width: 100%;height: 100%;padding: 10px;">
<scroll-view scroll-y="true" class="scroll-Y" show-scrollbar="false" >
<view style="display: flex;flex-direction: row;border-bottom: 1rpx solid #4BBC9A;align-items: center;">
<image class="tip" src="../../static/security-submit/tip.png">
<text class="toptitle">整改项提交</text>
<template>
<view style="width: 100%;height: 100%;padding: 10px;">
<scroll-view scroll-y="true" class="scroll-Y" show-scrollbar="false">
<view style="display: flex;flex-direction: row;border-bottom: 1rpx solid #4BBC9A;align-items: center;">
<image class="tip" src="../../static/security-submit/tip.png">
<text class="toptitle">整改项提交</text>
</view>
<view class="item" hover-class="hover" @click="showTaskPicker">
<text class="title" style="margin-top: 30rpx;">检查任务</text>
<view class="selcontent">
<text class="datacontent">{{curTask.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showObjectPicker">
<text class="title" style="margin-top: 30rpx;">检查对象</text>
<view class="selcontent">
<text class="datacontent">{{curObject.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemTypePicker">
<text class="title" style="margin-top: 30rpx;">检查项类型</text>
<view class="selcontent">
<text class="datacontent">{{curItemType.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemPicker">
<text class="title" style="margin-top: 30rpx;">检查项</text>
<view class="selcontent">
<text class="datacontent">{{curItem.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showAddressSel">
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="selcontent">
<text class="datacontent">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view style="margin-top: 20px;">
<text class="title">整改项详情</text>
<view style="width: auto;margin-top: 10px;">
<textarea class="detail" @blur="changeTextValue" />
</view>
</view>
<view class="item" hover-class="hover" @click="showTaskPicker">
<text class="title" style="margin-top: 30rpx;">检查任务</text>
<view class="selcontent">
<text class="datacontent">{{curTask.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showObjectPicker">
<text class="title" style="margin-top: 30rpx;">检查对象</text>
<view class="selcontent">
<text class="datacontent">{{curObject.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemTypePicker">
<text class="title" style="margin-top: 30rpx;">检查项类型</text>
<view class="selcontent">
<text class="datacontent">{{curItemType.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showItemPicker">
<text class="title" style="margin-top: 30rpx;">检查项</text>
<view class="selcontent">
<text class="datacontent">{{curItem.name}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view class="item" hover-class="hover" @click="showAddressSel">
<text class="title" style="margin-top: 30rpx;">位置</text>
<view class="selcontent">
<text class="datacontent">{{address}}</text>
<image class="tip" src="../../static/common/arrow_right_gray.png">
</view>
</view>
<view style="margin-top: 20px;">
<text class="title">整改项详情</text>
<view style="width: auto;margin-top: 10px;">
<textarea class="detail" @blur="changeTextValue" />
</view>
</view>
<view style="margin-top: 20px;">
<text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
<view class="photo">
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 40px;">
<view hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text>
</view>
</view>
<view style="width: 100%;height: 40px;">
</view>
</scroll-view>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="actionList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<Picker
mode="linkage"
:level="1"
@confirm="onConfirm"
ref="picker"
:linkList="itemList"
themeColor="#f00"
></Picker>
<form-alert v-if="submitShow" name="整改项提交" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</view>
<view style="margin-top: 20px;">
<text class="title" style="margin-top: 30rpx;">整改项照片</text>
<view style="width: 100%;display: flex;align-items: flex-start; justify-content: flex-start;margin-top: 30rpx;flex-direction: row;">
<view style="margin-right: 30rpx;" v-for="(item,index) in images" :key="index">
<button @click="onPhotoClick(index)" class="camera-button">
<image mod="scaleToFill" class="camera-button" :src="item" />
</button>
</view>
<view class="photo">
<button @click="onclick" class="camera-button">
<image class="camera" src="../../static/common/camera.png">
</button>
</view>
</view>
</view>
<view style="display: flex;justify-content: center;align-items: center;width: 100%;margin-top: 40px;">
<view hover-class="submithover" @click="showModal" class="submit-button">
<text class="submittext" >提交</text>
</view>
</view>
<view style="width: 100%;height: 40px;">
</view>
</scroll-view>
<ActionSheet :show="showActionSheet" :tips="tips" :item-list="actionList" :mask-closable="maskClosable"
:color="color" :size="size" :is-cancel="isCancel" @click="itemClick" @cancel="closeActionSheet"></ActionSheet>
<Picker
mode="linkage"
:level="1"
@confirm="onConfirm"
ref="picker"
:linkList="itemList"
themeColor="#f00"
></Picker>
<form-alert v-if="submitShow" name="整改项提交" placeholder="确定提交所填的数据?" @confirm="onSubmitClick" @cancel="cancel"></form-alert>
<PopUp ref="popup" :isdistance="true"></PopUp>
</view>
</template>
<script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue"
import Picker from "@/components/w-picker/w-picker.vue";
<script>
import ActionSheet from "@/components/actionsheet/actionsheet.vue"
import AddressSelect from "@/components/multi-select/cityChiden.vue"
import Picker from "@/components/w-picker/w-picker.vue";
export default {
data() {
return {
showActionSheet: false,
maskClosable: true,
tips: "请选择",
color: "#9a9a9a",
size: 26,
isCancel: true,
actionList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{},
checkitem:{},
taskId:"",
images:[],
textvalue:"kk",
itemList:[],
curPicker:"",
curTask:{},
curObject:{},
curItemType:{},
curItem:{},
taskList:[],
objectList:[],
itemTypeList:[],
checkItemList:[],
address:"",
addressType:"",
description:"",
room:{},
submitShow:false,
showActionSheet: false,
maskClosable: true,
tips: "请选择",
color: "#9a9a9a",
size: 26,
isCancel: true,
actionList: [{text:"打开相机"},{text:"从相册中选择"}],
objectData:{},
checkitem:{},
taskId:"",
images:[],
textvalue:"kk",
itemList:[],
curPicker:"",
curTask:{},
curObject:{},
curItemType:{},
curItem:{},
taskList:[],
objectList:[],
itemTypeList:[],
checkItemList:[],
address:"",
addressType:"",
description:"",
room:{},
submitShow:false,
}
},
onLoad() {
var that = this;
uni.$on('addressSave',function(data){
var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
})
uni.$on('securitySubmitPicChange',function(data){
that.images = data[0];
})
onLoad() {
var that = this;
uni.$on('addressSave',function(data){
var roomData = {};
roomData.code = that.GLOBALUTIL.addressSelectionTemp[3].code;
roomData.id = that.GLOBALUTIL.addressSelectionTemp[3].id;
roomData.name = that.GLOBALUTIL.addressSelectionTemp[1].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
that.room = roomData
that.address = that.GLOBALUTIL.addressSelectionTemp[0].name + that.GLOBALUTIL.addressSelectionTemp[1].name+that.GLOBALUTIL.addressSelectionTemp[2].name + that.GLOBALUTIL.addressSelectionTemp[3].name;
})
uni.$on('securitySubmitPicChange',function(data){
that.images = data[0];
})
this.getTaskList();
},
onUnload(){
var that = this;
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('securitySubmitPicChange',function(data){
})
},
methods: {
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
onUnload(){
var that = this;
uni.$off('addressSave',function(data){
that.GLOBALUTIL.addressSelectionTemp = [];
})
uni.$off('securitySubmitPicChange',function(data){
})
},
methods: {
cancel:function(){
this.submitShow = false;
},
showModal:function(){
this.submitShow = true;
},
onclick: function() {
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
},
onSubmitClick: function() {
this.submitShow = false;
onclick: function() {
this.showActionSheet = true;
},
onPhotoClick:function(index){
uni.navigateTo({
url:"../../components/image-preview/image-preview"
})
uni.$emit("previewPhoto",[this.images,index])
},
onSubmitClick: function() {
this.submitShow = false;
var body = {
"check_scope":JSON.stringify(this.curCheckScope),
"check_item_id":this.curItem.value,
......@@ -171,238 +171,238 @@ import Picker from "@/components/w-picker/w-picker.vue";
"images":JSON.stringify(this.images),
"description":this.description,
"room":JSON.stringify(this.room)
}
console.log(JSON.stringify(body))
// console.log(this.GLOBALUTIL.url)
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
var bd = JSON.stringify(body);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: 'POST',
data:bd,
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user' : JSON.stringify(user)
},
success: (res) => {
if(res.statusCode == 200){
this.$refs.popup.open({
type:'success',
content:'提交成功!',
timeout:1000,
isClick:false
});
setTimeout(()=>{
uni.navigateBack({
delta:1
})
},1000)
}
}
})
},
itemClick: function(item) {
var that = this
if(item.index == 0){
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机
success: function (res) {
}
console.log(JSON.stringify(body))
// console.log(this.GLOBALUTIL.url)
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
var bd = JSON.stringify(body);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/danger',
method: 'POST',
data:bd,
header: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'user' : JSON.stringify(user)
},
success: (res) => {
if(res.statusCode == 200){
this.$refs.popup.open({
type:'success',
content:'提交成功!',
timeout:1000,
isClick:false
});
setTimeout(()=>{
uni.navigateBack({
delta:1
})
},1000)
}
}
})
},
itemClick: function(item) {
var that = this
if(item.index == 0){
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], //相机
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}else{
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}
this.closeActionSheet();
},
uploadPic(imgPath){
var user = {};
var that = this;
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => {
return {
name: "file",
uri: value
}
});
uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs,
filePath:imgPath[0],
name:"file",
header: {
'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data',
},
success: (res) => {
var uri = JSON.parse(res.data).data;
console.log(uri)
console.log(JSON.stringify(res))
that.images.push(uri);
}
})
},
closeActionSheet: function() {
this.showActionSheet = false
},
changeTextValue:function(e){
this.description = e.detail.value;
},
showTaskPicker(){
this.curPicker = "task";
this.itemList = this.taskList
this.$refs.picker.show()
},
showObjectPicker(){
this.curPicker = "object";
this.itemList = this.objectList
this.$refs.picker.show()
},
showItemTypePicker(){
this.curPicker = "type";
this.itemList = this.itemTypeList
this.$refs.picker.show()
},
showItemPicker(){
this.curPicker = "item";
this.itemTypeList.map((opt)=>{
if(opt.value == this.curItemType.value){
this.checkItemList = opt.children
var itemlist = []
this.checkItemList.map((opt)=>{
itemlist.push({label:opt.content,value:opt.id})
})
this.itemList = itemlist
}
})
this.$refs.picker.show()
},
onConfirm(data){
console.log(JSON.stringify(data))
if(this.curPicker == "task"){
this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
this.loadTaskObject();
}else if(this.curPicker == "object"){
this.curObject = {"name":data.checkArr[0],value:data.checkValue[0]}
this.objectData.map((opt)=>{
if(opt.id == this.curObject.value){
if(opt.type == "site"){
this.addressType = "site";
this.address = opt.name
}
this.curCheckScope = opt;
this.room = opt
}
})
this.loadItemTypeData();
}else if (this.curPicker == "type"){
this.curItemType = {"name":data.checkArr[0],value:data.checkValue[0]}
}else{
this.curItem = {"name":data.checkArr[0],value:data.checkValue[0]}
}
},
showAddressSel(){
if(this.addressType == "site"){
return
}
uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4"
})
},
//任务列表
getTaskList(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.tasklist = itemList;
this.itemList = itemList;
}
})
},
//任务对象
loadTaskObject(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.curTask.value,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.objectData = data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.objectList = itemList;
this.itemList = itemList;
}
})
},
loadItemTypeData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.curTask.value+"?check_site_id="+this.selObject,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.itemData = data;
var itemList = data.map((opt)=>{
return {label:opt.content,value:opt.id,children:opt.children};
})
this.itemarr = itemList;
this.itemTypeList = itemList;
}
})
},
that.uploadPic(imgPath);
}
});
}else{
uni.chooseImage({
sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
var imgPath = res.tempFilePaths;
that.uploadPic(imgPath);
}
});
}
this.closeActionSheet();
},
uploadPic(imgPath){
var user = {};
var that = this;
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
let imgs = imgPath.map((value, index) => {
return {
name: "file",
uri: value
}
});
uni.uploadFile({
url: this.GLOBALUTIL.url+'/safety/v1/file/image',
files:imgs,
filePath:imgPath[0],
name:"file",
header: {
'user' : JSON.stringify(user),
'Content-Type': 'multipart/form-data',
},
success: (res) => {
var uri = JSON.parse(res.data).data;
console.log(uri)
console.log(JSON.stringify(res))
that.images.push(uri);
}
})
},
closeActionSheet: function() {
this.showActionSheet = false
},
changeTextValue:function(e){
this.description = e.detail.value;
},
showTaskPicker(){
this.curPicker = "task";
this.itemList = this.taskList
this.$refs.picker.show()
},
showObjectPicker(){
this.curPicker = "object";
this.itemList = this.objectList
this.$refs.picker.show()
},
showItemTypePicker(){
this.curPicker = "type";
this.itemList = this.itemTypeList
this.$refs.picker.show()
},
showItemPicker(){
this.curPicker = "item";
this.itemTypeList.map((opt)=>{
if(opt.value == this.curItemType.value){
this.checkItemList = opt.children
var itemlist = []
this.checkItemList.map((opt)=>{
itemlist.push({label:opt.content,value:opt.id})
})
this.itemList = itemlist
}
})
this.$refs.picker.show()
},
onConfirm(data){
console.log(JSON.stringify(data))
if(this.curPicker == "task"){
this.curTask = {"name":data.checkArr[0],value:data.checkValue[0]}
this.loadTaskObject();
}else if(this.curPicker == "object"){
this.curObject = {"name":data.checkArr[0],value:data.checkValue[0]}
this.objectData.map((opt)=>{
if(opt.id == this.curObject.value){
if(opt.type == "site"){
this.addressType = "site";
this.address = opt.name
}
this.curCheckScope = opt;
this.room = opt
}
})
this.loadItemTypeData();
}else if (this.curPicker == "type"){
this.curItemType = {"name":data.checkArr[0],value:data.checkValue[0]}
}else{
this.curItem = {"name":data.checkArr[0],value:data.checkValue[0]}
}
},
showAddressSel(){
if(this.addressType == "site"){
return
}
uni.navigateTo({
url:"../../components/address-select/index?maxLevel=4"
})
},
//任务列表
getTaskList(){
var body = {};
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-tasks?page_size=200&page_number=1',
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data.data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.tasklist = itemList;
this.itemList = itemList;
}
})
},
//任务对象
loadTaskObject(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-scope/'+this.curTask.value,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.objectData = data;
var itemList = data.map((opt)=>{
return {label:opt.name,value:opt.id};
})
this.objectList = itemList;
this.itemList = itemList;
}
})
},
loadItemTypeData(){
var user = {};
user.id = this.GLOBALUTIL.user.userid;
user.name = encodeURI(this.GLOBALUTIL.user.username);
uni.request({
url: this.GLOBALUTIL.url+'/safety/v1/check-task-lists/'+this.curTask.value+"?check_site_id="+this.selObject,
method: 'GET',
header: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'user' : JSON.stringify(user)
},
body:null,
success: (res) => {
var data = res.data;
this.itemData = data;
var itemList = data.map((opt)=>{
return {label:opt.content,value:opt.id,children:opt.children};
})
this.itemarr = itemList;
this.itemTypeList = itemList;
}
})
},
},
components: {
ActionSheet,
AddressSelect,
Picker,
},
components: {
ActionSheet,
AddressSelect,
Picker,
},
}
</script>
......@@ -410,7 +410,7 @@ import Picker from "@/components/w-picker/w-picker.vue";
<style>
.content {
display: flex;
flex-direction: column;
flex-direction: column;
background-color: #F5F5F5;
}
......@@ -431,109 +431,109 @@ import Picker from "@/components/w-picker/w-picker.vue";
.title {
font-size: 30rpx;
color: #8f8f94;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
width:100%;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
padding: 0;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-left: 0;
margin-right: 0;
margin-bottom: 40rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:auto;
height:300rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.location{
font-size: 34rpx;
color: #000000;
}
.tip {
width: 30rpx;
height:30rpx
}
.toptitle {
color: #666666;
font-size: 17px;
}
.selcontent {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 20rpx;
}
.item {
border-bottom: 1rpx solid #D0D0D0;
width: 100%;
margin-top: 20rpx;
padding-bottom: 10rpx;
}
.datacontent {
width: 100%;
font-size: 16px;
color: #4F4F4F;
}
.hover {
opacity: 0.7;
}
.scroll-Y{
height: 100%;
}
.photo{
margin-right: 30rpx;
}
.loginbtn {
width:180rpx;
height:200rpx;
}
.login-hover {
width:200rpx;
height:200rpx;
background-color:#00CE47;
}
.testview {
width:209rpx;
height:200rpx;
background-color:linear-gradient(red, yellow, blue);
}
.location-container{
display: flex;
flex-direction: row;
align-items: center;
width:100%;
}
.arrow-right{
width:40rpx;
height:40rpx;
}
.camera-button {
display:flex;
flex-direction: row;
align-items: center;
justify-content: center;
width:200rpx;
height: 200rpx;
padding: 0;
}
.camera {
width:50rpx;
height:50rpx;
}
.submit-button {
display: flex;
width:600rpx;
height:60rpx;
align-items: center;
justify-content: center;
background: linear-gradient(-45deg, rgba(87, 225, 181, 1) 0%, rgba(0, 63, 255, 1) 100%);
border-radius: 15rpx;
margin-left: 0;
margin-right: 0;
margin-bottom: 40rpx;
}
.submittext {
font-size: 14px;
color: #FFFFFF;
font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.submithover{
opacity: 0.7;
}
.detail {
width:auto;
height:300rpx;
border: 1rpx solid #000000;
}
.status_bar {
height: var(--status-bar-height);
width: 100%;
}
.location{
font-size: 34rpx;
color: #000000;
}
.tip {
width: 30rpx;
height:30rpx
}
.toptitle {
color: #666666;
font-size: 17px;
}
.selcontent {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 20rpx;
}
.item {
border-bottom: 1rpx solid #D0D0D0;
width: 100%;
margin-top: 20rpx;
padding-bottom: 10rpx;
}
.datacontent {
width: 100%;
font-size: 16px;
color: #4F4F4F;
}
.hover {
opacity: 0.7;
}
.scroll-Y{
height: 100%;
}
.photo{
margin-right: 30rpx;
}
</style>
......@@ -50,6 +50,7 @@
}
},
methods:{
clickSubmit(){
uni.navigateTo({
url:"../Security-Submit/index"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment