Commit 48692a00 authored by houjn@hikoon.cn's avatar houjn@hikoon.cn

部门目标设置时,显示多级部门名称

parent 20b1178e
......@@ -148,7 +148,7 @@
getCreateInitData,
getPersonTargetPage
} from "@/api/ecw/deptTarget";
import {listSimpleDepts} from "@/api/system/dept";
import {listDept, listSimpleDepts} from "@/api/system/dept";
import {getChannelList} from '@/api/ecw/channel';
import dayjs from "dayjs";
import { parseTime } from '@/utils/ruoyi';
......@@ -237,24 +237,27 @@ import { parseTime } from '@/utils/ruoyi';
}
},
created() {
listSimpleDepts().then(res => {
res.data.forEach((item) => {
if (item.parentId == 0) {
this.getDeptList();
this.deptArr.push(item)
} else {
this.deptData.push(item)
}
})
this.deptData.forEach((value) => {
var dept = this.deptArr.filter(itt => itt.id == value.parentId)
if (dept.length > 0) {
value.name = dept[0].name + ' | ' + value.name
}
})
});
// listSimpleDepts().then(res => {
// this.deptList = this.handleTree(res, "id");
// console.log("this.deptList:"+JSON.stringify(this.deptList));
// res.data.forEach((item) => {
// if (item.parentId == 0) {
// this.deptArr.push(item)
// }
// else {
// this.deptData.push(item)
// }
// })
// this.deptData.forEach((value) => {
// var dept = this.deptArr.filter(itt => itt.id == value.parentId)
// if (dept.length > 0) {
// value.name = dept[0].name + ' | ' + value.name
// }
//
// })
// });
getCreateInitData().then(res => {
this.monthList = res.data.month;
this.quarterList = res.data.quarter;
......@@ -264,6 +267,36 @@ import { parseTime } from '@/utils/ruoyi';
this.getList();
},
methods: {
/** 查询部门列表 */
getDeptList(){
this.loading = true;
listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "id");
console.log("this.deptList:"+JSON.stringify(this.deptList));
this.deptList.forEach((item) => {
this.normalizer(item);
// this.deptData.push(item);
// if(item.children!=null&&item.children.length>0){
// item.children.forEach((c) => {
// c.name = item.name +"|"+ c.name;
// this.deptData.push(c);
// });
// }
});
// this.loading = false;
});
},
normalizer(item) {
this.deptData.push(item);
if(item.children!=null&&item.children.length>0){
item.children.forEach((c) => {
c.name = item.name +"|"+ c.name;
this.normalizer(c);
// this.deptData.push(c);
});
}
return item;
},
getChannelList() {
getChannelList().then(res => this.channelList = res.data)
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment