From 77737f4e73f7267170b9b06fc73d1610c29c0661 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 12 十一月 2024 13:18:35 +0800 Subject: [PATCH] 新增 --- src/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue | 69 +++++++++++++++++++++++++++------- 1 files changed, 54 insertions(+), 15 deletions(-) diff --git a/src/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue b/src/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue index 94d244a..d5a5f10 100644 --- a/src/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue +++ b/src/views/newSpecialWorkSystem/workTicket/zysq/components/open.vue @@ -42,15 +42,15 @@ </el-col> <el-col :span="12"> <el-form-item label="作业人" prop="operatorUids"> - <el-select v-model="form.operatorUids" multiple clearable> - <el-option - v-for="item in zyList" - :key="item.uid" - :label="item.realName" - :value="item.uid" - /> - </el-select> - <!-- <el-cascader style="width: 100%" v-model="form.operatorUids" :options="lists.spList.opList" :props="cas2Props" @change="singleSelect($event,'作业人')" filterable :show-all-levels="false"/>--> +<!-- <el-select v-model="form.operatorUids" multiple clearable>--> +<!-- <el-option--> +<!-- v-for="item in zyList"--> +<!-- :key="item.uid"--> +<!-- :label="item.realName"--> +<!-- :value="item.uid"--> +<!-- />--> +<!-- </el-select>--> + <el-cascader style="width: 100%" v-model="form.operatorUids" :options="zyList?zyList:lists.spList.opList" :props="cas2Props" @change="singleSelect($event,'作业人')" filterable :show-all-levels="false"/> </el-form-item> </el-col> </el-row> @@ -396,6 +396,7 @@ props1:{}, depProps:{}, casProps:{} + cas2Props:{} safetyMeasureBasicList: [], fileList: Array<file>, uploadUrl: string, @@ -470,6 +471,13 @@ multiple: true, checkStrictly: true, emitPath: false + }, + cas2Props: { + value: 'uid', + label: 'realName', + multiple: true, + checkStrictly: true, + children: 'certList' }, casProps: { expandTrigger: 'hover', @@ -588,13 +596,44 @@ state.form.workDetail.qpDetailList.splice(index,1) } - const getWorkerList = (val)=>{ - const filteredList = props.lists.spList.opList.filter(i => state.form.workDepIds.includes(i.depId)); + const getWorkerList = ()=>{ + let idList:Array<any> = [] + for(let i of state.form.workDepIds){ + idList = idList.concat(getListFromDep(getIdListsFormDepId(props.lists.departList,i))) + } + const depLists = [...new Set(idList)] + const filteredList = props.lists.spList.opList.filter(i => depLists.includes(i.depId)); if(filteredList && filteredList.length>0){ state.zyList = filteredList }else{ state.zyList = props.lists.spList.opList } + } + + const getListFromDep = (dep) =>{ + let depIds = [] + depIds.push(dep.depId) + if (Array.isArray(dep.children)) { + for (let child of dep.children) { + depIds = depIds.concat(getListFromDep(child)); + } + } + return depIds; + } + + const getIdListsFormDepId=(DepList:Array<any>,id:number)=>{ + for(const i of DepList){ + if(i.depId === id){ + return i + } + if(Array.isArray(i.children)){ + const node:any = getIdListsFormDepId(i.children,id) + if(node){ + return node + } + } + } + return null } const getSelected = ()=>{ @@ -662,9 +701,9 @@ return arr.map((i)=>{ return { uid: i[0], - certificate: i[1].split(',')[0], - certExpiredAt: i[1].split(',')[1], - certTypeName: i[1].split(',')[2] + certificate: i[1]?i[1].split(',')[0]:'', + certExpiredAt: i[1]?i[1].split(',')[1]:'', + certTypeName: '' } }) } @@ -730,7 +769,7 @@ state.form.workDetail.sketchMapPath = state.form.workDetail.sketchMapPath.join(',') state.form.riskIdentification = state.form.riskIdentification.join(',') const {depIdList,...data} = state.form - data.operatorUids = transform2Arr(data.operatorUids) + data.operatorUids = transformArr(data.operatorUids) data.headUids = transform2Arr(data.headUids) data.guardianUids = transform2Arr(data.guardianUids) data.safetyMeasureUids = transform2Arr(data.safetyMeasureUids) -- Gitblit v1.9.2