Browse Source

修改事件分类问题;

feature
luyan 2 years ago
parent
commit
b512e64e1a
  1. 27
      src/views/modules/shequzhili/event/cpts/add.vue
  2. 1
      src/views/modules/shequzhili/event/cpts/event-info.vue
  3. 33
      src/views/modules/shequzhili/event/cpts/process-form-designate.vue
  4. 33
      src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue
  5. 57
      src/views/modules/shequzhili/event/cpts/process-form-replay.vue
  6. 18
      src/views/modules/shequzhili/event/eventList.vue

27
src/views/modules/shequzhili/event/cpts/add.vue

@ -326,11 +326,11 @@ export default {
}
},
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.categrayList = data
//
++this.iscascaderShow;
@ -343,18 +343,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;
},
handleChangeAgency(value) {

1
src/views/modules/shequzhili/event/cpts/event-info.vue

@ -366,7 +366,6 @@ export default {
},
async handelAdd() {
debugger
this.$refs.ref_add.getEventInfo();
if (this.$refs.ref_add.okflag) {
this.eventInfoData = this.$refs.ref_add.formData;

33
src/views/modules/shequzhili/event/cpts/process-form-designate.vue

@ -87,8 +87,8 @@ export default {
optionProps: {
multiple: false,
value: "id",
label: "name",
children: "subCategory",
label: "categoryName",
children: "children",
},
dataRule: {
content: [
@ -163,12 +163,11 @@ export default {
}
},
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 = [];
this.casOptions = treeDataNew;
@ -182,7 +181,6 @@ export default {
this.formData.orgType = obj.level === 'grid' ? 'grid' : 'agency'
this.formData.deptId = obj.agencyId
this.formData.deptName = obj.agencyName
} else {
this.form.orgType = ''
this.form.orgId = ''
@ -198,18 +196,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;

33
src/views/modules/shequzhili/event/cpts/process-form-replay-end.vue

@ -64,9 +64,9 @@ export default {
iscascaderShow: 0,
optionProps: {
multiple: false,
value: 'id',
label: 'name',
children: 'subCategory',
value: "id",
label: "categoryName",
children: "children",
},
dataRule: {
content: [
@ -115,11 +115,11 @@ export default {
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 = [];
@ -136,18 +136,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;

57
src/views/modules/shequzhili/event/cpts/process-form-replay.vue

@ -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;

18
src/views/modules/shequzhili/event/eventList.vue

@ -27,8 +27,8 @@
multiple: true,
checkStrictly: false,
emitPath: false,
children: 'subCategory',
label: 'name',
children: 'children',
label: 'categoryName',
value: 'id',
}" clearable class="u-item-width-normal" @change="handleEventType" />
<!-- <template slot-scope="{ node, data }">
@ -669,10 +669,10 @@ export default {
}
},
async getCateOptions() {
const url = "/governance/issueprojectcategorydict/list";
const url = "/governance/icEvent/getCategoryTree";
const { data, code, msg } = await requestPost(url, {});
if (code === 0) {
this.cateOptions = this.deepTree(data, "subCategory");
this.cateOptions = this.deepTree(data, "children");
} else {
this.$message.error(msg);
}
@ -708,15 +708,15 @@ export default {
this.getTableData();
// this.loadTable()
},
deepTree(arr, child) {
deepTree(arr, children) {
if (Array.isArray(arr) && arr.length > 0) {
return arr.map((item) => {
return {
...item,
[child]:
(item[child] &&
item[child].length > 0 &&
this.deepTree(item[child], child)) ||
[children]:
(item[children] &&
item[children].length > 0 &&
this.deepTree(item[children], children)) ||
null,
};
});

Loading…
Cancel
Save