|
|
@ -487,7 +487,7 @@ |
|
|
|
v-model="peoForm.manageScopes" |
|
|
|
:options="orgOptions" |
|
|
|
:props="orgOptionProps" |
|
|
|
:show-all-levels="false" |
|
|
|
:show-all-levels="true" |
|
|
|
clearable></el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
@ -1328,7 +1328,8 @@ export default { |
|
|
|
// 组织树 |
|
|
|
orgOptions: [], |
|
|
|
orgOptionProps :{ |
|
|
|
multiple: false, |
|
|
|
multiple: true, |
|
|
|
emitPath: true, |
|
|
|
value: 'agencyId', |
|
|
|
label: 'agencyName', |
|
|
|
children: 'subAgencyList', |
|
|
@ -1710,6 +1711,18 @@ export default { |
|
|
|
}, |
|
|
|
// 人员修改 |
|
|
|
async updatePeoDo () { |
|
|
|
|
|
|
|
const targetAgencyIds = this.peoForm.manageScopes.map(innerArray => innerArray[innerArray.length - 1]); |
|
|
|
|
|
|
|
// 用于存储提取结果的 Set 对象 |
|
|
|
const result = new Set(); |
|
|
|
|
|
|
|
// 调用递归函数提取 level 与 agencyId 组合成的字符串 |
|
|
|
this.extractLevelAndAgencyId(this.orgOptions[0], targetAgencyIds, result); |
|
|
|
|
|
|
|
// 将 Set 对象转换为数组 |
|
|
|
const manageScopeArray = Array.from(result); |
|
|
|
|
|
|
|
const url = "/gov/org/staff/editstaff"; |
|
|
|
|
|
|
|
let params = { |
|
|
@ -1723,7 +1736,7 @@ export default { |
|
|
|
newRoles: this.peoForm.newRoles, |
|
|
|
agencyId: this.currentAgencyId, |
|
|
|
idCard: this.peoForm.idCard, |
|
|
|
manageScopes:this.peoForm.manageScopes |
|
|
|
manageScopes:manageScopeArray |
|
|
|
}; |
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
|
|
|
@ -1743,6 +1756,20 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 递归函数,遍历 JSON 对象提取所有的 level 与 agencyId 组合成的字符串 |
|
|
|
extractLevelAndAgencyId(obj, agencyIds, result) { |
|
|
|
if (obj && typeof obj === 'object') { |
|
|
|
if (obj.level && obj.agencyId && agencyIds.includes(obj.agencyId)) { |
|
|
|
result.add(`${obj.level}:${obj.agencyId}`); |
|
|
|
} |
|
|
|
if (Array.isArray(obj.subAgencyList)) { |
|
|
|
obj.subAgencyList.forEach(subObj => { |
|
|
|
this.extractLevelAndAgencyId(subObj, agencyIds, result); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 字典 |
|
|
|
async getDictionaries () { |
|
|
|
const url = "/sys/dict/data/dictlist"; |
|
|
@ -2043,6 +2070,7 @@ export default { |
|
|
|
}, |
|
|
|
// 修改网格人员 |
|
|
|
async xiuGridPeo (row) { |
|
|
|
console.log("修改网格人员"); |
|
|
|
this.modifyPeo = true; |
|
|
|
this.peoForm.orgType = "grid"; |
|
|
|
|
|
|
@ -2085,6 +2113,7 @@ export default { |
|
|
|
}, |
|
|
|
// 修改人员 |
|
|
|
async xiuPeo (row) { |
|
|
|
console.log("修改人员"); |
|
|
|
this.modifyPeo = true; |
|
|
|
this.peoForm.orgType = "agency"; |
|
|
|
|
|
|
@ -2119,13 +2148,42 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
this.peoForm.newRoles = existedRoleArr; |
|
|
|
this.peoForm.manageScopes = data.manageScopes |
|
|
|
var paths = this.findParentPath(this.orgOptions[0], data.manageScopes); |
|
|
|
this.peoForm.manageScopes = paths; |
|
|
|
} else { |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
}, |
|
|
|
findParentPath(data,agencyIds) { |
|
|
|
let paths = []; |
|
|
|
|
|
|
|
function findPathRecursive(agencyId, node, path) { |
|
|
|
if (node.agencyId === agencyId) { |
|
|
|
path.push(agencyId); |
|
|
|
paths.push(path.slice()); // Make a copy of the path array before pushing |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
if (node.subAgencyList) { |
|
|
|
for (let i = 0; i < node.subAgencyList.length; i++) { |
|
|
|
if (findPathRecursive(agencyId, node.subAgencyList[i], path.concat(node.agencyId))) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
agencyIds.forEach(agencyId => { |
|
|
|
findPathRecursive(agencyId, data, []); |
|
|
|
}); |
|
|
|
|
|
|
|
return paths; |
|
|
|
}, |
|
|
|
// 修改社区人员 |
|
|
|
async xiuCommunityPeo (row) { |
|
|
|
console.log("修改社区人员"); |
|
|
|
this.modifyPeo = true; |
|
|
|
this.peoForm.orgType = "dept"; |
|
|
|
|
|
|
|