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