imatrix-ui 2.9.15-dw-tmp2 → 2.9.16-boe2

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 (193) hide show
  1. package/lib/super-ui.css +1 -1
  2. package/lib/super-ui.umd.min.js +5 -35
  3. package/package.json +2 -2
  4. package/src/api/sso-service.js +19 -1
  5. package/src/assets/nonemessage.png +0 -0
  6. package/src/i18n/i18n.js +1 -1
  7. package/src/i18n/langs/cn.js +18 -6
  8. package/src/i18n/langs/en.js +20 -7
  9. package/src/permission.js +2 -2
  10. package/src/plugins.js +3 -3
  11. package/src/router/index.js +10 -0
  12. package/src/store/modules/tab-content.js +6 -0
  13. package/src/store/modules/user.js +32 -2
  14. package/src/styles/display-layout.scss +1 -1
  15. package/src/styles/index.scss +74 -4
  16. package/src/styles/theme/black/font-style.scss +70 -0
  17. package/src/styles/theme/black/index.scss +6 -30
  18. package/src/styles/theme/blue/font-style.scss +37 -0
  19. package/src/styles/theme/blue/index.scss +2 -18
  20. package/src/styles/theme/blue2/font-style.scss +70 -0
  21. package/src/styles/theme/blue2/index.scss +3 -13
  22. package/src/styles/theme/dark-blue/card.scss +4 -6
  23. package/src/styles/theme/dark-blue/form.scss +7 -4
  24. package/src/styles/theme/dark-blue/index.scss +30 -5
  25. package/src/styles/theme/dark-blue/message.scss +8 -0
  26. package/src/styles/theme/dark-blue/radio.scss +13 -0
  27. package/src/styles/theme/dark-blue/sidebar.scss +7 -37
  28. package/src/styles/theme/dark-blue/tab.scss +4 -1
  29. package/src/styles/theme/dark-blue/table.scss +1 -1
  30. package/src/styles/theme/dark-blue/tree.scss +35 -10
  31. package/src/styles/theme/gray/card-style.scss +13 -1
  32. package/src/styles/theme/gray/font-style.scss +38 -0
  33. package/src/styles/theme/gray/index.scss +13 -25
  34. package/src/styles/theme/gray/scrollbar-style.scss +32 -0
  35. package/src/styles/theme/gray/sidebar.scss +7 -14
  36. package/src/utils/auth-api.js +47 -1
  37. package/src/utils/common-util.js +22 -81
  38. package/src/utils/jump-page-utils.js +3 -6
  39. package/src/utils/range-selector.js +185 -0
  40. package/src/utils/request.js +6 -3
  41. package/src/utils/util.js +13 -11
  42. package/src/utils/workflow-util.js +3 -0
  43. package/src/views/dsc-component/Sidebar/Item.vue +7 -5
  44. package/src/views/dsc-component/Sidebar/SidebarItem.vue +2 -3
  45. package/src/views/dsc-component/Sidebar/index.vue +12 -20
  46. package/src/views/dsc-component/tabs/tab-content.vue +8 -9
  47. package/src/views/layout/EmptyLayout.vue +4 -1
  48. package/src/views/layout/NewLayout.vue +6 -65
  49. package/src/views/layout/components/AppMain.vue +2 -1
  50. package/src/views/layout/components/Menubar/Item.vue +23 -7
  51. package/src/views/layout/components/Menubar/Link.vue +11 -2
  52. package/src/views/layout/components/Menubar/SidebarItem.vue +50 -7
  53. package/src/views/layout/components/Menubar/index.vue +51 -16
  54. package/src/views/layout/components/tabs/tab-content.vue +162 -0
  55. package/src/views/layout/tab-content-iframe-index.vue +31 -0
  56. package/src/views/layout/tab-content-index.vue +85 -0
  57. package/src/views/login/index.vue +1 -1
  58. package/packages/breadcrumb/index.js +0 -6
  59. package/packages/breadcrumb/src/breadcrumb.vue +0 -71
  60. package/packages/department-tree/index.js +0 -6
  61. package/packages/department-tree/src/department-tree.vue +0 -108
  62. package/packages/department-tree-inline/index.js +0 -6
  63. package/packages/department-tree-inline/src/department-multi-tree-inline.vue +0 -408
  64. package/packages/department-tree-inline/src/department-single-tree-inline.vue +0 -290
  65. package/packages/department-tree-inline/src/department-tree-inline.vue +0 -86
  66. package/packages/department-tree-inline/src/department-tree-service.js +0 -273
  67. package/packages/department-tree-inline/src/search-result.vue +0 -176
  68. package/packages/department-user-tree/index.js +0 -6
  69. package/packages/department-user-tree/src/department-user-multiple-tree.vue +0 -116
  70. package/packages/department-user-tree/src/department-user-single-tree.vue +0 -76
  71. package/packages/department-user-tree/src/department-user-tree.vue +0 -101
  72. package/packages/department-user-tree-inline/index.js +0 -6
  73. package/packages/department-user-tree-inline/src/department-user-multiple-tree-inline.vue +0 -636
  74. package/packages/department-user-tree-inline/src/department-user-single-tree-inline.vue +0 -271
  75. package/packages/department-user-tree-inline/src/department-user-tree-inline.vue +0 -79
  76. package/packages/department-user-tree-inline/src/department-user-tree-multi-service.js +0 -248
  77. package/packages/department-user-tree-inline/src/department-user-tree-single-service.js +0 -142
  78. package/packages/department-user-tree-inline/src/search-result.vue +0 -197
  79. package/packages/directives/prevent-reclick.js +0 -19
  80. package/packages/dynamic-source-select/index.js +0 -6
  81. package/packages/dynamic-source-select/src/dynamic-source-select-service.js +0 -70
  82. package/packages/dynamic-source-select/src/dynamic-source-select.vue +0 -440
  83. package/packages/dynamic-source-select/src/events.js +0 -55
  84. package/packages/fs-preview/index.js +0 -6
  85. package/packages/fs-preview/src/fs-preview.vue +0 -226
  86. package/packages/fs-upload/index.js +0 -6
  87. package/packages/fs-upload/src/fs-upload-multi.vue +0 -420
  88. package/packages/fs-upload/src/fs-upload-single.vue +0 -312
  89. package/packages/fs-upload/src/fs-upload.vue +0 -189
  90. package/packages/fs-upload/src/see-big-picture.vue +0 -55
  91. package/packages/fs-upload-list/index.js +0 -6
  92. package/packages/fs-upload-list/src/fs-upload-list.vue +0 -287
  93. package/packages/hamburger/index.js +0 -6
  94. package/packages/hamburger/src/hamburger.vue +0 -38
  95. package/packages/index.js +0 -121
  96. package/packages/multipart-upload/index.js +0 -6
  97. package/packages/multipart-upload/src/index.vue +0 -73
  98. package/packages/multipart-upload/src/multipart-upload-form.vue +0 -297
  99. package/packages/multipart-upload/src/multipart-upload-list.vue +0 -378
  100. package/packages/organization-input/index.js +0 -6
  101. package/packages/organization-input/src/organization-input.vue +0 -542
  102. package/packages/plugins/export-data-new.js +0 -466
  103. package/packages/plugins/export-data.js +0 -361
  104. package/packages/plugins/index.js +0 -15
  105. package/packages/plugins/public-method.js +0 -43
  106. package/packages/remove-department/index.js +0 -6
  107. package/packages/remove-department/src/remove-department.vue +0 -172
  108. package/packages/remove-department/src/remove-dept-service.js +0 -20
  109. package/packages/remove-user/index.js +0 -6
  110. package/packages/remove-user/src/remove-user-service.js +0 -20
  111. package/packages/remove-user/src/remove-user.vue +0 -195
  112. package/packages/remove-workgroup/index.js +0 -6
  113. package/packages/remove-workgroup/src/remove-workgroup-service.js +0 -20
  114. package/packages/remove-workgroup/src/remove-workgroup.vue +0 -159
  115. package/packages/rich-editor/index.js +0 -7
  116. package/packages/rich-editor/index.vue +0 -278
  117. package/packages/rich-editor/langs/zh-Hans.js +0 -1
  118. package/packages/rich-editor/viewer.vue +0 -103
  119. package/packages/scan-code-input/index.js +0 -6
  120. package/packages/scan-code-input/src/events.js +0 -33
  121. package/packages/scan-code-input/src/scan-code-input-colse.vue +0 -131
  122. package/packages/scan-code-input/src/scan-code-input.vue +0 -116
  123. package/packages/secret-info/index.js +0 -7
  124. package/packages/secret-info/index.vue +0 -90
  125. package/packages/super-grid/index.js +0 -7
  126. package/packages/super-grid/src/apis.js +0 -820
  127. package/packages/super-grid/src/columns-config.vue +0 -335
  128. package/packages/super-grid/src/custom-formatter.js +0 -278
  129. package/packages/super-grid/src/dynamic-input.vue +0 -1279
  130. package/packages/super-grid/src/eventBus.js +0 -2
  131. package/packages/super-grid/src/events.js +0 -55
  132. package/packages/super-grid/src/formValidatorUtil.js +0 -226
  133. package/packages/super-grid/src/formatter.js +0 -181
  134. package/packages/super-grid/src/group-column.vue +0 -100
  135. package/packages/super-grid/src/header-context-menu.vue +0 -87
  136. package/packages/super-grid/src/index-column.vue +0 -51
  137. package/packages/super-grid/src/normal-column.vue +0 -771
  138. package/packages/super-grid/src/public-methods.js +0 -31
  139. package/packages/super-grid/src/row-operation.vue +0 -161
  140. package/packages/super-grid/src/search-button.vue +0 -66
  141. package/packages/super-grid/src/search-condition-input.vue +0 -61
  142. package/packages/super-grid/src/search-condition-list.vue +0 -59
  143. package/packages/super-grid/src/search-form-advancedQuery.vue +0 -653
  144. package/packages/super-grid/src/search-form-dialog.vue +0 -79
  145. package/packages/super-grid/src/search-form-item.vue +0 -404
  146. package/packages/super-grid/src/search-form-number.vue +0 -38
  147. package/packages/super-grid/src/search-form-open.vue +0 -170
  148. package/packages/super-grid/src/search-form-ordinarySearch.vue +0 -196
  149. package/packages/super-grid/src/search-form.vue +0 -642
  150. package/packages/super-grid/src/search-methods.js +0 -448
  151. package/packages/super-grid/src/selection-column.vue +0 -43
  152. package/packages/super-grid/src/store.js +0 -3
  153. package/packages/super-grid/src/super-grid-service.js +0 -593
  154. package/packages/super-grid/src/super-grid.vue +0 -2882
  155. package/packages/super-grid/src/utils.js +0 -762
  156. package/packages/super-grid/src/view-image-dialog.vue +0 -130
  157. package/packages/super-nine-grid/index.js +0 -7
  158. package/packages/super-nine-grid/src/apis.js +0 -103
  159. package/packages/super-nine-grid/src/custom-formatter.js +0 -66
  160. package/packages/super-nine-grid/src/formatter.js +0 -132
  161. package/packages/super-nine-grid/src/search-form-number.vue +0 -38
  162. package/packages/super-nine-grid/src/search-form.vue +0 -430
  163. package/packages/super-nine-grid/src/search-methods.js +0 -134
  164. package/packages/super-nine-grid/src/store.js +0 -3
  165. package/packages/super-nine-grid/src/super-grid-service.js +0 -91
  166. package/packages/super-nine-grid/src/super-nine-grid.vue +0 -872
  167. package/packages/super-nine-grid/src/utils.js +0 -261
  168. package/packages/svg-icon/index.js +0 -6
  169. package/packages/svg-icon/src/svg-icon.vue +0 -43
  170. package/packages/utils/memory-cache-utils.js +0 -90
  171. package/packages/utils/utils.js +0 -152
  172. package/packages/utils/value-set.js +0 -86
  173. package/packages/valid-code/index.js +0 -7
  174. package/packages/valid-code/src/valid-code.vue +0 -95
  175. package/packages/workflow-button/index.js +0 -6
  176. package/packages/workflow-button/src/workflow-button.vue +0 -325
  177. package/packages/workflow-history-list/index.js +0 -6
  178. package/packages/workflow-history-list/src/api.js +0 -7
  179. package/packages/workflow-history-list/src/workflow-history-list.vue +0 -185
  180. package/packages/workgroup-tree/index.js +0 -6
  181. package/packages/workgroup-tree/src/workgroup-tree.vue +0 -76
  182. package/packages/workgroup-tree-inline/index.js +0 -6
  183. package/packages/workgroup-tree-inline/src/workgroup-tree-inline.vue +0 -317
  184. package/packages/workgroup-tree-inline/src/workgroup-tree-service.js +0 -43
  185. package/packages/workgroup-user-tree/index.js +0 -6
  186. package/packages/workgroup-user-tree/src/workgroup-user-tree.vue +0 -100
  187. package/packages/workgroup-user-tree-inline/index.js +0 -6
  188. package/packages/workgroup-user-tree-inline/src/workgroup-tree-inline-service.js +0 -163
  189. package/packages/workgroup-user-tree-inline/src/workgroup-user-tree-inline.vue +0 -436
  190. package/packages/year-range-picker/index.js +0 -6
  191. package/packages/year-range-picker/src/year-range-picker.vue +0 -51
  192. package/src/index.js +0 -93
  193. package/src/styles/theme/gray/form-style.scss +0 -41
