agilebuilder-ui 1.1.36 → 1.1.37-sit1

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.
Files changed (64) hide show
  1. package/lib/{401-b8934d65.js → 401-ce7358c2.js} +1 -1
  2. package/lib/{404-743a4631.js → 404-8a0c9304.js} +1 -1
  3. package/lib/{iframe-page-5e102433.js → iframe-page-53f52856.js} +1 -1
  4. package/lib/{index-a0c08bb5.js → index-2e61e67f.js} +10747 -10648
  5. package/lib/super-ui.css +1 -1
  6. package/lib/super-ui.js +1 -1
  7. package/lib/super-ui.umd.cjs +98 -98
  8. package/lib/{tab-content-iframe-index-e9b465bf.js → tab-content-iframe-index-e0a67343.js} +1 -1
  9. package/lib/{tab-content-index-313404d0.js → tab-content-index-fd4f9ad4.js} +1 -1
  10. package/lib/{tache-subprocess-history-7d87cd77.js → tache-subprocess-history-7381fba2.js} +1 -1
  11. package/package.json +1 -1
  12. package/packages/department-tree/src/department-tree.vue +130 -123
  13. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +435 -466
  14. package/packages/department-tree-inline/src/department-single-tree-inline.vue +335 -342
  15. package/packages/department-tree-inline/src/department-tree-inline.vue +18 -11
  16. package/packages/department-tree-inline/src/department-tree-service.js +10 -11
  17. package/packages/department-tree-mobile/src/department-tree-app.vue +103 -75
  18. package/packages/department-tree-mobile/src/department-tree-inline-app.vue +256 -225
  19. package/packages/department-tree-mobile/src/department-tree-service.ts +98 -75
  20. package/packages/department-user-tree/src/department-user-multiple-tree.vue +112 -115
  21. package/packages/department-user-tree/src/department-user-single-tree.vue +85 -88
  22. package/packages/department-user-tree/src/department-user-tree.vue +127 -119
  23. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +6 -1
  24. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +5 -0
  25. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +18 -11
  26. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +26 -51
  27. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +25 -45
  28. package/packages/department-user-tree-inline/src/group-user/group-list.vue +97 -90
  29. package/packages/department-user-tree-inline/src/group-user/group-user.vue +28 -32
  30. package/packages/department-user-tree-mobile/src/department-user-tree-app.vue +103 -75
  31. package/packages/department-user-tree-mobile/src/department-user-tree-inline-app.vue +282 -224
  32. package/packages/department-user-tree-mobile/src/department-user-tree-service.ts +58 -51
  33. package/packages/fs-preview/src/fs-preview.vue +20 -2
  34. package/packages/fs-upload-list/src/fs-upload-list.vue +30 -7
  35. package/packages/fs-upload-new/src/file-upload-mobile/file-upload-browser.vue +1 -1
  36. package/packages/fs-upload-new/src/fs-preview-new.vue +27 -15
  37. package/packages/organization-input/src/organization-input.vue +34 -12
  38. package/packages/super-grid/src/apis.js +25 -4
  39. package/packages/super-grid/src/dynamic-input.vue +85 -15
  40. package/packages/super-grid/src/normal-column-content.vue +2 -1
  41. package/packages/super-grid/src/row-operation.vue +23 -13
  42. package/packages/super-grid/src/super-grid.vue +51 -42
  43. package/packages/super-grid/src/utils.js +28 -9
  44. package/packages/super-icon/src/index.vue +4 -1
  45. package/packages/workgroup-tree/src/workgroup-tree.vue +117 -110
  46. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +6 -1
  47. package/packages/workgroup-tree-mobile/src/workgroup-tree-app.vue +103 -75
  48. package/packages/workgroup-tree-mobile/src/workgroup-tree-inline-app.vue +229 -208
  49. package/src/api/sso-service.js +6 -5
  50. package/src/store/modules/table.js +0 -1
  51. package/src/styles/theme/dark-blue/sidebar.scss +9 -0
  52. package/src/styles/theme/gray/sidebar.scss +9 -8
  53. package/src/styles/theme/green/sidebar.scss +10 -0
  54. package/src/styles/theme/ocean-blue/sidebar.scss +9 -0
  55. package/src/styles/theme/tiffany-blue-mobile/sidebar.scss +9 -0
  56. package/src/utils/common-util.js +2 -1
  57. package/src/utils/insert_css.js +1 -1
  58. package/src/utils/util.js +19 -0
  59. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -2
  60. package/src/views/dsc-component/Sidebar/index.vue +36 -18
  61. package/src/views/layout/components/Menubar/Item.vue +0 -9
  62. package/src/views/layout/components/Menubar/SidebarItem.vue +2 -2
  63. package/src/views/layout/components/Sidebar/Item.vue +4 -1
  64. package/src/views/layout/components/Sidebar/SidebarItem.vue +2 -2
@@ -1,112 +1,96 @@
1
1
  <template>
