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() { async getCategoryList() {
const url = "/governance/issueprojectcategorydict/list"; const url = "/governance/icEvent/getCategoryTree";
let params = {}; let params = {};
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
let treeDataNew = this.filterTree(data); let treeDataNew = this.deepTree(data, "children");
// this.categrayList = data // this.categrayList = data
// //
++this.iscascaderShow; ++this.iscascaderShow;
@ -343,18 +343,19 @@ export default {
}, },
// //
filterTree(arr) { deepTree(arr, children) {
let childs = arr; if (Array.isArray(arr) && arr.length > 0) {
for (let i = childs.length; i--; i > 0) { return arr.map((item) => {
if (childs[i].subCategory) { return {
if (childs[i].subCategory.length) { ...item,
this.filterTree(childs[i].subCategory); [children]:
} else { (item[children] &&
delete childs[i].subCategory; item[children].length > 0 &&
} this.deepTree(item[children], children)) ||
} null,
};
});
} }
return arr;
}, },
handleChangeAgency(value) { handleChangeAgency(value) {

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

@ -366,7 +366,6 @@ export default {
}, },
async handelAdd() { async handelAdd() {
debugger
this.$refs.ref_add.getEventInfo(); this.$refs.ref_add.getEventInfo();
if (this.$refs.ref_add.okflag) { if (this.$refs.ref_add.okflag) {
this.eventInfoData = this.$refs.ref_add.formData; 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: { optionProps: {
multiple: false, multiple: false,
value: "id", value: "id",
label: "name", label: "categoryName",
children: "subCategory", children: "children",
}, },
dataRule: { dataRule: {
content: [ content: [
@ -163,12 +163,11 @@ export default {
} }
}, },
async getCategoryList() { async getCategoryList() {
const url = "/governance/issueprojectcategorydict/list"; const url = '/governance/icEvent/getCategoryTree';
let params = {}; let params = {};
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
let treeDataNew = this.filterTree(data); let treeDataNew = this.deepTree(data, "children");
//
++this.iscascaderShow; ++this.iscascaderShow;
this.casOptions = []; this.casOptions = [];
this.casOptions = treeDataNew; this.casOptions = treeDataNew;
@ -182,7 +181,6 @@ export default {
this.formData.orgType = obj.level === 'grid' ? 'grid' : 'agency' this.formData.orgType = obj.level === 'grid' ? 'grid' : 'agency'
this.formData.deptId = obj.agencyId this.formData.deptId = obj.agencyId
this.formData.deptName = obj.agencyName this.formData.deptName = obj.agencyName
} else { } else {
this.form.orgType = '' this.form.orgType = ''
this.form.orgId = '' this.form.orgId = ''
@ -198,18 +196,19 @@ export default {
} }
}, },
// //
filterTree(arr) { deepTree(arr, children) {
let childs = arr; if (Array.isArray(arr) && arr.length > 0) {
for (let i = childs.length; i--; i > 0) { return arr.map((item) => {
if (childs[i].subCategory) { return {
if (childs[i].subCategory.length) { ...item,
this.filterTree(childs[i].subCategory); [children]:
} else { (item[children] &&
delete childs[i].subCategory; item[children].length > 0 &&
} this.deepTree(item[children], children)) ||
} null,
};
});
} }
return arr;
}, },
async getReplayInfo() { async getReplayInfo() {
this.okflag = false; this.okflag = false;

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

@ -64,9 +64,9 @@ export default {
iscascaderShow: 0, iscascaderShow: 0,
optionProps: { optionProps: {
multiple: false, multiple: false,
value: 'id', value: "id",
label: 'name', label: "categoryName",
children: 'subCategory', children: "children",
}, },
dataRule: { dataRule: {
content: [ content: [
@ -115,11 +115,11 @@ export default {
methods: { methods: {
async getCategoryList() { async getCategoryList() {
const url = '/governance/issueprojectcategorydict/list'; const url = '/governance/icEvent/getCategoryTree';
let params = {}; let params = {};
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
let treeDataNew = this.filterTree(data); let treeDataNew = this.deepTree(data, "children");
// //
++this.iscascaderShow; ++this.iscascaderShow;
this.casOptions = []; this.casOptions = [];
@ -136,18 +136,19 @@ export default {
} }
}, },
// //
filterTree(arr) { deepTree(arr, children) {
let childs = arr; if (Array.isArray(arr) && arr.length > 0) {
for (let i = childs.length; i--; i > 0) { return arr.map((item) => {
if (childs[i].subCategory) { return {
if (childs[i].subCategory.length) { ...item,
this.filterTree(childs[i].subCategory); [children]:
} else { (item[children] &&
delete childs[i].subCategory; item[children].length > 0 &&
} this.deepTree(item[children], children)) ||
} null,
};
});
} }
return arr;
}, },
async getReplayInfo() { async getReplayInfo() {
this.okflag = false; this.okflag = false;

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

@ -61,9 +61,10 @@ export default {
iscascaderShow: 0, iscascaderShow: 0,
optionProps: { optionProps: {
multiple: false, multiple: false,
value: 'id', value: "id",
label: 'name', label: "categoryName",
children: 'subCategory', children: "children",
level: 'categoryType'
}, },
dataRule: { dataRule: {
content: [ content: [
@ -110,20 +111,19 @@ export default {
if (this.eventId) { if (this.eventId) {
this.eventDetailCopy = JSON.parse(JSON.stringify(this.eventDetailData)); this.eventDetailCopy = JSON.parse(JSON.stringify(this.eventDetailData));
// eventDetailCopy // eventDetailCopy
if (this.eventDetailCopy.parentCategoryId && this.eventDetailCopy.categoryId) { if (this.eventDetailCopy.categoryId) {
this.formData.categoryId = this.eventDetailCopy.categoryId this.formData.categoryId = this.eventDetailCopy.categoryId
this.selCategoryArray.push(this.eventDetailCopy.parentCategoryId, this.eventDetailCopy.categoryId)
} }
} }
}, },
methods: { methods: {
async getCategoryList() { async getCategoryList() {
const url = '/governance/issueprojectcategorydict/list'; const url = '/governance/icEvent/getCategoryTree';
let params = {}; let params = {};
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
if (code === 0) { if (code === 0) {
let treeDataNew = this.filterTree(data); let treeDataNew = this.deepTree(data, "children");
// //
++this.iscascaderShow; ++this.iscascaderShow;
this.casOptions = []; this.casOptions = [];
@ -131,6 +131,26 @@ export default {
} else { } else {
this.$message.error(msg); 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() { handleChangeCate() {
if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) { if (this.selCateObj = this.$refs['myCascader'].getCheckedNodes()[0]) {
@ -140,18 +160,19 @@ export default {
} }
}, },
// //
filterTree(arr) { deepTree(arr, children) {
let childs = arr; if (Array.isArray(arr) && arr.length > 0) {
for (let i = childs.length; i--; i > 0) { return arr.map((item) => {
if (childs[i].subCategory) { return {
if (childs[i].subCategory.length) { ...item,
this.filterTree(childs[i].subCategory); [children]:
} else { (item[children] &&
delete childs[i].subCategory; item[children].length > 0 &&
} this.deepTree(item[children], children)) ||
} null,
};
});
} }
return arr;
}, },
async getReplayInfo() { async getReplayInfo() {
this.okflag = false; this.okflag = false;

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

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

Loading…
Cancel
Save