eoss-ui 0.6.37 → 0.6.39

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