agilebuilder-ui 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+
2
+ <template>
3
+ <el-drawer v-model="isShowForm" direction="btt" size="80%" class="organization-tree">
4
+ <template #header>
5
+ <div style="text-align: center;">
6
+ {{$t('departmentTreeInline.selectResultTitle')}}
7
+ </div>
8
+ </template>
9
+ <template #default>
10
+ <el-tree
11
+ ref="orgResultTreeRef"
12
+ :data="selectDepts"
13
+ node-key="nodeId"
14
+ check-on-click-node
15
+ >
16
+ <template #default="{ node, data }">
17
+ <div class="item-row">
18
+ <div class="item-label">{{ data.showName }}</div>
19
+ <div class="item-side" @click="removeDept(data)">
20
+ <el-icon><DeleteFilled /></el-icon>
21
+ </div>
22
+ </div>
23
+ </template>
24
+ </el-tree>
25
+ </template>
26
+ </el-drawer>
27
+ </template>
28
+ <script setup lang="ts">
29
+ import {
30
+ DeleteFilled
31
+ } from '@element-plus/icons-vue'
32
+ import { reactive,ref,onMounted, defineEmits } from 'vue'
33
+ const props = defineProps({
34
+ selectDepts: {
35
+ type: Array<any>,
36
+ default: null
37
+ }
38
+ })
39
+ let isShowForm = ref(false)
40
+ const emits = defineEmits(['removeDept'])
41
+ function removeDept (item) {
42
+ emits('removeDept', item )
43
+ }
44
+
45
+ function showResult() {
46
+ isShowForm.value = true
47
+ }
48
+
49
+ defineExpose({showResult})
50
+
51
+ </script>
@@ -0,0 +1,6 @@
1
+ import DepartmentUserTreeMobile from './src/department-user-tree-app.vue'
2
+ DepartmentUserTreeMobile.install = function (Vue) {
3
+ Vue.component('DepartmentUserTreeMobile', DepartmentUserTreeMobile)
4
+ }
5
+
6
+ export default DepartmentUserTreeMobile
@@ -0,0 +1,119 @@
1
+ <template>
2
+ <el-drawer v-model="isShowForm" direction="btt" size="100%" class="organization-tree">
3
+ <template #header>
4
+ <div style="text-align: center;">
5
+ {{$t('imatrixUIMessage.pleaseSelect')}}
6
+ </div>
7
+ </template>
8
+ <template #default>
9
+ <InlineDepartmentUserTreeApp v-if="isShowForm" :multiple="multiple" :departmentInfo="departmentInfo" :selectUserInfo="selectUserInfo" :searchField="searchField" :separator="separator" @close="closeTree"/>
10
+ </template>
11
+ </el-drawer>
12
+
13
+ </template>
14
+ <script lang="ts">
15
+ export default {
16
+ name: 'DepartmentUserTreeMobile'
17
+ }
18
+ </script>
19
+ <script setup lang="ts">
20
+ import InlineDepartmentUserTreeApp from './department-user-tree-inline-app.vue'
21
+ import { reactive,ref,onMounted, defineEmits } from 'vue'
22
+ const props = defineProps<{
23
+ // 是否是多选树,默认是true
24
+ multiple: {
25
+ type: Boolean,
26
+ default: true,
27
+ },
28
+ // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
29
+ departmentInfo: {
30
+ type: Array<any>,
31
+ default: null,
32
+ },
33
+ // 多选用户树时,已选择用户id或登录名集合,多个之间以逗号隔开
34
+ selectUserInfo: {
35
+ type: [String, Number],
36
+ default: null,
37
+ },
38
+ // 移除用户时,用户属性名称:id、loginName、email、telephone,默认是loginName
39
+ searchField: {
40
+ type: String,
41
+ default: 'loginName',
42
+ },
43
+ // 多选树时结果之间的分隔符,默认是逗号分隔
44
+ separator: {
45
+ type: String,
46
+ default: ','
47
+ }
48
+ }>()
49
+ const emits = defineEmits(['close'])
50
+ let isShowForm = ref(false)
51
+ function showTree() {
52
+ isShowForm.value = true
53
+ }
54
+ function closeTree(selectNodeInfo) {
55
+ emits('close', selectNodeInfo)
56
+ isShowForm.value = false
57
+ }
58
+ function selectDepartment() {
59
+ // this.$refs.inlineDeparmentTree.selectDepartment()
60
+ }
61
+ defineExpose({showTree})
62
+ </script>
63
+ <style>
64
+ .organization-tree, .organization-tree .el-checkbox__label,.organization-tree .el-breadcrumb__inner,.organization-tree .el-tree {
65
+ font-size: 17px;
66
+ font-weight: 700;
67
+ }
68
+
69
+ .organization-tree .el-breadcrumb__item:last-child .el-breadcrumb__inner, .el-breadcrumb__item:last-child .el-breadcrumb__inner a, .el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover, .el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
70
+ font-size: 17px;
71
+ font-weight: 700;
72
+ }
73
+ .organization-tree .el-card__body {
74
+ padding-top: 10px;
75
+ }
76
+ .organization-tree .card-content {
77
+ margin-top: 10px;
78
+ }
79
+ .organization-tree .item-row-all {
80
+ margin-bottom: 10px;
81
+ }
82
+ .organization-tree .item-row {
83
+ display: flex;
84
+ width: 100%;
85
+ }
86
+ .organization-tree .item-label {
87
+ flex: 0 0 90%;
88
+ text-align: left;
89
+ }
90
+ .organization-tree .item-side {
91
+ flex: 0 0 10%;
92
+ text-align: right;
93
+ }
94
+ .organization-tree .el-tree-node {
95
+ margin-bottom: 10px;
96
+ }
97
+
98
+ .organization-tree .el-tree-node__content>.el-tree-node__expand-icon {
99
+ padding: 0;
100
+ display: none;
101
+ }
102
+
103
+ .organization-tree .card-footer {
104
+ padding: 20px;
105
+ }
106
+ .organization-tree .card-footer .select-result {
107
+ color: #409EFF;
108
+ flex:1 1 75%;
109
+ text-align: left;
110
+ }
111
+ .organization-tree .card-footer .button-area {
112
+ flex:0 0 20%;
113
+ text-align: right;
114
+ }
115
+
116
+ .organization-tree .dept-path .breadcrumb-label-link{
117
+ color:#409EFF
118
+ }
119
+ </style>
@@ -0,0 +1,397 @@
1
+ <template>
2
+ <div>
3
+ <el-card class="card-content" style="height: 50px">
4
+ <el-row class="item-row item-row-all">
5
+ <el-col style="width: 100%;">
6
+ <div style="display: flex">
7
+ <div style="flex: 0 0 20%;text-align:left">
8
+ <el-checkbox v-if="multiple" v-model="checkAll" :label="$t('departmentTreeInline.allCheck')" value="all" @change="changeAllCheck" />
9
+ </div>
10
+ <div style="flex: 0 0 80%;text-align:right">
11
+ <el-input v-model="searchParam.searchValue" :placeholder="$t('departmentUserTree.pleaseEnterUserInformation')" @clear="filterAppendNodes" @keyup.enter="filterAppendNodes" @blur="filterAppendNodes" clearable>
12
+ <template v-slot:suffix>
13
+ <el-icon @click="filterAppendNodes"><Search /></el-icon>
14
+ </template>
15
+ </el-input>
16
+ </div>
17
+ </div>
18
+ </el-col>
19
+ </el-row>
20
+ </el-card>
21
+ <el-card v-if="tenantName" class="card-content" style="height: 40px">
22
+ <el-row class="item-row item-row-all">
23
+ <el-col class="item-label dept-path"><deptPath :tenantName="tenantName" :clickDepts="clickDepts" @clickBreadcrumb="clickBreadcrumb"/></el-col>
24
+ </el-row>
25
+ </el-card>
26
+ <el-card class="card-content org-tree" style="overflow: auto;">
27
+ <el-tree
28
+ ref="orgTreeRef"
29
+ :data="departments"
30
+ :show-checkbox="multiple"
31
+ node-key="nodeId"
32
+ :props="defaultProps"
33
+ :default-checked-keys="defaultCheckedKeys"
34
+ @check-change="handleCheckNode"
35
+ @node-click="handleClickNode"
36
+ >
37
+ <template #default="{ node, data }">
38
+ <div class="item-row">
39
+ <div v-if="data.nodeType && data.nodeType === 'USER'" class="item-label">{{ data.showName }}
40
+ <span style="color:#999">({{ data.loginName }}{{ getUserMainDeptName(data) ? '/'+getUserMainDeptName(data): ''}})</span>
41
+ </div>
42
+ <div v-else class="item-label">{{ data.showName }}<span v-if="data.parentNodeId !== '-1' && getDeptNamePath(data)" style="color:#999">({{ getDeptNamePath(data) }})</span></div>
43
+ <div v-if="!data.nodeType || data.nodeType !== 'USER'" class="item-side" @click="loadChildren(data,false)">
44
+ <el-icon><ArrowRight /></el-icon>
45
+ </div>
46
+ </div>
47
+ </template>
48
+ </el-tree>
49
+ </el-card>
50
+ <el-card class="card-footer" style="height: 40px">
51
+ <div style="display: flex;">
52
+ <div class="select-result" >
53
+ <!-- 已选择:{useNum}个用户,{deptNum}个部门(含子部门) -->
54
+ <!-- {{$t('departmentUserTree.selectResultInfo',{userNum: selectUsers.length, deptNum: selectDepts.length})}} -->
55
+ <span v-if="multiple" @click="showResult">
56
+ <span v-if="selectUsers.length > 0 && selectDepts.length > 0">{{$t('departmentTreeInline.selectResultInfoHasSelect')}}{{$t('departmentUserTree.selectUserResultInfo',{userNum: selectUsers.length })}}, {{$t('departmentUserTree.selectDeptResultInfo',{deptNum: selectDepts.length })}}</span>
57
+ <span v-else-if="selectUsers.length > 0">{{$t('departmentTreeInline.selectResultInfoHasSelect')}}{{$t('departmentUserTree.selectUserResultInfo',{userNum: selectUsers.length })}}</span>
58
+ <span v-else-if="selectDepts.length > 0">{{$t('departmentTreeInline.selectResultInfoHasSelect')}}{{$t('departmentUserTree.selectDeptResultInfo',{deptNum: selectDepts.length })}}</span>
59
+ <span v-if="selectUsers.length > 0 || selectDepts.length > 0" style="padding-left: 10px"><el-icon><ArrowUpBold /></el-icon></span>
60
+ </span>
61
+ <span v-else-if="selectUsers.length > 0">
62
+ {{$t('departmentTreeInline.selectResultInfoHasSelect')}}{{selectUsers[0].showName }}<span style="color:#999">({{ selectUsers[0].loginName }}{{ getUserMainDeptName(selectUsers[0]) ? '/'+getUserMainDeptName(selectUsers[0]): ''}})</span>
63
+ </span>
64
+
65
+ </div>
66
+ <div class="button-area">
67
+ <el-button size="large" type="primary" @click="saveDept">{{$t('imatrixUIPublicModel.sure')}}</el-button>
68
+ </div>
69
+ </div>
70
+ </el-card>
71
+ <deptResult ref="deptResultRef" :selectUsers="selectUsers.concat(selectDepts)" @removeResult="removeResultDept"/>
72
+ </div>
73
+ </template>
74
+
75
+ <script setup lang="ts">
76
+ import { reactive,ref,onMounted, defineEmits,Ref } from 'vue'
77
+ import {
78
+ ArrowRight,
79
+ Search,
80
+ ArrowUpBold
81
+ } from '@element-plus/icons-vue'
82
+ import {getTenant, getTenantChildren, checkedDeptDefault, loadDepartment, getUserInDepartments} from './department-user-tree-service.ts'
83
+ import {resizeScrollTargetHeightUtil, getUserMainDeptName, getDeptNamePath,initSelectUsers, addSelectedUserInfo, packageSelectResult} from '../../utils/organization.ts'
84
+ import deptPath from './dept-path.vue'
85
+ import deptResult from './dept-result.vue'
86
+ import {ElMessage} from 'element-plus'
87
+ import {useI18n} from "vue-i18n"
88
+ const props = defineProps<{
89
+ // 是否是多选树,默认是true
90
+ multiple: {
91
+ type: Boolean,
92
+ default: true,
93
+ },
94
+ // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
95
+ departmentInfo: {
96
+ type: Array<any>,
97
+ default: null,
98
+ },
99
+ // 多选用户树时,已选择用户id或登录名集合,多个之间以逗号隔开
100
+ selectUserInfo: {
101
+ type: [String, Number],
102
+ default: null,
103
+ },
104
+ // 移除用户时,用户属性名称:id、loginName、email、telephone,默认是loginName
105
+ searchField: {
106
+ type: String,
107
+ default: 'loginName',
108
+ },
109
+ // 多选树时结果之间的分隔符,默认是逗号分隔
110
+ separator: {
111
+ type: String,
112
+ default: ','
113
+ }
114
+ }>()
115
+ const emits = defineEmits(["close"])
116
+ const orgTreeRef = ref(null)
117
+ let tenantInfo = ref(null)
118
+ let containBranch = ref(false)
119
+ let tenantName = ref(null)
120
+ let tenantNodeId = "-1"
121
+ let departments = ref([])
122
+ let checkedKeys = ref([])
123
+ let selectUsers = ref([])
124
+ let selectDepts = ref([])
125
+ let selectDeptNodeIds = ref([])
126
+ let clickDepts = ref([])
127
+ let defaultCheckedKeys = ref([])
128
+ let deptResultRef:Ref<any> = ref(null)
129
+ let checkAll = ref(false)
130
+ let searchParam = ref({
131
+ userField: 'name',
132
+ searchValue: null,
133
+ treeType: 'MAN_DEPARTMENT_TREE',
134
+ departmentInfo: null
135
+ })
136
+ let defaultProps = ref({
137
+ disabled: 'disable'
138
+
139
+ })
140
+ let loading = ref(false)
141
+ const {t} = useI18n()
142
+ onMounted(()=>{
143
+ initSelectUsers(props.searchField, props.selectUserInfo, props.separator ).then((departments)=>{
144
+ selectUsers.value = departments
145
+ getTenantInfo()
146
+ })
147
+ resizeScrollTargetHeight()
148
+ })
149
+ function getTenantInfo() {
150
+ getTenant().then(data=>{
151
+ const tenantData = data[0].data
152
+ tenantInfo.value = JSON.parse(tenantData)
153
+ containBranch.value = data[0].containBranch
154
+ tenantName.value = data[0].name
155
+ getTenantChildrenDept()
156
+ })
157
+ }
158
+
159
+ function getTenantChildrenDept() {
160
+ getTenantChildren(props.departmentInfo, tenantNodeId).then(children=>{
161
+ departments.value = children
162
+ checkedDeptDefault(selectUsers.value, defaultCheckedKeys.value)
163
+ })
164
+ }
165
+
166
+ function resizeScrollTargetHeight () {
167
+ const scrollTarget = document.querySelector('.org-tree')
168
+ let height = resizeScrollTargetHeightUtil(scrollTarget)
169
+ const titleArea = 110
170
+ const deptPathArea = 60
171
+ const allCheckArea = 60
172
+ const buttonArea = 60
173
+ height = height - titleArea - deptPathArea - allCheckArea - buttonArea
174
+ scrollTarget['style'].height = height + 'px'
175
+ scrollTarget['style'].minHeight = '300px'
176
+ // scrollTarget.style.maxHeight = height + 'px'
177
+ }
178
+ // 点击复选框时处理
179
+ function handleCheckNode(data, check, isChildrenCheck) {
180
+ debugger
181
+ if(check) {
182
+ // 表示选择节点时
183
+ if(props.multiple) {
184
+ // 表示是复选组织树
185
+ addToSelectDept(data)
186
+ }
187
+ } else {
188
+ // 表示取消选择
189
+ if(props.multiple || (data.nodeType && data.nodeType === 'USER')) {
190
+ removeSelectDept(data)
191
+ }
192
+ }
193
+ }
194
+
195
+ function handleClickNode(data, node, treenode, events) {
196
+ if(data.nodeType && data.nodeType === 'USER') {
197
+ selectUsers.value = [data]
198
+ }
199
+ }
200
+ function addToSelectDept(dept) {
201
+ if(dept.nodeType && dept.nodeType === 'USER') {
202
+ // 表示是用户
203
+ const filterValue = selectUsers.value.filter(item=> item.nodeId === dept.nodeId)
204
+ if(!filterValue || filterValue.length === 0) {
205
+ // 表示集合中没有该记录,需要记录到结果集合中
206
+ selectUsers.value.push(JSON.parse(JSON.stringify(dept)))
207
+ }
208
+ } else {
209
+ // 表示是部门
210
+ const filterValue = selectDepts.value.filter(item=> item.nodeId === dept.nodeId)
211
+ if(!filterValue || filterValue.length === 0) {
212
+ // 表示集合中没有该记录,需要记录到结果集合中
213
+ selectDepts.value.push(JSON.parse(JSON.stringify(dept)))
214
+ }
215
+ }
216
+ }
217
+
218
+ function removeSelectDept(dept) {
219
+ debugger
220
+ if(dept.nodeType && dept.nodeType === 'USER') {
221
+ const index = selectUsers.value.findIndex(selectItem=> selectItem.nodeId === dept.nodeId)
222
+ // 删除指定元素
223
+ selectUsers.value.splice(index, 1)
224
+ } else {
225
+ const index = selectDepts.value.findIndex(selectItem=> selectItem.nodeId === dept.nodeId)
226
+ // 删除指定元素
227
+ selectDepts.value.splice(index, 1)
228
+ }
229
+
230
+ checkAll.value =false
231
+ }
232
+ function changeAllCheck(value: boolean) {
233
+ console.log('changeCheck====value=', value)
234
+ if(props.multiple) {
235
+ // 表示是复选组织树
236
+ if(value){
237
+ // 表示全选时
238
+ const allNodeIds = departments.value.map((item)=>{
239
+ return item['nodeId'];
240
+ })
241
+ orgTreeRef.value.setCheckedKeys(allNodeIds, false)
242
+ departments.value.forEach(item=>{
243
+ addToSelectDept(item)
244
+ })
245
+ } else {
246
+ // 表示取消全选时
247
+ departments.value.forEach(item=>{
248
+ removeSelectDept(item)
249
+ })
250
+ orgTreeRef.value.setCheckedKeys([], false)
251
+ }
252
+ }
253
+ }
254
+
255
+ function loadChildrenDept(dept) {
256
+ loadDepartment(dept.id, dept.branchId).then(children=>{
257
+ departments.value = children
258
+ checkedDeptDefault(selectUsers.value, defaultCheckedKeys.value)
259
+ })
260
+ }
261
+ function loadChildren (dept, isBreadcrumb) {
262
+ clickDepts.value.push(dept)
263
+ loadChildrenDept(dept)
264
+ }
265
+
266
+ function clickBreadcrumb(item, isTenant, index) {
267
+ if(isTenant) {
268
+ // 表示点击的时公司节点
269
+ clickDepts.value = []
270
+ getTenantChildrenDept()
271
+ } else {
272
+ // 表示点击的是部门节点
273
+ // 删除指定元素
274
+ clickDepts.value.splice(index+1, clickDepts.value.length - (index + 1) )
275
+ loadChildrenDept(item)
276
+ }
277
+ }
278
+
279
+ function showResult() {
280
+ deptResultRef.value.showResult()
281
+ }
282
+
283
+ function removeResultDept(dept) {
284
+ const removeDeptInDepts = departments.value.filter(item=>item.nodeId === dept.nodeId)
285
+ if(removeDeptInDepts && removeDeptInDepts.length > 0) {
286
+ // departments结果存在当前移除的节点时,check-change事件会走removeSelectDept的逻辑
287
+ const selectNodeIds = []
288
+ selectUsers.value.forEach(item=>{
289
+ if(item.nodeId !== dept.nodeId) {
290
+ selectNodeIds.push(item.nodeId)
291
+ }
292
+ })
293
+ selectDepts.value.forEach(item=>{
294
+ if(item.nodeId !== dept.nodeId) {
295
+ selectNodeIds.push(item.nodeId)
296
+ }
297
+ })
298
+ orgTreeRef.value.setCheckedKeys(selectNodeIds, true)
299
+ } else {
300
+ // departments结果不存在当前移除的节点时
301
+ removeSelectDept(dept)
302
+ }
303
+ }
304
+
305
+ function saveDept () {
306
+ if (selectDepts.value.length === 0 && selectUsers.value.length === 0 ) {
307
+ ElMessage({
308
+ message: t('imatrixUIMessage.pleaseSelectPersonnel'),
309
+ type: 'warning',
310
+ })
311
+ return
312
+ }
313
+ if (props.multiple) {
314
+ const selectNodeInfo = {
315
+ userIds: [],
316
+ userNames: [],
317
+ loginNames: [],
318
+ userZhNames: [],
319
+ userEnNames: [],
320
+ emails: [],
321
+ telephones: [],
322
+ users: []
323
+ }
324
+ const departmentIds = []
325
+ selectDepts.value.forEach(node => {
326
+ // 部门集合,最后确定时会使用该集合去后台获得用户集合
327
+ departmentIds.push(node.id)
328
+ })
329
+ selectUsers.value.forEach(node => {
330
+ // 用户集合
331
+ // node.data是部门对象的json字符串信息,通过JSON.parse(node.data)将json字符串转为对象
332
+ const userData = JSON.parse(node.data)
333
+ addSelectedUserInfo(selectNodeInfo, userData, containBranch.value)
334
+ })
335
+ loading.value = true
336
+ if (departmentIds.length > 0) {
337
+ getUserInDepartments(departmentIds).then(users => {
338
+ if (users) {
339
+ users.forEach(user => {
340
+ addSelectedUserInfo(selectNodeInfo, user, containBranch.value)
341
+ })
342
+ }
343
+ loading.value = false
344
+ if (selectNodeInfo.userIds.length > 0) {
345
+ emits('close', selectNodeInfo)
346
+ } else {
347
+ ElMessage({
348
+ message: t('imatrixUIMessage.pleaseSelectPersonnel'),
349
+ type: 'warning',
350
+ })
351
+ }
352
+ }).catch(() => {
353
+ loading.value = false
354
+ })
355
+ } else {
356
+ loading.value = false
357
+ if (selectNodeInfo.userIds.length > 0) {
358
+ emits('close', selectNodeInfo)
359
+ } else {
360
+ ElMessage({
361
+ message: t('imatrixUIMessage.pleaseSelectPersonnel'),
362
+ type: 'warning',
363
+ })
364
+ }
365
+ }
366
+ } else {
367
+ const user = JSON.parse(selectUsers.value[0].data)
368
+ const selectNodeInfo = packageSelectResult(user, containBranch.value)
369
+ emits('close', selectNodeInfo)
370
+ }
371
+ }
372
+
373
+ function filterAppendNodes ( ) {
374
+ if (searchParam.value.searchValue) {
375
+ searchParam.value.searchValue = searchParam.value.searchValue.trim()
376
+ searchParam.value.departmentInfo = props.departmentInfo
377
+ window['$vueApp'].config.globalProperties.$http.post(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/search-users-mobile', searchParam.value).then(result => {
378
+ if (result) {
379
+ if (result.length === 0) {
380
+ ElMessage({
381
+ message: t('imatrixUIMessage.queryResultIsEmpty'),
382
+ type: 'warning',
383
+ })
384
+ }
385
+ departments.value = result
386
+ } else {
387
+ ElMessage({
388
+ message: t('imatrixUIMessage.queryResultIsEmpty'),
389
+ type: 'warning',
390
+ })
391
+ }
392
+ })
393
+ } else {
394
+ getTenantChildrenDept()
395
+ }
396
+ }
397
+ </script>
@@ -0,0 +1,75 @@
1
+ export function getTenant () {
2
+ const parentId = 0
3
+ return window['$vueApp'].config.globalProperties.$http.get(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/departments/' + parentId)
4
+ }
5
+
6
+ // 获得公司节点的孩子节点
7
+ export function getTenantChildren (departmentInfo, tenantNodeId) {
8
+ if (departmentInfo && departmentInfo.length > 0) {
9
+ // 加载指定部门时,展开公司节点
10
+ return loadPointDepartments(departmentInfo)
11
+ } else {
12
+ // 加载整个组织结构树时,展开公司节点
13
+ return loadDepartment(tenantNodeId, null)
14
+ }
15
+
16
+ }
17
+
18
+
19
+ // 加载指定部门节点
20
+ export function loadPointDepartments (departmentInfo) {
21
+ return new Promise((resolve,reject)=>{
22
+ window['$vueApp'].config.globalProperties.$http.post(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/point-department-users', departmentInfo).then(children => {
23
+ resolve(children)
24
+ })
25
+ })
26
+ }
27
+
28
+
29
+ // 加载当前节点的子节点
30
+ export function loadDepartment (parentId, branchId) {
31
+ let param = {
32
+ parentId: parentId,
33
+ needVirtualUser: false,
34
+ branchId: null
35
+ }
36
+ if (branchId) {
37
+ param.branchId = branchId
38
+ }
39
+ return new Promise((resolve,reject)=>{
40
+ window['$vueApp'].config.globalProperties.$http.post(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/department-users', param)
41
+ .then(children => {
42
+ resolve(children)
43
+ })
44
+ })
45
+ }
46
+ export function checkedDeptDefault (selectDepts, defaultCheckedKeys) {
47
+ defaultCheckedKeys = []
48
+ selectDepts.forEach(dept => {
49
+ defaultCheckedKeys.push(dept.nodeId)
50
+ })
51
+ }
52
+ // 获得所有指定父部门的子部门信息
53
+ export function getChildDepts (parentDept) {
54
+ return new Promise((resolve, reject) => {
55
+ const parentIds = [parentDept.id]
56
+ window['$vueApp'].config.globalProperties.$http.post(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/department-children', parentIds).then(departments => {
57
+ resolve(departments)
58
+ }).catch(error => {
59
+ reject(error)
60
+ })
61
+ })
62
+ }
63
+ // ,
64
+ // isDeptOrUser (item, dept) {
65
+ // return item.id === dept.id && item.nodeType && dept.nodeType && item.nodeType === dept.nodeType
66
+ // },
67
+ export function getUserInDepartments (departmentIds) {
68
+ return window['$vueApp'].config.globalProperties.$http.post(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/user-only-in-departments', departmentIds)
69
+ }
70
+ // getTenantNoDeptUsers () {
71
+ // return this.$http.get(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/tenant-no-dept-users')
72
+ // },
73
+ // getBranchNoDeptUsers (branchId) {
74
+ // return this.$http.get(window['$vueApp'].config.globalProperties.baseAPI + '/component/organization-trees/branch-no-dept-users/' + branchId)
75
+ // }
@@ -0,0 +1,36 @@
1
+
2
+ <template>
3
+ <el-breadcrumb separator="/">
4
+ <el-breadcrumb-item>
5
+ <span class="breadcrumb-label-link" v-if="clickDepts.length > 0" @click="clickBreadcrumb(null, true)">{{myTenantName}}</span>
6
+ <span v-else>{{myTenantName}}</span>
7
+ </el-breadcrumb-item>
8
+ <el-breadcrumb-item
9
+ v-for="(dept,index) in clickDepts"
10
+ :key="dept.id"
11
+ >
12
+ <span class="breadcrumb-label-link" v-if="index < clickDepts.length - 1" @click="clickBreadcrumb(dept,false, index )" >{{dept.showName}}</span>
13
+ <span v-else>{{dept.showName}}</span>
14
+ </el-breadcrumb-item>
15
+ </el-breadcrumb>
16
+ </template>
17
+ <script setup lang="ts">
18
+ import { reactive,ref,onMounted, defineEmits } from 'vue'
19
+ const props = defineProps({
20
+ tenantName:{
21
+ type: String,
22
+ default: null
23
+ },
24
+ clickDepts: {
25
+ type: Array<any>,
26
+ default: null
27
+ }
28
+ })
29
+ const emits = defineEmits(['clickBreadcrumb'])
30
+
31
+ let myTenantName = ref(props.tenantName)
32
+
33
+ function clickBreadcrumb (item, isTenant, index) {
34
+ emits('clickBreadcrumb', item, isTenant, index )
35
+ }
36
+ </script>