|
|
@ -61,9 +61,10 @@ export default { |
|
|
|
iscascaderShow: 0, |
|
|
|
optionProps: { |
|
|
|
multiple: false, |
|
|
|
value: 'id', |
|
|
|
label: 'name', |
|
|
|
children: 'subCategory', |
|
|
|
value: "id", |
|
|
|
label: "categoryName", |
|
|
|
children: "children", |
|
|
|
level: 'categoryType' |
|
|
|
}, |
|
|
|
dataRule: { |
|
|
|
content: [ |
|
|
@ -110,20 +111,19 @@ export default { |
|
|
|
if (this.eventId) { |
|
|
|
this.eventDetailCopy = JSON.parse(JSON.stringify(this.eventDetailData)); |
|
|
|
// 这一步接收到eventDetailCopy在这里回填 |
|
|
|
if (this.eventDetailCopy.parentCategoryId && this.eventDetailCopy.categoryId) { |
|
|
|
if (this.eventDetailCopy.categoryId) { |
|
|
|
this.formData.categoryId = this.eventDetailCopy.categoryId |
|
|
|
this.selCategoryArray.push(this.eventDetailCopy.parentCategoryId, this.eventDetailCopy.categoryId) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
async getCategoryList() { |
|
|
|
const url = '/governance/issueprojectcategorydict/list'; |
|
|
|
const url = '/governance/icEvent/getCategoryTree'; |
|
|
|
let params = {}; |
|
|
|
const { data, code, msg } = await requestPost(url, params); |
|
|
|
if (code === 0) { |
|
|
|
let treeDataNew = this.filterTree(data); |
|
|
|
let treeDataNew = this.deepTree(data, "children"); |
|
|
|
//组织级联数据 |
|
|
|
++this.iscascaderShow; |
|
|
|
this.casOptions = []; |
|
|
@ -131,6 +131,26 @@ export default { |
|
|
|
} else { |
|
|
|
this.$message.error(msg); |
|
|
|
} |
|
|
|
if (this.eventDetailCopy.parentCategoryId) { |
|
|
|
let pids = this.eventDetailCopy.parentCategoryId.split(','); |
|
|
|
pids.push(this.eventDetailCopy.categoryId) |
|
|
|
pids.forEach(id => { |
|
|
|
let node = this.buildTree(this.casOptions, toString(id)); |
|
|
|
this.selCategoryArray.push(node) |
|
|
|
}); |
|
|
|
let node = this.buildTree(this.casOptions, this.eventDetailCopy.categoryId); |
|
|
|
this.selCategoryArray.push(node); |
|
|
|
console.log(this.selCategoryArray); |
|
|
|
} |
|
|
|
}, |
|
|
|
buildTree(nodes, treeId) { |
|
|
|
nodes.forEach(item => { |
|
|
|
if (treeId === item.id) { |
|
|
|
return item; |
|
|
|
} else { |
|
|
|
this.buildTree(item.children, treeId) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleChangeCate() { |
|
|
|
if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) { |
|
|
@ -140,18 +160,19 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
//重构树,去除网格 |
|
|
|
filterTree(arr) { |
|
|
|
let childs = arr; |
|
|
|
for (let i = childs.length; i--; i > 0) { |
|
|
|
if (childs[i].subCategory) { |
|
|
|
if (childs[i].subCategory.length) { |
|
|
|
this.filterTree(childs[i].subCategory); |
|
|
|
} else { |
|
|
|
delete childs[i].subCategory; |
|
|
|
} |
|
|
|
} |
|
|
|
deepTree(arr, children) { |
|
|
|
if (Array.isArray(arr) && arr.length > 0) { |
|
|
|
return arr.map((item) => { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
[children]: |
|
|
|
(item[children] && |
|
|
|
item[children].length > 0 && |
|
|
|
this.deepTree(item[children], children)) || |
|
|
|
null, |
|
|
|
}; |
|
|
|
}); |
|
|
|
} |
|
|
|
return arr; |
|
|
|
}, |
|
|
|
async getReplayInfo() { |
|
|
|
this.okflag = false; |
|
|
|