2
- <div>
3
- <el-container style="height: 395px">
4
- <el-aside width="350px">
5
- <el-container style="height: 390px">
6
- <el-header style="text-align: right; font-size: 12px; height: 35px">
7
- <el-autocomplete
8
- v-model="filterText"
9
- :fetch-suggestions="querySearch"
10
- :placeholder="
11
- $t('departmentTreeInline.pleaseEnterDepartmentName')
12
- "
13
- class="inline-input inline-input-custom"
14
- size="default"
15
- @select="handleSelect"
16
- @keyup.enter="clickSearch"
17
- >
18
- <template v-slot:append>
19
- <el-button
20
- :icon="ElIconSearch"
21
- size="default"
22
- @click="clickSearch"
23
- />
24
- </template>
25
- </el-autocomplete>
26
- </el-header>
27
- <el-main style="padding: 10px">
28
- <div
29
- v-if="!searchValue"
30
- style="
31
- padding-top: 5px;
32
- overflow: auto;
33
- width: 100%;
34
- display: inline-block !important;
35
- "
36
- >
37
- <el-tree
38
- ref="deparmentTree"
39
- :filter-node-method="filterNode"
40
- :load="loadNode"
41
- :props="defaultProps"
42
- :show-checkbox="true"
43
- check-strictly
44
- lazy
45
- node-key="id"
46
- @check="handleCheckNode"
47
- @check-change="handleCheckChange"
48
- @node-expand="handleNodeExpand"
49
- @node-click="handleNodeClick"
50
- >
51
- <template #default="{ node, data }">
52
- <span>
53
- <el-icon>
54
- <Menu v-if="node.data.id === -1 || node.data.branch"/>
55
- <Tickets v-else-if="node.data.id === -2 || node.data.id === -3"/>
56
- <Calendar v-else/>
57
- </el-icon>
58
- <span :title="node.label">
59
- {{ node.label }}
60
- </span>
61
- </span>
62
- </template>
63
- </el-tree>
64
- </div>
2
+ <div>
3
+ <el-container style="height: 395px">
4
+ <el-aside width="350px">
5
+ <el-container style="height: 390px">
6
+ <el-header style="text-align: right; font-size: 12px; height: 35px">
7
+ <el-autocomplete
8
+ v-model="filterText"
9
+ :fetch-suggestions="querySearch"
10
+ :placeholder="$t('departmentTreeInline.pleaseEnterDepartmentName')"
11
+ class="inline-input inline-input-custom"
12
+ size="default"
13
+ @select="handleSelect"
14
+ @keyup.enter="clickSearch"
15
+ >
16
+ <template v-slot:append>
17
+ <el-button :icon="ElIconSearch" size="default" @click="clickSearch" />
18
+ </template>
19
+ </el-autocomplete>
20
+ </el-header>
21
+ <el-main style="padding: 10px">
22
+ <div
23
+ v-if="!searchValue"
24
+ style="padding-top: 5px; overflow: auto; width: 100%; display: inline-block !important"
25
+ >
26
+ <el-tree
27
+ ref="deparmentTree"
28
+ :filter-node-method="filterNode"
29
+ :load="loadNode"
30
+ :props="defaultProps"
31
+ :show-checkbox="true"
32
+ check-strictly
33
+ lazy
34
+ node-key="id"
35
+ @check="handleCheckNode"
36
+ @check-change="handleCheckChange"
37
+ @node-expand="handleNodeExpand"
38
+ @node-click="handleNodeClick"
39
+ >
40
+ <template #default="{ node, data }">
41
+ <span>
42
+ <el-icon>
43
+ <Menu v-if="node.data.id === -1 || node.data.branch" />
44
+ <Tickets v-else-if="node.data.id === -2 || node.data.id === -3" />
45
+ <Calendar v-else />
46
+ </el-icon>
47
+ <span :title="node.label">
48
+ {{ node.label }}
49
+ </span>
50
+ </span>
51
+ </template>
52
+ </el-tree>
53
+ </div>
65
54
 
66
- <div
67
- v-if="searchValue && searchValue.length > 0"
68
- style="height: 100%; overflow: hidden"
69
- >
70
- <user-result
71
- :grid-data="searchResult"
72
- :height="height"
73
- :is-search-result="true"
74
- :multiple="true"
75
- :select-result="selectResult"
76
- @addUser="selectUser"
77
- />
78
- </div>
79
- </el-main>
80
- </el-container>
81
- </el-aside>
55
+ <div v-if="searchValue && searchValue.length > 0" style="height: 100%; overflow: hidden">
56
+ <user-result
57
+ :grid-data="searchResult"
58
+ :height="height"
59
+ :is-search-result="true"
60
+ :multiple="true"
61
+ :select-result="selectResult"
62
+ @addUser="selectUser"
63
+ />
64
+ </div>
65
+ </el-main>
66
+ </el-container>
67
+ </el-aside>
82
68
 
83
- <el-container>
84
- <!-- <el-aside width="2px">
69
+ <el-container>
70
+ <!-- <el-aside width="2px">
85
71
  <table border="1px" cellpadding="0" cellspacing="0" style="height:100%;border-left-style:solid; border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-color: #cccccc" />
86
72
  </el-aside> -->
87
- <el-main style="padding: 10px">
88
- <div style="text-align: left; font-size: 16px">
89
- {{ $t('departmentTreeInline.selectedDept') }}:
90
- </div>
91
- <div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
92
- <user-result
93
- v-loading="isloading"
94
- :grid-data="selectResult"
95
- :height="height"
96
- :is-search-result="false"
97
- :multiple="true"
98
- @removeUser="removeUser"
99
- />
100
- </div>
101
- </el-main>
102
- </el-container>
103
- </el-container>
104
- </div>
73
+ <el-main style="padding: 10px">
74
+ <div style="text-align: left; font-size: 16px">{{ $t('departmentTreeInline.selectedDept') }}:</div>
75
+ <div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
76
+ <user-result
77
+ v-loading="isloading"
78
+ :grid-data="selectResult"
79
+ :height="height"
80
+ :is-search-result="false"
81
+ :multiple="true"
82
+ @removeUser="removeUser"
83
+ />
84
+ </div>
85
+ </el-main>
86
+ </el-container>
87
+ </el-container>
88
+ </div>
105
89
  </template>
106
90
 
107
91
  <script>
108
- import {Search as ElIconSearch} from '@element-plus/icons-vue'
109
- import {$emit} from '../../utils/gogocodeTransfer'
92
+ import { Search as ElIconSearch } from '@element-plus/icons-vue'
93
+ import { $emit } from '../../utils/gogocodeTransfer'
110
94
  import localStorage from '../../../src/utils/local-storage'
111
95
  import utils from '../../utils/utils'
112
96
  import departmentTreeService from './department-tree-service'
@@ -114,381 +98,366 @@ import UserResult from './search-result.vue'
114
98
  import memoryCacheUtils from '../../utils/memory-cache-utils'
115
99
 
116
100
  export default {
117
- data() {
118
- return {
119
- filterText: '',
120
- defaultProps: {
121
- id: 'id',
122
- label: 'showName',
123
- children: 'childDepartments',
124
- isLeaf: 'leaf',
125
- },
126
- searchParam: {
127
- searchValue: null,
128
- treeType: 'DEPARTMENT_TREE',
129
- departmentInfo: null,
130
- },
131
- count: 0,
132
- // 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给用户,例如:部门1(分支1)
133
- containBranch: false,
134
- // 公司节点的id
135
- tenantNodeId: -1,
136
- // 用于保存所有查询出的节点id
137
- allSearchNodeIds: [],
138
- // 用于保存allSearchNodeIds中所有已加载子节点的id集合
139
- allExpandNodeIds: [],
140
- isClickNode: false,
141
- // 查询的备选值
142
- restaurants: [],
143
- // 查询条件
144
- searchValue: null,
145
- searchStoreKey: 'searchDepartment',
146
- // 单选时,选择的部门信息
147
- selectNodeInfo: null,
148
- // 公司根节点信息
149
- tenantInfo: {},
150
- searchResult: [],
151
- selectResult: [],
152
- // 控制右侧选择区的loading状态
153
- isloading: false,
154
- multiple: true,
155
- memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
156
- // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
157
- memoryCacheData: [],
158
- ElIconSearch,
159
- }
160
- },
161
- name: 'InlineDepartmentMultiTree',
162
- components: {
163
- UserResult,
164
- },
165
- props: {
166
- checkStrictly: {
167
- type: Boolean,
168
- default: false,
169
- },
170
- // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
171
- departmentInfo: {
172
- type: Array,
173
- default: null,
174
- },
175
- // 弹框的高度
176
- height: {
177
- type: String,
178
- default: '300px',
179
- },
180
- // 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
181
- selectDepartmentInfo: {
182
- type: [String, Number],
183
- default: null,
184
- },
185
- // 移除部门时,部门属性名称:id、name、code,默认是id
186
- searchField: {
187
- type: String,
188
- default: 'id',
189
- },
190
- // 多选树时结果之间的分隔符,默认是逗号分隔
191
- separator: {
192
- type: String,
193
- default: ',',
194
- },
195
- },
196
- computed: {},
197
- watch: {
198
- filterText(val) {
199
- if (!val) {
200
- this.searchValue = val
201
- // 清空查询内容时,重新加载整个树
202
- if (this.departmentInfo && this.departmentInfo.length > 0) {
203
- // 加载指定部门时,展开公司节点
204
- this.loadPointDepartments()
205
- } else {
206
- // 加载整个组织结构树时,展开公司节点
207
- this.loadDepartment(this.tenantNodeId)
208
- }
209
- }
210
- },
211
- },
212
- created() {
213
- this.initSelectDepts(
214
- this.searchField,
215
- this.selectDepartmentInfo,
216
- this.separator
217
- ).then((selectUsers) => {
218
- if (selectUsers) {
219
- this.selectResult = selectUsers
220
- }
221
- })
222
- },
223
- mounted() {
224
- var searchDepartment = localStorage.getObject(this.searchStoreKey)
225
- if (searchDepartment) {
226
- this.restaurants = searchDepartment
227
- } else {
228
- this.restaurants = []
229
- }
230
- this.getMemoryCacheData('department')
231
- },
232
- methods: {
233
- ...utils,
234
- ...departmentTreeService,
235
- ...memoryCacheUtils,
236
- filterNode(value, data, node) {
237
- if (!value) {
238
- return true
239
- } else {
240
- return data.name.indexOf(value) !== -1
241
- }
242
- },
243
- // 选中当前节点及其子节点
244
- checkedNodeAndChildren(data) {
245
- // 取消选中状态时,保持节点是展开的状态,不要折叠
246
- // this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
247
- let department = data
248
- if (data.data) {
249
- department = JSON.parse(data.data)
250
- }
251
- this.selectUser(null, department)
252
- // 获得所有应该选中的节点
253
- this.$refs.deparmentTree.setChecked(data.id, true)
254
- const childDepartments = data.childDepartments
255
- if (childDepartments && !this.checkStrictly) {
256
- // 递归设置子子节点的选中状态
257
- childDepartments.forEach((nodeData) => {
258
- this.checkedNodeAndChildren(nodeData)
259
- })
260
- }
261
- },
262
- // 取消当前节点的子节点的选中状态
263
- cancelChildCheckedNodes(data) {
264
- const department = JSON.parse(data.data)
265
- this.selectResult = this.removeRow(this.selectResult, department)
266
- if (data.id !== this.tenantNodeId) {
267
- // 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
268
- this.$refs.deparmentTree.setChecked(this.tenantNodeId, false)
269
- }
270
- const childDepartments = data.childDepartments
271
- if (childDepartments && !this.checkStrictly) {
272
- childDepartments.forEach((nodeData) => {
273
- // 取消节点的选中状态
274
- this.$refs.deparmentTree.setChecked(nodeData.id, false)
275
- // 递归取消子子节点的选中状态
276
- this.cancelChildCheckedNodes(nodeData)
277
- })
278
- }
279
- },
280
- handleCheckChange(data, checked, indeterminate) {
281
- },
282
- handleNodeExpand(data, node, nodeTree) {
283
- },
284
- handleNodeClick(data, node, nodeTree) {
285
- // 多选部门树时,处理点击节点事件
286
- this.clickNodeWhenMultiple(data)
287
- },
288
- // 多选树时,点击节点处理复选框的选中状态
289
- clickNodeWhenMultiple(data) {
290
- var checkedKeys = []
291
- if (this.$refs.deparmentTree) {
292
- checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
293
- }
294
- if (checkedKeys && checkedKeys.indexOf(data.id) > -1) {
295
- // 表示当前节点是选中状态,则需要取消其选中状态
296
- // 取消当前节点的勾选状态
297
- this.$refs.deparmentTree.setChecked(data.id, false)
298
- // 取消当前节点的子节点的勾选状态
299
- if (!this.checkStrictly) {
300
- this.cancelChildCheckedNodes(data)
301
- }
302
- // 取消选中状态时,保持节点是展开的状态,不要折叠
303
- this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
304
- } else {
305
- // 表示当前节点不是选中的状态,需要勾选该节点
306
- if (data.nodeType && data.nodeType === 'DEPARTMENT' && data.data) {
307
- // 表示当前选中的节点是部门
308
- const department = JSON.parse(data.data)
309
- this.selectUser(null, department)
310
- }
311
- this.$refs.deparmentTree.setChecked(data.id, true)
312
- // 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
313
- const children = data.childDepartments
314
- if (children && children.length > 0) {
315
- // 表示加载过该节点,直接选中即可
316
- if (!this.checkStrictly) {
317
- this.checkedNodeAndChildren(data)
318
- }
319
- } else {
320
- // 表示没有加载过该节点,是首次加载,需要走后台
321
- // 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
322
- this.isClickNode = true
323
- }
324
- }
325
- },
326
- isDepartmentNode(data) {
327
- // 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
328
- return (
329
- data.id !== this.tenantNodeId &&
330
- data.nodeType &&
331
- data.nodeType === 'DEPARTMENT' &&
332
- !data.branch
333
- )
334
- },
335
- selectDepartment() {
336
- // 是否需要显示提示框,默认不显示
337
- var showTip = false
338
- var leafSelectNodeInfo = {
339
- ids: [],
340
- names: [],
341
- codes: [],
342
- zhNames: [],
343
- enNames: [],
344
- departments: [],
345
- }
346
- if (this.selectResult.length === 0) {
347
- // 没有选择任何节点
348
- showTip = true
349
- } else {
350
- for (var i = 0; i < this.selectResult.length; i++) {
351
- var userData = this.selectResult[i]
352
- // 不存在该用户则放到结果集合中,去掉重复使用
353
- leafSelectNodeInfo.ids.push(userData.id)
354
- leafSelectNodeInfo.codes.push(userData.code)
355
- if (userData.enName) {
356
- leafSelectNodeInfo.enNames.push(userData.enName)
357
- } else {
358
- leafSelectNodeInfo.enNames.push('')
359
- }
360
- if (userData.department) {
361
- leafSelectNodeInfo.departments.push(userData.department)
362
- } else {
363
- leafSelectNodeInfo.departments.push(userData)
364
- }
365
- const name = userData.showName
366
- leafSelectNodeInfo.names.push(name)
367
- leafSelectNodeInfo.zhNames.push(userData.name)
368
- }
369
- }
370
- if (leafSelectNodeInfo.ids.length > 0) {
371
- leafSelectNodeInfo.containBranch = this.containBranch
372
- $emit(this, 'result', leafSelectNodeInfo)
373
- } else {
374
- showTip = true
375
- }
376
- if (showTip) {
377
- this.$alert(
378
- this.$t('imatrixUIMessage.pleaseSelectDepartment'),
379
- this.$t('imatrixUIMessage.tips'),
380
- {
381
- confirmButtonText: this.$t('imatrixUIPublicModel.sure'),
382
- }
383
- )
384
- }
385
- },
386
- // 是否选中了公司节点
387
- isSelectTenantNode(dataId) {
388
- return (
389
- dataId === this.tenantNodeId &&
390
- (!this.departmentInfo || this.departmentInfo.length === 0)
391
- )
392
- },
393
- // 给节点添加自定义图标
394
- // renderContent(h, {node, data, store}) {
395
- // var className
396
- // if (node.data.id === -1 || node.data.branch) {
397
- // // node.id ===-1表示公司节点,node.branch表示是分支机构节点
398
- // className = 'Menu'
399
- // } else if (node.data.id === -2 || node.data.id === -3) {
400
- // // node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
401
- // className = 'Tickets'
402
- // } else {
403
- // // 表示是部门节点
404
- // className = 'Date'
405
- // }
406
- // return h(
407
- // 'span',
408
- // h('el-icon', h(className)),
409
- // h('span', {title: node.label}, node.label)
410
- // )
411
- // // return (
412
- // // `<span>
413
- // // <i class={className}></i>
414
- // // <span title={node.label}>{node.label}</span>
415
- // // </span>`
416
- // // )
417
- // },
418
- // 将查询结果中指定用户添加到已选择用户集合中
419
- selectUser(index, dept) {
420
- // if (!this.isContainAllUser()) {
421
- const containUsers = this.selectResult.filter(this.filterDept(dept))
422
- if (containUsers && containUsers.length === 0) {
423
- // 如果已选结果中不包含当前用户,则添加
424
- // 将查询结果中的用户复制到已选择用户集合中
425
- dept.tenantCode = this.tenantInfo.code
426
- dept.tenantName = this.tenantInfo.tenantName
427
- this.selectResult.push(dept)
428
- // 搜索选中记忆
429
- this.setMemoryCacheData(dept, 'department')
430
- }
431
- // } else {
432
- // this.alertByAllUser()
433
- // }
434
- },
435
- // 判断用户是否存在的过滤器
436
- filterDept(queryDept) {
437
- return (dept) => {
438
- return dept.id === queryDept.id
439
- }
440
- },
441
- filterDeptNode(queryDept) {
442
- return (deptNodeId) => {
443
- return deptNodeId + '' === queryDept.id + ''
444
- }
445
- },
446
- // 从已选择用户集合中移除指定用户,并添加到查询结果集合中
447
- removeUser(index, dept) {
448
- // 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
449
- if (dept.nodeId) {
450
- const nodeId = dept.nodeId
451
- if (this.$refs.deparmentTree && nodeId) {
452
- this.$refs.deparmentTree.setChecked(nodeId, false)
453
- }
454
- } else {
455
- if (this.$refs.deparmentTree) {
456
- // 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
457
- const checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
458
- const currentCheckedUserNodeIds = checkedKeys.filter(
459
- this.filterDeptNode(dept)
460
- )
461
- if (currentCheckedUserNodeIds.length > 0) {
462
- // 表示当前用户是选中的状态,需要去掉
463
- currentCheckedUserNodeIds.forEach((userNodeId) => {
464
- this.$refs.deparmentTree.setChecked(userNodeId, false)
465
- })
466
- }
467
- }
468
- }
469
- this.selectResult = this.removeRow(this.selectResult, dept)
470
- if (!this.selectResult || this.selectResult.length === 0) {
471
- // 已选结果面板没有内容,则左侧树节点也不要有选中节点了
472
- if (this.$refs.deparmentTree) {
473
- this.$refs.deparmentTree.setCheckedKeys([])
474
- }
475
- }
476
- },
477
- },
478
- emits: ['result'],
101
+ data() {
102
+ return {
103
+ filterText: '',
104
+ defaultProps: {
105
+ id: 'id',
106
+ label: 'showName',
107
+ children: 'childDepartments',
108
+ isLeaf: 'leaf'
109
+ },
110
+ searchParam: {
111
+ searchValue: null,
112
+ treeType: 'DEPARTMENT_TREE',
113
+ departmentInfo: null
114
+ },
115
+ count: 0,
116
+ // 当前租户内是否包含分支机构。获得当前选中部门名称时,如果有分支,则需要将分支名称返回给用户,例如:部门1(分支1)
117
+ containBranch: false,
118
+ // 公司节点的id
119
+ tenantNodeId: -1,
120
+ // 用于保存所有查询出的节点id
121
+ allSearchNodeIds: [],
122
+ // 用于保存allSearchNodeIds中所有已加载子节点的id集合
123
+ allExpandNodeIds: [],
124
+ isClickNode: false,
125
+ // 查询的备选值
126
+ restaurants: [],
127
+ // 查询条件
128
+ searchValue: null,
129
+ searchStoreKey: 'searchDepartment',
130
+ // 单选时,选择的部门信息
131
+ selectNodeInfo: null,
132
+ // 公司根节点信息
133
+ tenantInfo: {},
134
+ searchResult: [],
135
+ selectResult: [],
136
+ // 控制右侧选择区的loading状态
137
+ isloading: false,
138
+ multiple: true,
139
+ memoryCacheKey: 'DEPARTMENT_MEMORY_KEY',
140
+ // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
141
+ memoryCacheData: [],
142
+ ElIconSearch
143
+ }
144
+ },
145
+ name: 'InlineDepartmentMultiTree',
146
+ components: {
147
+ UserResult
148
+ },
149
+ props: {
150
+ checkStrictly: {
151
+ type: Boolean,
152
+ default: false
153
+ },
154
+ // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
155
+ departmentInfo: {
156
+ type: Array,
157
+ default: null
158
+ },
159
+ // 弹框的高度
160
+ height: {
161
+ type: String,
162
+ default: '300px'
163
+ },
164
+ // 多选部门树时,已选择部门id或部门名称或编码集合,多个之间以逗号隔开
165
+ selectDepartmentInfo: {
166
+ type: [String, Number],
167
+ default: null
168
+ },
169
+ // 移除部门时,部门属性名称:id、name、code,默认是id
170
+ searchField: {
171
+ type: String,
172
+ default: 'id'
173
+ },
174
+ // 多选树时结果之间的分隔符,默认是逗号分隔
175
+ separator: {
176
+ type: String,
177
+ default: ','
178
+ },
179
+ // 根据变量限制部门时,根据部门表的哪个字段进行过滤,默认是code
180
+ limitFilterColumn: {
181
+ type: String,
182
+ default: 'code'
183
+ }
184
+ },
185
+ computed: {},
186
+ watch: {
187
+ filterText(val) {
188
+ if (!val) {
189
+ this.searchValue = val
190
+ // 清空查询内容时,重新加载整个树
191
+ if (this.departmentInfo && this.departmentInfo.length > 0) {
192
+ // 加载指定部门时,展开公司节点
193
+ this.loadPointDepartments()
194
+ } else {
195
+ // 加载整个组织结构树时,展开公司节点
196
+ this.loadDepartment(this.tenantNodeId)
197
+ }
198
+ }
199
+ }
200
+ },
201
+ created() {
202
+ this.initSelectDepts(this.searchField, this.selectDepartmentInfo, this.separator).then((selectUsers) => {
203
+ if (selectUsers) {
204
+ this.selectResult = selectUsers
205
+ }
206
+ })
207
+ },
208
+ mounted() {
209
+ var searchDepartment = localStorage.getObject(this.searchStoreKey)
210
+ if (searchDepartment) {
211
+ this.restaurants = searchDepartment
212
+ } else {
213
+ this.restaurants = []
214
+ }
215
+ this.getMemoryCacheData('department')
216
+ },
217
+ methods: {
218
+ ...utils,
219
+ ...departmentTreeService,
220
+ ...memoryCacheUtils,
221
+ filterNode(value, data, node) {
222
+ if (!value) {
223
+ return true
224
+ } else {
225
+ return data.name.indexOf(value) !== -1
226
+ }
227
+ },
228
+ // 选中当前节点及其子节点
229
+ checkedNodeAndChildren(data) {
230
+ // 取消选中状态时,保持节点是展开的状态,不要折叠
231
+ // this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
232
+ let department = data
233
+ if (data.data) {
234
+ department = JSON.parse(data.data)
235
+ }
236
+ this.selectUser(null, department)
237
+ // 获得所有应该选中的节点
238
+ this.$refs.deparmentTree.setChecked(data.id, true)
239
+ const childDepartments = data.childDepartments
240
+ if (childDepartments && !this.checkStrictly) {
241
+ // 递归设置子子节点的选中状态
242
+ childDepartments.forEach((nodeData) => {
243
+ this.checkedNodeAndChildren(nodeData)
244
+ })
245
+ }
246
+ },
247
+ // 取消当前节点的子节点的选中状态
248
+ cancelChildCheckedNodes(data) {
249
+ const department = JSON.parse(data.data)
250
+ this.selectResult = this.removeRow(this.selectResult, department)
251
+ if (data.id !== this.tenantNodeId) {
252
+ // 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
253
+ this.$refs.deparmentTree.setChecked(this.tenantNodeId, false)
254
+ }
255
+ const childDepartments = data.childDepartments
256
+ if (childDepartments && !this.checkStrictly) {
257
+ childDepartments.forEach((nodeData) => {
258
+ // 取消节点的选中状态
259
+ this.$refs.deparmentTree.setChecked(nodeData.id, false)
260
+ // 递归取消子子节点的选中状态
261
+ this.cancelChildCheckedNodes(nodeData)
262
+ })
263
+ }
264
+ },
265
+ handleCheckChange(data, checked, indeterminate) {},
266
+ handleNodeExpand(data, node, nodeTree) {},
267
+ handleNodeClick(data, node, nodeTree) {
268
+ // 多选部门树时,处理点击节点事件
269
+ this.clickNodeWhenMultiple(data)
270
+ },
271
+ // 多选树时,点击节点处理复选框的选中状态
272
+ clickNodeWhenMultiple(data) {
273
+ var checkedKeys = []
274
+ if (this.$refs.deparmentTree) {
275
+ checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
276
+ }
277
+ if (checkedKeys && checkedKeys.indexOf(data.id) > -1) {
278
+ // 表示当前节点是选中状态,则需要取消其选中状态
279
+ // 取消当前节点的勾选状态
280
+ this.$refs.deparmentTree.setChecked(data.id, false)
281
+ // 取消当前节点的子节点的勾选状态
282
+ if (!this.checkStrictly) {
283
+ this.cancelChildCheckedNodes(data)
284
+ }
285
+ // 取消选中状态时,保持节点是展开的状态,不要折叠
286
+ this.$refs.deparmentTree.store.nodesMap[data.id].expanded = true
287
+ } else {
288
+ // 表示当前节点不是选中的状态,需要勾选该节点
289
+ if (data.nodeType && data.nodeType === 'DEPARTMENT' && data.data) {
290
+ // 表示当前选中的节点是部门
291
+ const department = JSON.parse(data.data)
292
+ this.selectUser(null, department)
293
+ }
294
+ this.$refs.deparmentTree.setChecked(data.id, true)
295
+ // 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
296
+ const children = data.childDepartments
297
+ if (children && children.length > 0) {
298
+ // 表示加载过该节点,直接选中即可
299
+ if (!this.checkStrictly) {
300
+ this.checkedNodeAndChildren(data)
301
+ }
302
+ } else {
303
+ // 表示没有加载过该节点,是首次加载,需要走后台
304
+ // 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
305
+ this.isClickNode = true
306
+ }
307
+ }
308
+ },
309
+ isDepartmentNode(data) {
310
+ // 当前节点不是公司节点,也不是分支机构节点,表示是部门节点
311
+ return data.id !== this.tenantNodeId && data.nodeType && data.nodeType === 'DEPARTMENT' && !data.branch
312
+ },
313
+ selectDepartment() {
314
+ // 是否需要显示提示框,默认不显示
315
+ var showTip = false
316
+ var leafSelectNodeInfo = {
317
+ ids: [],
318
+ names: [],
319
+ codes: [],
320
+ zhNames: [],
321
+ enNames: [],
322
+ departments: []
323
+ }
324
+ if (this.selectResult.length === 0) {
325
+ // 没有选择任何节点
326
+ showTip = true
327
+ } else {
328
+ for (var i = 0; i < this.selectResult.length; i++) {
329
+ var userData = this.selectResult[i]
330
+ // 不存在该用户则放到结果集合中,去掉重复使用
331
+ leafSelectNodeInfo.ids.push(userData.id)
332
+ leafSelectNodeInfo.codes.push(userData.code)
333
+ if (userData.enName) {
334
+ leafSelectNodeInfo.enNames.push(userData.enName)
335
+ } else {
336
+ leafSelectNodeInfo.enNames.push('')
337
+ }
338
+ if (userData.department) {
339
+ leafSelectNodeInfo.departments.push(userData.department)
340
+ } else {
341
+ leafSelectNodeInfo.departments.push(userData)
342
+ }
343
+ const name = userData.showName
344
+ leafSelectNodeInfo.names.push(name)
345
+ leafSelectNodeInfo.zhNames.push(userData.name)
346
+ }
347
+ }
348
+ if (leafSelectNodeInfo.ids.length > 0) {
349
+ leafSelectNodeInfo.containBranch = this.containBranch
350
+ $emit(this, 'result', leafSelectNodeInfo)
351
+ } else {
352
+ showTip = true
353
+ }
354
+ if (showTip) {
355
+ this.$alert(this.$t('imatrixUIMessage.pleaseSelectDepartment'), this.$t('imatrixUIMessage.tips'), {
356
+ confirmButtonText: this.$t('imatrixUIPublicModel.sure')
357
+ })
358
+ }
359
+ },
360
+ // 是否选中了公司节点
361
+ isSelectTenantNode(dataId) {
362
+ return dataId === this.tenantNodeId && (!this.departmentInfo || this.departmentInfo.length === 0)
363
+ },
364
+ // 给节点添加自定义图标
365
+ // renderContent(h, {node, data, store}) {
366
+ // var className
367
+ // if (node.data.id === -1 || node.data.branch) {
368
+ // // node.id ===-1表示公司节点,node.branch表示是分支机构节点
369
+ // className = 'Menu'
370
+ // } else if (node.data.id === -2 || node.data.id === -3) {
371
+ // // node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
372
+ // className = 'Tickets'
373
+ // } else {
374
+ // // 表示是部门节点
375
+ // className = 'Date'
376
+ // }
377
+ // return h(
378
+ // 'span',
379
+ // h('el-icon', h(className)),
380
+ // h('span', {title: node.label}, node.label)
381
+ // )
382
+ // // return (
383
+ // // `<span>
384
+ // // <i class={className}></i>
385
+ // // <span title={node.label}>{node.label}</span>
386
+ // // </span>`
387
+ // // )
388
+ // },
389
+ // 将查询结果中指定用户添加到已选择用户集合中
390
+ selectUser(index, dept) {
391
+ // if (!this.isContainAllUser()) {
392
+ const containUsers = this.selectResult.filter(this.filterDept(dept))
393
+ if (containUsers && containUsers.length === 0) {
394
+ // 如果已选结果中不包含当前用户,则添加
395
+ // 将查询结果中的用户复制到已选择用户集合中
396
+ dept.tenantCode = this.tenantInfo.code
397
+ dept.tenantName = this.tenantInfo.tenantName
398
+ this.selectResult.push(dept)
399
+ // 搜索选中记忆
400
+ this.setMemoryCacheData(dept, 'department')
401
+ }
402
+ // } else {
403
+ // this.alertByAllUser()
404
+ // }
405
+ },
406
+ // 判断用户是否存在的过滤器
407
+ filterDept(queryDept) {
408
+ return (dept) => {
409
+ return dept.id === queryDept.id
410
+ }
411
+ },
412
+ filterDeptNode(queryDept) {
413
+ return (deptNodeId) => {
414
+ return deptNodeId + '' === queryDept.id + ''
415
+ }
416
+ },
417
+ // 从已选择用户集合中移除指定用户,并添加到查询结果集合中
418
+ removeUser(index, dept) {
419
+ // 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
420
+ if (dept.nodeId) {
421
+ const nodeId = dept.nodeId
422
+ if (this.$refs.deparmentTree && nodeId) {
423
+ this.$refs.deparmentTree.setChecked(nodeId, false)
424
+ }
425
+ } else {
426
+ if (this.$refs.deparmentTree) {
427
+ // 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
428
+ const checkedKeys = this.$refs.deparmentTree.getCheckedKeys()
429
+ const currentCheckedUserNodeIds = checkedKeys.filter(this.filterDeptNode(dept))
430
+ if (currentCheckedUserNodeIds.length > 0) {
431
+ // 表示当前用户是选中的状态,需要去掉
432
+ currentCheckedUserNodeIds.forEach((userNodeId) => {
433
+ this.$refs.deparmentTree.setChecked(userNodeId, false)
434
+ })
435
+ }
436
+ }
437
+ }
438
+ this.selectResult = this.removeRow(this.selectResult, dept)
439
+ if (!this.selectResult || this.selectResult.length === 0) {
440
+ // 已选结果面板没有内容,则左侧树节点也不要有选中节点了
441
+ if (this.$refs.deparmentTree) {
442
+ this.$refs.deparmentTree.setCheckedKeys([])
443
+ }
444
+ }
445
+ }
446
+ },
447
+ emits: ['result']
479
448
  }
480
449
  </script>
481
450
 
482
451
  <style>
483
452
  .searchResult {
484
- color: red;
453
+ color: red;
485
454
  }
486
455
 
487
456
  .inline-input-custom {
488
- width: 90%;
457
+ width: 90%;
489
458
  }
490
459
 
491
460
  .el-autocomplete-suggestion.el-popper {
492
- min-width: 300px;
461
+ min-width: 300px;
493
462
  }
494
463
  </style>