|
|
@ -487,7 +487,7 @@ |
|
|
|
v-model.trim="peoForm.manageScopes" |
|
|
|
:options="orgOptions" |
|
|
|
:props="orgOptionProps" |
|
|
|
:show-all-levels="true" |
|
|
|
:show-all-levels="true" |
|
|
|
clearable></el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
@ -611,7 +611,7 @@ |
|
|
|
v-model.trim="peoForm.manageScopes" |
|
|
|
:options="orgOptions" |
|
|
|
:props="orgOptionProps" |
|
|
|
:show-all-levels="false" |
|
|
|
:show-all-levels="true" |
|
|
|
clearable></el-cascader> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
@ -1330,10 +1330,15 @@ export default { |
|
|
|
orgOptionProps :{ |
|
|
|
multiple: true, |
|
|
|
emitPath: true, |
|
|
|
value: 'agencyId', |
|
|
|
label: 'agencyName', |
|
|
|
children: 'subAgencyList', |
|
|
|
checkStrictly: true |
|
|
|
value: 'id', |
|
|
|
label: 'label', |
|
|
|
children: 'children', |
|
|
|
checkStrictly: true, |
|
|
|
lazy: true, |
|
|
|
lazyLoad: (node, resolve) => { |
|
|
|
this.loadOptions(node, resolve) |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
dialogVisiblePeoAgency:false,//通过组织添加 |
|
|
|
peoFormAgency:{ |
|
|
@ -1401,12 +1406,11 @@ export default { |
|
|
|
methods: { |
|
|
|
getOrgTreeList () { |
|
|
|
this.$http |
|
|
|
.post('/gov/org/customeragency/agencygridtree', {}) |
|
|
|
.get('/actual/base/communityBuilding/tree/initTree', {}) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
console.log('获取组织树成功', res.data) |
|
|
|
this.orgOptions = [] |
|
|
|
this.orgOptions.push(res.data) |
|
|
|
} |
|
|
@ -1415,10 +1419,29 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
async loadOptions(node, resolve) { |
|
|
|
let data1 =node.data; |
|
|
|
if (data1.level == 'district') { |
|
|
|
resolve(this.orgOptions); |
|
|
|
|
|
|
|
} else { |
|
|
|
if(data1.level !== "building"){ |
|
|
|
const url = "/actual/base/communityBuilding/tree/nextTreeNode"; |
|
|
|
let params = { |
|
|
|
level:data1.level, |
|
|
|
id:data1.id |
|
|
|
}; |
|
|
|
const { data, code, msg } =await requestGet(url, params); |
|
|
|
data1.children=data |
|
|
|
resolve(data); |
|
|
|
}else{ |
|
|
|
return resolve() |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
// 点击后获取id |
|
|
|
handleChangeTransferCascader (e) { |
|
|
|
console.log("*********************"); |
|
|
|
function findItem (valueArr, coll) { |
|
|
|
console.log("--------------------"); |
|
|
|
console.log(valueArr); |
|
|
@ -1656,14 +1679,13 @@ export default { |
|
|
|
// 添加人员 |
|
|
|
async submitPeoDo () { |
|
|
|
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/addstaffv2"; |
|
|
|
const { |
|
|
@ -1721,20 +1743,15 @@ export default { |
|
|
|
}, |
|
|
|
// 人员修改 |
|
|
|
async updatePeoDo () { |
|
|
|
|
|
|
|
const targetAgencyIds = this.peoForm.manageScopes.map(innerArray => innerArray[innerArray.length - 1]); |
|
|
|
|
|
|
|
// 用于存储提取结果的 Set 对象 |
|
|
|
const result = new Set(); |
|
|
|
|
|
|
|
console.log(this.orgOptions[0],targetAgencyIds,'11111112'); |
|
|
|
// 调用递归函数提取 level 与 agencyId 组合成的字符串 |
|
|
|
this.extractLevelAndAgencyId(this.orgOptions[0], targetAgencyIds, result); |
|
|
|
|
|
|
|
// 将 Set 对象转换为数组 |
|
|
|
const manageScopeArray = Array.from(result); |
|
|
|
|
|
|
|
const url = "/gov/org/staff/editstaff"; |
|
|
|
|
|
|
|
let params = { |
|
|
|
staffId: this.userStaffId, |
|
|
|
name: this.peoForm.name, |
|
|
@ -1768,12 +1785,14 @@ 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}`); |
|
|
|
console.log(obj,"1111"); |
|
|
|
if (obj.level && obj.id && agencyIds.includes(obj.id)) { |
|
|
|
result.add(`${obj.level}:${obj.id}`); |
|
|
|
} |
|
|
|
if (Array.isArray(obj.subAgencyList)) { |
|
|
|
obj.subAgencyList.forEach(subObj => { |
|
|
|
if (Array.isArray(obj.children)) { |
|
|
|
obj.children.forEach(subObj => { |
|
|
|
this.extractLevelAndAgencyId(subObj, agencyIds, result); |
|
|
|
}); |
|
|
|
} |
|
|
|