integrated_traffic_uniapp/pages/application/hidden-danger-check-standard/custom/list-item.vue

260 lines
6.5 KiB
Vue

<template><!-- 源自 pages/application/hidden-trouble-investigation/hidden-trouble-app/hidden-trouble-spot -->
<view>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" :isRingt="true">
<block slot="backText">返回</block>
<block slot="content">检查项目列表</block>
<block slot="right">
<view @tap.stop="openAuth('CAMERA')">扫描</view>
</block>
</cu-custom>
<scroll-view scroll-y>
<view class="spot-list">
<view class="spot-item" v-for="item in list" :key="item.CHECK_ITEM" @click="$noMultipleClicks(goToList,{
'ELECTRONIC_FENCE_ID':item.ELECTRONIC_FENCE_ID,
'CHECK_ITEM':item.CHECK_ITEM,
'isChecked':item.isChecked})">
<view class="spot-img">
<image v-if="item.isChecked" src="../../../../static/zt-over.png" mode=""></image>
<image v-else src="../../../../static/zt-ing.png" mode=""></image>
</view>
<view class="spot-cont">
<view class="text f30">
{{ item.DICTIONARY_NAMES ? item.DICTIONARY_NAMES.replace(/,/g,'--') : '' }}
</view>
<view v-if="item.ELECTRONIC_FENCE_ID" class="text f30">
所属电子围栏:{{item.ELECTRONIC_FENCE}}
</view>
</view>
</view>
</view>
<view class="cu-tabbar-height"></view>
</scroll-view>
<view class="bottom-fixed" @click="$noMultipleClicks(goNext)">
<button class="cu-btn bg-green">下一步</button>
</view>
<yk-authpup ref="authpup" type="top" @changeAuth="$noMultipleClicks(scan)" :permissionID="permissionID">
</yk-authpup>
</view>
</template>
<script>
import {
basePath,
loginUser,
loginSession
} from '@/common/tool.js';
import ykAuthpup from "@/components/yk-authpup/yk-authpup"
export default {
components: {
ykAuthpup
},
data() {
return {
permissionID: '',
noClick: true,
initflag: false,
listId: '',
listName: '',
baoBaoType: '',
list: [],
dataFlag: 'noData',
CHECKRECORD_ID: '',
}
},
onLoad(e) {
this.listId = e.listId;
this.listName = e.listName;
this.baoBaoType = e.baoBaoType
this.getData();
loginSession();
},
onShow(e) {
var _this = this;
if (_this.initflag) {
_this.initflag = false;
_this.list = [];
this.getData()
}
},
methods: {
getData() {
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/hiddenDangerCheckStandardCustom/getCheckItem', // /app/listmanager/getRisk
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
CUSTOM_ID: _this.listId,
USER_NAME: loginUser.NAME,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if ("success" == res.data.result) {
uni.hideLoading();
_this.list = res.data.varList;
_this.CHECKRECORD_ID = res.data.CHECKRECORD_ID;
if (res.data.checkmap) {
for (var i = 0; i < _this.list.length; i++) {
if (res.data.checkmap[_this.list[i].CHECK_ITEM]) {
_this.list[i].isChecked = 1
}
}
}
} else {
uni.showToast({
icon: 'none',
title: '系统异常',
duration: 2000
});
}
}
});
},
getInorout(e) {
uni.request({
url: basePath + '/app/listmanager/isInElectronicFence',
method: 'POST',
dataType: 'json',
header: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
ELECTRONIC_FENCE_ID: e.ELECTRONIC_FENCE_ID,
USER_NAME: loginUser.NAME,
PLS_ID: loginUser.PLS_ID,
CORPINFO_ID: loginUser.CORPINFO_ID,
USER_ID: loginUser.USER_ID,
},
success: (res) => {
if(res.data.code != 0) {
uni.showToast({
icon: 'none',
title: res.data.msg,
duration: 2000
});
}else{
uni.navigateTo({
url: '/pages/application/hidden-danger-check-standard/custom/list-item-check-list?CHECK_ITEM=' +
e.CHECK_ITEM + "&listId=" + this.listId + '&listName=' + this.listName +
"&CHECKRECORD_ID=" + (this.CHECKRECORD_ID ? this.CHECKRECORD_ID : '') + "&baoBaoType=" +
this
.baoBaoType
});
}
}
});
},
//跳转事件
goToList(e) {
if (e.ELECTRONIC_FENCE_ID) {
this.getInorout(e)
}else {
uni.navigateTo({
url: '/pages/application/hidden-danger-check-standard/custom/list-item-check-list?CHECK_ITEM=' +
e.CHECK_ITEM + "&listId=" + this.listId + '&listName=' + this.listName +
"&CHECKRECORD_ID=" + (this.CHECKRECORD_ID ? this.CHECKRECORD_ID : '') + "&baoBaoType=" + this.baoBaoType
});
}
// uni.navigateTo({
// url: '/pages/application/hidden-trouble-investigation/hidden-trouble-app/check-items-list?CHECK_ITEM=' +
// e.CHECK_ITEM + "&listId=" + this.listId + '&listName=' + this.listName +
// "&CHECKRECORD_ID=" + (this.CHECKRECORD_ID ? this.CHECKRECORD_ID : '') + "&baoBaoType=" +
// this
// .baoBaoType
// });
},
openAuth(permissionID) {
this.permissionID = permissionID;
setTimeout(() => {
this.$refs['authpup'].open();
}, 200)
},
scan() {
let _this = this;
uni.scanCode({
success: function(res) {
let flag = false;
let ideId = res.result;
for (var i = 0; i < _this.list.length; i++) {
if (_this.list[i].CHECK_ITEM == ideId) {
flag = true;
_this.goToList({
'CHECK_ITEM': _this.list[i].CHECK_ITEM
});
break;
}
}
if (!flag) {
uni.showToast({
icon: 'none',
title: "该清单中不含此部位。",
duration: 2000
});
}
}
});
},
//跳转事件
goNext(e) {
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].isChecked != 1) {
uni.showToast({
icon: 'none',
title: '清单未全部检查,无法提交',
duration: 3000
});
return;
}
}
uni.navigateTo({
url: '/pages/application/hidden-danger-check-standard/custom/list-item-check-next?listId=' +
this.listId + '&CHECKRECORD_ID=' + (this.CHECKRECORD_ID ? this.CHECKRECORD_ID : '')
});
},
}
}
</script>
<style>
.spot-list {}
.spot-cont {
margin-left: 20upx;
flex: 1;
}
.spot-cont .text {
line-height: 1.4;
}
.spot-img {
width: 100upx;
height: 100upx;
}
.spot-img image {
width: 100%;
height: 100%;
}
.spot-list .spot-item {
display: flex;
align-items: center;
background-color: #fff;
border-radius: 10upx;
margin: 20upx;
padding: 20upx;
}
</style>