|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <div class="lz-edit">
|
|
|
+ <div class="register-edit">
|
|
|
<nav-bar></nav-bar>
|
|
|
<div class="page-container">
|
|
|
<!-- 基本信息 -->
|
|
|
@@ -8,12 +8,13 @@
|
|
|
<van-cell title="日期时间" :value="rangDate(taskInfo.planstarttime,taskInfo.planendtime)" />
|
|
|
<van-cell title="受检机构" :value="taskInfo.beCheckedOrgName" />
|
|
|
<van-field
|
|
|
+ :disabled="!enable"
|
|
|
v-model="taskInfo.checkTeam"
|
|
|
label="检查组成员"
|
|
|
rows="2"
|
|
|
autosize
|
|
|
type="textarea"
|
|
|
- placeholder="请输入用户名" />
|
|
|
+ placeholder="请输入" />
|
|
|
</van-panel>
|
|
|
</div>
|
|
|
|
|
|
@@ -21,16 +22,17 @@
|
|
|
<!-- 检查项目 -->
|
|
|
<fieldset class="fieldset" :disabled="!enable">
|
|
|
<div class="card" >
|
|
|
- <p class="legend">检查项目 <span @click="addCheck">添加检查内容</span></p>
|
|
|
- <van-collapse v-model="activeNames" v-for="v in checkList" :key="v.areaId">
|
|
|
+ <p class="legend">检查项目 <span v-if="enable" @click="addCheck">添加检查内容</span></p>
|
|
|
+ <van-collapse v-model="activeNames" v-for="v in checkList" :key="v.itemId">
|
|
|
<van-collapse-item :title="v.itemName" :name="v.itemName" >
|
|
|
- <div v-for="(item,index) in v.pointList" :key="item.itemId">
|
|
|
- <van-cell :title="item.itemName">
|
|
|
+ <div v-for="(item,index) in v.pointList" :key="item.pointId">
|
|
|
+ <van-cell :title="item.pointName">
|
|
|
<template #right-icon>
|
|
|
+ <img v-if="enable && item.nfcList.length > 0" :src="require('../../../assets/svg/NFC.svg')" class="nfc-icon" @click="clickNFC(item.nfcList)"/>
|
|
|
<van-switch
|
|
|
v-if="enable"
|
|
|
style="margin-left: 10px;"
|
|
|
- v-model="item.resvalue"
|
|
|
+ v-model="item.status"
|
|
|
:active-value="1"
|
|
|
:inactive-value="0"
|
|
|
inactive-color="#4fc08d"
|
|
|
@@ -38,18 +40,22 @@
|
|
|
@change="switchChange(item)"
|
|
|
size="20" />
|
|
|
<span v-else>
|
|
|
-<!-- <van-icon v-if="item.resvalue" name="success" color="#07c160" />-->
|
|
|
-<!-- <van-icon v-else name="fail" color="#ee0a24"/>-->
|
|
|
- <van-tag v-if="item.resvalue" type="warning">隐患</van-tag>
|
|
|
+ <van-tag v-if="item.status" type="warning">隐患</van-tag>
|
|
|
<van-tag v-else type="success">正常</van-tag>
|
|
|
</span>
|
|
|
</template>
|
|
|
</van-cell>
|
|
|
- <van-cell-group v-show="item.resvalue">
|
|
|
+ <van-cell-group v-show="item.status">
|
|
|
+ <van-cell v-show="item.nfcList.length > 0" :border="false" >
|
|
|
+ <div v-if="img.img" class="nfc-img" v-for="(img,i) in item.nfcList" :key="img.img" @click="preViewNFC(i)">
|
|
|
+ <img :src="imgUrl(img.img)" alt="" >
|
|
|
+ <span>{{img.checkName}}</span>
|
|
|
+ </div>
|
|
|
+ </van-cell>
|
|
|
<select-cell required :disabled="!enable" title="整改期限" v-model="item.rectificationDeadline" :data-list="dayList" />
|
|
|
<van-field
|
|
|
required
|
|
|
- v-model="item.resremark"
|
|
|
+ v-model="item.remark"
|
|
|
rows="1"
|
|
|
autosize
|
|
|
label="情况描述:"
|
|
|
@@ -80,7 +86,7 @@
|
|
|
</div >
|
|
|
|
|
|
<div v-if="enable" class="flex-box">
|
|
|
- <van-button type="default" style="width: 30%;" plain @click="goBack">授权</van-button>
|
|
|
+ <van-button type="default" style="width: 30%;" plain @click="accredit">授权</van-button>
|
|
|
<van-button type="info" style="width: 30%;" plain hairline @click="saveData">保存</van-button>
|
|
|
<van-button type="info" style="width: 30%;" @click="submitData">提交</van-button>
|
|
|
</div>
|
|
|
@@ -108,10 +114,13 @@ import {getDict} from "@/api/toConsult";
|
|
|
import {imgUrl} from "@/utils";
|
|
|
import { ImagePreview } from 'vant';
|
|
|
import {mapGetters} from "vuex";
|
|
|
+import taskInfo from "@/views/menu/monitoringCall/components/taskInfo";
|
|
|
export default {
|
|
|
+ name:'securityDetail',
|
|
|
components:{NavBar,SelectCell,DateCell,Uploader,NfcPopup},
|
|
|
data(){
|
|
|
return {
|
|
|
+ id:null,
|
|
|
activeNames: ['1'],
|
|
|
//基本信息
|
|
|
taskInfo:[],
|
|
|
@@ -137,8 +146,56 @@ export default {
|
|
|
},
|
|
|
dicts:['safety_check_status'],
|
|
|
showPreView:false,
|
|
|
+ selected:null,
|
|
|
}
|
|
|
},
|
|
|
+ beforeRouteEnter: (to, from, next) => {
|
|
|
+ if(from.name === 'addCheck'){
|
|
|
+ let str = sessionStorage.getItem('selected') ;
|
|
|
+ next(vm => {
|
|
|
+ vm.selected = JSON.parse(str);
|
|
|
+ sessionStorage.removeItem('selected');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ next()
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ selected:{
|
|
|
+ handler(val){
|
|
|
+ console.log(val,'val')
|
|
|
+ if(!val)return
|
|
|
+
|
|
|
+ val.forEach((valItem) => {
|
|
|
+ // 查找是否有与 valItem.itemId 相同的项
|
|
|
+ const existingItem = this.checkList.find((checkItem) => checkItem.itemId === valItem.itemId);
|
|
|
+
|
|
|
+ if (existingItem) {
|
|
|
+ // 如果存在相同 itemId 的项,查找 pointList 是否有与 valItem.pointId 相同的项
|
|
|
+ const existingPoint = existingItem.pointList.find((pointItem) => pointItem.pointId === valItem.id);
|
|
|
+
|
|
|
+ if (!existingPoint) {
|
|
|
+ console.log(existingItem,'point添加成功')
|
|
|
+ // 如果不存在相同 pointId 的项,将 valItem 添加到 pointList 中
|
|
|
+ existingItem.pointList.push({
|
|
|
+ pointId: valItem.id,
|
|
|
+ pointName: valItem.pointName,
|
|
|
+ mustCheck: valItem.checked ? 1 : 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log(valItem,'item添加成功')
|
|
|
+ // 如果不存在相同 itemId 的项,创建一个新的项并添加到 checkList 数组中
|
|
|
+ this.checkList.push({
|
|
|
+ itemId: valItem.itemId,
|
|
|
+ itemName: valItem.itemName,
|
|
|
+ pointList: [valItem],
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deep:true
|
|
|
+ },
|
|
|
+ },
|
|
|
computed:{
|
|
|
...mapGetters(['dictionary'])
|
|
|
},
|
|
|
@@ -153,11 +210,12 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.id = this.$route.query.id;
|
|
|
this.getData();
|
|
|
},
|
|
|
methods:{
|
|
|
addCheck(){
|
|
|
- this.$router.push({path:'/addCheckRegister'});
|
|
|
+ this.$router.push({path:'/addCheck',query:{id:this.id}});
|
|
|
},
|
|
|
clickWarnImage(arr,i){
|
|
|
this.preViewImages.images = arr.map(v=>imgUrl(v.imgPath));
|
|
|
@@ -180,134 +238,77 @@ export default {
|
|
|
this.taskInfo = res.data;
|
|
|
this.enable = this.taskInfo.status === 1 || this.taskInfo.status === 2; //是否可编辑
|
|
|
this.checkList = res.data.checkList;
|
|
|
+ //设置默认展开项
|
|
|
+ this.activeNames = this.checkList.map(v=>v.itemName);
|
|
|
})
|
|
|
},
|
|
|
//保存数据
|
|
|
saveData(){
|
|
|
- let pointdata = [];
|
|
|
- let checkNFC = [];
|
|
|
- this.areaList.forEach(area=>{
|
|
|
- area.nfclist.forEach(v=>{
|
|
|
- if(v.status === 1){
|
|
|
- checkNFC.push(v)
|
|
|
- }
|
|
|
- })
|
|
|
- area.checklist.forEach(item=>{
|
|
|
- item.checkitemlist.forEach(checkItem=>{
|
|
|
- checkItem.protections = checkItem.protectionVo;
|
|
|
- checkItem.resRemark = checkItem.resremark;
|
|
|
- checkItem.resStatus = checkItem.resstatus;
|
|
|
- checkItem.areaId = checkItem.areaid;
|
|
|
- checkItem.id = checkItem.pointdataid;
|
|
|
- checkItem.pointId = checkItem.pointid;
|
|
|
- checkItem.resValue = checkItem.resvalue;
|
|
|
- checkItem.resumptionId = this.$route.query.id;
|
|
|
- pointdata.push(checkItem);
|
|
|
- })
|
|
|
- })
|
|
|
- });
|
|
|
//验证必填项
|
|
|
- let arr = pointdata.filter(v=>{
|
|
|
- if(v.resvalue === 1 ){
|
|
|
- return !v.resremark || !v.rectificationDeadline
|
|
|
+ let pointData = [];
|
|
|
+ this.checkList.forEach(v=>{
|
|
|
+ v.pointList.forEach(item=>{
|
|
|
+ pointData.push(item);
|
|
|
+ })
|
|
|
+ })
|
|
|
+ let arr = pointData.filter(v=>{
|
|
|
+ if(v.status === 1 ){
|
|
|
+ return !v.remark || !v.rectificationDeadline
|
|
|
}
|
|
|
})
|
|
|
- if(arr.length) return this.$toast(`${arr[0].areaname}-${arr[0].itemname}:信息不完整请填写`);
|
|
|
- let data = {
|
|
|
- dateTime:new Date(),
|
|
|
- isSubmit:0,
|
|
|
- resumptionId:this.$route.query.id,
|
|
|
- year: this.taskInfo.year,
|
|
|
- quarter: this.taskInfo.quarter,
|
|
|
- nfcData:checkNFC,
|
|
|
- pointdata,
|
|
|
- }
|
|
|
- saveTaskData(data).then(res=>{
|
|
|
- this.$toast('提交成功');
|
|
|
+ if(arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`);
|
|
|
+ //console.log( this.taskInfo,' this.taskInfo')
|
|
|
+ this.taskInfo.isSubmit = 0;
|
|
|
+ registerSubmit(this.taskInfo).then(res=>{
|
|
|
+ this.$toast('保存成功');
|
|
|
this.$router.go(-1);
|
|
|
})
|
|
|
},
|
|
|
|
|
|
-
|
|
|
- //获取当前区域检查项数量
|
|
|
- getCheckItemNum(){
|
|
|
- let num = 0;
|
|
|
- this.selectArea.checklist.forEach(v=>{
|
|
|
- num += v.checkitemlist.length;
|
|
|
- });
|
|
|
- this.checkNum = num;
|
|
|
- },
|
|
|
- //获取当前区域nfc数量
|
|
|
- getNFCItemNum(){
|
|
|
- let num = 0;
|
|
|
- this.selectArea.nfclist.forEach(v=>{
|
|
|
- if(v.status === 0 || !v.img){
|
|
|
- num++;
|
|
|
- }
|
|
|
- })
|
|
|
- this.NFCNum = num;
|
|
|
- },
|
|
|
//提交数据
|
|
|
submitData(){
|
|
|
- let pointdata = [];
|
|
|
- let checkNFC = [];
|
|
|
- this.areaList.forEach(area=>{
|
|
|
- area.nfclist.forEach(v=>{
|
|
|
- if(v.status === 1){
|
|
|
- checkNFC.push(v)
|
|
|
- }
|
|
|
- })
|
|
|
- area.checklist.forEach(item=>{
|
|
|
- item.checkitemlist.forEach(checkItem=>{
|
|
|
- checkItem.protections = checkItem.protectionVo;
|
|
|
- checkItem.resRemark = checkItem.resremark;
|
|
|
- checkItem.resStatus = checkItem.resstatus;
|
|
|
- checkItem.areaId = checkItem.areaid;
|
|
|
- checkItem.id = checkItem.pointdataid;
|
|
|
- checkItem.pointId = checkItem.pointid;
|
|
|
- checkItem.resValue = checkItem.resvalue;
|
|
|
- checkItem.resumptionId = this.$route.query.id;
|
|
|
- pointdata.push(checkItem);
|
|
|
- })
|
|
|
-
|
|
|
+ //验证必填项
|
|
|
+ let pointData = [];
|
|
|
+ this.checkList.forEach(v=>{
|
|
|
+ v.pointList.forEach(item=>{
|
|
|
+ pointData.push(item);
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
- //验证必填项
|
|
|
- let arr = pointdata.filter(v=>{
|
|
|
- if(v.resvalue === 1 ){
|
|
|
- console.log(v,'验证')
|
|
|
- return !v.resremark || !v.rectificationDeadline
|
|
|
+ let arr = pointData.filter(v=>{
|
|
|
+ if(v.status === 1 ){
|
|
|
+ return !v.remark || !v.rectificationDeadline
|
|
|
}
|
|
|
})
|
|
|
- if(arr.length) return this.$toast(`${arr[0].areaname}-${arr[0].itemname}:信息不完整请填写`);
|
|
|
-
|
|
|
- let data = {
|
|
|
- dateTime:new Date(),
|
|
|
- isSubmit:1,
|
|
|
- resumptionId:this.$route.query.id,
|
|
|
- year: this.taskInfo.year,
|
|
|
- quarter: this.taskInfo.quarter,
|
|
|
- nfcData:checkNFC,
|
|
|
- pointdata,
|
|
|
- }
|
|
|
- saveTaskData(data).then(res=>{
|
|
|
+ if(arr.length) return this.$toast(`${arr[0].itemName}:该信息不完整请填写`);
|
|
|
+ //console.log( this.taskInfo,' this.taskInfo')
|
|
|
+ this.taskInfo.isSubmit = 1;
|
|
|
+ registerSubmit(this.taskInfo).then(res=>{
|
|
|
this.$toast('提交成功');
|
|
|
this.$router.go(-1);
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- //返回
|
|
|
- goBack(){
|
|
|
- this.$router.go(-1);
|
|
|
- this.clearData();
|
|
|
+ //授权
|
|
|
+ accredit(){
|
|
|
+ let {checkOrgId,ymdDate,planId,beCheckedOrgId,id } = this.taskInfo;
|
|
|
+ console.log(checkOrgId,'checkOrgId')
|
|
|
+ this.$router.push({
|
|
|
+ path: '/addWorker',
|
|
|
+ query:{
|
|
|
+ orgId:checkOrgId,
|
|
|
+ ymdDate,
|
|
|
+ planId,
|
|
|
+ beCheckedOrgId,
|
|
|
+ taskId:id
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
//点击NFC图标
|
|
|
- clickNFC(){
|
|
|
- if(!this.NFCNum) return;
|
|
|
- let arr = this.selectArea.nfclist.filter(item=>{
|
|
|
- return item.status == 0;
|
|
|
- })
|
|
|
+ clickNFC(arr){
|
|
|
+ //if(arr.length === 0) return;
|
|
|
+ // let arr = this.selectArea.nfclist.filter(item=>{
|
|
|
+ // return item.status == 0;
|
|
|
+ // })
|
|
|
this.$refs.NfcPopup.show(arr);
|
|
|
},
|
|
|
//清空数据
|
|
|
@@ -343,99 +344,98 @@ export default {
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
- .lz-edit{
|
|
|
+ .register-edit{
|
|
|
height: 100%;
|
|
|
overflow: hidden;
|
|
|
- }
|
|
|
- .page-container{
|
|
|
- height: calc(100vh - 194px);
|
|
|
- overflow: auto;
|
|
|
- padding: 20px;
|
|
|
- }
|
|
|
- .flex-box{
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- >span{
|
|
|
- margin: 0 20px;
|
|
|
+ .page-container{
|
|
|
+ height: calc(100vh - 194px);
|
|
|
+ overflow: auto;
|
|
|
+ padding: 20px;
|
|
|
}
|
|
|
- }
|
|
|
- .legend{
|
|
|
- background-color: #fff;
|
|
|
- padding: 0 20px;
|
|
|
- height: 80px;
|
|
|
- line-height: 80px;
|
|
|
- font-size: 30px;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- >span{
|
|
|
+ .flex-box{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ >span{
|
|
|
+ margin: 0 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .legend{
|
|
|
+ background-color: #fff;
|
|
|
+ padding: 0 20px;
|
|
|
+ height: 80px;
|
|
|
+ line-height: 80px;
|
|
|
+ font-size: 30px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ >span{
|
|
|
+ color: orange;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .card{
|
|
|
+ margin-bottom: 20px;
|
|
|
+ box-shadow: 0 10px 10px #eaeaea;
|
|
|
+ }
|
|
|
+ .check-area{
|
|
|
+ background-color: #f1f1f1;
|
|
|
+ margin: 10px;
|
|
|
+ padding:20px;
|
|
|
+ color:#aaa;
|
|
|
+ border-radius: 6px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ box-shadow: 0 2px 6px #ddd;
|
|
|
+ }
|
|
|
+ .nfc-icon{
|
|
|
+ width: 50px;
|
|
|
+ height: 50px;
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
+ .custom-title {
|
|
|
+ align-self: center;
|
|
|
+ vertical-align: middle;
|
|
|
+ }
|
|
|
+ .upload-box{
|
|
|
+ margin: 30px;
|
|
|
+ }
|
|
|
+ .warning-msg{
|
|
|
color: orange;
|
|
|
+ text-align: center;
|
|
|
+ height: 80px;
|
|
|
+ line-height: 80px;
|
|
|
}
|
|
|
- }
|
|
|
- .card{
|
|
|
- margin-bottom: 20px;
|
|
|
- box-shadow: 0 10px 10px #eaeaea;
|
|
|
- }
|
|
|
- .check-area{
|
|
|
- background-color: #f1f1f1;
|
|
|
- margin: 10px;
|
|
|
- padding:20px;
|
|
|
- color:#aaa;
|
|
|
- border-radius: 6px;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
- box-shadow: 0 2px 6px #ddd;
|
|
|
- }
|
|
|
- .nfc-icon{
|
|
|
- width: 50px;
|
|
|
- height: 50px;
|
|
|
- margin-left: 20px;
|
|
|
- }
|
|
|
- .custom-title {
|
|
|
- align-self: center;
|
|
|
- vertical-align: middle;
|
|
|
- }
|
|
|
- .upload-box{
|
|
|
- margin: 30px;
|
|
|
- }
|
|
|
- .warning-msg{
|
|
|
- color: orange;
|
|
|
- text-align: center;
|
|
|
- height: 80px;
|
|
|
- line-height: 80px;
|
|
|
- }
|
|
|
- .active{
|
|
|
- color: #fff;
|
|
|
- background-color: #1989fa;
|
|
|
- }
|
|
|
- .nfc-img{
|
|
|
- display: inline-block;
|
|
|
- width: 140px;
|
|
|
- height: 140px;
|
|
|
- margin: 0 10px;
|
|
|
- position: relative;
|
|
|
- >img{
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- border: none;
|
|
|
+ .active{
|
|
|
+ color: #fff;
|
|
|
+ background-color: #1989fa;
|
|
|
}
|
|
|
- >span{
|
|
|
- position: absolute;
|
|
|
- padding: 0 10px;
|
|
|
- bottom: 0;
|
|
|
- left: 0;
|
|
|
- display: block;
|
|
|
- width: 100%;
|
|
|
- background-color: rgba(0,0,0,.2 );
|
|
|
- color: #eaeaea;
|
|
|
- font-size: 20px;
|
|
|
- overflow: hidden;
|
|
|
- text-overflow: ellipsis;
|
|
|
- white-space: nowrap;
|
|
|
- line-height: 30px;
|
|
|
- height: 30px;
|
|
|
+ .nfc-img{
|
|
|
+ display: inline-block;
|
|
|
+ width: 140px;
|
|
|
+ height: 140px;
|
|
|
+ margin: 0 10px;
|
|
|
+ position: relative;
|
|
|
+ >img{
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ border: none;
|
|
|
+ }
|
|
|
+ >span{
|
|
|
+ position: absolute;
|
|
|
+ padding: 0 10px;
|
|
|
+ bottom: 0;
|
|
|
+ left: 0;
|
|
|
+ display: block;
|
|
|
+ width: 100%;
|
|
|
+ background-color: rgba(0,0,0,.2 );
|
|
|
+ color: #eaeaea;
|
|
|
+ font-size: 20px;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ line-height: 30px;
|
|
|
+ height: 30px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</style>
|