@@ -1,636 +0,0 @@
1
- <template>
2
- <div>
3
- <el-container style="height: 395px">
4
- <el-aside width="430px">
5
- <el-container style="height: 390px">
6
- <el-header style=" font-size: 12px;height: 35px">
7
- <el-autocomplete
8
- v-model="filterText"
9
- :fetch-suggestions="querySearch"
10
- :placeholder="$t('departmentUserTree.pleaseEnterUserInformation')"
11
- size="small"
12
- class="inline-input inline-input-custom searchDepartmentUser"
13
- @keyup.enter.native="clickSearch"
14
- @select="handleSelect"
15
- >
16
- <el-button slot="append" icon="el-icon-search" @click="clickSearch" />
17
- </el-autocomplete>
18
- </el-header>
19
- <el-main style="padding: 10px">
20
- <div v-if="!searchValue" style="padding-top:5px;overflow:auto;width: auto;display: inline-block !important;">
21
- <el-tree
22
- ref="deparmentUserTree"
23
- :props="defaultProps"
24
- :load="loadNode"
25
- lazy
26
- :check-on-click-node="true"
27
- show-checkbox
28
- node-key="nodeId"
29
- :render-content="renderContent"
30
- @check="handleCheckNode"
31
- @check-change="handleCheckChange"
32
- />
33
- <!-- @node-click="handleNodeClick" 移除节点点击,不然会造成节点不可选择时,点击也会选择节点 -->
34
- </div>
35
-
36
- <div v-if="searchValue && searchValue.length > 0 || selectResult.length > 0" style="height:100%;overflow: hidden;">
37
- <user-result :grid-data="searchResult" :select-result="selectResult" :height="height" :contain-branch="containBranch" :multiple="true" :is-search-result="true" @addUser="selectUser" />
38
- </div>
39
- </el-main>
40
- </el-container>
41
- </el-aside>
42
-
43
- <el-container>
44
- <el-aside width="2px">
45
- <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" />
46
- </el-aside>
47
- <el-main style="padding: 10px">
48
- <div style="text-align:left;font-size:16px">
49
- {{ $t('departmentUserTree.selectedPeople') }}:
50
- </div>
51
- <div :style="'padding-top: 5px;height:90%;overflow: hidden;'">
52
- <user-result :grid-data="selectResult" :height="height" :contain-branch="containBranch" :multiple="true" :is-search-result="false" @removeUser="removeUser" />
53
- </div>
54
- </el-main>
55
- </el-container>
56
- </el-container>
57
- </div>
58
- </template>
59
- <style>
60
- .searchResult {
61
- color:red
62
- }
63
- .inline-select-custom {
64
- width : 100px
65
- }
66
- .inline-input-custom {
67
- width : 98%
68
- }
69
- .searchDepartmentUser {
70
- width: 250px
71
- }
72
- </style>
73
- <script>
74
- import localStorage from '../../../src/utils/local-storage'
75
- import UserResult from './search-result'
76
- import utils from '../../utils/utils'
77
- import departmentUserTreeMultiService from './department-user-tree-multi-service'
78
- import memoryCacheUtils from '../../utils/memory-cache-utils'
79
-
80
- export default {
81
- name: 'InlineDepartmentUserMultiTree',
82
- components: {
83
- UserResult
84
- },
85
- props: {
86
- // 显示指定部门节点及其子节点,不传该属性,表示显示整个组织结构树
87
- departmentInfo: {
88
- type: Array,
89
- default: null
90
- },
91
- // 弹框的高度
92
- height: {
93
- type: String,
94
- default: '300px'
95
- },
96
- // 是否需要显示虚拟用户
97
- isNeedVirtualUser: {
98
- type: Boolean,
99
- default: false
100
- },
101
- // 多选用户树时,已选择用户id或登录名集合,多个之间以逗号隔开
102
- selectUserInfo: {
103
- type: [String, Number],
104
- default: null
105
- },
106
- // 移除用户时,用户属性名称:id、loginName、email、telephone,默认是loginName
107
- searchField: {
108
- type: String,
109
- default: 'loginName'
110
- },
111
- // 多选树时结果之间的分隔符,默认是逗号分隔
112
- separator: {
113
- type: String,
114
- default: ','
115
- }
116
- },
117
- data() {
118
- return {
119
- filterText: '',
120
- defaultProps: {
121
- id: 'id',
122
- label: 'showName',
123
- children: 'children',
124
- isLeaf: 'leaf',
125
- disabled: 'disabled'
126
- },
127
- searchParam: {
128
- userField: null,
129
- searchValue: null,
130
- treeType: 'MAN_DEPARTMENT_TREE',
131
- departmentInfo: null
132
- },
133
- containBranch: false, // 当前租户内是否包含分支机构。获得当前选中用户名称时,如果有分支,则需要将分支名称返回给用户,例如:张三(分支1)
134
- tenantNodeId: -1, // 公司节点的id
135
- allSearchNodeIds: [], // 用于保存所有查询出的节点id
136
- allExpandNodeIds: [], // 用于保存allSearchNodeIds中所有已加载子节点的id集合
137
- isClickNode: false, // 多选树时,是否点击当前的节点
138
- restaurants: [], // 查询的备选值
139
- searchValue: null, // 查询条件
140
- searchResult: [], // 用户的查询结果
141
- selectResult: [], // 已选用户结果
142
- searchStoreKey: 'searchDepartmentUser',
143
- tenantInfo: {}, // 公司根节点信息
144
- memoryCacheKey: 'DEPARTMENT_USER_MEMORY_KEY',
145
- memoryCacheData: [] // 记忆选择数据, 搜索框获得焦点后,下拉显示最近选中的10个人,倒序排列,最后选中的在最上面显示。
146
- }
147
- },
148
- computed: {
149
- },
150
- watch: {
151
- filterText(val) {
152
- if (!val) {
153
- this.searchValue = val
154
- // 清空查询内容时,重新加载整个树
155
- if (this.departmentInfo && this.departmentInfo.length > 0) {
156
- // 加载指定部门时,展开公司节点
157
- this.loadPointDepartments()
158
- } else {
159
- // 加载整个组织结构树时,展开公司节点
160
- this.loadDepartment(this.tenantNodeId, this.tenantNodeId + '')
161
- }
162
- }
163
- }
164
- },
165
- created() {
166
- this.initSelectUsers(this.searchField, this.selectUserInfo, this.separator).then(selectUsers => {
167
- if (selectUsers) {
168
- this.selectResult = selectUsers
169
- }
170
- })
171
- },
172
- mounted() {
173
- var searchDepartmentUser = localStorage.getObject(this.searchStoreKey)
174
- if (searchDepartmentUser) {
175
- this.restaurants = searchDepartmentUser
176
- } else {
177
- this.restaurants = []
178
- }
179
- this.getMemoryCacheData('departmentUser')
180
- },
181
- methods: {
182
- ...utils,
183
- ...departmentUserTreeMultiService,
184
- ...memoryCacheUtils,
185
- // 将查询结果中指定用户添加到已选择用户集合中
186
- selectUser(index, user) {
187
- if (!this.isContainAllUser()) {
188
- const containUsers = this.selectResult.filter(this.filterUser(user))
189
- if (containUsers && containUsers.length === 0) {
190
- // 如果已选结果中不包含当前用户,则添加
191
- // 将查询结果中的用户复制到已选择用户集合中
192
- user.tenantCode = this.tenantInfo.code
193
- user.tenantName = this.tenantInfo.tenantName
194
- this.selectResult.push(user)
195
- // 搜索选中记忆
196
- this.setMemoryCacheData(user, 'departmentUser')
197
- }
198
- } else {
199
- this.alertByAllUser()
200
- }
201
- },
202
- // 从已选择用户集合中移除指定用户,并添加到查询结果集合中
203
- removeUser(index, user) {
204
- // 表示是在组织结构树页面,需要将树的人员节点的选中状态去掉
205
- if (user.nodeId) {
206
- const nodeId = user.nodeId
207
- if (this.$refs.deparmentUserTree && nodeId) {
208
- this.$refs.deparmentUserTree.setChecked(nodeId, false)
209
- }
210
- } else {
211
- if (this.$refs.deparmentUserTree) {
212
- // 通过查询结果添加的用户,在返回到组织结构树时,也选中了该用户,在移除该用户时,需要去掉复选框的选中状态
213
- const checkedKeys = this.$refs.deparmentUserTree.getCheckedKeys()
214
- const currentCheckedUserNodeIds = checkedKeys.filter(this.filterUserNode(user))
215
- if (currentCheckedUserNodeIds.length > 0) {
216
- // 表示当前用户是选中的状态,需要去掉
217
- currentCheckedUserNodeIds.forEach(userNodeId => {
218
- this.$refs.deparmentUserTree.setChecked(userNodeId, false)
219
- })
220
- }
221
- }
222
- }
223
- this.selectResult = this.removeRow(this.selectResult, user)
224
- if (!this.selectResult || this.selectResult.length === 0) {
225
- // 已选结果面板没有内容,则左侧树节点也不要有选中节点了
226
- if (this.$refs.deparmentUserTree) {
227
- this.$refs.deparmentUserTree.setCheckedKeys([])
228
- }
229
- }
230
- },
231
- filterUserNode(queryUser) {
232
- return (userNodeId) => {
233
- // 用户节点的id的分隔符,USER~departmentId~userId
234
- const nodeIdSeparator = '~'
235
- const userId = userNodeId.substring(userNodeId.lastIndexOf(nodeIdSeparator) + 1)
236
- return (userId === queryUser.id + '')
237
- }
238
- },
239
- // handleSelect(item) {
240
- // this.handleSelectUtil(item, localStorage)
241
- // },
242
- search(value) {
243
- this.searchValue = value
244
- let mySearchValue = value
245
- if (mySearchValue) {
246
- mySearchValue = mySearchValue.trim()
247
- }
248
- this.searchParam.searchValue = mySearchValue
249
- this.searchParam.departmentInfo = this.departmentInfo
250
- // TODO: 查询的信息,不需要该属性了,默认自动匹配姓名、登录名等
251
- // this.searchParam.userField = this.searchField
252
- // 后台查询部门,并拼接树节点
253
- this.filterAppendNodes(value)
254
- },
255
- // 点击查询按钮调用的方法
256
- clickSearch() {
257
- this.storeSeachValue(localStorage, this.searchStoreKey, this.filterText)
258
- this.search(this.filterText)
259
- },
260
- handleCheckChange(data, checked, childrenChecked) {
261
- if (this.isUserNode(data)) {
262
- // 是否是人员节点
263
- if (checked) {
264
- // 当前节点是否被选中
265
- const user = JSON.parse(data.data)
266
- const selectUser = this.packageSelectUser(user)
267
- if (selectUser) {
268
- this.selectResult.push(selectUser)
269
- // 搜索选中记忆
270
- this.setMemoryCacheData(user, 'departmentUser')
271
- }
272
- }
273
- }
274
- },
275
- // 封装已选人员结果
276
- packageSelectUser(user) {
277
- if (!this.isContainAllUser()) {
278
- const containUsers = this.selectResult.filter(this.filterUser(user))
279
- if (containUsers && containUsers.length === 0) {
280
- user.tenantName = this.tenantInfo.tenantName
281
- user.tenantCode = this.tenantInfo.code
282
- // 表示集合中不存在该用户,则封装该用户
283
- var selectUser = {
284
- id: user.id,
285
- name: user.name,
286
- zhName: user.name,
287
- loginName: user.loginName,
288
- email: user.email,
289
- telephone: user.telephone,
290
- mainDepartmentName: user.mainDepartmentName,
291
- subCompanyName: user.subCompanyName,
292
- user: user,
293
- enName: user.enName
294
- }
295
- return selectUser
296
- }
297
- return null
298
- } else {
299
- this.alertByAllUser()
300
- }
301
- },
302
- isContainAllUser() {
303
- if (this.selectResult.length > 0) {
304
- return this.selectResult[0].id === this.tenantNodeId
305
- }
306
- return false
307
- },
308
- // 选中了组织结构树的根节点
309
- packageAllUserToResult() {
310
- if (!this.isContainAllUser()) {
311
- // 表示集合中不存在该用户,则封装该用户
312
- var allUser = {
313
- id: this.tenantNodeId,
314
- name: '所有用户'
315
- }
316
- return allUser
317
- }
318
- return null
319
- },
320
- // 判断用户是否存在的过滤器
321
- filterUser(queryUser) {
322
- return (user) => {
323
- return (user.id === queryUser.id)
324
- }
325
- },
326
- // 点击复选框时处理
327
- handleCheckNode(data, checkObj) {
328
- if (checkObj.checkedKeys.indexOf(data.nodeId) > -1) {
329
- if (!this.isContainAllUser()) {
330
- // 如果没有选择所有用户,则可以继续选择用户
331
- this.checkedNodeToSelectResult(data)
332
- } else {
333
- // 如果已选择所有用户,提示用户,先移除所有用户
334
- this.alertByAllUser()
335
- }
336
- } else {
337
- this.cancelChildCheckedNodes(data)
338
- }
339
- },
340
- // 由于选择了所有用户,再次选择时的提示信息
341
- alertByAllUser() {
342
- this.$alert(this.$t('imatrixUIMessage.pleaseRemoveallpersonnelBeforeSelectingSpecificPersonnel'), this.$t('imatrixUIMessage.tips'), {
343
- confirmButtonText: this.$t('imatrixUIPublicModel.sure')
344
- }).then(() => {
345
- if (this.$refs.deparmentUserTree) {
346
- this.$refs.deparmentUserTree.setCheckedKeys([])
347
- }
348
- })
349
- },
350
- // 选中树节点处理
351
- checkedNodeToSelectResult(data) {
352
- if (this.isSelectTenantNode(data.id)) {
353
- // 如果选中了公司节点,表示选择了所有人
354
- const selectUser = this.packageAllUserToResult()
355
- if (selectUser) {
356
- this.selectResult = []
357
- selectUser.nodeId = this.tenantNodeId + ''
358
- this.selectResult.push(selectUser)
359
- }
360
- } else {
361
- this.checkedNode(data)
362
- }
363
- },
364
- // 取消当前节点及其子节点的选中状态
365
- cancelCheckedNodeAndChildren(data) {
366
- if (data.id !== this.tenantNodeId) {
367
- // 如果当前节点不是公司节点,需要将公司节点的选中状态去掉
368
- this.$refs.deparmentUserTree.setChecked(this.tenantNodeId + '', false)
369
- }
370
- const children = data.children
371
- if (children) {
372
- children.forEach(nodeData => {
373
- // 取消节点的选中状态
374
- this.$refs.deparmentUserTree.setChecked(nodeData.nodeId, false)
375
- // 递归取消子子节点的选中状态
376
- this.cancelCheckedNodeAndChildren(nodeData)
377
- })
378
- }
379
- },
380
- // 勾选节点时的操作
381
- checkedNode(data) {
382
- // 勾选当前节点
383
- const isExpand = this.$refs.deparmentUserTree.store.nodesMap[data.nodeId].expanded
384
- if (isExpand) {
385
- // 如果已展开,不需要再走后台获得其子节点。只需要选中已有子节点
386
- // 选中当前节点及其子节点
387
- this.checkedChildrenUserNodes(data, data.children)
388
- } else {
389
- // 当前节点未展开。则再判断是否需要走后台加载叶子节点
390
- if (!data.leaf) {
391
- // 不是叶子节点
392
- if (data.children) {
393
- // 如果已经加载过该父节点的子节点,则只需展开,并选中人员节点
394
- this.staticCheckedUserNodes(data)
395
- } else {
396
- // 没有加载过该父节点的子节点时,需要走后台获得该父节点的子节点,并展开子节点
397
- this.dynamicCheckedUserNodes(data)
398
- }
399
- }
400
- }
401
- },
402
- // 取消当前节点的子节点的勾选状态
403
- cancelChildCheckedNodes(data) {
404
- const children = data.children
405
- if (children) {
406
- children.forEach(nodeData => {
407
- // 取消节点的选中状态
408
- this.$refs.deparmentUserTree.setChecked(nodeData.nodeId, false)
409
- // 递归取消子节点的孩子节点的选中状态
410
- this.cancelChildCheckedNodes(nodeData)
411
- })
412
- }
413
- },
414
- // 勾选指定节点及其下的所有用户节点
415
- checkedChildrenUserNodes(data, children) {
416
- // 勾选指定节点
417
- // 勾选指定节点下的用户节点
418
- if (children) {
419
- const childrenDepartmentIds = []
420
- children.forEach(childData => {
421
- if (childData.nodeType === 'USER') {
422
- // 勾选用户节点
423
- this.$refs.deparmentUserTree.setChecked(childData.nodeId, true)
424
- const user = JSON.parse(childData.data)
425
- const selectUser = this.packageSelectUser(user)
426
- if (selectUser) {
427
- selectUser.nodeId = childData.nodeId
428
- this.selectResult.push(selectUser)
429
- }
430
- } else if (childData.nodeType === 'DEPARTMENT') {
431
- this.$refs.deparmentUserTree.setChecked(childData.nodeId, true)
432
- childrenDepartmentIds.push(childData.id)
433
- } else {
434
- this.$refs.deparmentUserTree.setChecked(childData.nodeId, false)
435
- }
436
- if (this.$refs.deparmentUserTree.store.nodesMap[childData.nodeId].expanded) {
437
- // 如果当前子节点已展开,则选中子节点的孩子节点中的用户节点
438
- this.checkedChildrenUserNodes(childData)
439
- }
440
- })
441
- // 封装所有子部门及孙子部门的用户
442
- this.packageChildrenDepartmentUsers(childrenDepartmentIds)
443
- }
444
- if (data.id === this.tenantNodeId) {
445
- // 如果是公司节点,清除其它所有节点的选中状态,只选中公司节点,表示选择了所有用户
446
- this.$refs.deparmentUserTree.setCheckedKeys([])
447
- }
448
- // 选中当前点击的节点,即使当前点击的是非用户节点也要选中
449
- this.$refs.deparmentUserTree.setChecked(data.nodeId, true)
450
- },
451
- // 封装所有子部门及孙子部门的用户
452
- packageChildrenDepartmentUsers(childrenDepartmentIds) {
453
- if (childrenDepartmentIds && childrenDepartmentIds.length > 0) {
454
- this.getChildrenDepartmentUsers(childrenDepartmentIds).then(users => {
455
- users.forEach(user => {
456
- const selectUser = this.packageSelectUser(user)
457
- if (selectUser) {
458
- this.selectResult.push(selectUser)
459
- }
460
- })
461
- })
462
- }
463
- },
464
- // 选中非叶子类型的部门节点时,已加载过该节点下的子节点,只需展开该部门,且选中用户节点
465
- staticCheckedUserNodes(data) {
466
- // 展开当前选中的节点
467
- this.$refs.deparmentUserTree.store.nodesMap[data.nodeId].expanded = true
468
- // 选中用户节点
469
- this.checkedChildrenUserNodes(data, data.children)
470
- },
471
- // 多选树时,点击节点处理复选框的选中状态
472
- handleNodeClick(data, node, nodeTree) {
473
- var checkedKeys = []
474
- if (this.$refs.deparmentUserTree) {
475
- checkedKeys = this.$refs.deparmentUserTree.getCheckedKeys()
476
- }
477
- if (checkedKeys.indexOf(data.nodeId) > -1) {
478
- // 表示当前节点是选中状态,则需要取消其选中状态
479
- // 取消当前节点的勾选状态
480
- this.$refs.deparmentUserTree.setChecked(data.nodeId, false)
481
- // 取消当前节点的子节点的勾选状态
482
- this.cancelChildCheckedNodes(data)
483
- // 取消选中状态时,保持节点是展开的状态,不要折叠
484
- this.$refs.deparmentUserTree.store.nodesMap[data.nodeId].expanded = true
485
- } else {
486
- // 表示当前节点不是选中的状态,需要勾选该节点
487
- if (!this.isContainAllUser()) {
488
- if (this.isSelectTenantNode(data.id)) {
489
- // 如果选中了公司节点,表示选择了所有人
490
- const selectUser = this.packageAllUserToResult()
491
- if (selectUser) {
492
- this.selectResult = []
493
- selectUser.nodeId = this.tenantNodeId + ''
494
- this.selectResult.push(selectUser)
495
- }
496
- this.staticCheckedUserNodes(data)
497
- } else {
498
- // 点击树节点时添加并展开节点会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
499
- const children = data.children
500
- if (children && children.length > 0) {
501
- // 表示加载过该节点,直接选中即可
502
- this.staticCheckedUserNodes(data)
503
- } else if (data.nodeType && data.nodeType === 'USER') {
504
- // 表示是用户节点需要选中该节点
505
- this.$refs.deparmentUserTree.setChecked(data.nodeId, true)
506
- } else {
507
- // 表示没有加载过该节点,是首次加载,需要走后台
508
- // 会走loadNode方法,因为设置了树组件的expand-on-click-node属性为true
509
- this.isClickNode = true
510
- }
511
- }
512
- } else {
513
- // 如果已选择所有用户,提示用户,先移除所有用户
514
- // 当前节点的当前展开状态
515
- const currentExpand = this.$refs.deparmentUserTree.store.nodesMap[data.nodeId].expanded
516
- // 当前节点的原展开状态
517
- const originalExpand = !currentExpand
518
- // 保持当前节点的原展开状态
519
- this.$refs.deparmentUserTree.store.nodesMap[data.nodeId].expanded = originalExpand
520
- this.alertByAllUser()
521
- }
522
- }
523
- },
524
- isUserNode(data) {
525
- // 当前节点不是公司节点,节点类型是用户类型时,表示点击的是用户节点
526
- return data.id !== this.tenantNodeId && data.nodeType && data.nodeType === 'USER'
527
- },
528
- confirmSelectUser() {
529
- // 选中的用户结果
530
- var selectNodeInfo = {
531
- userIds: [],
532
- userNames: [],
533
- userZhNames: [],
534
- userEnNames: [],
535
- loginNames: [],
536
- emails: [],
537
- telephones: [],
538
- users: []
539
- }
540
- // 是否需要显示提示框,默认不显示
541
- var showTip = false
542
- if (this.selectResult.length === 0) {
543
- // 没有选择任何节点
544
- showTip = true
545
- } else {
546
- for (var i = 0; i < this.selectResult.length; i++) {
547
- var userData = this.selectResult[i]
548
- // 不存在该用户则放到结果集合中,去掉重复使用
549
- selectNodeInfo.userIds.push(userData.id)
550
- selectNodeInfo.loginNames.push(userData.loginName)
551
- if (userData.email && userData.email !== '') {
552
- selectNodeInfo.emails.push(userData.email)
553
- }
554
- if (userData.telephone && userData.telephone !== '') {
555
- selectNodeInfo.telephones.push(userData.telephone)
556
- }
557
- if (userData.user) {
558
- selectNodeInfo.users.push(userData.user)
559
- } else {
560
- selectNodeInfo.users.push(userData)
561
- }
562
- var name = userData.name
563
- selectNodeInfo.userZhNames.push(name)
564
- if (userData.enName && userData.enName.trim() !== '') {
565
- selectNodeInfo.userEnNames.push(userData.enName)
566
- name = name + '(' + userData.enName + ')'
567
- } else {
568
- selectNodeInfo.userEnNames.push('')
569
- }
570
- // if (this.containBranch && userData.subCompanyName) {
571
- // // 如果包含分支机构,则拼接分支机构名称
572
- // name = name + '(' + userData.subCompanyName + ')'
573
- // }
574
- selectNodeInfo.userNames.push(name)
575
- }
576
- }
577
- if (selectNodeInfo.userIds.length > 0) {
578
- selectNodeInfo.containBranch = this.containBranch
579
- this.$emit('result', selectNodeInfo)
580
- } else {
581
- showTip = true
582
- }
583
- if (showTip) {
584
- this.$alert(this.$t('imatrixUIMessage.pleaseSelectPersonnel'), this.$t('imatrixUIMessage.tips'), {
585
- confirmButtonText: this.$t('imatrixUIPublicModel.sure')
586
- })
587
- }
588
- },
589
- // 是否选中了公司节点
590
- isSelectTenantNode(dataId) {
591
- return dataId === this.tenantNodeId && (!this.departmentInfo || this.departmentInfo.length === 0)
592
- },
593
- // 初始化树 或 点击三角展开节点时动态加载子节点
594
- loadNode(node, resolve) {
595
- var parentId = 0
596
- var parentNodeId = '0'
597
- if (node.level === 0) {
598
- // 表示初始化树
599
- parentId = 0
600
- parentNodeId = parentId + ''
601
- } else {
602
- parentId = node.data.id
603
- parentNodeId = node.data.nodeId
604
- }
605
- var checkedKeys = []
606
- if (this.$refs.deparmentUserTree) {
607
- checkedKeys = this.$refs.deparmentUserTree.getCheckedKeys()
608
- }
609
- // 初始化部门人员树
610
- this.initLoadDepartment(parentId, node, resolve, checkedKeys, parentNodeId)
611
- },
612
- // 给节点添加自定义图标
613
- renderContent(h, { node, data, store }) {
614
- var className
615
- if (node.data.id === -1 || node.data.branch) {
616
- // node.id ===-1表示公司节点,node.branch表示是分支机构节点
617
- className = 'el-icon-menu'
618
- } else if (node.data.id === -2 || node.data.id === -3) {
619
- // node.id ===-2表示集团公司无部门用户节点,node.id ===-3表示是分支机构无部门用户节点
620
- className = 'el-icon-tickets'
621
- } else if (node.data.nodeType === 'USER') {
622
- className = 'el-icon-user'
623
- } else {
624
- className = 'el-icon-date'
625
- }
626
- return (
627
- <span>
628
- <i class={className}></i>
629
- <span title={node.label}>{node.label}</span>
630
- </span>
631
- )
632
- }
633
-
634
- }
635
- }
636
- </script>