diff --git a/components/select_measures/index.vue b/components/select_measures/index.vue new file mode 100644 index 0000000..d12f4df --- /dev/null +++ b/components/select_measures/index.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/pages/application/breakground/breakground-measures/breakground-measures-detail.vue b/pages/application/breakground/breakground-measures/breakground-measures-detail.vue index c3e2ec4..47ccf7a 100644 --- a/pages/application/breakground/breakground-measures/breakground-measures-detail.vue +++ b/pages/application/breakground/breakground-measures/breakground-measures-detail.vue @@ -9,66 +9,78 @@ - + 安全防护措施 + - - - - - 主要安全措施 - - - - - - - - + + + + + + + 确认单位: + + + {{item.DEPARTMENT_NAME?item.DEPARTMENT_NAME:'请选择'}} - - - 签字照片: - - - - - + + + + + + 确认人 + + + {{item.USER_NAME?item.USER_NAME:'请选择'}} + + + + + + + 安全措施: + + - - + + {{index1+1}} . {{item1.PROTECTIVE_MEASURES}} + + + + + + + + + + + 签字照片: + + + + + + + + + + @@ -78,6 +90,7 @@ + @@ -90,9 +103,10 @@ import gcoord from '@/common/gcoord.js' import ruiDatePicker from '@/components/rattenking-dtpicker/rattenking-dtpicker.vue'; import detail from '@/pages/application/breakground/breakground-detail/index' + import selectMeasures from "@/components/select_measures/index.vue"; export default { components: { - tkiTree,ruiDatePicker,writingBoard,detail + tkiTree,ruiDatePicker,writingBoard,detail,selectMeasures }, data() { return { @@ -102,8 +116,11 @@ treeNode:[],//部门下拉数据 pd:{},// 数据 measuresList:[], + measuresListCopy:[], modalName:null, imgList:[], + selectMeasuresShow:false, + selectMeasuresIndex:-1, } }, onLoad(event){ @@ -112,6 +129,7 @@ // 初始化现场作业负责人 this.getDept(); this.getMeasures(); + this.addMeasuresListCopy(); loginSession(); }, methods: { @@ -165,8 +183,8 @@ return; } if(APPLY_STATUS == 1){ - for (let i = 0; i < this.measuresList.length; i++) { - const measures = this.measuresList[i] + for (let i = 0; i < this.measuresListCopy.length; i++) { + const measures = this.measuresListCopy[i] if(!measures.USER_ID){ uni.showToast({ icon: 'none', @@ -175,17 +193,38 @@ }); return; } + if(measures.selectMeasures.length === 0){ + uni.showToast({ + icon: 'none', + title: '第'+(i+1)+'项未选择安全措施', + duration: 1500 + }); + return; + } } } const formData={} var files = []; var signtime = []; - const signers = this.measuresList.map(item => { - return { - BUS_BREAKGROUND_MEASURES_ID: item.BUS_BREAKGROUND_MEASURES_ID, - USER_ID: item.USER_ID - } - }) + var signers = []; + for (let i = 0; i < this.measuresListCopy.length; i++) { + const measures = this.measuresListCopy[i] + for (let j = 0; j < measures.selectMeasures.length; j++) { + signers.push({ + BUS_BREAKGROUND_MEASURES_ID: measures.selectMeasures[j].BUS_BREAKGROUND_MEASURES_ID, + USER_ID: measures.USER_ID + }) + } + } + if(signers.length !== this.measuresList.length){ + uni.showToast({ + icon: 'none', + title: '请为每个安全措施选择确认人', + duration: 1500 + }); + return; + } + this.uploadImgFaults(files,signtime) formData.BREAKGROUND_ID = _this.pd.BREAKGROUND_ID formData.SIGNTIME = signtime.join(",") @@ -238,11 +277,7 @@ USER_ID:loginUser.USER_ID, }, success: function (res) { - _this.measuresList = res.data.measuresList.map((item,index)=>{ - item.userList = [] - item.userIndex = -1 - return item - }) + _this.measuresList = res.data.measuresList } }); }, @@ -272,6 +307,25 @@ } }); }, + addMeasuresListCopy(){ + this.measuresListCopy.push({ + id:Math.random(), + DEPARTMENT_ID:'', + DEPARTMENT_NAME:'', + USER_ID:'', + USER_NAME:'', + userList:[], + userIndex:-1, + selectMeasures:[] + }) + }, + removeMeasuresListCopy(index){ + this.measuresListCopy.splice(index,1) + }, + fnSelectMeasures(index){ + this.selectMeasuresShow = true + this.selectMeasuresIndex = index + }, showDeptTree(index) { this.isUps=true @@ -280,10 +334,10 @@ deptTreeConfirm(e,i) { this.isUps=false; - this.measuresList[i].DEPARTMENT_ID=e[0].id; - this.measuresList[i].DEPARTMENT_NAME=e[0].name; - this.measuresList[i].USER_ID = '' - this.measuresList[i].USER_NAME = '' + this.measuresListCopy[i].DEPARTMENT_ID=e[0].id; + this.measuresListCopy[i].DEPARTMENT_NAME=e[0].name; + this.measuresListCopy[i].USER_ID = '' + this.measuresListCopy[i].USER_NAME = '' this.getUserList(e[0].id,i); }, @@ -292,14 +346,24 @@ }, pickerUser(e,i) { - this.measuresList[i].userIndex = e.detail.value; - this.measuresList[i].USER_ID=this.measuresList[i].userList[e.detail.value].USER_ID; - this.measuresList[i].USER_NAME=this.measuresList[i].userList[e.detail.value].NAME; + for (let j = 0; j < this.measuresListCopy.length; j++) { + if(this.measuresListCopy[j].USER_ID === this.measuresListCopy[i].userList[e.detail.value].USER_ID && i !== j){ + uni.showToast({ + icon: 'none', + title: '确认人不能重复', + duration: 1500 + }); + return; + } + } + this.measuresListCopy[i].userIndex = e.detail.value; + this.measuresListCopy[i].USER_ID=this.measuresListCopy[i].userList[e.detail.value].USER_ID; + this.measuresListCopy[i].USER_NAME=this.measuresListCopy[i].userList[e.detail.value].NAME; this.$forceUpdate();//强制刷新 }, isBlankList(i) { - if (this.measuresList[i].userList.length == 0) { + if (this.measuresListCopy[i].userList.length == 0) { uni.showToast({ icon: 'none', title: '请先选择确认单位', @@ -327,7 +391,7 @@ }, success: function(res){ if("success" == res.data.result){ - _this.measuresList[i].userList = res.data.userList; + _this.measuresListCopy[i].userList = res.data.userList; }else{ uni.showToast({ title: res.data.message, @@ -375,5 +439,19 @@