eoss-ui 0.7.94 → 0.7.96

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 (242) hide show
  1. package/lib/calogin.js +233 -233
  2. package/lib/cascader.js +1 -1
  3. package/lib/data-table-form.js +8 -8
  4. package/lib/data-table.js +8 -7
  5. package/lib/eoss-ui.common.js +1040 -1051
  6. package/lib/flow-list.js +96 -96
  7. package/lib/flow.js +283 -282
  8. package/lib/index.js +1 -1
  9. package/lib/main.js +288 -288
  10. package/lib/qr-code.js +13 -13
  11. package/lib/radio-group.js +98 -111
  12. package/lib/select.js +1 -1
  13. package/package.json +2 -2
  14. package/packages/button/index.js +5 -5
  15. package/packages/button/src/main.vue +418 -418
  16. package/packages/button-group/index.js +5 -5
  17. package/packages/button-group/src/main.vue +346 -346
  18. package/packages/calendar/index.js +5 -5
  19. package/packages/calogin/index.js +5 -5
  20. package/packages/calogin/src/main.vue +412 -412
  21. package/packages/calogin/src/plugin.js +915 -915
  22. package/packages/card/index.js +5 -5
  23. package/packages/card/src/main.vue +156 -156
  24. package/packages/cascader/index.js +5 -5
  25. package/packages/cascader/src/main.vue +168 -168
  26. package/packages/checkbox-group/index.js +5 -5
  27. package/packages/checkbox-group/src/main.vue +333 -333
  28. package/packages/clients/index.js +5 -5
  29. package/packages/clients/src/main.vue +151 -151
  30. package/packages/data-table/index.js +5 -5
  31. package/packages/data-table/src/children.vue +39 -39
  32. package/packages/data-table/src/column.vue +1 -0
  33. package/packages/data-table/src/main.vue +1845 -1845
  34. package/packages/data-table/src/sizer.vue +195 -195
  35. package/packages/data-table-form/index.js +5 -5
  36. package/packages/data-table-form/src/checkbox.vue +101 -101
  37. package/packages/data-table-form/src/colgroup.vue +17 -17
  38. package/packages/data-table-form/src/main.vue +181 -181
  39. package/packages/data-table-form/src/radio.vue +65 -65
  40. package/packages/data-table-form/src/table.vue +233 -233
  41. package/packages/data-table-form/src/tbody.vue +336 -336
  42. package/packages/data-table-form/src/thead.vue +68 -68
  43. package/packages/date-picker/index.js +5 -5
  44. package/packages/date-picker/src/main.vue +236 -236
  45. package/packages/dialog/index.js +5 -5
  46. package/packages/enable-drag/index.js +5 -5
  47. package/packages/enterprise/index.js +5 -5
  48. package/packages/enterprise/src/main.vue +66 -66
  49. package/packages/error-page/index.js +5 -5
  50. package/packages/error-page/src/main.vue +44 -44
  51. package/packages/flow/index.js +5 -5
  52. package/packages/flow/src/component/Circulate.vue +417 -417
  53. package/packages/flow/src/component/CommonOpinions.vue +376 -376
  54. package/packages/flow/src/component/CustomPreset.vue +324 -324
  55. package/packages/flow/src/component/FileList.vue +97 -97
  56. package/packages/flow/src/component/FreeCirculation.vue +244 -244
  57. package/packages/flow/src/component/Preset.vue +257 -257
  58. package/packages/flow/src/component/SendMsg.vue +242 -242
  59. package/packages/flow/src/component/SortFlow.vue +110 -110
  60. package/packages/flow/src/component/TimeLimit.vue +190 -190
  61. package/packages/flow/src/component/taskUnionExamine.vue +761 -761
  62. package/packages/flow/src/form.vue +123 -123
  63. package/packages/flow/src/freeStartFlow.vue +2855 -2855
  64. package/packages/flow/src/main.vue +4145 -4144
  65. package/packages/flow/src/processForm.vue +1680 -1680
  66. package/packages/flow/src/processReject.vue +309 -309
  67. package/packages/flow/src/reset.vue +946 -946
  68. package/packages/flow/src/startTaskRead.vue +695 -695
  69. package/packages/flow/src/supervise.vue +159 -159
  70. package/packages/flow/src/table.vue +58 -58
  71. package/packages/flow-group/index.js +5 -5
  72. package/packages/flow-group/src/main.vue +750 -750
  73. package/packages/flow-list/index.js +5 -5
  74. package/packages/flow-list/src/main.vue +2337 -2337
  75. package/packages/form/index.js +5 -5
  76. package/packages/form/src/main.vue +3901 -3901
  77. package/packages/form/src/table.vue +1512 -1512
  78. package/packages/handle-user/index.js +5 -5
  79. package/packages/handle-user/src/main.vue +137 -137
  80. package/packages/handler/index.js +5 -5
  81. package/packages/handler/src/main.vue +499 -499
  82. package/packages/icon/index.js +5 -5
  83. package/packages/icon/src/main.vue +104 -104
  84. package/packages/icons/index.js +5 -5
  85. package/packages/icons/src/main.vue +81 -81
  86. package/packages/input/index.js +5 -5
  87. package/packages/input/src/main.vue +356 -356
  88. package/packages/input-number/index.js +5 -5
  89. package/packages/input-number/src/main.vue +106 -106
  90. package/packages/label/index.js +5 -5
  91. package/packages/label/src/main.vue +457 -457
  92. package/packages/layout/index.js +5 -5
  93. package/packages/layout/src/item.vue +152 -152
  94. package/packages/layout/src/main.vue +31 -31
  95. package/packages/login/index.js +5 -5
  96. package/packages/login/src/main.vue +2088 -2088
  97. package/packages/login/src/resetPassword.vue +557 -557
  98. package/packages/main/index.js +5 -5
  99. package/packages/main/src/default/message.vue +249 -249
  100. package/packages/main/src/default/notice.vue +157 -157
  101. package/packages/main/src/default/userinfo.vue +513 -513
  102. package/packages/main/src/public/online.vue +89 -89
  103. package/packages/main/src/public/search.vue +464 -464
  104. package/packages/main/src/public/settings.vue +273 -273
  105. package/packages/main/src/simplicity/apps.vue +388 -388
  106. package/packages/main/src/simplicity/avatar.vue +82 -82
  107. package/packages/main/src/simplicity/handler.vue +158 -158
  108. package/packages/main/src/simplicity/index.vue +2335 -2335
  109. package/packages/main/src/simplicity/lists.vue +84 -84
  110. package/packages/main/src/simplicity/menu-list.vue +135 -135
  111. package/packages/main/src/simplicity/message.vue +293 -293
  112. package/packages/main/src/simplicity/notice.vue +222 -222
  113. package/packages/main/src/simplicity/router-page.vue +45 -45
  114. package/packages/main/src/simplicity/sub-menu.vue +276 -276
  115. package/packages/main/src/simplicity/user.vue +259 -259
  116. package/packages/main/src/simplicity/userinfo.vue +408 -408
  117. package/packages/main/src/simplicityTop/apps.vue +388 -388
  118. package/packages/main/src/simplicityTop/avatar.vue +82 -82
  119. package/packages/main/src/simplicityTop/handler.vue +215 -215
  120. package/packages/main/src/simplicityTop/index.vue +2620 -2620
  121. package/packages/main/src/simplicityTop/lists.vue +84 -84
  122. package/packages/main/src/simplicityTop/menu-list.vue +135 -135
  123. package/packages/main/src/simplicityTop/message.vue +293 -293
  124. package/packages/main/src/simplicityTop/notice.vue +222 -222
  125. package/packages/main/src/simplicityTop/router-page.vue +45 -45
  126. package/packages/main/src/simplicityTop/sub-menu.vue +274 -274
  127. package/packages/main/src/simplicityTop/user.vue +259 -259
  128. package/packages/main/src/simplicityTop/userinfo.vue +408 -408
  129. package/packages/menu/index.js +5 -5
  130. package/packages/menu/src/main.vue +595 -595
  131. package/packages/nav/index.js +5 -5
  132. package/packages/nav/src/main.vue +351 -351
  133. package/packages/notify/index.js +5 -5
  134. package/packages/notify/src/main.vue +538 -538
  135. package/packages/page/index.js +5 -5
  136. package/packages/page/src/main.vue +167 -167
  137. package/packages/pagination/index.js +5 -5
  138. package/packages/pagination/src/main.vue +96 -96
  139. package/packages/player/index.js +5 -5
  140. package/packages/player/src/main.vue +194 -194
  141. package/packages/qr-code/index.js +5 -5
  142. package/packages/qr-code/src/main.vue +170 -170
  143. package/packages/radio-group/index.js +6 -6
  144. package/packages/radio-group/src/main.vue +319 -319
  145. package/packages/retrial-auth/index.js +5 -5
  146. package/packages/retrial-auth/src/main.vue +299 -299
  147. package/packages/select/index.js +5 -5
  148. package/packages/select/src/main.vue +1 -1
  149. package/packages/select-ganged/index.js +5 -5
  150. package/packages/select-ganged/src/main.vue +724 -724
  151. package/packages/selector/index.js +5 -5
  152. package/packages/selector/src/main.vue +761 -761
  153. package/packages/selector-panel/index.js +5 -5
  154. package/packages/selector-panel/src/main.vue +1036 -1036
  155. package/packages/selector-panel/src/selection.vue +174 -174
  156. package/packages/selector-panel/src/tree.vue +129 -129
  157. package/packages/sizer/index.js +5 -5
  158. package/packages/sizer/src/main.vue +254 -254
  159. package/packages/steps/index.js +5 -5
  160. package/packages/steps/src/main.vue +181 -181
  161. package/packages/switch/index.js +5 -5
  162. package/packages/switch/src/main.vue +170 -170
  163. package/packages/table-form/index.js +5 -5
  164. package/packages/tabs/index.js +5 -5
  165. package/packages/tabs/src/main.vue +788 -788
  166. package/packages/tabs-panel/index.js +5 -5
  167. package/packages/tabs-panel/src/main.vue +29 -29
  168. package/packages/theme-chalk/src/base.scss +261 -261
  169. package/packages/theme-chalk/src/button-group.scss +176 -176
  170. package/packages/theme-chalk/src/button.scss +24 -24
  171. package/packages/theme-chalk/src/calendar.scss +113 -113
  172. package/packages/theme-chalk/src/card.scss +99 -99
  173. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  174. package/packages/theme-chalk/src/clients.scss +87 -87
  175. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  176. package/packages/theme-chalk/src/data-table.scss +297 -297
  177. package/packages/theme-chalk/src/date-picker.scss +7 -7
  178. package/packages/theme-chalk/src/dialog.scss +77 -77
  179. package/packages/theme-chalk/src/enable-drag.scss +181 -181
  180. package/packages/theme-chalk/src/enterprise.scss +5 -5
  181. package/packages/theme-chalk/src/error-page.scss +18 -18
  182. package/packages/theme-chalk/src/flow-group.scss +110 -110
  183. package/packages/theme-chalk/src/flow-list.scss +55 -55
  184. package/packages/theme-chalk/src/flow.scss +373 -373
  185. package/packages/theme-chalk/src/form.scss +501 -501
  186. package/packages/theme-chalk/src/handle-user.scss +40 -40
  187. package/packages/theme-chalk/src/handler.scss +148 -148
  188. package/packages/theme-chalk/src/icon.scss +3452 -3452
  189. package/packages/theme-chalk/src/icons.scss +99 -99
  190. package/packages/theme-chalk/src/input.scss +9 -9
  191. package/packages/theme-chalk/src/label.scss +24 -24
  192. package/packages/theme-chalk/src/layout.scss +46 -46
  193. package/packages/theme-chalk/src/login.scss +1006 -1006
  194. package/packages/theme-chalk/src/main.scss +664 -664
  195. package/packages/theme-chalk/src/menu.scss +224 -224
  196. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  197. package/packages/theme-chalk/src/nav.scss +111 -111
  198. package/packages/theme-chalk/src/page.scss +3 -3
  199. package/packages/theme-chalk/src/pagination.scss +29 -29
  200. package/packages/theme-chalk/src/player.scss +9 -9
  201. package/packages/theme-chalk/src/qr-code.scss +17 -17
  202. package/packages/theme-chalk/src/radio-group.scss +9 -9
  203. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  204. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  205. package/packages/theme-chalk/src/select.scss +8 -8
  206. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  207. package/packages/theme-chalk/src/selector.scss +114 -114
  208. package/packages/theme-chalk/src/simplicity-top.scss +1845 -1845
  209. package/packages/theme-chalk/src/simplicity.scss +1403 -1403
  210. package/packages/theme-chalk/src/sizer.scss +36 -36
  211. package/packages/theme-chalk/src/steps.scss +88 -88
  212. package/packages/theme-chalk/src/switch.scss +3 -3
  213. package/packages/theme-chalk/src/table-form.scss +1 -1
  214. package/packages/theme-chalk/src/tabs.scss +87 -87
  215. package/packages/theme-chalk/src/tips.scss +7 -7
  216. package/packages/theme-chalk/src/toolbar.scss +179 -179
  217. package/packages/theme-chalk/src/tree-group.scss +72 -72
  218. package/packages/theme-chalk/src/tree.scss +165 -165
  219. package/packages/theme-chalk/src/upload.scss +172 -172
  220. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  221. package/packages/tips/index.js +5 -5
  222. package/packages/tips/src/main.vue +141 -141
  223. package/packages/toolbar/index.js +5 -5
  224. package/packages/toolbar/src/main.vue +430 -430
  225. package/packages/tree/index.js +5 -5
  226. package/packages/tree-group/index.js +5 -5
  227. package/packages/upload/index.js +5 -5
  228. package/packages/upload/src/main.vue +1344 -1344
  229. package/packages/upload/src/picture.js +15 -15
  230. package/packages/wujie/index.js +5 -5
  231. package/packages/wujie/src/main.vue +146 -146
  232. package/packages/wxlogin/index.js +5 -5
  233. package/packages/wxlogin/src/main.vue +128 -128
  234. package/src/config/api.js +348 -348
  235. package/src/config/image.js +2 -2
  236. package/src/index.js +163 -163
  237. package/src/utils/bus.js +3 -3
  238. package/src/utils/date-util.js +312 -312
  239. package/src/utils/http.js +50 -50
  240. package/src/utils/rules.js +18 -18
  241. package/src/utils/store.js +21 -21
  242. package/src/utils/webSocket.js +107 -107
