qa-prevention-gwj-first-app/pages/application/hidden-trouble-investigation/hidden-trouble-app/hidden-trouble-spot.vue

188 lines
5.2 KiB
Vue
Raw Normal View History

2023-11-07 09:43:46 +08:00
<template>
<view>
<cu-custom bgColor="bg-gradual-blueness" :isBack="true" :isRingt="true">
<block slot="backText">返回</block>
<block slot="content">清单排查列表</block>
<block slot="right">
<view @click="$noMultipleClicks(scan)"></view>
</block>
<!-- <block slot="right">-->
<!-- <view class="cuIcon-scan f36" @click="$noMultipleClicks(goToEdit)"></view>-->
<!-- </block>-->
</cu-custom>
<scroll-view scroll-y>
<view class="spot-list">
<view class="spot-item" v-for="item in list" :key="item.IDENTIFICATIONPARTS_ID" @click="$noMultipleClicks(goToList,{'IDENTIFICATIONPARTS_ID':item.IDENTIFICATIONPARTS_ID,'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.DEPT_NAME}}--{{item.RISKUNITNAME}}--{{item.PARTSNAME}}
<!-- <text v-if="item.LEVELID=='levelA'" class="cu-tag bg-red radius"></text>-->
<!-- <text v-else-if="item.LEVELID=='levelB'" class="cu-tag bg-orange radius">较大风险</text>-->
<!-- <text v-else-if="item.LEVELID=='levelC'" class="cu-tag bg-yellow radius text-white">一般风险</text>-->
<!-- <text v-else-if="item.LEVELID=='levelD'" class="cu-tag bg-blue radius">低风险</text>-->
</view>
<!-- <view class="text text-gray">-->
<!-- 责任人{{item.DEPT_NAME}}/{{item.USER_NAME}}-->
<!-- </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>
</view>
</template>
<script>
import {
basePath,loginUser,loginSession
} from '@/common/tool.js';
export default {
data() {
return {
noClick:true,
initflag:false,
listId:'',
listName:'',
list: [],
dataFlag:'noData',
CHECKRECORD_ID:'',
}
},
onLoad(e){
this.listId=e.listId;
this.listName=e.listName;
loginSession();
},
onShow(e){
this.getData()
var _this = this;
if(_this.initflag){
_this.initflag = false;
_this.list = [];
}
},
methods: {
getData() {
console.log(333)
var _this = this;
uni.showLoading({
title: '请稍候'
})
uni.request({
url: basePath + '/app/listmanager/getRisk',
method: 'POST',
dataType: 'json',
header: {
'Content-type':'application/x-www-form-urlencoded'
},
data: {
LISTMANAGER_ID: _this.listId,
USER_ID : loginUser.NAME,
},
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].IDENTIFICATIONPARTS_ID] >=_this.list[i].RISK_COUNT){
_this.list[i].isChecked=1
}
}
}
} else {
uni.showToast({
icon:'none',
title:'系统异常',
duration: 2000
});
}
}
});
},
//跳转事件
goToList(e) {
uni.navigateTo({
url: '/pages/application/hidden-trouble-investigation/hidden-trouble-app/check-items-list?IDENTIFICATIONPARTS_ID='
+e.IDENTIFICATIONPARTS_ID+"&listId="+this.listId+'&listName='+this.listName+"&CHECKRECORD_ID="+(this.CHECKRECORD_ID?this.CHECKRECORD_ID:'')
});
},
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].IDENTIFICATIONPARTS_ID==ideId){
flag=true;
_this.goToList({'IDENTIFICATIONPARTS_ID':_this.list[i].IDENTIFICATIONPARTS_ID});
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-trouble-investigation/hidden-trouble-app/check-items-next?listId='+this.listId+'&CHECKRECORD_ID='+(this.CHECKRECORD_ID?this.CHECKRECORD_ID:'')
});
},
}
}
</script>
<style>
.spot-list{
}
.spot-cont{
margin-left: 20upx;
}
.spot-cont .text{
line-height: 1.8;
}
.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>