diff --git a/src/views/safetyenvironmental/inspection/components/add.vue b/src/views/safetyenvironmental/inspection/components/add.vue index 76bede6..2f76f94 100644 --- a/src/views/safetyenvironmental/inspection/components/add.vue +++ b/src/views/safetyenvironmental/inspection/components/add.vue @@ -22,6 +22,7 @@ :options="treeData" :props="defaultProps" v-model="form.INSPECTED_DEPARTMENT_ID" + @change="changeCurrentDeptId(form.INSPECTED_DEPARTMENT_ID)" placeholder="请选择被检查单位" style="width: 300px" /> @@ -68,8 +69,8 @@ - 检查人员 添加 - + 检查人员 添加 +
@@ -82,7 +83,8 @@ v-model="item.INSPECTION_DEPARTMENT_ID" placeholder="请选择检查人员部门" style="width: 300px" - @change="updateInspecteDept(item.INSPECTION_DEPARTMENT_ID,index)"/> + @visible-change="" + @change="updateInspecteDept(item.INSPECTION_DEPARTMENT_ID,index,item)"/> @@ -348,6 +350,7 @@ export default { }, pd: [], switchInspectionType: 'select', + CURRENT_INSPECTED_DEPARTMENT_ID: '', //当前被检查单位 form: { INSPECTION_SUBJECT: '', // 检查标题 INSPECTION_SOURCE: '4', // 检查来源(4-监管端 5-企业端) @@ -480,6 +483,12 @@ export default { handleAdd() { this.dialogType = 'add' }, + changeCurrentDeptId(id) { + this.form.inspectorList = [] + this.form.inspectorList.push({ INSPECTION_INSPECTOR_ID: '', INSPECTION_DEPARTMENT_ID: '', INSPECTION_USER_ID: '', USER_SIDE: '' }) + this.INSPECTOR_List.push([]) + this.CURRENT_INSPECTED_DEPARTMENT_ID = id + }, changeSwitch(type) { if (type === 'InspectionType') { this.form.INSPECTION_TYPE = '' @@ -498,10 +507,46 @@ export default { this.form.inspectorList.push({ INSPECTION_INSPECTOR_ID: '', INSPECTION_DEPARTMENT_ID: '', INSPECTION_USER_ID: '', USER_SIDE: '' }) this.INSPECTOR_List.push([]) }, - updateInspecteDept(DEPARTMENT_ID, i) { - this.form.inspectorList[i].INSPECTION_USER_ID = '' - this.form.inspectorList[i].USER_SIDE = '' - this.getInspectorList(DEPARTMENT_ID, i) + updateInspecteDept(id,i,item) { + // 获取人员列表 + if (id) { + requestFN( + '/corpDepartment/checkDept', + { + DEPARTMENT_ID: this.CURRENT_INSPECTED_DEPARTMENT_ID, + id: id + } + ).then((data) => { + if (data.message!=null) { + this.INSPECTION_DEPARTMENT_ID = '' + this.INSPECTOR_List = [] + this.INSPECTION_USER_ID = '' + this.$message.error(data.message) + }else { + // 获取人员列表 + if (id) { + requestFN( + '/user/listAllManageAndCorp', + { + DEPARTMENT_ID: id + } + ).then((data) => { + this.INSPECTOR_List[i] = data.userList + this.$forceUpdate() + }).catch((e) => { + }) + } + this.form.inspectorList[i].INSPECTION_USER_ID = '' + this.form.inspectorList[i].USER_SIDE = '' + this.$message.success('检查人员部门选择成功') + this.getInspectorList(DEPARTMENT_ID, i) + } + }).catch((e) => { + }) + } + this.form.inspectorList = [] + this.form.inspectorList.push({ INSPECTION_INSPECTOR_ID: item.INSPECTION_INSPECTOR_ID, INSPECTION_DEPARTMENT_ID: item.INSPECTION_DEPARTMENT_ID, INSPECTION_USER_ID: '', USER_SIDE: item.USER_SIDE }) + this.INSPECTOR_List.push([]) }, // 获取人员列表 getInspectorList(DEPARTMENT_ID, i) { @@ -509,6 +554,7 @@ export default { requestFN( '/user/listAllManageAndCorp', { + CURRENT_INSPECTED_DEPARTMENT_ID: this.CURRENT_INSPECTED_DEPARTMENT_ID, DEPARTMENT_ID: DEPARTMENT_ID, NOMAIN: '1' }