@@ -1,1036 +1,1036 @@
1
- <template>
2
- <es-tabs
3
- v-model="activeName"
4
- class="es-selector-panel"
5
- mold="border-card"
6
- :style="styles"
7
- @tab-click="handleClick"
8
- >
9
- <el-tab-pane
10
- v-for="items in trees"
11
- :key="items.label"
12
- :label="items.label"
13
- :name="items.name"
14
- class="es-selector-content"
15
- >
16
- <div class="es-selector-view">
17
- <tree
18
- v-if="isShowTree"
19
- :data="items.data"
20
- :loading="loading"
21
- @loadsub="loadsub"
22
- @search="searchTree"
23
- ></tree>
24
- <div class="es-selector-selection">
25
- <el-form
26
- ref="form"
27
- @submit.native.prevent
28
- :inline="true"
29
- :model="form"
30
- class="es-selector-selection-toolbar"
31
- v-if="multiple || isShowTree"
32
- >
33
- <el-form-item>
34
- <es-switch v-model="showDisabled" :data="options"></es-switch>
35
- </el-form-item>
36
- <el-form-item>
37
- <el-checkbox
38
- v-show="multiple && !max"
39
- v-model="checkAll"
40
- @change="handleCheckAll"
41
- >
42
- 全选
43
- </el-checkbox>
44
- </el-form-item>
45
- <div class="es-float-right" v-if="isShowTree">
46
- <el-form-item v-if="showSelect && activeName == 'enterprise'">
47
- <es-select
48
- v-model="selectValue"
49
- placeholder="请选择"
50
- @change="handleSelect"
51
- >
52
- <el-option
53
- v-for="item in filtrate.options"
54
- :key="item.value"
55
- :label="item.name"
56
- :value="item.value"
57
- ></el-option>
58
- </es-select>
59
- </el-form-item>
60
- <el-form-item>
61
- <el-input
62
- v-model="search"
63
- placeholder="请输入搜索关键字"
64
- @change="handleChangeSearch"
65
- >
66
- <template slot="append">
67
- <el-button
68
- icon="el-icon-search"
69
- type="primary"
70
- @click="handleSearch"
71
- ></el-button>
72
- </template>
73
- </el-input>
74
- </el-form-item>
75
- </div>
76
- </el-form>
77
- <selection
78
- v-model="checkeds"
79
- :data="checkboxs"
80
- :value-key="valueKey"
81
- :label-key="labelKey"
82
- :multiple="mix ? mix : multiple"
83
- :max="max"
84
- :showTooltip="showTooltip"
85
- :showDisabled="showDisabled"
86
- :disableds="disableds"
87
- ></selection>
88
- <selection
89
- v-model="checkeds"
90
- genre="delete"
91
- :data="Array.isArray(checkeds) ? checkeds : [checkeds]"
92
- :value-key="valueKey"
93
- :label-key="labelKey"
94
- :showTooltip="showTooltip"
95
- :multiple="multiple"
96
- :max="max"
97
- :mix="mix"
98
- :isSort="true"
99
- @sort="handleSort"
100
- ></selection>
101
- </div>
102
- </div>
103
- <div class="es-selector-handle">
104
- <span v-if="multiple && checkeds.length > 0" style="margin-right: 20px;color:red">
105
- 已选 {{ checkeds.length }}
106
- </span>
107
- <el-button type="primary" size="small" @click="handleConfirm"
108
- >确定</el-button
109
- >
110
- <el-button size="small" @click="handleCancel">取消</el-button>
111
- </div>
112
- </el-tab-pane>
113
- </es-tabs>
114
- </template>
115
- <script>
116
- import tree from './tree.vue';
117
- import selection from './selection.vue';
118
- import {
119
- getSelectorOrgTree,
120
- getSelectorOrgDetail
121
- } from 'eoss-ui/src/config/api.js';
122
- import { debounce } from 'throttle-debounce';
123
- import util from 'eoss-ui/src/utils/util.js';
124
- export default {
125
- name: 'EsSelectorPanel',
126
- inheritAttrs: false,
127
- components: {
128
- tree,
129
- selection
130
- },
131
- props: {
132
- isShowLevel3: {
133
- type: Boolean,
134
- default: true
135
- },
136
- method: {
137
- type: String,
138
- default: 'get'
139
- },
140
- host: {
141
- type: String,
142
- default: ''
143
- },
144
- value: [Array, Object, String],
145
- width: {
146
- type: String,
147
- default: '900px'
148
- },
149
- height: {
150
- type: String,
151
- default: '560px'
152
- },
153
- //树结构
154
- tree: {
155
- type: Boolean,
156
- default: true
157
- },
158
- type: {
159
- type: Array,
160
- default() {
161
- return ['enterprise', 'person'];
162
- }
163
- },
164
- active: String,
165
- //是否替换页签
166
- replace: {
167
- type: Boolean,
168
- default: false
169
- },
170
- showTooltip: {
171
- type: Boolean,
172
- default: true
173
- },
174
- //页签
175
- tabs: Object,
176
- filtrate: {
177
- type: [Boolean, Object],
178
- default() {
179
- return {
180
- show: true,
181
- value: '1',
182
- options: [
183
- {
184
- value: '1',
185
- name: '直接下级'
186
- },
187
- {
188
- value: '2',
189
- name: '所有下级'
190
- }
191
- ]
192
- };
193
- }
194
- },
195
- selection: {
196
- type: [String, Array],
197
- default: getSelectorOrgDetail
198
- },
199
- param: {
200
- type: Object,
201
- default() {
202
- return {};
203
- }
204
- },
205
- valueKey: {
206
- type: String,
207
- default: 'showid'
208
- },
209
- labelKey: {
210
- type: String,
211
- default: 'showname'
212
- },
213
- form: {
214
- type: Object,
215
- default() {
216
- return {};
217
- }
218
- },
219
- multiple: {
220
- type: Boolean,
221
- default: true
222
- },
223
- max: Number,
224
- mix: Boolean,
225
- disableds: {
226
- type: Array,
227
- default() {
228
- return [];
229
- }
230
- }
231
- },
232
- data() {
233
- return {
234
- styles: { width: this.width, height: this.height },
235
- loading: true,
236
- search: '',
237
- defaults: '',
238
- trees: '',
239
- checkAll: false,
240
- selectValue: this.filtrate.value,
241
- orgpath: false,
242
- nodeData: '',
243
- activeName: '',
244
- selections: [],
245
- checkboxs: [],
246
- checkeds: null,
247
- showDisabled: true,
248
- options: [
249
- {
250
- value: true,
251
- name: '展示'
252
- },
253
- {
254
- value: false,
255
- name: '过滤'
256
- }
257
- ]
258
- };
259
- },
260
- computed: {
261
- //是否显示树结构
262
- isShowTree() {
263
- if (typeof this.selection === 'object' && Array.isArray(this.selection)) {
264
- return false;
265
- } else {
266
- return this.tree;
267
- }
268
- },
269
- showSelect() {
270
- if (typeof this.filtrate === 'object') {
271
- return this.filtrate.show;
272
- } else {
273
- return false;
274
- }
275
- },
276
- actived: {
277
- get() {
278
- return this.active ? this.active : this.type[0];
279
- },
280
- set(val) {
281
- return val;
282
- }
283
- },
284
- newTabs() {
285
- const orgId = util.getStorage('orgId');
286
- const tabs = {
287
- enterprise: {
288
- label: '选择单位',
289
- name: 'enterprise',
290
- url: getSelectorOrgTree,
291
- data: [],
292
- nodeData: '',
293
- selection: [],
294
- value: [],
295
- param: {
296
- showarea: 1,
297
- id: 0,
298
- filid: 'all'
299
- }
300
- },
301
- department: {
302
- label: '选择部门',
303
- name: 'department',
304
- url: getSelectorOrgTree,
305
- data: [],
306
- nodeData: '',
307
- selection: [],
308
- value: [],
309
- param: {
310
- showarea: 0,
311
- id: 0,
312
- filid: 'all'
313
- }
314
- },
315
- employee: {
316
- label: '选择用户',
317
- name: 'employee',
318
- url: getSelectorOrgTree,
319
- data: [],
320
- nodeData: '',
321
- selection: [],
322
- value: [],
323
- param: {
324
- showarea: 0,
325
- id: 0,
326
- filid: 'all'
327
- }
328
- },
329
- myemployee: {
330
- label: '本单位用户',
331
- name: 'myemployee',
332
- url: getSelectorOrgTree,
333
- data: [],
334
- nodeData: '',
335
- selection: [],
336
- value: [],
337
- param: {
338
- showarea: 2,
339
- id: 0,
340
- filid: orgId
341
- }
342
- },
343
- otheremployee: {
344
- label: '外单位用户',
345
- name: 'otheremployee',
346
- url: getSelectorOrgTree,
347
- data: [],
348
- nodeData: '',
349
- selection: [],
350
- value: [],
351
- param: {
352
- showarea: 0,
353
- id: 0,
354
- filid: 'all'
355
- }
356
- },
357
- person: {
358
- label: '选择人员',
359
- name: 'person',
360
- url: getSelectorOrgTree,
361
- data: [],
362
- nodeData: '',
363
- selection: [],
364
- value: [],
365
- param: {
366
- showarea: 0,
367
- id: 0,
368
- filid: 'all'
369
- }
370
- },
371
- otherperson: {
372
- label: '外单位人员',
373
- name: 'otherperson',
374
- url: getSelectorOrgTree,
375
- data: [],
376
- nodeData: '',
377
- selection: [],
378
- value: [],
379
- param: {
380
- showarea: 0,
381
- id: 0,
382
- filid: 'all'
383
- }
384
- },
385
- persongroup: {
386
- label: '选择群组成员',
387
- name: 'persongroup',
388
- url: getSelectorOrgTree,
389
- data: [],
390
- nodeData: '',
391
- selection: [],
392
- value: [],
393
- param: {
394
- showarea: 3,
395
- id: 0,
396
- filid: 'all'
397
- }
398
- },
399
- filgroup: {
400
- label: '单位群组成员',
401
- data: [],
402
- nodeData: '',
403
- selection: [],
404
- value: [],
405
- name: 'filgroup',
406
- url: getSelectorOrgTree,
407
- param: {
408
- showarea: 4,
409
- id: 0,
410
- filid: 'all'
411
- }
412
- },
413
- depgroup: {
414
- label: '部门群组成员',
415
- name: 'depgroup',
416
- url: getSelectorOrgTree,
417
- data: [],
418
- nodeData: '',
419
- selection: [],
420
- value: [],
421
- param: {
422
- showarea: 5,
423
- id: 0,
424
- filid: 'all'
425
- }
426
- },
427
- persongroupobj: {
428
- label: '人员群组',
429
- name: 'persongroupobj',
430
- url: getSelectorOrgTree,
431
- data: [],
432
- nodeData: '',
433
- selection: [],
434
- value: [],
435
- param: {
436
- showarea: 11,
437
- id: 0,
438
- filid: 'all'
439
- }
440
- },
441
- filgroupobj: {
442
- label: '单位群组',
443
- name: 'filgroupobj',
444
- url: getSelectorOrgTree,
445
- data: [],
446
- nodeData: '',
447
- selection: [],
448
- value: [],
449
- param: {
450
- showarea: 13,
451
- id: 0,
452
- filid: 'all'
453
- }
454
- },
455
- depgroupobj: {
456
- label: '部门群组',
457
- name: 'depgroupobj',
458
- url: getSelectorOrgTree,
459
- data: [],
460
- nodeData: '',
461
- selection: [],
462
- value: [],
463
- param: {
464
- showarea: 14,
465
- id: 0,
466
- filid: 'all'
467
- }
468
- },
469
- role: {
470
- label: '选择角色',
471
- name: 'role',
472
- url: getSelectorOrgTree,
473
- data: [],
474
- nodeData: '',
475
- selection: [],
476
- value: [],
477
- param: {
478
- showarea: 6,
479
- id: 0,
480
- filid: 'all'
481
- }
482
- },
483
- post: {
484
- label: '选择岗位',
485
- name: 'post',
486
- url: getSelectorOrgTree,
487
- data: [],
488
- nodeData: '',
489
- selection: [],
490
- value: [],
491
- param: {
492
- showarea: 8,
493
- id: 0,
494
- filid: 'all'
495
- }
496
- },
497
- codetable: {
498
- label: '代码表',
499
- name: 'codetable',
500
- url: getSelectorOrgTree,
501
- data: [],
502
- nodeData: '',
503
- selection: [],
504
- value: [],
505
- param: {
506
- showarea: 10,
507
- id: 0,
508
- filid: 'all'
509
- }
510
- },
511
- topcontacts: {
512
- label: '常用联系人',
513
- name: 'topcontacts',
514
- url: getSelectorOrgTree,
515
- data: [],
516
- nodeData: '',
517
- selection: [],
518
- value: [],
519
- param: {
520
- showarea: 9,
521
- id: 0,
522
- filid: 'all'
523
- }
524
- }
525
- };
526
- if (this.tabs) {
527
- if (this.replace) {
528
- return this.tabs;
529
- } else {
530
- return util.extend(true, tabs, this.tabs);
531
- }
532
- }
533
- return tabs;
534
- }
535
- },
536
- watch: {
537
- type: {
538
- immediate: true,
539
- deep: true,
540
- handler(val, old) {
541
- if (
542
- old === undefined ||
543
- new Set([...val, ...old]).size !== val.length
544
- ) {
545
- var obj = {};
546
- this.activeName = this.actived;
547
- if (this.isShowTree) {
548
- for (let i in val) {
549
- obj[val[i]] = this.newTabs[val[i]];
550
- }
551
- } else {
552
- obj[this.activeName] = this.newTabs[this.activeName];
553
- }
554
- this.trees = obj;
555
- this.defaults = JSON.parse(JSON.stringify(obj));
556
- }
557
- }
558
- },
559
- activeName: {
560
- handler(val) {
561
- this.ajaxActive(val);
562
- }
563
- },
564
- tabs: {
565
- deep: true,
566
- handler() {
567
- this.loading = true;
568
- this.getTreeData(
569
- this.host + this.newTabs[this.activeName].url,
570
- this.newTabs[this.activeName].param
571
- );
572
- }
573
- },
574
- value: {
575
- immediate: true,
576
- handler(val) {
577
- if (val !== undefined) {
578
- this.trees[this.activeName].value = JSON.parse(JSON.stringify(val));
579
- } else {
580
- this.trees[this.activeName].value = '';
581
- }
582
- this.checkeds = this.trees[this.activeName].value || [];
583
- }
584
- },
585
- checkboxs(val) {
586
- let flag = this.checkboxs.length ? true : false;
587
- this.checkboxs.forEach((item) => {
588
- if (util.isObject(item)) {
589
- if (util.indexOfObj(this.checkeds, item) === -1) {
590
- flag = false;
591
- return;
592
- }
593
- } else {
594
- if (this.checkeds.indexOf(item) === -1) {
595
- flag = false;
596
- return;
597
- }
598
- }
599
- });
600
- this.checkAll = flag;
601
- },
602
- checkeds(res, old) {
603
- let val = res;
604
- // if (!Array.isArray(val)) {
605
- // this.checkeds = [res];
606
- // return;
607
- // }
608
- if (old.length > 0) {
609
- if (val.length < old.length) {
610
- this.checkAll = false;
611
- } else {
612
- let flag = true;
613
- this.checkboxs.forEach((item) => {
614
- if (util.isObject(item)) {
615
- if (util.indexOfObj(val, item) === -1) {
616
- flag = false;
617
- return;
618
- }
619
- } else {
620
- if (val.indexOf(item) === -1) {
621
- flag = false;
622
- return;
623
- }
624
- }
625
- });
626
- this.checkAll = flag;
627
- }
628
- }
629
- this.trees[this.activeName].value = val;
630
- }
631
- },
632
- beforeCreate() {
633
- this.ajaxActive = debounce(500, (active) => {
634
- this.getAjaxActive(active);
635
- });
636
- },
637
- created() {},
638
- mounted() {
639
- this.ajaxActive(this.activeName);
640
- },
641
- methods: {
642
- getAjaxActive(active) {
643
- if (this.isShowTree) {
644
- if (
645
- (!this.trees[active].data ||
646
- (this.trees[active].data &&
647
- this.trees[active].data.length === 0)) &&
648
- this.newTabs[active].url
649
- ) {
650
- this.loading = true;
651
- this.getTreeData(
652
- this.host + this.newTabs[active].url,
653
- this.newTabs[active].param
654
- );
655
- }
656
- if (
657
- !this.trees[active].value ||
658
- (this.trees[active].value && this.trees[active].value.length === 0)
659
- ) {
660
- if (this.value !== undefined) {
661
- this.trees[active].value = JSON.parse(JSON.stringify(this.value));
662
- }
663
- }
664
- this.checkboxs = this.trees[active].selection || [];
665
- if (!this.mix) {
666
- this.checkeds = this.trees[active].value || [];
667
- }
668
- this.nodeData = this.trees[active].nodeData;
669
- } else {
670
- if (typeof this.selection === 'string') {
671
- let params = this.param[this.activeName]
672
- ? this.param[this.activeName]
673
- : this.param;
674
- util
675
- .ajax({
676
- method: this.method,
677
- url: this.host + this.selection,
678
- params: params,
679
- data: params
680
- })
681
- .then((res) => {
682
- if (res.rCode === 0) {
683
- this.selections = JSON.parse(JSON.stringify(res.results));
684
- this.checkboxs = JSON.parse(JSON.stringify(res.results)) || [];
685
- }
686
- })
687
- .catch((err) => {
688
- if (err.message && err.message !== 'canceled') {
689
- this.$message.error(err.message);
690
- }
691
- });
692
- } else {
693
- this.selections = this.selection;
694
- this.checkboxs = this.selection || [];
695
- }
696
- }
697
- },
698
- getTreeData(url, params, id) {
699
- let data = util.extend(
700
- {},
701
- params,
702
- this.param[this.activeName] ? this.param[this.activeName] : this.param
703
- );
704
- if (id !== undefined) {
705
- data.id = id;
706
- }
707
- util
708
- .ajax({ method: this.method, url: url, params: data, data: data })
709
- .then((res) => {
710
- if (res.rCode === 0) {
711
- this.loading = false;
712
- if (!Object.prototype.hasOwnProperty.call(params, 'seachkey')) {
713
- this.$set(
714
- this.defaults[this.activeName],
715
- 'data',
716
- JSON.parse(JSON.stringify(res.results))
717
- );
718
- }
719
- if (res.results.length && res.results[0].name === '无搜索数据') {
720
- this.$set(this.trees[this.activeName], 'data', null);
721
- } else {
722
- this.$set(
723
- this.trees[this.activeName],
724
- 'data',
725
- JSON.parse(JSON.stringify(res.results))
726
- );
727
- }
728
- }
729
- })
730
- .catch((err) => {
731
- if (err.message && err.message !== 'canceled') {
732
- this.$message.error(err.message);
733
- }
734
- });
735
- },
736
- loadsub(data, node, flag) {
737
- node;
738
- if (flag) {
739
- if (data.selection === undefined || data.selection.length === 0) {
740
- this.checkAll = false;
741
- let params = util.extend(
742
- {},
743
- this.param[this.activeName]
744
- ? this.param[this.activeName]
745
- : this.param
746
- );
747
- params.type = this.activeName;
748
- params.mid = data.id;
749
- if (this.activeName === 'enterprise') {
750
- params.querymode = this.selectValue;
751
- if (this.selectValue === '2' || this.selectValue === 2) {
752
- params.orgpath =
753
- data.attributes && data.attributes.orgpath
754
- ? data.attributes.orgpath
755
- : '';
756
- }
757
- }
758
- // if (this.activeName === 'department') {
759
- // params.querymode = 0;
760
- // }
761
- util
762
- .ajax({
763
- method: this.method,
764
- url: this.host + this.selection,
765
- params: params,
766
- data: params
767
- })
768
- .then((res) => {
769
- if (res.rCode === 0) {
770
- data.selection = JSON.parse(JSON.stringify(res.results));
771
- this.$set(
772
- this.trees[this.activeName],
773
- 'selection',
774
- JSON.parse(JSON.stringify(res.results))
775
- );
776
- this.$set(this.trees[this.activeName], 'nodeData', data);
777
- this.nodeData = this.trees[this.activeName].nodeData;
778
- this.checkboxs = this.trees[this.activeName].selection;
779
- }
780
- })
781
- .catch((err) => {
782
- if (err.message && err.message !== 'canceled') {
783
- this.$message.error(err.message);
784
- }
785
- });
786
- } else {
787
- this.trees[this.activeName].selection = data.selection;
788
- this.trees[this.activeName].nodeData = data;
789
- this.nodeData = this.trees[this.activeName].nodeData;
790
- this.checkboxs = this.trees[this.activeName].selection;
791
- }
792
- } else {
793
- if (!this.isShowLevel3) {
794
- data.state = '';
795
- }
796
- if (
797
- data.state !== '' &&
798
- (!data.children || data.children.length === 0)
799
- ) {
800
- let params = util.extend(
801
- {},
802
- this.newTabs[this.activeName].param,
803
- this.param[this.activeName]
804
- ? this.param[this.activeName]
805
- : this.param
806
- );
807
- params.id = data.id;
808
- util
809
- .ajax({
810
- method: this.method,
811
- url: this.host + this.newTabs[this.activeName].url,
812
- data: params,
813
- params: params
814
- })
815
- .then((res) => {
816
- if (res.rCode === 0) {
817
- this.loading = false;
818
- this.$set(
819
- data,
820
- 'children',
821
- JSON.parse(JSON.stringify(res.results))
822
- );
823
- this.$set(
824
- this.defaults[this.activeName],
825
- 'data',
826
- JSON.parse(JSON.stringify(this.trees[this.activeName].data))
827
- );
828
- }
829
- })
830
- .catch((err) => {
831
- if (err.message && err.message !== 'canceled') {
832
- this.$message.error(err.message);
833
- }
834
- });
835
- }
836
- }
837
- },
838
- searchTree(res) {
839
- if (res) {
840
- this.loading = true;
841
- let params = util.extend({}, this.newTabs[this.activeName].param, {
842
- seachkey: res
843
- });
844
- this.getTreeData(this.host + this.newTabs[this.activeName].url, params);
845
- } else {
846
- this.$set(
847
- this.trees[this.activeName],
848
- 'data',
849
- this.defaults[this.activeName].data
850
- );
851
- }
852
- },
853
- handleCheckAll(res) {
854
- if (this.checkboxs.length > 0) {
855
- let isObject = util.isObject(this.checkboxs[0]);
856
- if (res) {
857
- if (this.isShowTree) {
858
- this.nodeData.checkAll = true;
859
- let checkeds = this.checkeds.concat(
860
- this.checkboxs.filter((item) => {
861
- return item.disabled !== true;
862
- })
863
- );
864
- if (checkeds.length > 0) {
865
- this.checkeds = util.arrUnique(
866
- checkeds,
867
- isObject ? this.valueKey : undefined
868
- );
869
- }
870
- } else {
871
- this.checkeds = this.checkboxs;
872
- }
873
- } else {
874
- if (this.isShowTree) {
875
- this.nodeData.checkAll = false;
876
- this.checkboxs.forEach((element) => {
877
- for (let i in this.checkeds) {
878
- if (
879
- (isObject &&
880
- this.checkeds[i][this.valueKey] ===
881
- element[this.valueKey]) ||
882
- this.checkeds[i] === element
883
- ) {
884
- this.checkeds.splice(i, 1);
885
- break;
886
- }
887
- }
888
- });
889
- } else {
890
- this.checkeds = [];
891
- }
892
- }
893
- }
894
- },
895
- handleSelect(res) {
896
- if (this.nodeData) {
897
- this.nodeData.selection = '';
898
- this.loadsub(this.nodeData, '', true);
899
- }
900
- this.$emit('filtratechage', this.trees, this.activeName);
901
- },
902
- handleChangeSearch() {
903
- if (this.search === '') {
904
- if (this.isShowTree) {
905
- this.checkboxs = this.nodeData.selection;
906
- } else {
907
- this.checkboxs = this.selections;
908
- }
909
- } else {
910
- if (this.isShowTree) {
911
- if (this.nodeData && this.nodeData.selection) {
912
- let arry = [];
913
- this.nodeData.selection.forEach((item) => {
914
- if (util.isObject(item)) {
915
- if (item[this.labelKey].indexOf(this.search) > -1) {
916
- arry.push(item);
917
- }
918
- } else {
919
- if (item.indexOf(this.search) > -1) {
920
- arry.push(item);
921
- }
922
- }
923
- });
924
- this.checkboxs = arry;
925
- }
926
- } else {
927
- let arry = [];
928
- this.selections.forEach((item) => {
929
- if (util.isObject(item)) {
930
- if (item[this.labelKey].indexOf(this.search) > -1) {
931
- arry.push(item);
932
- }
933
- } else {
934
- if (item.indexOf(this.search) > -1) {
935
- arry.push(item);
936
- }
937
- }
938
- });
939
- this.checkboxs = arry;
940
- }
941
- }
942
- },
943
- handleSearch() {
944
- if (this.isShowTree) {
945
- if (this.nodeData && this.nodeData.selection) {
946
- if (this.search !== '') {
947
- let arry = [];
948
- this.nodeData.selection.forEach((item) => {
949
- if (util.isObject(item)) {
950
- if (item[this.labelKey].indexOf(this.search) > -1) {
951
- arry.push(item);
952
- }
953
- } else {
954
- if (item.indexOf(this.search) > -1) {
955
- arry.push(item);
956
- }
957
- }
958
- });
959
- this.checkboxs = arry;
960
- }
961
- } else {
962
- let mid = '0-0-0-0-0';
963
- if (this.nodeData) {
964
- mid = this.nodeData.id;
965
- }
966
- util
967
- .ajax({
968
- url: this.selection,
969
- params: {
970
- mid: mid,
971
- querymode: this.selectValue,
972
- type: this.activeName,
973
- namelike: this.search
974
- }
975
- })
976
- .then((res) => {
977
- if (res.rCode === 0) {
978
- this.checkboxs = JSON.parse(JSON.stringify(res.results));
979
- }
980
- })
981
- .catch((err) => {
982
- if (err.message && err.message !== 'canceled') {
983
- this.$message.error(err.message);
984
- }
985
- });
986
- }
987
- } else {
988
- if (this.search !== '') {
989
- let arry = [];
990
- this.selections.forEach((item) => {
991
- if (util.isObject(item)) {
992
- if (item[this.labelKey].indexOf(this.search) > -1) {
993
- arry.push(item);
994
- }
995
- } else {
996
- if (item.indexOf(this.search) > -1) {
997
- arry.push(item);
998
- }
999
- }
1000
- });
1001
- this.checkboxs = arry;
1002
- }
1003
- }
1004
- },
1005
- handleClick() {
1006
- this.$emit('tabschage', this.trees, this.activeName);
1007
- },
1008
- handleChange() {},
1009
- handleConfirm() {
1010
- if (!this.checkeds || (this.multiple && this.checkeds.length === 0)) {
1011
- this.$message({
1012
- message: '请选择',
1013
- type: 'warning'
1014
- });
1015
- } else {
1016
- this.$emit('input', this.checkeds);
1017
- this.$emit('confirm', this.checkeds);
1018
- }
1019
- },
1020
- handleCancel() {
1021
- this.$emit('cancel', false);
1022
- },
1023
- handleSort(res) {
1024
- let oldIndex = res.oldIndex;
1025
- let newIndex = res.newIndex;
1026
-
1027
- this.checkeds.splice(newIndex, 0, this.checkeds[oldIndex]);
1028
- if (oldIndex > newIndex) {
1029
- this.checkeds.splice(oldIndex + 1, 1);
1030
- } else {
1031
- this.checkeds.splice(oldIndex, 1);
1032
- }
1033
- }
1034
- }
1035
- };
1036
- </script>
1
+ <template>
2
+ <es-tabs
3
+ v-model="activeName"
4
+ class="es-selector-panel"
5
+ mold="border-card"
6
+ :style="styles"
7
+ @tab-click="handleClick"
8
+ >
9
+ <el-tab-pane
10
+ v-for="items in trees"
11
+ :key="items.label"
12
+ :label="items.label"
13
+ :name="items.name"
14
+ class="es-selector-content"
15
+ >
16
+ <div class="es-selector-view">
17
+ <tree
18
+ v-if="isShowTree"
19
+ :data="items.data"
20
+ :loading="loading"
21
+ @loadsub="loadsub"
22
+ @search="searchTree"
23
+ ></tree>
24
+ <div class="es-selector-selection">
25
+ <el-form
26
+ ref="form"
27
+ @submit.native.prevent
28
+ :inline="true"
29
+ :model="form"
30
+ class="es-selector-selection-toolbar"
31
+ v-if="multiple || isShowTree"
32
+ >
33
+ <el-form-item>
34
+ <es-switch v-model="showDisabled" :data="options"></es-switch>
35
+ </el-form-item>
36
+ <el-form-item>
37
+ <el-checkbox
38
+ v-show="multiple && !max"
39
+ v-model="checkAll"
40
+ @change="handleCheckAll"
41
+ >
42
+ 全选
43
+ </el-checkbox>
44
+ </el-form-item>
45
+ <div class="es-float-right" v-if="isShowTree">
46
+ <el-form-item v-if="showSelect && activeName == 'enterprise'">
47
+ <es-select
48
+ v-model="selectValue"
49
+ placeholder="请选择"
50
+ @change="handleSelect"
51
+ >
52
+ <el-option
53
+ v-for="item in filtrate.options"
54
+ :key="item.value"
55
+ :label="item.name"
56
+ :value="item.value"
57
+ ></el-option>
58
+ </es-select>
59
+ </el-form-item>
60
+ <el-form-item>
61
+ <el-input
62
+ v-model="search"
63
+ placeholder="请输入搜索关键字"
64
+ @change="handleChangeSearch"
65
+ >
66
+ <template slot="append">
67
+ <el-button
68
+ icon="el-icon-search"
69
+ type="primary"
70
+ @click="handleSearch"
71
+ ></el-button>
72
+ </template>
73
+ </el-input>
74
+ </el-form-item>
75
+ </div>
76
+ </el-form>
77
+ <selection
78
+ v-model="checkeds"
79
+ :data="checkboxs"
80
+ :value-key="valueKey"
81
+ :label-key="labelKey"
82
+ :multiple="mix ? mix : multiple"
83
+ :max="max"
84
+ :showTooltip="showTooltip"
85
+ :showDisabled="showDisabled"
86
+ :disableds="disableds"
87
+ ></selection>
88
+ <selection
89
+ v-model="checkeds"
90
+ genre="delete"
91
+ :data="Array.isArray(checkeds) ? checkeds : [checkeds]"
92
+ :value-key="valueKey"
93
+ :label-key="labelKey"
94
+ :showTooltip="showTooltip"
95
+ :multiple="multiple"
96
+ :max="max"
97
+ :mix="mix"
98
+ :isSort="true"
99
+ @sort="handleSort"
100
+ ></selection>
101
+ </div>
102
+ </div>
103
+ <div class="es-selector-handle">
104
+ <span v-if="multiple && checkeds.length > 0" style="margin-right: 20px;color:red">
105
+ 已选 {{ checkeds.length }}
106
+ </span>
107
+ <el-button type="primary" size="small" @click="handleConfirm"
108
+ >确定</el-button
109
+ >
110
+ <el-button size="small" @click="handleCancel">取消</el-button>
111
+ </div>
112
+ </el-tab-pane>
113
+ </es-tabs>
114
+ </template>
115
+ <script>
116
+ import tree from './tree.vue';
117
+ import selection from './selection.vue';
118
+ import {
119
+ getSelectorOrgTree,
120
+ getSelectorOrgDetail
121
+ } from 'eoss-ui/src/config/api.js';
122
+ import { debounce } from 'throttle-debounce';
123
+ import util from 'eoss-ui/src/utils/util.js';
124
+ export default {
125
+ name: 'EsSelectorPanel',
126
+ inheritAttrs: false,
127
+ components: {
128
+ tree,
129
+ selection
130
+ },
131
+ props: {
132
+ isShowLevel3: {
133
+ type: Boolean,
134
+ default: true
135
+ },
136
+ method: {
137
+ type: String,
138
+ default: 'get'
139
+ },
140
+ host: {
141
+ type: String,
142
+ default: ''
143
+ },
144
+ value: [Array, Object, String],
145
+ width: {
146
+ type: String,
147
+ default: '900px'
148
+ },
149
+ height: {
150
+ type: String,
151
+ default: '560px'
152
+ },
153
+ //树结构
154
+ tree: {
155
+ type: Boolean,
156
+ default: true
157
+ },
158
+ type: {
159
+ type: Array,
160
+ default() {
161
+ return ['enterprise', 'person'];
162
+ }
163
+ },
164
+ active: String,
165
+ //是否替换页签
166
+ replace: {
167
+ type: Boolean,
168
+ default: false
169
+ },
170
+ showTooltip: {
171
+ type: Boolean,
172
+ default: true
173
+ },
174
+ //页签
175
+ tabs: Object,
176
+ filtrate: {
177
+ type: [Boolean, Object],
178
+ default() {
179
+ return {
180
+ show: true,
181
+ value: '1',
182
+ options: [
183
+ {
184
+ value: '1',
185
+ name: '直接下级'
186
+ },
187
+ {
188
+ value: '2',
189
+ name: '所有下级'
190
+ }
191
+ ]
192
+ };
193
+ }
194
+ },
195
+ selection: {
196
+ type: [String, Array],
197
+ default: getSelectorOrgDetail
198
+ },
199
+ param: {
200
+ type: Object,
201
+ default() {
202
+ return {};
203
+ }
204
+ },
205
+ valueKey: {
206
+ type: String,
207
+ default: 'showid'
208
+ },
209
+ labelKey: {
210
+ type: String,
211
+ default: 'showname'
212
+ },
213
+ form: {
214
+ type: Object,
215
+ default() {
216
+ return {};
217
+ }
218
+ },
219
+ multiple: {
220
+ type: Boolean,
221
+ default: true
222
+ },
223
+ max: Number,
224
+ mix: Boolean,
225
+ disableds: {
226
+ type: Array,
227
+ default() {
228
+ return [];
229
+ }
230
+ }
231
+ },
232
+ data() {
233
+ return {
234
+ styles: { width: this.width, height: this.height },
235
+ loading: true,
236
+ search: '',
237
+ defaults: '',
238
+ trees: '',
239
+ checkAll: false,
240
+ selectValue: this.filtrate.value,
241
+ orgpath: false,
242
+ nodeData: '',
243
+ activeName: '',
244
+ selections: [],
245
+ checkboxs: [],
246
+ checkeds: null,
247
+ showDisabled: true,
248
+ options: [
249
+ {
250
+ value: true,
251
+ name: '展示'
252
+ },
253
+ {
254
+ value: false,
255
+ name: '过滤'
256
+ }
257
+ ]
258
+ };
259
+ },
260
+ computed: {
261
+ //是否显示树结构
262
+ isShowTree() {
263
+ if (typeof this.selection === 'object' && Array.isArray(this.selection)) {
264
+ return false;
265
+ } else {
266
+ return this.tree;
267
+ }
268
+ },
269
+ showSelect() {
270
+ if (typeof this.filtrate === 'object') {
271
+ return this.filtrate.show;
272
+ } else {
273
+ return false;
274
+ }
275
+ },
276
+ actived: {
277
+ get() {
278
+ return this.active ? this.active : this.type[0];
279
+ },
280
+ set(val) {
281
+ return val;
282
+ }
283
+ },
284
+ newTabs() {
285
+ const orgId = util.getStorage('orgId');
286
+ const tabs = {
287
+ enterprise: {
288
+ label: '选择单位',
289
+ name: 'enterprise',
290
+ url: getSelectorOrgTree,
291
+ data: [],
292
+ nodeData: '',
293
+ selection: [],
294
+ value: [],
295
+ param: {
296
+ showarea: 1,
297
+ id: 0,
298
+ filid: 'all'
299
+ }
300
+ },
301
+ department: {
302
+ label: '选择部门',
303
+ name: 'department',
304
+ url: getSelectorOrgTree,
305
+ data: [],
306
+ nodeData: '',
307
+ selection: [],
308
+ value: [],
309
+ param: {
310
+ showarea: 0,
311
+ id: 0,
312
+ filid: 'all'
313
+ }
314
+ },
315
+ employee: {
316
+ label: '选择用户',
317
+ name: 'employee',
318
+ url: getSelectorOrgTree,
319
+ data: [],
320
+ nodeData: '',
321
+ selection: [],
322
+ value: [],
323
+ param: {
324
+ showarea: 0,
325
+ id: 0,
326
+ filid: 'all'
327
+ }
328
+ },
329
+ myemployee: {
330
+ label: '本单位用户',
331
+ name: 'myemployee',
332
+ url: getSelectorOrgTree,
333
+ data: [],
334
+ nodeData: '',
335
+ selection: [],
336
+ value: [],
337
+ param: {
338
+ showarea: 2,
339
+ id: 0,
340
+ filid: orgId
341
+ }
342
+ },
343
+ otheremployee: {
344
+ label: '外单位用户',
345
+ name: 'otheremployee',
346
+ url: getSelectorOrgTree,
347
+ data: [],
348
+ nodeData: '',
349
+ selection: [],
350
+ value: [],
351
+ param: {
352
+ showarea: 0,
353
+ id: 0,
354
+ filid: 'all'
355
+ }
356
+ },
357
+ person: {
358
+ label: '选择人员',
359
+ name: 'person',
360
+ url: getSelectorOrgTree,
361
+ data: [],
362
+ nodeData: '',
363
+ selection: [],
364
+ value: [],
365
+ param: {
366
+ showarea: 0,
367
+ id: 0,
368
+ filid: 'all'
369
+ }
370
+ },
371
+ otherperson: {
372
+ label: '外单位人员',
373
+ name: 'otherperson',
374
+ url: getSelectorOrgTree,
375
+ data: [],
376
+ nodeData: '',
377
+ selection: [],
378
+ value: [],
379
+ param: {
380
+ showarea: 0,
381
+ id: 0,
382
+ filid: 'all'
383
+ }
384
+ },
385
+ persongroup: {
386
+ label: '选择群组成员',
387
+ name: 'persongroup',
388
+ url: getSelectorOrgTree,
389
+ data: [],
390
+ nodeData: '',
391
+ selection: [],
392
+ value: [],
393
+ param: {
394
+ showarea: 3,
395
+ id: 0,
396
+ filid: 'all'
397
+ }
398
+ },
399
+ filgroup: {
400
+ label: '单位群组成员',
401
+ data: [],
402
+ nodeData: '',
403
+ selection: [],
404
+ value: [],
405
+ name: 'filgroup',
406
+ url: getSelectorOrgTree,
407
+ param: {
408
+ showarea: 4,
409
+ id: 0,
410
+ filid: 'all'
411
+ }
412
+ },
413
+ depgroup: {
414
+ label: '部门群组成员',
415
+ name: 'depgroup',
416
+ url: getSelectorOrgTree,
417
+ data: [],
418
+ nodeData: '',
419
+ selection: [],
420
+ value: [],
421
+ param: {
422
+ showarea: 5,
423
+ id: 0,
424
+ filid: 'all'
425
+ }
426
+ },
427
+ persongroupobj: {
428
+ label: '人员群组',
429
+ name: 'persongroupobj',
430
+ url: getSelectorOrgTree,
431
+ data: [],
432
+ nodeData: '',
433
+ selection: [],
434
+ value: [],
435
+ param: {
436
+ showarea: 11,
437
+ id: 0,
438
+ filid: 'all'
439
+ }
440
+ },
441
+ filgroupobj: {
442
+ label: '单位群组',
443
+ name: 'filgroupobj',
444
+ url: getSelectorOrgTree,
445
+ data: [],
446
+ nodeData: '',
447
+ selection: [],
448
+ value: [],
449
+ param: {
450
+ showarea: 13,
451
+ id: 0,
452
+ filid: 'all'
453
+ }
454
+ },
455
+ depgroupobj: {
456
+ label: '部门群组',
457
+ name: 'depgroupobj',
458
+ url: getSelectorOrgTree,
459
+ data: [],
460
+ nodeData: '',
461
+ selection: [],
462
+ value: [],
463
+ param: {
464
+ showarea: 14,
465
+ id: 0,
466
+ filid: 'all'
467
+ }
468
+ },
469
+ role: {
470
+ label: '选择角色',
471
+ name: 'role',
472
+ url: getSelectorOrgTree,
473
+ data: [],
474
+ nodeData: '',
475
+ selection: [],
476
+ value: [],
477
+ param: {
478
+ showarea: 6,
479
+ id: 0,
480
+ filid: 'all'
481
+ }
482
+ },
483
+ post: {
484
+ label: '选择岗位',
485
+ name: 'post',
486
+ url: getSelectorOrgTree,
487
+ data: [],
488
+ nodeData: '',
489
+ selection: [],
490
+ value: [],
491
+ param: {
492
+ showarea: 8,
493
+ id: 0,
494
+ filid: 'all'
495
+ }
496
+ },
497
+ codetable: {
498
+ label: '代码表',
499
+ name: 'codetable',
500
+ url: getSelectorOrgTree,
501
+ data: [],
502
+ nodeData: '',
503
+ selection: [],
504
+ value: [],
505
+ param: {
506
+ showarea: 10,
507
+ id: 0,
508
+ filid: 'all'
509
+ }
510
+ },
511
+ topcontacts: {
512
+ label: '常用联系人',
513
+ name: 'topcontacts',
514
+ url: getSelectorOrgTree,
515
+ data: [],
516
+ nodeData: '',
517
+ selection: [],
518
+ value: [],
519
+ param: {
520
+ showarea: 9,
521
+ id: 0,
522
+ filid: 'all'
523
+ }
524
+ }
525
+ };
526
+ if (this.tabs) {
527
+ if (this.replace) {
528
+ return this.tabs;
529
+ } else {
530
+ return util.extend(true, tabs, this.tabs);
531
+ }
532
+ }
533
+ return tabs;
534
+ }
535
+ },
536
+ watch: {
537
+ type: {
538
+ immediate: true,
539
+ deep: true,
540
+ handler(val, old) {
541
+ if (
542
+ old === undefined ||
543
+ new Set([...val, ...old]).size !== val.length
544
+ ) {
545
+ var obj = {};
546
+ this.activeName = this.actived;
547
+ if (this.isShowTree) {
548
+ for (let i in val) {
549
+ obj[val[i]] = this.newTabs[val[i]];
550
+ }
551
+ } else {
552
+ obj[this.activeName] = this.newTabs[this.activeName];
553
+ }
554
+ this.trees = obj;
555
+ this.defaults = JSON.parse(JSON.stringify(obj));
556
+ }
557
+ }
558
+ },
559
+ activeName: {
560
+ handler(val) {
561
+ this.ajaxActive(val);
562
+ }
563
+ },
564
+ tabs: {
565
+ deep: true,
566
+ handler() {
567
+ this.loading = true;
568
+ this.getTreeData(
569
+ this.host + this.newTabs[this.activeName].url,
570
+ this.newTabs[this.activeName].param
571
+ );
572
+ }
573
+ },
574
+ value: {
575
+ immediate: true,
576
+ handler(val) {
577
+ if (val !== undefined) {
578
+ this.trees[this.activeName].value = JSON.parse(JSON.stringify(val));
579
+ } else {
580
+ this.trees[this.activeName].value = '';
581
+ }
582
+ this.checkeds = this.trees[this.activeName].value || [];
583
+ }
584
+ },
585
+ checkboxs(val) {
586
+ let flag = this.checkboxs.length ? true : false;
587
+ this.checkboxs.forEach((item) => {
588
+ if (util.isObject(item)) {
589
+ if (util.indexOfObj(this.checkeds, item) === -1) {
590
+ flag = false;
591
+ return;
592
+ }
593
+ } else {
594
+ if (this.checkeds.indexOf(item) === -1) {
595
+ flag = false;
596
+ return;
597
+ }
598
+ }
599
+ });
600
+ this.checkAll = flag;
601
+ },
602
+ checkeds(res, old) {
603
+ let val = res;
604
+ // if (!Array.isArray(val)) {
605
+ // this.checkeds = [res];
606
+ // return;
607
+ // }
608
+ if (old.length > 0) {
609
+ if (val.length < old.length) {
610
+ this.checkAll = false;
611
+ } else {
612
+ let flag = true;
613
+ this.checkboxs.forEach((item) => {
614
+ if (util.isObject(item)) {
615
+ if (util.indexOfObj(val, item) === -1) {
616
+ flag = false;
617
+ return;
618
+ }
619
+ } else {
620
+ if (val.indexOf(item) === -1) {
621
+ flag = false;
622
+ return;
623
+ }
624
+ }
625
+ });
626
+ this.checkAll = flag;
627
+ }
628
+ }
629
+ this.trees[this.activeName].value = val;
630
+ }
631
+ },
632
+ beforeCreate() {
633
+ this.ajaxActive = debounce(500, (active) => {
634
+ this.getAjaxActive(active);
635
+ });
636
+ },
637
+ created() {},
638
+ mounted() {
639
+ this.ajaxActive(this.activeName);
640
+ },
641
+ methods: {
642
+ getAjaxActive(active) {
643
+ if (this.isShowTree) {
644
+ if (
645
+ (!this.trees[active].data ||
646
+ (this.trees[active].data &&
647
+ this.trees[active].data.length === 0)) &&
648
+ this.newTabs[active].url
649
+ ) {
650
+ this.loading = true;
651
+ this.getTreeData(
652
+ this.host + this.newTabs[active].url,
653
+ this.newTabs[active].param
654
+ );
655
+ }
656
+ if (
657
+ !this.trees[active].value ||
658
+ (this.trees[active].value && this.trees[active].value.length === 0)
659
+ ) {
660
+ if (this.value !== undefined) {
661
+ this.trees[active].value = JSON.parse(JSON.stringify(this.value));
662
+ }
663
+ }
664
+ this.checkboxs = this.trees[active].selection || [];
665
+ if (!this.mix) {
666
+ this.checkeds = this.trees[active].value || [];
667
+ }
668
+ this.nodeData = this.trees[active].nodeData;
669
+ } else {
670
+ if (typeof this.selection === 'string') {
671
+ let params = this.param[this.activeName]
672
+ ? this.param[this.activeName]
673
+ : this.param;
674
+ util
675
+ .ajax({
676
+ method: this.method,
677
+ url: this.host + this.selection,
678
+ params: params,
679
+ data: params
680
+ })
681
+ .then((res) => {
682
+ if (res.rCode === 0) {
683
+ this.selections = JSON.parse(JSON.stringify(res.results));
684
+ this.checkboxs = JSON.parse(JSON.stringify(res.results)) || [];
685
+ }
686
+ })
687
+ .catch((err) => {
688
+ if (err.message && err.message !== 'canceled') {
689
+ this.$message.error(err.message);
690
+ }
691
+ });
692
+ } else {
693
+ this.selections = this.selection;
694
+ this.checkboxs = this.selection || [];
695
+ }
696
+ }
697
+ },
698
+ getTreeData(url, params, id) {
699
+ let data = util.extend(
700
+ {},
701
+ params,
702
+ this.param[this.activeName] ? this.param[this.activeName] : this.param
703
+ );
704
+ if (id !== undefined) {
705
+ data.id = id;
706
+ }
707
+ util
708
+ .ajax({ method: this.method, url: url, params: data, data: data })
709
+ .then((res) => {
710
+ if (res.rCode === 0) {
711
+ this.loading = false;
712
+ if (!Object.prototype.hasOwnProperty.call(params, 'seachkey')) {
713
+ this.$set(
714
+ this.defaults[this.activeName],
715
+ 'data',
716
+ JSON.parse(JSON.stringify(res.results))
717
+ );
718
+ }
719
+ if (res.results.length && res.results[0].name === '无搜索数据') {
720
+ this.$set(this.trees[this.activeName], 'data', null);
721
+ } else {
722
+ this.$set(
723
+ this.trees[this.activeName],
724
+ 'data',
725
+ JSON.parse(JSON.stringify(res.results))
726
+ );
727
+ }
728
+ }
729
+ })
730
+ .catch((err) => {
731
+ if (err.message && err.message !== 'canceled') {
732
+ this.$message.error(err.message);
733
+ }
734
+ });
735
+ },
736
+ loadsub(data, node, flag) {
737
+ node;
738
+ if (flag) {
739
+ if (data.selection === undefined || data.selection.length === 0) {
740
+ this.checkAll = false;
741
+ let params = util.extend(
742
+ {},
743
+ this.param[this.activeName]
744
+ ? this.param[this.activeName]
745
+ : this.param
746
+ );
747
+ params.type = this.activeName;
748
+ params.mid = data.id;
749
+ if (this.activeName === 'enterprise') {
750
+ params.querymode = this.selectValue;
751
+ if (this.selectValue === '2' || this.selectValue === 2) {
752
+ params.orgpath =
753
+ data.attributes && data.attributes.orgpath
754
+ ? data.attributes.orgpath
755
+ : '';
756
+ }
757
+ }
758
+ // if (this.activeName === 'department') {
759
+ // params.querymode = 0;
760
+ // }
761
+ util
762
+ .ajax({
763
+ method: this.method,
764
+ url: this.host + this.selection,
765
+ params: params,
766
+ data: params
767
+ })
768
+ .then((res) => {
769
+ if (res.rCode === 0) {
770
+ data.selection = JSON.parse(JSON.stringify(res.results));
771
+ this.$set(
772
+ this.trees[this.activeName],
773
+ 'selection',
774
+ JSON.parse(JSON.stringify(res.results))
775
+ );
776
+ this.$set(this.trees[this.activeName], 'nodeData', data);
777
+ this.nodeData = this.trees[this.activeName].nodeData;
778
+ this.checkboxs = this.trees[this.activeName].selection;
779
+ }
780
+ })
781
+ .catch((err) => {
782
+ if (err.message && err.message !== 'canceled') {
783
+ this.$message.error(err.message);
784
+ }
785
+ });
786
+ } else {
787
+ this.trees[this.activeName].selection = data.selection;
788
+ this.trees[this.activeName].nodeData = data;
789
+ this.nodeData = this.trees[this.activeName].nodeData;
790
+ this.checkboxs = this.trees[this.activeName].selection;
791
+ }
792
+ } else {
793
+ if (!this.isShowLevel3) {
794
+ data.state = '';
795
+ }
796
+ if (
797
+ data.state !== '' &&
798
+ (!data.children || data.children.length === 0)
799
+ ) {
800
+ let params = util.extend(
801
+ {},
802
+ this.newTabs[this.activeName].param,
803
+ this.param[this.activeName]
804
+ ? this.param[this.activeName]
805
+ : this.param
806
+ );
807
+ params.id = data.id;
808
+ util
809
+ .ajax({
810
+ method: this.method,
811
+ url: this.host + this.newTabs[this.activeName].url,
812
+ data: params,
813
+ params: params
814
+ })
815
+ .then((res) => {
816
+ if (res.rCode === 0) {
817
+ this.loading = false;
818
+ this.$set(
819
+ data,
820
+ 'children',
821
+ JSON.parse(JSON.stringify(res.results))
822
+ );
823
+ this.$set(
824
+ this.defaults[this.activeName],
825
+ 'data',
826
+ JSON.parse(JSON.stringify(this.trees[this.activeName].data))
827
+ );
828
+ }
829
+ })
830
+ .catch((err) => {
831
+ if (err.message && err.message !== 'canceled') {
832
+ this.$message.error(err.message);
833
+ }
834
+ });
835
+ }
836
+ }
837
+ },
838
+ searchTree(res) {
839
+ if (res) {
840
+ this.loading = true;
841
+ let params = util.extend({}, this.newTabs[this.activeName].param, {
842
+ seachkey: res
843
+ });
844
+ this.getTreeData(this.host + this.newTabs[this.activeName].url, params);
845
+ } else {
846
+ this.$set(
847
+ this.trees[this.activeName],
848
+ 'data',
849
+ this.defaults[this.activeName].data
850
+ );
851
+ }
852
+ },
853
+ handleCheckAll(res) {
854
+ if (this.checkboxs.length > 0) {
855
+ let isObject = util.isObject(this.checkboxs[0]);
856
+ if (res) {
857
+ if (this.isShowTree) {
858
+ this.nodeData.checkAll = true;
859
+ let checkeds = this.checkeds.concat(
860
+ this.checkboxs.filter((item) => {
861
+ return item.disabled !== true;
862
+ })
863
+ );
864
+ if (checkeds.length > 0) {
865
+ this.checkeds = util.arrUnique(
866
+ checkeds,
867
+ isObject ? this.valueKey : undefined
868
+ );
869
+ }
870
+ } else {
871
+ this.checkeds = this.checkboxs;
872
+ }
873
+ } else {
874
+ if (this.isShowTree) {
875
+ this.nodeData.checkAll = false;
876
+ this.checkboxs.forEach((element) => {
877
+ for (let i in this.checkeds) {
878
+ if (
879
+ (isObject &&
880
+ this.checkeds[i][this.valueKey] ===
881
+ element[this.valueKey]) ||
882
+ this.checkeds[i] === element
883
+ ) {
884
+ this.checkeds.splice(i, 1);
885
+ break;
886
+ }
887
+ }
888
+ });
889
+ } else {
890
+ this.checkeds = [];
891
+ }
892
+ }
893
+ }
894
+ },
895
+ handleSelect(res) {
896
+ if (this.nodeData) {
897
+ this.nodeData.selection = '';
898
+ this.loadsub(this.nodeData, '', true);
899
+ }
900
+ this.$emit('filtratechage', this.trees, this.activeName);
901
+ },
902
+ handleChangeSearch() {
903
+ if (this.search === '') {
904
+ if (this.isShowTree) {
905
+ this.checkboxs = this.nodeData.selection;
906
+ } else {
907
+ this.checkboxs = this.selections;
908
+ }
909
+ } else {
910
+ if (this.isShowTree) {
911
+ if (this.nodeData && this.nodeData.selection) {
912
+ let arry = [];
913
+ this.nodeData.selection.forEach((item) => {
914
+ if (util.isObject(item)) {
915
+ if (item[this.labelKey].indexOf(this.search) > -1) {
916
+ arry.push(item);
917
+ }
918
+ } else {
919
+ if (item.indexOf(this.search) > -1) {
920
+ arry.push(item);
921
+ }
922
+ }
923
+ });
924
+ this.checkboxs = arry;
925
+ }
926
+ } else {
927
+ let arry = [];
928
+ this.selections.forEach((item) => {
929
+ if (util.isObject(item)) {
930
+ if (item[this.labelKey].indexOf(this.search) > -1) {
931
+ arry.push(item);
932
+ }
933
+ } else {
934
+ if (item.indexOf(this.search) > -1) {
935
+ arry.push(item);
936
+ }
937
+ }
938
+ });
939
+ this.checkboxs = arry;
940
+ }
941
+ }
942
+ },
943
+ handleSearch() {
944
+ if (this.isShowTree) {
945
+ if (this.nodeData && this.nodeData.selection) {
946
+ if (this.search !== '') {
947
+ let arry = [];
948
+ this.nodeData.selection.forEach((item) => {
949
+ if (util.isObject(item)) {
950
+ if (item[this.labelKey].indexOf(this.search) > -1) {
951
+ arry.push(item);
952
+ }
953
+ } else {
954
+ if (item.indexOf(this.search) > -1) {
955
+ arry.push(item);
956
+ }
957
+ }
958
+ });
959
+ this.checkboxs = arry;
960
+ }
961
+ } else {
962
+ let mid = '0-0-0-0-0';
963
+ if (this.nodeData) {
964
+ mid = this.nodeData.id;
965
+ }
966
+ util
967
+ .ajax({
968
+ url: this.selection,
969
+ params: {
970
+ mid: mid,
971
+ querymode: this.selectValue,
972
+ type: this.activeName,
973
+ namelike: this.search
974
+ }
975
+ })
976
+ .then((res) => {
977
+ if (res.rCode === 0) {
978
+ this.checkboxs = JSON.parse(JSON.stringify(res.results));
979
+ }
980
+ })
981
+ .catch((err) => {
982
+ if (err.message && err.message !== 'canceled') {
983
+ this.$message.error(err.message);
984
+ }
985
+ });
986
+ }
987
+ } else {
988
+ if (this.search !== '') {
989
+ let arry = [];
990
+ this.selections.forEach((item) => {
991
+ if (util.isObject(item)) {
992
+ if (item[this.labelKey].indexOf(this.search) > -1) {
993
+ arry.push(item);
994
+ }
995
+ } else {
996
+ if (item.indexOf(this.search) > -1) {
997
+ arry.push(item);
998
+ }
999
+ }
1000
+ });
1001
+ this.checkboxs = arry;
1002
+ }
1003
+ }
1004
+ },
1005
+ handleClick() {
1006
+ this.$emit('tabschage', this.trees, this.activeName);
1007
+ },
1008
+ handleChange() {},
1009
+ handleConfirm() {
1010
+ if (!this.checkeds || (this.multiple && this.checkeds.length === 0)) {
1011
+ this.$message({
1012
+ message: '请选择',
1013
+ type: 'warning'
1014
+ });
1015
+ } else {
1016
+ this.$emit('input', this.checkeds);
1017
+ this.$emit('confirm', this.checkeds);
1018
+ }
1019
+ },
1020
+ handleCancel() {
1021
+ this.$emit('cancel', false);
1022
+ },
1023
+ handleSort(res) {
1024
+ let oldIndex = res.oldIndex;
1025
+ let newIndex = res.newIndex;
1026
+
1027
+ this.checkeds.splice(newIndex, 0, this.checkeds[oldIndex]);
1028
+ if (oldIndex > newIndex) {
1029
+ this.checkeds.splice(oldIndex + 1, 1);
1030
+ } else {
1031
+ this.checkeds.splice(oldIndex, 1);
1032
+ }
1033
+ }
1034
+ }
1035
+ };
1036
+ </script>