DeptBaseInfo.vue
3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<template>
<div :visible="visible">
<a-descriptions size="small" bordered :column="1">
<a-descriptions-item label="机构名称">{{ model.departName }}</a-descriptions-item>
<a-descriptions-item label="上级部门"><span>{{ model.parentId }}</span></a-descriptions-item>
<a-descriptions-item label="机构编码"><span>{{ model.orgCode }}</span></a-descriptions-item>
<a-descriptions-item label="机构类型"><span>{{ model.orgCategory }}</span></a-descriptions-item>
<a-descriptions-item label="排序"><span>{{ model.departOrder }}</span></a-descriptions-item>
<a-descriptions-item label="手机号"><span>{{ model.mobile }}</span></a-descriptions-item>
<a-descriptions-item label="地址"><span>{{ model.address }}</span></a-descriptions-item>
<a-descriptions-item label="备注"><span>{{ model.memo }}</span></a-descriptions-item>
</a-descriptions>
</div>
</template>
<script>
import {queryIdTree} from '@/api/api'
export default {
name: 'DeptBaseInfo',
components: {},
data() {
return {
departTree: [],
id: '',
model: {},
visible: false,
disable: true,
treeData: [],
labelCol: {
xs: {span: 24},
sm: {span: 3}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
}
},
created() {
this.loadTreeData();
},
methods: {
loadTreeData() {
queryIdTree().then((res) => {
if (res.success) {
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i];
this.treeData.push(temp);
}
}
})
},
open(record) {
this.visible = true;
//update-begin---author:wangshuai ---date:20220211 for:[JTC-174]部门管理界面参考vue3的改改------------
this.model = Object.assign({}, record)
this.model.parentId = this.findTree(this.treeData, record.parentId);
this.model.orgCategory = this.orgCategoryText(record.orgCategory)
//update-end---author:wangshuai ---date:20220211 for:[JTC-174]部门管理界面参考vue3的改改------------
},
clearForm() {
this.treeData = [];
},
/**
* 通过父id查找部门名称
* @param treeList 树数组
* @param id 父id
* @return id对应的部门名称
*/
findTree(treeList, id) {
for (let i = 0; i < treeList.length; i++) {
let item = treeList[i];
//如果当前id和父id相同则返回部门名称
if (item.key == id) {
return item.title;
}
let children = item.children
//存在子部门进行递归查询
if (children) {
let findResult = this.findTree(children, id);
//返回的数据不为空,结束递归,返回结果
if (findResult) {
return findResult
}
}
}
},
/**
* 将机构类型数值翻译成文本
* @param orgCategory 部门类别
* @return 部门类别对应的文本
*/
orgCategoryText(orgCategory) {
if (orgCategory == 1) {
return "公司";
} else if (orgCategory == 2) {
return "部门";
} else {
return "岗位";
}
}
}
}
</script>
<style scoped lang="less">
.ant-descriptions-view {
border: 1px solid #f0f0f0;
}
/deep/ .ant-descriptions-item-label {
width: 180px
}
/deep/ .ant-descriptions-item-content span {
color: #000000d9;
}
/deep/ .ant-descriptions-bordered .ant-descriptions-row {
border-bottom: 1px solid #f0f0f0 !important;
}
/deep/ .ant-descriptions-bordered .ant-descriptions-item-label {
border-right: 1px solid #f0f0f0;
}
</style>