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

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

parent 20b1178e
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
getCreateInitData, getCreateInitData,
getPersonTargetPage getPersonTargetPage
} from "@/api/ecw/deptTarget"; } from "@/api/ecw/deptTarget";
import {listSimpleDepts} from "@/api/system/dept"; import {listDept, listSimpleDepts} from "@/api/system/dept";
import {getChannelList} from '@/api/ecw/channel'; import {getChannelList} from '@/api/ecw/channel';
import dayjs from "dayjs"; import dayjs from "dayjs";
import { parseTime } from '@/utils/ruoyi'; import { parseTime } from '@/utils/ruoyi';
...@@ -237,24 +237,27 @@ import { parseTime } from '@/utils/ruoyi'; ...@@ -237,24 +237,27 @@ import { parseTime } from '@/utils/ruoyi';
} }
}, },
created() { created() {
listSimpleDepts().then(res => { this.getDeptList();
res.data.forEach((item) => {
if (item.parentId == 0) {
this.deptArr.push(item) // listSimpleDepts().then(res => {
// this.deptList = this.handleTree(res, "id");
} else { // console.log("this.deptList:"+JSON.stringify(this.deptList));
this.deptData.push(item) // res.data.forEach((item) => {
} // if (item.parentId == 0) {
}) // this.deptArr.push(item)
this.deptData.forEach((value) => { // }
var dept = this.deptArr.filter(itt => itt.id == value.parentId) // else {
if (dept.length > 0) { // this.deptData.push(item)
value.name = dept[0].name + ' | ' + value.name // }
} // })
// 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 => { getCreateInitData().then(res => {
this.monthList = res.data.month; this.monthList = res.data.month;
this.quarterList = res.data.quarter; this.quarterList = res.data.quarter;
...@@ -264,6 +267,36 @@ import { parseTime } from '@/utils/ruoyi'; ...@@ -264,6 +267,36 @@ import { parseTime } from '@/utils/ruoyi';
this.getList(); this.getList();
}, },
methods: { 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() {
getChannelList().then(res => this.channelList = res.data) 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