eoss-mobiles 0.3.97 → 0.3.99

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 (213) hide show
  1. package/lib/checkbox.js +21 -0
  2. package/lib/eoss-mobile.common.js +284 -123
  3. package/lib/flow-btn.js +21 -0
  4. package/lib/flow-list.js +21 -0
  5. package/lib/flow.js +244 -83
  6. package/lib/index.js +1 -1
  7. package/lib/picker.js +27 -6
  8. package/lib/radio.js +26 -5
  9. package/lib/retrial-auth.js +21 -0
  10. package/lib/selector.js +49 -28
  11. package/lib/table-column.js +21 -0
  12. package/lib/table.js +21 -0
  13. package/lib/theme-chalk/fonts/iconfont.scss +98 -98
  14. package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
  15. package/lib/uploader.js +21 -0
  16. package/lib/utils/util.js +21 -0
  17. package/package.json +1 -1
  18. package/packages/action-sheet/index.js +5 -5
  19. package/packages/action-sheet/src/main.vue +32 -32
  20. package/packages/button/index.js +5 -5
  21. package/packages/button/src/main.vue +15 -15
  22. package/packages/button-group/index.js +5 -5
  23. package/packages/button-group/src/main.vue +80 -80
  24. package/packages/calendar/index.js +5 -5
  25. package/packages/calendar/src/main.vue +34 -34
  26. package/packages/cascader/index.js +5 -5
  27. package/packages/cascader/src/main.vue +39 -39
  28. package/packages/cell/index.js +5 -5
  29. package/packages/cell/src/main.vue +77 -77
  30. package/packages/checkbox/index.js +5 -5
  31. package/packages/checkbox/src/main.vue +232 -232
  32. package/packages/circle/index.js +5 -5
  33. package/packages/circle/src/main.vue +27 -27
  34. package/packages/count-down/index.js +5 -5
  35. package/packages/count-down/src/main.vue +27 -27
  36. package/packages/date/index.js +5 -5
  37. package/packages/date/src/date-time.vue +290 -290
  38. package/packages/date/src/main.vue +401 -401
  39. package/packages/empty/index.js +5 -5
  40. package/packages/empty/src/main.vue +16 -16
  41. package/packages/esign/index.js +5 -5
  42. package/packages/esign/src/main.vue +144 -144
  43. package/packages/field/index.js +5 -5
  44. package/packages/flow/index.js +5 -5
  45. package/packages/flow/src/components/Circulate.vue +595 -595
  46. package/packages/flow/src/components/Handle.vue +2404 -2404
  47. package/packages/flow/src/components/Message.vue +208 -208
  48. package/packages/flow/src/components/ProcessSettings.vue +342 -342
  49. package/packages/flow/src/components/TaskRead.vue +100 -4
  50. package/packages/flow/src/components/supervise.vue +139 -139
  51. package/packages/flow/src/flowMix.js +288 -288
  52. package/packages/flow/src/main.vue +116 -116
  53. package/packages/flow-btn/index.js +5 -5
  54. package/packages/flow-btn/src/main.vue +494 -494
  55. package/packages/flow-list/index.js +5 -5
  56. package/packages/flow-list/src/main.vue +248 -248
  57. package/packages/form/index.js +5 -5
  58. package/packages/grid/index.js +5 -5
  59. package/packages/grid/src/main.vue +486 -486
  60. package/packages/grid-item/index.js +5 -5
  61. package/packages/grid-item/src/main.vue +16 -16
  62. package/packages/image/index.js +5 -5
  63. package/packages/image/src/main.vue +12 -12
  64. package/packages/image-preview/index.js +5 -5
  65. package/packages/list/index.js +5 -5
  66. package/packages/list/src/main.vue +32 -32
  67. package/packages/loading/index.js +5 -5
  68. package/packages/loading/src/main.vue +19 -19
  69. package/packages/nav-bar/index.js +5 -5
  70. package/packages/nav-bar/src/main.vue +24 -24
  71. package/packages/notice-bar/index.js +5 -5
  72. package/packages/notice-bar/src/main.vue +15 -15
  73. package/packages/pagination/index.js +5 -5
  74. package/packages/pagination/src/main.vue +73 -73
  75. package/packages/picker/index.js +5 -5
  76. package/packages/picker/src/main.vue +604 -604
  77. package/packages/popover/index.js +5 -5
  78. package/packages/popover/src/main.vue +32 -32
  79. package/packages/popup/index.js +5 -5
  80. package/packages/popup/src/main.vue +27 -27
  81. package/packages/pull-refresh/index.js +5 -5
  82. package/packages/pull-refresh/src/main.vue +31 -31
  83. package/packages/radio/index.js +5 -5
  84. package/packages/radio/src/main.vue +179 -179
  85. package/packages/rate/index.js +5 -5
  86. package/packages/rate/src/main.vue +26 -26
  87. package/packages/retrial-auth/index.js +5 -5
  88. package/packages/retrial-auth/src/main.vue +257 -257
  89. package/packages/search/index.js +5 -5
  90. package/packages/search/src/main.vue +39 -39
  91. package/packages/selector/index.js +5 -5
  92. package/packages/selector/src/main.vue +186 -186
  93. package/packages/selector/src/selector-tree.vue +1117 -1117
  94. package/packages/selector/src/tree.vue +405 -405
  95. package/packages/skeleton/index.js +5 -5
  96. package/packages/skeleton/src/main.vue +17 -17
  97. package/packages/stepper/index.js +5 -5
  98. package/packages/stepper/src/main.vue +25 -25
  99. package/packages/swipe/index.js +5 -5
  100. package/packages/swipe/src/main.vue +42 -42
  101. package/packages/switch/index.js +5 -5
  102. package/packages/switch/src/main.vue +38 -38
  103. package/packages/tab/index.js +5 -5
  104. package/packages/tab/src/main.vue +16 -16
  105. package/packages/table/index.js +5 -5
  106. package/packages/table/src/main.vue +1006 -1006
  107. package/packages/table-column/index.js +5 -5
  108. package/packages/table-column/src/main.vue +931 -931
  109. package/packages/table-column/src/mixins/table.js +12 -12
  110. package/packages/tabs/index.js +5 -5
  111. package/packages/tabs/src/main.vue +34 -34
  112. package/packages/tag/index.js +5 -5
  113. package/packages/tag/src/main.vue +16 -16
  114. package/packages/theme-chalk/gulpfile.js +25 -0
  115. package/packages/theme-chalk/src/base.scss +195 -195
  116. package/packages/theme-chalk/src/button-group.scss +25 -25
  117. package/packages/theme-chalk/src/button.scss +2 -2
  118. package/packages/theme-chalk/src/calendar.scss +11 -11
  119. package/packages/theme-chalk/src/cascader.scss +11 -11
  120. package/packages/theme-chalk/src/cell.scss +14 -14
  121. package/packages/theme-chalk/src/checkbox.scss +9 -9
  122. package/packages/theme-chalk/src/circle.scss +6 -6
  123. package/packages/theme-chalk/src/common/var.scss +1525 -1525
  124. package/packages/theme-chalk/src/esign.scss +51 -51
  125. package/packages/theme-chalk/src/field.scss +98 -98
  126. package/packages/theme-chalk/src/flow-btn.scss +99 -99
  127. package/packages/theme-chalk/src/flow-list.scss +122 -122
  128. package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
  129. package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
  130. package/packages/theme-chalk/src/form.scss +33 -33
  131. package/packages/theme-chalk/src/grid-item.scss +16 -16
  132. package/packages/theme-chalk/src/grid.scss +46 -46
  133. package/packages/theme-chalk/src/icon.scss +1661 -1661
  134. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  135. package/packages/theme-chalk/src/navbar.scss +5 -5
  136. package/packages/theme-chalk/src/pagination.scss +12 -12
  137. package/packages/theme-chalk/src/picker.scss +31 -31
  138. package/packages/theme-chalk/src/radio.scss +6 -6
  139. package/packages/theme-chalk/src/retrial-auth.scss +28 -28
  140. package/packages/theme-chalk/src/selector.scss +247 -247
  141. package/packages/theme-chalk/src/stepper.scss +9 -9
  142. package/packages/theme-chalk/src/switch.scss +5 -5
  143. package/packages/theme-chalk/src/table.scss +86 -86
  144. package/packages/theme-chalk/src/tabs.scss +31 -31
  145. package/packages/theme-chalk/src/tag.scss +12 -12
  146. package/packages/theme-chalk/src/theme.scss +1 -1
  147. package/packages/theme-chalk/src/tree.scss +127 -127
  148. package/packages/uploader/index.js +5 -5
  149. package/src/config/api.js +190 -190
  150. package/src/index.js +1 -1
  151. package/src/utils/axios.js +217 -217
  152. package/src/utils/date-util.js +312 -312
  153. package/src/utils/http.js +106 -106
  154. package/src/utils/rules.js +18 -18
  155. package/src/utils/store.js +21 -21
  156. package/src/utils/util.js +21 -0
  157. package/CHANGELOG.md +0 -95
  158. package/packages/theme-chalk/lib/action-sheet.css +0 -0
  159. package/packages/theme-chalk/lib/base.css +0 -1
  160. package/packages/theme-chalk/lib/button-group.css +0 -1
  161. package/packages/theme-chalk/lib/button.css +0 -1
  162. package/packages/theme-chalk/lib/calendar.css +0 -1
  163. package/packages/theme-chalk/lib/cascader.css +0 -1
  164. package/packages/theme-chalk/lib/cell.css +0 -1
  165. package/packages/theme-chalk/lib/checkbox.css +0 -1
  166. package/packages/theme-chalk/lib/circle.css +0 -1
  167. package/packages/theme-chalk/lib/count-down.css +0 -0
  168. package/packages/theme-chalk/lib/date.css +0 -0
  169. package/packages/theme-chalk/lib/empty.css +0 -0
  170. package/packages/theme-chalk/lib/esign.css +0 -1
  171. package/packages/theme-chalk/lib/field.css +0 -1
  172. package/packages/theme-chalk/lib/flow-btn.css +0 -1
  173. package/packages/theme-chalk/lib/flow-list-task-read.css +0 -1
  174. package/packages/theme-chalk/lib/flow-list.css +0 -1
  175. package/packages/theme-chalk/lib/flow.css +0 -1
  176. package/packages/theme-chalk/lib/fonts/iconfont.scss +0 -98
  177. package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
  178. package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
  179. package/packages/theme-chalk/lib/fonts/iconfont1.scss +0 -90
  180. package/packages/theme-chalk/lib/form.css +0 -1
  181. package/packages/theme-chalk/lib/grid-item.css +0 -1
  182. package/packages/theme-chalk/lib/grid.css +0 -1
  183. package/packages/theme-chalk/lib/icon.css +0 -1
  184. package/packages/theme-chalk/lib/image-preview.css +0 -0
  185. package/packages/theme-chalk/lib/image.css +0 -0
  186. package/packages/theme-chalk/lib/index.css +0 -1
  187. package/packages/theme-chalk/lib/list.css +0 -0
  188. package/packages/theme-chalk/lib/loading.css +0 -0
  189. package/packages/theme-chalk/lib/nav-bar.css +0 -0
  190. package/packages/theme-chalk/lib/navbar.css +0 -1
  191. package/packages/theme-chalk/lib/notice-bar.css +0 -0
  192. package/packages/theme-chalk/lib/pagination.css +0 -1
  193. package/packages/theme-chalk/lib/picker.css +0 -1
  194. package/packages/theme-chalk/lib/popover.css +0 -0
  195. package/packages/theme-chalk/lib/popup.css +0 -0
  196. package/packages/theme-chalk/lib/pull-refresh.css +0 -0
  197. package/packages/theme-chalk/lib/radio.css +0 -1
  198. package/packages/theme-chalk/lib/rate.css +0 -0
  199. package/packages/theme-chalk/lib/retrial-auth.css +0 -1
  200. package/packages/theme-chalk/lib/search.css +0 -0
  201. package/packages/theme-chalk/lib/selector.css +0 -1
  202. package/packages/theme-chalk/lib/skeleton.css +0 -0
  203. package/packages/theme-chalk/lib/stepper.css +0 -1
  204. package/packages/theme-chalk/lib/swipe.css +0 -0
  205. package/packages/theme-chalk/lib/switch.css +0 -1
  206. package/packages/theme-chalk/lib/tab.css +0 -0
  207. package/packages/theme-chalk/lib/table-column.css +0 -0
  208. package/packages/theme-chalk/lib/table.css +0 -1
  209. package/packages/theme-chalk/lib/tabs.css +0 -1
  210. package/packages/theme-chalk/lib/tag.css +0 -1
  211. package/packages/theme-chalk/lib/theme.css +0 -0
  212. package/packages/theme-chalk/lib/tree.css +0 -1
  213. package/packages/theme-chalk/lib/uploader.css +0 -0
@@ -1,1117 +1,1117 @@
1
- <template>
2
- <div class="em-select-tree-content" :class="{ 'em-show-tree': showTree }">
3
- <!-- <div style="display:block;height:1px"></div> -->
4
- <em-nav-bar
5
- v-if="showNavBar && !showTree"
6
- :class="isBgColor ? 'em-selector-nav-bar' : ''"
7
- :paddingTop="paddingTop"
8
- :disabled="newTabs[selectIndex].name == 'persongroupobj'"
9
- @click-left="navigateBack"
10
- >
11
- <template slot="left">
12
- <van-icon name="arrow-left" />
13
- </template>
14
- <template slot="title">{{ navTitle }}</template>
15
- </em-nav-bar>
16
- <div class="em-search-box" v-if="showSearch && !showTree">
17
- <em-search
18
- v-model="namelike"
19
- @input="onSearch"
20
- placeholder="请输入搜索关键词"
21
- />
22
- </div>
23
- <em-tabs
24
- v-show="newTabs.length > 1 && !showTree"
25
- @click="handleClick"
26
- class="em-flow-tabs"
27
- type="card"
28
- style="margin: 10px 0px"
29
- >
30
- <em-tab
31
- :title="item.label"
32
- v-for="item in newTabs"
33
- :key="item.name"
34
- ></em-tab>
35
- </em-tabs>
36
- <div class="em-tree-box">
37
- <em-tree
38
- v-if="personnel && personnel.length > 0"
39
- ref="emTree"
40
- :model="personnel"
41
- :value-key="valueKey"
42
- :label-key="labelKey"
43
- :enterprise="isEnterprise"
44
- :department="isDepartment"
45
- :departmentLabelKey="departmentLabelKey"
46
- :departmentValueKey="departmentValueKey"
47
- :namelike="namelike"
48
- :nodeKey="nodeKey"
49
- :disableds="disableds"
50
- :showCount="showCount"
51
- :countKey="countKey"
52
- :selectType="newParam.selecttype"
53
- :showNameIcon="showNameIcon"
54
- :nameColor="nameColor"
55
- :nameBgColor="nameBgColor"
56
- :countPosition="countPosition"
57
- :nameSize="nameSize"
58
- :unit="unit"
59
- v-on="$listeners"
60
- @popen="open"
61
- :isAllCheck="isAllCheck"
62
- :isTreeIcon="isTreeIcon"
63
- :showMore="showMore"
64
- @checke="checked"
65
- :showTree="showTree"
66
- :selectLabel="selectLabel"
67
- :oldIsSearch="oldIsSearch"
68
- :isSearch="isSearch"
69
- :inputSearch="inputSearch"
70
- :isOtherUnit="isOtherUnit"
71
- :filid="filid"
72
- >
73
- <template
74
- slot="tree-icon"
75
- v-if="$scopedSlots['tree-icon']"
76
- slot-scope="{ value }"
77
- >
78
- <slot name="tree-icon" :value="value"></slot>
79
- </template>
80
- </em-tree>
81
- </div>
82
- <div class="em-btn-group" v-if="!showTree">
83
- <div class="select-list">
84
- <div v-for="(r, i) in list" :key="i" class="item">
85
- <!-- r[labelKey].length > 6
86
- ? r[labelKey].slice(0, 6) + '...'
87
- : r[labelKey] -->
88
- <div class="name" v-if="r[labelKey] || r['showname']">
89
- {{ r[labelKey] || r['showname'] }}
90
- </div>
91
- <div class="delte" @click="delteList(i)">
92
- <img
93
- src="data:image/png;base64,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"
94
- />
95
- </div>
96
- </div>
97
- </div>
98
- <div class="btn" @click="dispose">确认({{ list.length }})</div>
99
- </div>
100
- </div>
101
- </template>
102
-
103
- <script>
104
- import EmTree from './tree.vue';
105
- import { selectObject } from '../../../src/config/api.js';
106
- import $ from '../../../src/utils/util.js';
107
- import request from '../../../src/utils/http.js';
108
- export default {
109
- components: { EmTree },
110
- name: 'EmSelectorTree',
111
- inheritAttrs: false,
112
- props: {
113
- isSelectAll: {
114
- type: Boolean,
115
- default: false
116
- },
117
- nameSize: {
118
- type: [String, Number],
119
- default: 38
120
- },
121
- nameBgColor: {
122
- tpe: String,
123
- default: ''
124
- },
125
- countPosition: {
126
- type: String,
127
- default: 'right'
128
- },
129
- showNameIcon: {
130
- type: Boolean,
131
- default: false
132
- },
133
- nameColor: {
134
- type: String,
135
- default: '#fff'
136
- },
137
- showNameIcon: {
138
- type: Boolean,
139
- default: false
140
- },
141
- countKey: {
142
- type: String,
143
- default: 'count'
144
- },
145
- showCount: {
146
- type: Boolean,
147
- default: false
148
- },
149
- selectLabel: {
150
- type: Boolean,
151
- default: false
152
- },
153
- unit: {
154
- type: String,
155
- default: '人'
156
- },
157
- disableds: {
158
- type: Array,
159
- default: () => []
160
- },
161
- showSearch: {
162
- type: Boolean,
163
- default: true
164
- },
165
- multiple: {
166
- type: Boolean, // 判断是否多选
167
- default: true
168
- },
169
- selectList: {
170
- type: [Array, String], //传入选中数组
171
- default: () => []
172
- },
173
- isAllCheck: {
174
- type: Boolean,
175
- default: false
176
- },
177
- // pid: {
178
- // type: String, // 父id或者是空
179
- // default: 'root'
180
- // },
181
- url: {
182
- type: String,
183
- default: ''
184
- },
185
- param: {
186
- type: Object,
187
- default: () => {
188
- return { pid: 'root' };
189
- }
190
- },
191
- // depId:{
192
- // type: String, //
193
- // default:''
194
- // },
195
- isEnterprise: {
196
- type: Boolean,
197
- default: false
198
- },
199
- isDepartment: {
200
- type: Boolean,
201
- default: false
202
- },
203
- departmentLabelKey: {
204
- type: String,
205
- default: 'objType'
206
- },
207
- departmentValueKey: {
208
- type: String,
209
- default: 'department'
210
- },
211
- nodeKey: {
212
- type: String,
213
- default: 'subNode'
214
- },
215
- tabs: {
216
- type: [String, Object], //enterprise:单位,department:部门,employee:用户
217
- default: 'employee'
218
- },
219
- objType: {
220
- type: String, // 点击对象类型(enterprise:单位,department:部门,employee:用户,person:人员,persongroup:群组)
221
- default: 'enterprise'
222
- },
223
- isOtherUnit: {
224
- //是否是其它单位
225
- type: Boolean,
226
- default: false
227
- },
228
- filid: {
229
- type: String, // 指定企业
230
- default: undefined
231
- },
232
- type: {
233
- type: String, // 组件类型
234
- default: 'components'
235
- },
236
- navTitle: {
237
- type: String,
238
- default: '请选择'
239
- },
240
- showNavBar: {
241
- type: Boolean,
242
- default: true
243
- },
244
- showTree: {
245
- type: Boolean,
246
- default: true
247
- },
248
- showMore: {
249
- type: Boolean,
250
- default: true
251
- },
252
- isTreeIcon: {
253
- type: Boolean,
254
- default: false
255
- },
256
- isBgColor: {
257
- type: Boolean,
258
- default: true
259
- },
260
- promptText: {
261
- type: String,
262
- default: '只能选择一个'
263
- },
264
- listKey: {
265
- type: String,
266
- default: ''
267
- },
268
- valueKey: {
269
- type: String,
270
- default: 'showid'
271
- },
272
- labelKey: {
273
- type: String,
274
- default: 'showshortname'
275
- },
276
- paddingTop: {
277
- type: [String, Number],
278
- default: 0
279
- },
280
- isDefaultNode: {
281
- type: Boolean,
282
- default: true
283
- },
284
- nodeList: Array,
285
- baseUrl: String
286
- },
287
- data() {
288
- return {
289
- genre: '',
290
- personnel: '',
291
- label: '',
292
- namelike: '', //搜索关键字
293
- list: [], //选中数组
294
- selectData: [],
295
- timer: null,
296
- isSearch: false,
297
- inputSearch: false,
298
- newParam: {},
299
- oldIsSearch: false,
300
- selectIndex: 0,
301
- checkObj: {},
302
- first: true
303
- };
304
- },
305
- watch: {
306
- listKey: {
307
- handler(val) {
308
- this.label = val;
309
- },
310
- immediate: true
311
- },
312
- nodeList: {
313
- handler(val) {
314
- if (this.isSearch != this.oldIsSearch) {
315
- this.getNodeList(true);
316
- }
317
- },
318
- deep: true,
319
- immediate: true
320
- },
321
- selectList: {
322
- handler(val) {
323
- typeof this.selectList != 'string' && (this.list = $.deepClone(val));
324
- if (this.personnel.length == 0) {
325
- if (this.nodeList) {
326
- this.getNodeList();
327
- } else {
328
- this.getContent();
329
- }
330
- } else {
331
- if (typeof this.selectList == 'string') {
332
- this.selectData = [];
333
- this.list = this.getSelectData(this.personnel);
334
- this.$emit('update:selectList', this.list);
335
- }
336
- }
337
- },
338
- deep: true,
339
- immediate: true
340
- }
341
- },
342
- computed: {
343
- newTabs() {
344
- const tabs = {
345
- enterprise: {
346
- label: '选择单位',
347
- name: 'enterprise',
348
- url: selectObject,
349
- data: [],
350
- nodeData: '',
351
- selection: [],
352
- value: [],
353
- param: {
354
- objType: this.objType,
355
- selecttype: 'enterprise',
356
- pid: 'root'
357
- }
358
- },
359
- department: {
360
- label: '选择部门',
361
- name: 'department',
362
- url: selectObject,
363
- data: [],
364
- nodeData: '',
365
- selection: [],
366
- value: [],
367
- param: {
368
- objType: this.objType,
369
- selecttype: 'department',
370
- pid: 'root'
371
- }
372
- },
373
- employee: {
374
- label: '选择用户',
375
- name: 'employee',
376
- url: selectObject,
377
- data: [],
378
- nodeData: '',
379
- selection: [],
380
- value: [],
381
- param: {
382
- objType: this.objType,
383
- selecttype: 'employee',
384
- pid: 'root'
385
- }
386
- },
387
- myemployee: {
388
- label: '本单位用户',
389
- name: 'myemployee',
390
- url: selectObject,
391
- data: [],
392
- nodeData: '',
393
- selection: [],
394
- value: [],
395
- param: {
396
- objType: this.objType,
397
- selecttype: 'employee',
398
- pid: 'root'
399
- }
400
- },
401
- otheremployee: {
402
- label: '外单位用户',
403
- name: 'otheremployee',
404
- url: selectObject,
405
- data: [],
406
- nodeData: '',
407
- selection: [],
408
- value: [],
409
- param: {
410
- objType: this.objType,
411
- selecttype: 'otheremployee',
412
- pid: 'root'
413
- }
414
- },
415
- person: {
416
- label: '选择人员',
417
- name: 'person',
418
- url: selectObject,
419
- data: [],
420
- nodeData: '',
421
- selection: [],
422
- value: [],
423
- param: {
424
- objType: this.objType,
425
- selecttype: 'person',
426
- pid: 'root'
427
- }
428
- },
429
- otherperson: {
430
- label: '外单位人员',
431
- name: 'otherperson',
432
- url: selectObject,
433
- data: [],
434
- nodeData: '',
435
- selection: [],
436
- value: [],
437
- param: {
438
- objType: this.objType,
439
- selecttype: 'otherperson',
440
- pid: 'root'
441
- }
442
- },
443
- persongroup: {
444
- label: '选择群组成员',
445
- name: 'persongroup',
446
- url: selectObject,
447
- data: [],
448
- nodeData: '',
449
- selection: [],
450
- value: [],
451
- param: {
452
- objType: this.objType,
453
- selecttype: 'persongroup',
454
- pid: 'root'
455
- }
456
- },
457
- filgroup: {
458
- label: '单位群组成员',
459
- data: [],
460
- nodeData: '',
461
- selection: [],
462
- value: [],
463
- name: 'filgroup',
464
- url: selectObject,
465
- param: {
466
- objType: this.objType,
467
- selecttype: 'filgroup',
468
- pid: 'root'
469
- }
470
- },
471
- depgroup: {
472
- label: '部门群组成员',
473
- name: 'depgroup',
474
- url: selectObject,
475
- data: [],
476
- nodeData: '',
477
- selection: [],
478
- value: [],
479
- param: {
480
- objType: this.objType,
481
- selecttype: 'depgroup',
482
- pid: 'root'
483
- }
484
- },
485
- persongroupobj: {
486
- label: '人员群组',
487
- name: 'persongroupobj',
488
- url: selectObject,
489
- data: [],
490
- nodeData: '',
491
- selection: [],
492
- value: [],
493
- param: {
494
- objType: this.objType,
495
- selecttype: 'persongroupobj',
496
- pid: 'root'
497
- }
498
- },
499
- filgroupobj: {
500
- label: '单位群组',
501
- name: 'filgroupobj',
502
- url: selectObject,
503
- data: [],
504
- nodeData: '',
505
- selection: [],
506
- value: [],
507
- param: {
508
- objType: this.objType,
509
- selecttype: 'filgroupobj',
510
- pid: 'root'
511
- }
512
- },
513
- depgroupobj: {
514
- label: '部门群组',
515
- name: 'depgroupobj',
516
- url: selectObject,
517
- data: [],
518
- nodeData: '',
519
- selection: [],
520
- value: [],
521
- param: {
522
- objType: this.objType,
523
- selecttype: 'depgroupobj',
524
- pid: 'root'
525
- }
526
- },
527
- role: {
528
- label: '选择角色',
529
- name: 'role',
530
- url: selectObject,
531
- data: [],
532
- nodeData: '',
533
- selection: [],
534
- value: [],
535
- param: {
536
- objType: this.objType,
537
- selecttype: 'role',
538
- pid: 'root'
539
- }
540
- },
541
- post: {
542
- label: '选择岗位',
543
- name: 'post',
544
- url: selectObject,
545
- data: [],
546
- nodeData: '',
547
- selection: [],
548
- value: [],
549
- param: {
550
- objType: this.objType,
551
- selecttype: 'post',
552
- pid: 'root'
553
- }
554
- },
555
- codetable: {
556
- label: '代码表',
557
- name: 'codetable',
558
- url: selectObject,
559
- data: [],
560
- nodeData: '',
561
- selection: [],
562
- value: [],
563
- param: {
564
- objType: this.objType,
565
- selecttype: 'codetable',
566
- pid: 'root'
567
- }
568
- },
569
- topcontacts: {
570
- label: '常用联系人',
571
- name: 'topcontacts',
572
- url: selectObject,
573
- data: [],
574
- nodeData: '',
575
- selection: [],
576
- value: [],
577
- param: {
578
- objType: this.objType,
579
- selecttype: 'topcontacts',
580
- pid: 'root'
581
- }
582
- }
583
- };
584
- let copyTabs = this.tabs.split(',');
585
- let obj = {};
586
- copyTabs.map((x) => {
587
- if(this.param[x]){
588
- tabs[x].param = {...tabs[x].param, ...this.param[x]};
589
- }
590
- obj[x];
591
- });
592
- if (this.tabs) {
593
- if (this.replace) {
594
- return this.tabs;
595
- } else {
596
- obj = $.extend(true, tabs, obj);
597
- }
598
- }
599
- let newtabs = [];
600
- copyTabs.map((x) => {
601
- if (this.param[x]) {
602
- obj[x].param = { ...obj[x].param, ...this.param[x] };
603
- }
604
- newtabs.push(obj[x]);
605
- });
606
- return newtabs;
607
- }
608
- },
609
- mounted() {
610
- // typeof this.selectList != 'string' &&
611
- // (this.list = $.deepClone(this.selectList));
612
- // this.$nextTick(() => {
613
- // if (this.nodeList) {
614
- // this.getNodeList();
615
- // } else {
616
- // this.getContent();
617
- // }
618
- // });
619
- },
620
- methods: {
621
- handleClick(index) {
622
- this.selectIndex = index;
623
- this.getContent(undefined,false);
624
- },
625
- getNodeList(isSearch) {
626
- this.personnel = JSON.parse(JSON.stringify(this.nodeList));
627
- // !isSearch && (this.list = $.deepClone(this.selectList));
628
- if (!isSearch) {
629
- if (typeof this.selectList == 'string') {
630
- this.selectData = [];
631
- this.list = this.getSelectData(this.personnel);
632
- this.$emit('update:selectList', this.list);
633
- } else {
634
- this.list = $.deepClone(this.selectList);
635
- }
636
- }
637
- let _this = this;
638
- if (this.list && this.list.length > 0) {
639
- this.list.filter((r) => {
640
- _this.personnel.find((i) => {
641
- if (i[_this.valueKey] === r[_this.valueKey]) {
642
- _this.$set(i, 'checked', true);
643
- } else if (i.children) {
644
- _this.getActiveChildren(i.children, r[_this.valueKey]);
645
- }
646
- });
647
- });
648
- } else {
649
- _this.personnel.map((x) => {
650
- if (x.children && x.children.length > 0) {
651
- this.setChecked(x.children);
652
- } else {
653
- _this.$set(x, 'checked', false);
654
- }
655
- });
656
- }
657
- },
658
- getActiveChildren(data, id) {
659
- const _this = this;
660
- data.map((x) => {
661
- if (x[_this.valueKey] === id) {
662
- _this.$set(x, 'checked', true);
663
- } else if (x.children) {
664
- _this.getActiveChildren(x.children, id);
665
- }
666
- });
667
- },
668
- setChecked(list) {
669
- list.map((x) => {
670
- if (x.children && x.children.length > 0) {
671
- this.setChecked(x.children);
672
- } else {
673
- this.$set(x, 'checked', false);
674
- }
675
- });
676
- },
677
- /**
678
- * delteList
679
- * @desc:删除选中的数据
680
- * @date 2023年3月6日
681
- * @author liufan
682
- * @param {String,Number} i 点击数据的下标
683
- */
684
- delteList(i) {
685
- this.oldIsSearch = this.isSearch;
686
- let res = this.list[i];
687
- this.getArray(this.personnel, res[this.valueKey]);
688
- this.list.splice(i, 1);
689
- },
690
- // 树结构遍历
691
- getArray(data, showid) {
692
- for (let i in data) {
693
- //满足条件
694
- if (data[i][this.valueKey] == showid) {
695
- this.$set(data[i], 'checked', false);
696
- break;
697
- } else {
698
- //否则 继续遍历子元素
699
- this.getArray(data[i].children, showid);
700
- }
701
- }
702
- },
703
- /**
704
- * onSearch
705
- * @desc:条件搜索
706
- * @date 2023年3月6日
707
- * @author liufan
708
- */
709
- onSearch() {
710
- if (this.timer != null) {
711
- clearTimeout(this.timer);
712
- }
713
- this.timer = setTimeout( () => {
714
- if (this.$listeners.search) {
715
- this.oldIsSearch = this.isSearch;
716
- this.isSearch = !this.isSearch;
717
- this.$emit('search', this.namelike);
718
- } else {
719
- this.getContent(undefined,!!this.namelike.trim());
720
-
721
- }
722
- }, 1000);
723
- },
724
- /**
725
- * getContent
726
- * @desc:获取数据
727
- * @date 2023年3月6日
728
- * @author liufan
729
- */
730
- getContent(name,isSearch) {
731
- if (name) {
732
- this.label = name;
733
- }
734
- // this.list = $.deepClone(this.selectList);
735
- this.$toast.loading({
736
- message: '加载中...',
737
- forbidClick: true,
738
- loadingType: 'spinner',
739
- overlay: true,
740
- duration: 0
741
- });
742
- this.newParam = { ...JSON.parse(JSON.stringify(this.param)) };
743
- this.newParam.selecttype =
744
- this.newTabs[this.selectIndex].param.selecttype;
745
- if (this.newParam.selecttype === 'persongroup') {
746
- if(this.newParam[this.newTabs[this.selectIndex].name]){
747
- this.newParam = {...this.newTabs[this.selectIndex].param,...this.newParam[this.newTabs[this.selectIndex].name]?this.newParam[this.newTabs[this.selectIndex].name]:{}}
748
- }else{
749
- this.newParam.pid = 'root';
750
- }
751
- this.newParam.pid = 'root';
752
- this.newParam.myUserid =
753
- this.newParam.myUserid || $.getStorage('userId');
754
- } else {
755
- this.newParam = {...this.newParam,...this.newTabs[this.selectIndex].param,...this.newParam[this.newTabs[this.selectIndex].name]?this.newParam[this.newTabs[this.selectIndex].name]:{}}
756
- if(this.param.pid){
757
- this.newParam.pid = this.param.pid;
758
- }
759
- // this.newTabs[this.selectIndex].param.pid || this.param.pid || 'root';
760
- }
761
- delete this.newParam.department
762
- delete this.newParam.myemployee
763
- return request({
764
- url: this.url
765
- ? this.url
766
- : this.baseUrl
767
- ? this.baseUrl + selectObject
768
- : selectObject,
769
- params: {
770
- objType: this.objType,
771
- namelike: this.namelike,
772
- selecttype: this.tabs,
773
- filid: this.filid,
774
- ...this.newParam
775
- }
776
- }).then((res) => {
777
- if(isSearch != undefined){
778
- this.inputSearch = isSearch;
779
- }
780
- this.$toast.clear();
781
- const { rCode, msg } = res;
782
- if (rCode == 0) {
783
- if (typeof this.selectList == 'string') {
784
- this.selectData = [];
785
- this.list = this.getSelectData(
786
- JSON.parse(JSON.stringify(res.results))
787
- );
788
- this.$emit('update:selectList', this.list);
789
- }
790
- this.personnel = JSON.parse(JSON.stringify(res.results));
791
- let _this = this;
792
- this.list.filter((r) => {
793
- _this.personnel.find((i) => {
794
- if (i[_this.valueKey] === r[_this.valueKey]) {
795
- _this.$set(i, 'checked', true);
796
- }
797
- });
798
- });
799
- this.genre = JSON.parse(JSON.stringify(res.results));
800
- } else {
801
- this.$toast(msg);
802
- }
803
- });
804
- },
805
- getSelectData(data) {
806
- const _this = this;
807
- let user = this.selectList.split(',');
808
- user.map((x) => {
809
- data.map((i) => {
810
- if (i[_this.valueKey] == x) {
811
- this.selectData.push(i);
812
- } else if (i.children) {
813
- _this.getSelectData(i.children);
814
- }
815
- });
816
- });
817
- return this.selectData;
818
- },
819
- getData(obj) {
820
- let params = {
821
- ...this.newParam,
822
- pid: obj[this.valueKey],
823
- selecttype: obj.selecttype,
824
- objType: obj.objType
825
- };
826
- this.$toast.loading({
827
- message: '加载中...',
828
- forbidClick: true,
829
- loadingType: 'spinner',
830
- overlay: true,
831
- duration: 0
832
- });
833
- request({
834
- url: this.url
835
- ? this.url
836
- : this.baseUrl
837
- ? this.baseUrl + selectObject
838
- : selectObject,
839
- params: params
840
- }).then((res) => {
841
- if (res.rCode == 0) {
842
- if (
843
- res.results.length > 0 &&
844
- res.results[0].nocheck == false &&
845
- this.isAllCheck &&
846
- this.multiple
847
- ) {
848
- res.results.unshift({
849
- showshortname: '全选',
850
- checked: false,
851
- isAllCheck: true,
852
- id: $.generateUUID(),
853
- parentshowid: res.results[0].parentshowid
854
- });
855
- }
856
- this.$set(obj, 'children', res.results);
857
- let _this = this;
858
- this.list.filter((r) => {
859
- obj.children.find((i) => {
860
- if (i[_this.valueKey] === r[_this.valueKey]) {
861
- _this.$set(i, 'checked', true);
862
- }
863
- });
864
- });
865
- if (this.isAllCheck && this.multiple && obj.children.length > 0) {
866
- let checkList = obj.children
867
- .slice(1, obj.children.length)
868
- .filter((x) => x.checked);
869
- if (
870
- checkList.length ===
871
- obj.children.slice(1, obj.children.length).length
872
- ) {
873
- _this.$set(obj.children[0], 'checked', true);
874
- }
875
- }
876
- }
877
- this.$toast.clear();
878
- });
879
- },
880
- getChiled(res, isStart, key) {
881
- const _that = this;
882
- let data = [];
883
- if (this.isDefaultNode && !isStart) {
884
- data = _that.$listeners[key]
885
- ? _that.$listeners[key](res.obj, !!res.obj.children)
886
- : undefined;
887
- }
888
- if (!isStart) {
889
- if (res.obj.open) {
890
- this.$set(res.obj, 'open', false);
891
- } else {
892
- this.$set(res.obj, 'open', true);
893
- }
894
- }
895
- let newData = res.obj;
896
- if (
897
- (!newData.children || newData.children.length == 0) &&
898
- !isStart &&
899
- data
900
- ) {
901
- if (this.nodeList && this.nodeList.length > 0) {
902
- this.$toast.loading({
903
- message: '加载中...',
904
- forbidClick: true,
905
- loadingType: 'spinner',
906
- overlay: true,
907
- duration: 0
908
- });
909
- if (!Array.isArray(data)) {
910
- data
911
- .then((res) => {
912
- res.map((x) => {
913
- !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
914
- });
915
- _that.$set(newData, 'children', res);
916
- if (_that.selectList && _that.selectList.length > 0) {
917
- _that.selectList.filter((r) => {
918
- newData.children.find((i) => {
919
- if (i[_that.valueKey] === r[_that.valueKey]) {
920
- _that.$set(i, 'checked', true);
921
- }
922
- });
923
- });
924
- } else {
925
- newData.children.find((i) => {
926
- _that.$set(i, 'checked', false);
927
- });
928
- }
929
- this.$toast.clear();
930
- })
931
- .catch((err) => {
932
- this.$toast('数据返回错误');
933
- });
934
- } else {
935
- data.map((x) => {
936
- !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
937
- });
938
- _that.$set(newData, 'children', data);
939
- if (_that.selectList && _that.selectList.length > 0) {
940
- _that.selectList.filter((r) => {
941
- newData.children.find((i) => {
942
- if (i[_that.valueKey] === r[_that.valueKey]) {
943
- _that.$set(i, 'checked', true);
944
- }
945
- });
946
- });
947
- } else {
948
- newData.children.find((i) => {
949
- _that.$set(i, 'checked', false);
950
- });
951
- }
952
- this.$toast.clear();
953
- }
954
- } else {
955
- if (!res.obj.children || res.obj.children.length == 0) {
956
- this.getData(res.obj);
957
- }
958
- }
959
- }
960
- },
961
- open(res, isStart, isNode, key) {
962
- const _that = this;
963
- _that.oldIsSearch = _that.isSearch;
964
- // debugger
965
- if (
966
- this.$listeners['node-click'] &&
967
- (this.$listeners['left-icon'] ||
968
- (this.showMore && !this.isDefaultNode)) &&
969
- !isStart
970
- ) {
971
- if (this.$listeners['left-icon'] && key === 'node') {
972
- this.getChiled(res, isStart, 'left-icon');
973
- } else if (
974
- this.showMore &&
975
- this.$listeners['right-icon'] &&
976
- key === 'node'
977
- ) {
978
- this.getChiled(res, isStart, 'right-icon');
979
- } else if (
980
- (!this.isDefaultNode && key === 'title') ||
981
- (this.$listeners['node-click'] &&
982
- this.$listeners['left-icon'] &&
983
- !this.showMore &&
984
- !this.isDefaultNode)
985
- ) {
986
- _that.$listeners['node-click'](res.obj, !!res.obj.children);
987
- } else {
988
- this.getChiled(res, isStart, 'node-click');
989
- }
990
- } else if (
991
- this.$listeners['node-click'] ||
992
- this.$listeners['left-icon'] ||
993
- (this.showMore && !this.isDefaultNode)
994
- ) {
995
- isNode &&
996
- this.$listeners['node-click'] &&
997
- this.getChiled(res, isStart, 'node-click');
998
- this.$listeners['left-icon'] &&
999
- !isNode &&
1000
- this.getChiled(res, isStart, 'left-icon');
1001
- this.showMore &&
1002
- !this.isDefaultNode &&
1003
- !isNode &&
1004
- this.getChiled(res, isStart, 'right-icon');
1005
- } else {
1006
- if (!isStart) {
1007
- if (res.obj.open) {
1008
- this.$set(res.obj, 'open', false);
1009
- } else {
1010
- this.$set(res.obj, 'open', true);
1011
- }
1012
- }
1013
- if (!res.obj.children && !isStart) {
1014
- this.getData(res.obj);
1015
- }
1016
- }
1017
- },
1018
- checked(res, model) {
1019
- this.oldIsSearch = this.isSearch;
1020
- if (!res.obj.mixType) {
1021
- this.$set(res.obj, 'mixType', this.newTabs[this.selectIndex].name);
1022
- }
1023
- if (res.obj.checked) {
1024
- if (res.obj.isAllCheck) {
1025
- model.map((x) => {
1026
- for (let i in this.list) {
1027
- if (this.list[i][this.valueKey] == x[this.valueKey]) {
1028
- this.list.splice(i, 1);
1029
- }
1030
- }
1031
- this.$set(x, 'checked', false);
1032
- });
1033
- } else {
1034
- for (let i in this.list) {
1035
- if (this.list[i][this.valueKey] == res.obj[this.valueKey]) {
1036
- this.list.splice(i, 1);
1037
- }
1038
- }
1039
- this.$set(res.obj, 'checked', false);
1040
- }
1041
- } else {
1042
- // if (!this.multiple && this.list.length >= 1) {
1043
- // this.$toast(this.promptText);
1044
- // return;
1045
- // }
1046
- if (res.obj.isAllCheck) {
1047
- let selectData = [];
1048
- this.$set(res.obj, 'checked', true);
1049
- model.map((x) => {
1050
-
1051
- if(!x.disabled && !x.nocheck && !x.isAllCheck && (x.selecttype == this.newParam.selecttype || (this.newParam.selecttype == 'persongroup' && x.selecttype == 'employee')) && this.disableds.indexOf(x[this.valueKey]) == -1){
1052
- this.$set(x, 'checked', true);
1053
- if (!x.mixType) {
1054
- this.$set(x, 'mixType', this.newTabs[this.selectIndex].name);
1055
- }
1056
- selectData.push(x);
1057
- }
1058
- });
1059
-
1060
- this.list.push(...selectData);
1061
- // this.$set(res.obj, 'checked', true);
1062
- } else {
1063
- this.$set(res.obj, 'checked', true);
1064
- if (!this.multiple) {
1065
- this.list = [res.obj];
1066
- this.setChecked(this.personnel, res.obj);
1067
- } else {
1068
- this.list.push(res.obj);
1069
- }
1070
- }
1071
- }
1072
- if (this.isAllCheck && this.multiple && model[0].isAllCheck) {
1073
- let checkList = model.slice(1, model.length).filter((x) => x.checked);
1074
- var obj = {};
1075
- this.list = this.list.reduce((item, next) => {
1076
- obj[next.showid] ? '' : (obj[next.showid] = true && item.push(next));
1077
- return item;
1078
- }, []);
1079
- let newArr = model.filter((x) => !x.disabled&&!x.nocheck&& (x.selecttype == this.newParam.selecttype || (this.newParam.selecttype == 'persongroup' && x.selecttype == 'employee')) && this.disableds.indexOf(x[this.valueKey]) == -1);
1080
- if (newArr.length === checkList.length) {
1081
- model.map((x) => {
1082
- if (!x.disabled) {
1083
- this.$set(model[0], 'checked', true);
1084
- }
1085
- });
1086
- } else {
1087
- this.$set(model[0], 'checked', false);
1088
- }
1089
- }
1090
- },
1091
- setChecked(data, item) {
1092
- data.map((x) => {
1093
- if (x[this.valueKey] === item[this.valueKey]) {
1094
- this.$set(x, 'checked', true);
1095
- } else {
1096
- this.$set(x, 'checked', false);
1097
- }
1098
- if (x.children) {
1099
- this.setChecked(x.children, item);
1100
- }
1101
- });
1102
- },
1103
- dispose() {
1104
- let obj = {
1105
- list: this.list,
1106
- label: this.label ? this.label : undefined
1107
- };
1108
- this.oldIsSearch = this.isSearch;
1109
- this.$emit('dispose', $.deepClone(obj));
1110
- this.$parent.$emit('change', $.deepClone(obj));
1111
- },
1112
- navigateBack() {
1113
- this.$emit('close');
1114
- }
1115
- }
1116
- };
1117
- </script>
1
+ <template>
2
+ <div class="em-select-tree-content" :class="{ 'em-show-tree': showTree }">
3
+ <!-- <div style="display:block;height:1px"></div> -->
4
+ <em-nav-bar
5
+ v-if="showNavBar && !showTree"
6
+ :class="isBgColor ? 'em-selector-nav-bar' : ''"
7
+ :paddingTop="paddingTop"
8
+ :disabled="newTabs[selectIndex].name == 'persongroupobj'"
9
+ @click-left="navigateBack"
10
+ >
11
+ <template slot="left">
12
+ <van-icon name="arrow-left" />
13
+ </template>
14
+ <template slot="title">{{ navTitle }}</template>
15
+ </em-nav-bar>
16
+ <div class="em-search-box" v-if="showSearch && !showTree">
17
+ <em-search
18
+ v-model="namelike"
19
+ @input="onSearch"
20
+ placeholder="请输入搜索关键词"
21
+ />
22
+ </div>
23
+ <em-tabs
24
+ v-show="newTabs.length > 1 && !showTree"
25
+ @click="handleClick"
26
+ class="em-flow-tabs"
27
+ type="card"
28
+ style="margin: 10px 0px"
29
+ >
30
+ <em-tab
31
+ :title="item.label"
32
+ v-for="item in newTabs"
33
+ :key="item.name"
34
+ ></em-tab>
35
+ </em-tabs>
36
+ <div class="em-tree-box">
37
+ <em-tree
38
+ v-if="personnel && personnel.length > 0"
39
+ ref="emTree"
40
+ :model="personnel"
41
+ :value-key="valueKey"
42
+ :label-key="labelKey"
43
+ :enterprise="isEnterprise"
44
+ :department="isDepartment"
45
+ :departmentLabelKey="departmentLabelKey"
46
+ :departmentValueKey="departmentValueKey"
47
+ :namelike="namelike"
48
+ :nodeKey="nodeKey"
49
+ :disableds="disableds"
50
+ :showCount="showCount"
51
+ :countKey="countKey"
52
+ :selectType="newParam.selecttype"
53
+ :showNameIcon="showNameIcon"
54
+ :nameColor="nameColor"
55
+ :nameBgColor="nameBgColor"
56
+ :countPosition="countPosition"
57
+ :nameSize="nameSize"
58
+ :unit="unit"
59
+ v-on="$listeners"
60
+ @popen="open"
61
+ :isAllCheck="isAllCheck"
62
+ :isTreeIcon="isTreeIcon"
63
+ :showMore="showMore"
64
+ @checke="checked"
65
+ :showTree="showTree"
66
+ :selectLabel="selectLabel"
67
+ :oldIsSearch="oldIsSearch"
68
+ :isSearch="isSearch"
69
+ :inputSearch="inputSearch"
70
+ :isOtherUnit="isOtherUnit"
71
+ :filid="filid"
72
+ >
73
+ <template
74
+ slot="tree-icon"
75
+ v-if="$scopedSlots['tree-icon']"
76
+ slot-scope="{ value }"
77
+ >
78
+ <slot name="tree-icon" :value="value"></slot>
79
+ </template>
80
+ </em-tree>
81
+ </div>
82
+ <div class="em-btn-group" v-if="!showTree">
83
+ <div class="select-list">
84
+ <div v-for="(r, i) in list" :key="i" class="item">
85
+ <!-- r[labelKey].length > 6
86
+ ? r[labelKey].slice(0, 6) + '...'
87
+ : r[labelKey] -->
88
+ <div class="name" v-if="r[labelKey] || r['showname']">
89
+ {{ r[labelKey] || r['showname'] }}
90
+ </div>
91
+ <div class="delte" @click="delteList(i)">
92
+ <img
93
+ src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAGAUlEQVR4AeybR6glRRSGn24UdCNiBBEDgoggiAFBzIhgWBhQMOcIBgyYM2YFcwYVTLhQF4oBE4hpIYiigooKYkDcKOpG5/uYd2f6Vlf37arqe6cv84bz36o6dcJ/zjTvdVfft+bCav5vqQGr+QWwsHQFzOgK2J08N4CHwYvgA/At+HMRztW5p422+rA9XZnmFbAP1G8GP4B3waXgZHAw2AVsAdZZhHN17mmjrT76GsNYmPYvfTdgfSheAb4Cb4CLwGYgV/Q1hrGMaWxz5Mar+fXVgLWJfD74EFwLtgF9izGNbQ5zmbM4Rx8NOB0WH4HbwVZg2mIOc5nT3EX5ShvwINnvB9uDWYs5zS2H7NwlDXidrKeCVS1ykEsWj9wGfEO2fcFQRC5ySuaT04D/ybIlGJrISW5JvFIb4A+epASrwDiJY0oD7qWYncDQRY5y7cSzawNuItqZYF5ErnKu8Q0VXRrg79qLQ8c5WMtZ7q1UJzXAuy272RpkwJtyt4ZGipMaYABvOBoDDHxD7tbQSLOtAT50tDo3Rh3WhjVYS5RVWwN09L476tiivIa97RbhnGmRfI73/mAv8DZIFWuwlqhfWwOOi3pMVkryC8zE1Yw3glz5FMfDwGvAuLkNbaylqQEeTNg58ibLr4HHZaxvBanyMQ4W/yXjSMLYI/2k0VqsqWbX1ICDapbdFUdETD3UuCuib1K9z8bhILy/j8XGrJNEa2pqwIGdQsaNrkLtmR7DmJzHqssd2jvYWfz3jFUxprGrupR5tKZYAzx/2zglcsTWM71bIvqz0T0EmsSjL4v/KTAwljEDddLSmqxtzCnWgL3HLPIXF+J6JwjlNBSPg1BeQeEl/htjVYxhrKoud16rLdaADXOjR/zORXcPCOVEFE+BkbzExOL/YKyKvsao6krmtdqm3QDJnsVH7NjqGPTPgheAxfuOgOkK0UffFYoeJp0asFEPicIQHls9FipZHwks/l/GqmirT1XXx7xW2yyugBHxE5g8CUL5L1Boo22g7mXZ6QqoGfWSenmQoxmeAU3injZN+8n6wKFWW+wKCHx6X7ad27Xt9U7EgLEG5N5uGm8SvLyPajFyT5sWk6KtWm2zbIA/2I4N6Mfya6NtYNrLslMDfukl1XgQf6WdNK5aWIv1c+BpEIq2+oT60nWtttj/QK1LhVm9mQnP5tYlpsUfyuivwicYQ9FH31Bfsq7VNu0GeBt7TsB4PdYWX3089aboUfSh6GuMUJ+77tSAV3OjB34+wPgau6regIXFH8AYirfHD4RK1sYwFtNiqdUWuwLeI82PoER8dPVYuhpjUxbPA9/jMUTFB6W7IzvGMmZkq7PKmqxtzCHWAA1iP5jUd4HHVpcHhpuztvg9GCeJj8x3RIyMaezIVidVtKamBngG1ylqxOjlQLc1a4vfjbGreHjid4NC+zB2uN+2jtbU1IA3ifQ1KJVtCWDxvq9jmiQeo10fePwdrLsurcWaavZNDdCw+rzuuituw3BPcDyw+B0Yc8UDVU+WdySAMX1yZJosjbW0NeA+0oSHkqgmikTfwspTH98PMC0SzwE/IYIxnTNNEmuwlqhTWwN+x6PRkb15EWuwlijftgbooPNnTuYUcreGRvqTGvAPnq0B2B+UBGTkbg2BeuVyUgO09O6s7ShbmyFCznJv5dalAQbwDs0ze+fzALnKeSLXrg0w0H58+K1uhkGLHOXaiWRKAwzoS0bHISOJY2oDLHwNPnxzyzAokZPckkjlNMAEO/PhT1iGQYhc5JRMJrcBJvKtTeyBxb1ZQg5yycpZ0gATXsLHGcAbDoaZijnNLYfsxKUNMLG/a738LmDhfTfDVMUc5jKnuYuS9dEACXi35SGGf/dzJQpJMvQqxjS2OcxlzuIEfTVgRMSHjutYeAhyCOMj4GeQK/oaw1jGNLY5cuPV/PpuQDWB7/xPQbEJ8BzQb4tZjHr/7uc79H8twrk697TRVh99jaEe0/5lmg2osvU0xsMNi/F/c1c2/X6/7weEc3XuaaOtPphNV2bVgOlWURB9qQEFzRuEaymJZQAAAP//+lusnwAAAAZJREFUAwCz1uqBDo9rSAAAAABJRU5ErkJggg=="
94
+ />
95
+ </div>
96
+ </div>
97
+ </div>
98
+ <div class="btn" @click="dispose">确认({{ list.length }})</div>
99
+ </div>
100
+ </div>
101
+ </template>
102
+
103
+ <script>
104
+ import EmTree from './tree.vue';
105
+ import { selectObject } from '../../../src/config/api.js';
106
+ import $ from '../../../src/utils/util.js';
107
+ import request from '../../../src/utils/http.js';
108
+ export default {
109
+ components: { EmTree },
110
+ name: 'EmSelectorTree',
111
+ inheritAttrs: false,
112
+ props: {
113
+ isSelectAll: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ nameSize: {
118
+ type: [String, Number],
119
+ default: 38
120
+ },
121
+ nameBgColor: {
122
+ tpe: String,
123
+ default: ''
124
+ },
125
+ countPosition: {
126
+ type: String,
127
+ default: 'right'
128
+ },
129
+ showNameIcon: {
130
+ type: Boolean,
131
+ default: false
132
+ },
133
+ nameColor: {
134
+ type: String,
135
+ default: '#fff'
136
+ },
137
+ showNameIcon: {
138
+ type: Boolean,
139
+ default: false
140
+ },
141
+ countKey: {
142
+ type: String,
143
+ default: 'count'
144
+ },
145
+ showCount: {
146
+ type: Boolean,
147
+ default: false
148
+ },
149
+ selectLabel: {
150
+ type: Boolean,
151
+ default: false
152
+ },
153
+ unit: {
154
+ type: String,
155
+ default: '人'
156
+ },
157
+ disableds: {
158
+ type: Array,
159
+ default: () => []
160
+ },
161
+ showSearch: {
162
+ type: Boolean,
163
+ default: true
164
+ },
165
+ multiple: {
166
+ type: Boolean, // 判断是否多选
167
+ default: true
168
+ },
169
+ selectList: {
170
+ type: [Array, String], //传入选中数组
171
+ default: () => []
172
+ },
173
+ isAllCheck: {
174
+ type: Boolean,
175
+ default: false
176
+ },
177
+ // pid: {
178
+ // type: String, // 父id或者是空
179
+ // default: 'root'
180
+ // },
181
+ url: {
182
+ type: String,
183
+ default: ''
184
+ },
185
+ param: {
186
+ type: Object,
187
+ default: () => {
188
+ return { pid: 'root' };
189
+ }
190
+ },
191
+ // depId:{
192
+ // type: String, //
193
+ // default:''
194
+ // },
195
+ isEnterprise: {
196
+ type: Boolean,
197
+ default: false
198
+ },
199
+ isDepartment: {
200
+ type: Boolean,
201
+ default: false
202
+ },
203
+ departmentLabelKey: {
204
+ type: String,
205
+ default: 'objType'
206
+ },
207
+ departmentValueKey: {
208
+ type: String,
209
+ default: 'department'
210
+ },
211
+ nodeKey: {
212
+ type: String,
213
+ default: 'subNode'
214
+ },
215
+ tabs: {
216
+ type: [String, Object], //enterprise:单位,department:部门,employee:用户
217
+ default: 'employee'
218
+ },
219
+ objType: {
220
+ type: String, // 点击对象类型(enterprise:单位,department:部门,employee:用户,person:人员,persongroup:群组)
221
+ default: 'enterprise'
222
+ },
223
+ isOtherUnit: {
224
+ //是否是其它单位
225
+ type: Boolean,
226
+ default: false
227
+ },
228
+ filid: {
229
+ type: String, // 指定企业
230
+ default: undefined
231
+ },
232
+ type: {
233
+ type: String, // 组件类型
234
+ default: 'components'
235
+ },
236
+ navTitle: {
237
+ type: String,
238
+ default: '请选择'
239
+ },
240
+ showNavBar: {
241
+ type: Boolean,
242
+ default: true
243
+ },
244
+ showTree: {
245
+ type: Boolean,
246
+ default: true
247
+ },
248
+ showMore: {
249
+ type: Boolean,
250
+ default: true
251
+ },
252
+ isTreeIcon: {
253
+ type: Boolean,
254
+ default: false
255
+ },
256
+ isBgColor: {
257
+ type: Boolean,
258
+ default: true
259
+ },
260
+ promptText: {
261
+ type: String,
262
+ default: '只能选择一个'
263
+ },
264
+ listKey: {
265
+ type: String,
266
+ default: ''
267
+ },
268
+ valueKey: {
269
+ type: String,
270
+ default: 'showid'
271
+ },
272
+ labelKey: {
273
+ type: String,
274
+ default: 'showshortname'
275
+ },
276
+ paddingTop: {
277
+ type: [String, Number],
278
+ default: 0
279
+ },
280
+ isDefaultNode: {
281
+ type: Boolean,
282
+ default: true
283
+ },
284
+ nodeList: Array,
285
+ baseUrl: String
286
+ },
287
+ data() {
288
+ return {
289
+ genre: '',
290
+ personnel: '',
291
+ label: '',
292
+ namelike: '', //搜索关键字
293
+ list: [], //选中数组
294
+ selectData: [],
295
+ timer: null,
296
+ isSearch: false,
297
+ inputSearch: false,
298
+ newParam: {},
299
+ oldIsSearch: false,
300
+ selectIndex: 0,
301
+ checkObj: {},
302
+ first: true
303
+ };
304
+ },
305
+ watch: {
306
+ listKey: {
307
+ handler(val) {
308
+ this.label = val;
309
+ },
310
+ immediate: true
311
+ },
312
+ nodeList: {
313
+ handler(val) {
314
+ if (this.isSearch != this.oldIsSearch) {
315
+ this.getNodeList(true);
316
+ }
317
+ },
318
+ deep: true,
319
+ immediate: true
320
+ },
321
+ selectList: {
322
+ handler(val) {
323
+ typeof this.selectList != 'string' && (this.list = $.deepClone(val));
324
+ if (this.personnel.length == 0) {
325
+ if (this.nodeList) {
326
+ this.getNodeList();
327
+ } else {
328
+ this.getContent();
329
+ }
330
+ } else {
331
+ if (typeof this.selectList == 'string') {
332
+ this.selectData = [];
333
+ this.list = this.getSelectData(this.personnel);
334
+ this.$emit('update:selectList', this.list);
335
+ }
336
+ }
337
+ },
338
+ deep: true,
339
+ immediate: true
340
+ }
341
+ },
342
+ computed: {
343
+ newTabs() {
344
+ const tabs = {
345
+ enterprise: {
346
+ label: '选择单位',
347
+ name: 'enterprise',
348
+ url: selectObject,
349
+ data: [],
350
+ nodeData: '',
351
+ selection: [],
352
+ value: [],
353
+ param: {
354
+ objType: this.objType,
355
+ selecttype: 'enterprise',
356
+ pid: 'root'
357
+ }
358
+ },
359
+ department: {
360
+ label: '选择部门',
361
+ name: 'department',
362
+ url: selectObject,
363
+ data: [],
364
+ nodeData: '',
365
+ selection: [],
366
+ value: [],
367
+ param: {
368
+ objType: this.objType,
369
+ selecttype: 'department',
370
+ pid: 'root'
371
+ }
372
+ },
373
+ employee: {
374
+ label: '选择用户',
375
+ name: 'employee',
376
+ url: selectObject,
377
+ data: [],
378
+ nodeData: '',
379
+ selection: [],
380
+ value: [],
381
+ param: {
382
+ objType: this.objType,
383
+ selecttype: 'employee',
384
+ pid: 'root'
385
+ }
386
+ },
387
+ myemployee: {
388
+ label: '本单位用户',
389
+ name: 'myemployee',
390
+ url: selectObject,
391
+ data: [],
392
+ nodeData: '',
393
+ selection: [],
394
+ value: [],
395
+ param: {
396
+ objType: this.objType,
397
+ selecttype: 'employee',
398
+ pid: 'root'
399
+ }
400
+ },
401
+ otheremployee: {
402
+ label: '外单位用户',
403
+ name: 'otheremployee',
404
+ url: selectObject,
405
+ data: [],
406
+ nodeData: '',
407
+ selection: [],
408
+ value: [],
409
+ param: {
410
+ objType: this.objType,
411
+ selecttype: 'otheremployee',
412
+ pid: 'root'
413
+ }
414
+ },
415
+ person: {
416
+ label: '选择人员',
417
+ name: 'person',
418
+ url: selectObject,
419
+ data: [],
420
+ nodeData: '',
421
+ selection: [],
422
+ value: [],
423
+ param: {
424
+ objType: this.objType,
425
+ selecttype: 'person',
426
+ pid: 'root'
427
+ }
428
+ },
429
+ otherperson: {
430
+ label: '外单位人员',
431
+ name: 'otherperson',
432
+ url: selectObject,
433
+ data: [],
434
+ nodeData: '',
435
+ selection: [],
436
+ value: [],
437
+ param: {
438
+ objType: this.objType,
439
+ selecttype: 'otherperson',
440
+ pid: 'root'
441
+ }
442
+ },
443
+ persongroup: {
444
+ label: '选择群组成员',
445
+ name: 'persongroup',
446
+ url: selectObject,
447
+ data: [],
448
+ nodeData: '',
449
+ selection: [],
450
+ value: [],
451
+ param: {
452
+ objType: this.objType,
453
+ selecttype: 'persongroup',
454
+ pid: 'root'
455
+ }
456
+ },
457
+ filgroup: {
458
+ label: '单位群组成员',
459
+ data: [],
460
+ nodeData: '',
461
+ selection: [],
462
+ value: [],
463
+ name: 'filgroup',
464
+ url: selectObject,
465
+ param: {
466
+ objType: this.objType,
467
+ selecttype: 'filgroup',
468
+ pid: 'root'
469
+ }
470
+ },
471
+ depgroup: {
472
+ label: '部门群组成员',
473
+ name: 'depgroup',
474
+ url: selectObject,
475
+ data: [],
476
+ nodeData: '',
477
+ selection: [],
478
+ value: [],
479
+ param: {
480
+ objType: this.objType,
481
+ selecttype: 'depgroup',
482
+ pid: 'root'
483
+ }
484
+ },
485
+ persongroupobj: {
486
+ label: '人员群组',
487
+ name: 'persongroupobj',
488
+ url: selectObject,
489
+ data: [],
490
+ nodeData: '',
491
+ selection: [],
492
+ value: [],
493
+ param: {
494
+ objType: this.objType,
495
+ selecttype: 'persongroupobj',
496
+ pid: 'root'
497
+ }
498
+ },
499
+ filgroupobj: {
500
+ label: '单位群组',
501
+ name: 'filgroupobj',
502
+ url: selectObject,
503
+ data: [],
504
+ nodeData: '',
505
+ selection: [],
506
+ value: [],
507
+ param: {
508
+ objType: this.objType,
509
+ selecttype: 'filgroupobj',
510
+ pid: 'root'
511
+ }
512
+ },
513
+ depgroupobj: {
514
+ label: '部门群组',
515
+ name: 'depgroupobj',
516
+ url: selectObject,
517
+ data: [],
518
+ nodeData: '',
519
+ selection: [],
520
+ value: [],
521
+ param: {
522
+ objType: this.objType,
523
+ selecttype: 'depgroupobj',
524
+ pid: 'root'
525
+ }
526
+ },
527
+ role: {
528
+ label: '选择角色',
529
+ name: 'role',
530
+ url: selectObject,
531
+ data: [],
532
+ nodeData: '',
533
+ selection: [],
534
+ value: [],
535
+ param: {
536
+ objType: this.objType,
537
+ selecttype: 'role',
538
+ pid: 'root'
539
+ }
540
+ },
541
+ post: {
542
+ label: '选择岗位',
543
+ name: 'post',
544
+ url: selectObject,
545
+ data: [],
546
+ nodeData: '',
547
+ selection: [],
548
+ value: [],
549
+ param: {
550
+ objType: this.objType,
551
+ selecttype: 'post',
552
+ pid: 'root'
553
+ }
554
+ },
555
+ codetable: {
556
+ label: '代码表',
557
+ name: 'codetable',
558
+ url: selectObject,
559
+ data: [],
560
+ nodeData: '',
561
+ selection: [],
562
+ value: [],
563
+ param: {
564
+ objType: this.objType,
565
+ selecttype: 'codetable',
566
+ pid: 'root'
567
+ }
568
+ },
569
+ topcontacts: {
570
+ label: '常用联系人',
571
+ name: 'topcontacts',
572
+ url: selectObject,
573
+ data: [],
574
+ nodeData: '',
575
+ selection: [],
576
+ value: [],
577
+ param: {
578
+ objType: this.objType,
579
+ selecttype: 'topcontacts',
580
+ pid: 'root'
581
+ }
582
+ }
583
+ };
584
+ let copyTabs = this.tabs.split(',');
585
+ let obj = {};
586
+ copyTabs.map((x) => {
587
+ if(this.param[x]){
588
+ tabs[x].param = {...tabs[x].param, ...this.param[x]};
589
+ }
590
+ obj[x];
591
+ });
592
+ if (this.tabs) {
593
+ if (this.replace) {
594
+ return this.tabs;
595
+ } else {
596
+ obj = $.extend(true, tabs, obj);
597
+ }
598
+ }
599
+ let newtabs = [];
600
+ copyTabs.map((x) => {
601
+ if (this.param[x]) {
602
+ obj[x].param = { ...obj[x].param, ...this.param[x] };
603
+ }
604
+ newtabs.push(obj[x]);
605
+ });
606
+ return newtabs;
607
+ }
608
+ },
609
+ mounted() {
610
+ // typeof this.selectList != 'string' &&
611
+ // (this.list = $.deepClone(this.selectList));
612
+ // this.$nextTick(() => {
613
+ // if (this.nodeList) {
614
+ // this.getNodeList();
615
+ // } else {
616
+ // this.getContent();
617
+ // }
618
+ // });
619
+ },
620
+ methods: {
621
+ handleClick(index) {
622
+ this.selectIndex = index;
623
+ this.getContent(undefined,false);
624
+ },
625
+ getNodeList(isSearch) {
626
+ this.personnel = JSON.parse(JSON.stringify(this.nodeList));
627
+ // !isSearch && (this.list = $.deepClone(this.selectList));
628
+ if (!isSearch) {
629
+ if (typeof this.selectList == 'string') {
630
+ this.selectData = [];
631
+ this.list = this.getSelectData(this.personnel);
632
+ this.$emit('update:selectList', this.list);
633
+ } else {
634
+ this.list = $.deepClone(this.selectList);
635
+ }
636
+ }
637
+ let _this = this;
638
+ if (this.list && this.list.length > 0) {
639
+ this.list.filter((r) => {
640
+ _this.personnel.find((i) => {
641
+ if (i[_this.valueKey] === r[_this.valueKey]) {
642
+ _this.$set(i, 'checked', true);
643
+ } else if (i.children) {
644
+ _this.getActiveChildren(i.children, r[_this.valueKey]);
645
+ }
646
+ });
647
+ });
648
+ } else {
649
+ _this.personnel.map((x) => {
650
+ if (x.children && x.children.length > 0) {
651
+ this.setChecked(x.children);
652
+ } else {
653
+ _this.$set(x, 'checked', false);
654
+ }
655
+ });
656
+ }
657
+ },
658
+ getActiveChildren(data, id) {
659
+ const _this = this;
660
+ data.map((x) => {
661
+ if (x[_this.valueKey] === id) {
662
+ _this.$set(x, 'checked', true);
663
+ } else if (x.children) {
664
+ _this.getActiveChildren(x.children, id);
665
+ }
666
+ });
667
+ },
668
+ setChecked(list) {
669
+ list.map((x) => {
670
+ if (x.children && x.children.length > 0) {
671
+ this.setChecked(x.children);
672
+ } else {
673
+ this.$set(x, 'checked', false);
674
+ }
675
+ });
676
+ },
677
+ /**
678
+ * delteList
679
+ * @desc:删除选中的数据
680
+ * @date 2023年3月6日
681
+ * @author liufan
682
+ * @param {String,Number} i 点击数据的下标
683
+ */
684
+ delteList(i) {
685
+ this.oldIsSearch = this.isSearch;
686
+ let res = this.list[i];
687
+ this.getArray(this.personnel, res[this.valueKey]);
688
+ this.list.splice(i, 1);
689
+ },
690
+ // 树结构遍历
691
+ getArray(data, showid) {
692
+ for (let i in data) {
693
+ //满足条件
694
+ if (data[i][this.valueKey] == showid) {
695
+ this.$set(data[i], 'checked', false);
696
+ break;
697
+ } else {
698
+ //否则 继续遍历子元素
699
+ this.getArray(data[i].children, showid);
700
+ }
701
+ }
702
+ },
703
+ /**
704
+ * onSearch
705
+ * @desc:条件搜索
706
+ * @date 2023年3月6日
707
+ * @author liufan
708
+ */
709
+ onSearch() {
710
+ if (this.timer != null) {
711
+ clearTimeout(this.timer);
712
+ }
713
+ this.timer = setTimeout( () => {
714
+ if (this.$listeners.search) {
715
+ this.oldIsSearch = this.isSearch;
716
+ this.isSearch = !this.isSearch;
717
+ this.$emit('search', this.namelike);
718
+ } else {
719
+ this.getContent(undefined,!!this.namelike.trim());
720
+
721
+ }
722
+ }, 1000);
723
+ },
724
+ /**
725
+ * getContent
726
+ * @desc:获取数据
727
+ * @date 2023年3月6日
728
+ * @author liufan
729
+ */
730
+ getContent(name,isSearch) {
731
+ if (name) {
732
+ this.label = name;
733
+ }
734
+ // this.list = $.deepClone(this.selectList);
735
+ this.$toast.loading({
736
+ message: '加载中...',
737
+ forbidClick: true,
738
+ loadingType: 'spinner',
739
+ overlay: true,
740
+ duration: 0
741
+ });
742
+ this.newParam = { ...JSON.parse(JSON.stringify(this.param)) };
743
+ this.newParam.selecttype =
744
+ this.newTabs[this.selectIndex].param.selecttype;
745
+ if (this.newParam.selecttype === 'persongroup') {
746
+ if(this.newParam[this.newTabs[this.selectIndex].name]){
747
+ this.newParam = {...this.newTabs[this.selectIndex].param,...this.newParam[this.newTabs[this.selectIndex].name]?this.newParam[this.newTabs[this.selectIndex].name]:{}}
748
+ }else{
749
+ this.newParam.pid = 'root';
750
+ }
751
+ this.newParam.pid = 'root';
752
+ this.newParam.myUserid =
753
+ this.newParam.myUserid || $.getStorage('userId');
754
+ } else {
755
+ this.newParam = {...this.newParam,...this.newTabs[this.selectIndex].param,...this.newParam[this.newTabs[this.selectIndex].name]?this.newParam[this.newTabs[this.selectIndex].name]:{}}
756
+ if(this.param.pid){
757
+ this.newParam.pid = this.param.pid;
758
+ }
759
+ // this.newTabs[this.selectIndex].param.pid || this.param.pid || 'root';
760
+ }
761
+ delete this.newParam.department
762
+ delete this.newParam.myemployee
763
+ return request({
764
+ url: this.url
765
+ ? this.url
766
+ : this.baseUrl
767
+ ? this.baseUrl + selectObject
768
+ : selectObject,
769
+ params: {
770
+ objType: this.objType,
771
+ namelike: this.namelike,
772
+ selecttype: this.tabs,
773
+ filid: this.filid,
774
+ ...this.newParam
775
+ }
776
+ }).then((res) => {
777
+ if(isSearch != undefined){
778
+ this.inputSearch = isSearch;
779
+ }
780
+ this.$toast.clear();
781
+ const { rCode, msg } = res;
782
+ if (rCode == 0) {
783
+ if (typeof this.selectList == 'string') {
784
+ this.selectData = [];
785
+ this.list = this.getSelectData(
786
+ JSON.parse(JSON.stringify(res.results))
787
+ );
788
+ this.$emit('update:selectList', this.list);
789
+ }
790
+ this.personnel = JSON.parse(JSON.stringify(res.results));
791
+ let _this = this;
792
+ this.list.filter((r) => {
793
+ _this.personnel.find((i) => {
794
+ if (i[_this.valueKey] === r[_this.valueKey]) {
795
+ _this.$set(i, 'checked', true);
796
+ }
797
+ });
798
+ });
799
+ this.genre = JSON.parse(JSON.stringify(res.results));
800
+ } else {
801
+ this.$toast(msg);
802
+ }
803
+ });
804
+ },
805
+ getSelectData(data) {
806
+ const _this = this;
807
+ let user = this.selectList.split(',');
808
+ user.map((x) => {
809
+ data.map((i) => {
810
+ if (i[_this.valueKey] == x) {
811
+ this.selectData.push(i);
812
+ } else if (i.children) {
813
+ _this.getSelectData(i.children);
814
+ }
815
+ });
816
+ });
817
+ return this.selectData;
818
+ },
819
+ getData(obj) {
820
+ let params = {
821
+ ...this.newParam,
822
+ pid: obj[this.valueKey],
823
+ selecttype: obj.selecttype,
824
+ objType: obj.objType
825
+ };
826
+ this.$toast.loading({
827
+ message: '加载中...',
828
+ forbidClick: true,
829
+ loadingType: 'spinner',
830
+ overlay: true,
831
+ duration: 0
832
+ });
833
+ request({
834
+ url: this.url
835
+ ? this.url
836
+ : this.baseUrl
837
+ ? this.baseUrl + selectObject
838
+ : selectObject,
839
+ params: params
840
+ }).then((res) => {
841
+ if (res.rCode == 0) {
842
+ if (
843
+ res.results.length > 0 &&
844
+ res.results[0].nocheck == false &&
845
+ this.isAllCheck &&
846
+ this.multiple
847
+ ) {
848
+ res.results.unshift({
849
+ showshortname: '全选',
850
+ checked: false,
851
+ isAllCheck: true,
852
+ id: $.generateUUID(),
853
+ parentshowid: res.results[0].parentshowid
854
+ });
855
+ }
856
+ this.$set(obj, 'children', res.results);
857
+ let _this = this;
858
+ this.list.filter((r) => {
859
+ obj.children.find((i) => {
860
+ if (i[_this.valueKey] === r[_this.valueKey]) {
861
+ _this.$set(i, 'checked', true);
862
+ }
863
+ });
864
+ });
865
+ if (this.isAllCheck && this.multiple && obj.children.length > 0) {
866
+ let checkList = obj.children
867
+ .slice(1, obj.children.length)
868
+ .filter((x) => x.checked);
869
+ if (
870
+ checkList.length ===
871
+ obj.children.slice(1, obj.children.length).length
872
+ ) {
873
+ _this.$set(obj.children[0], 'checked', true);
874
+ }
875
+ }
876
+ }
877
+ this.$toast.clear();
878
+ });
879
+ },
880
+ getChiled(res, isStart, key) {
881
+ const _that = this;
882
+ let data = [];
883
+ if (this.isDefaultNode && !isStart) {
884
+ data = _that.$listeners[key]
885
+ ? _that.$listeners[key](res.obj, !!res.obj.children)
886
+ : undefined;
887
+ }
888
+ if (!isStart) {
889
+ if (res.obj.open) {
890
+ this.$set(res.obj, 'open', false);
891
+ } else {
892
+ this.$set(res.obj, 'open', true);
893
+ }
894
+ }
895
+ let newData = res.obj;
896
+ if (
897
+ (!newData.children || newData.children.length == 0) &&
898
+ !isStart &&
899
+ data
900
+ ) {
901
+ if (this.nodeList && this.nodeList.length > 0) {
902
+ this.$toast.loading({
903
+ message: '加载中...',
904
+ forbidClick: true,
905
+ loadingType: 'spinner',
906
+ overlay: true,
907
+ duration: 0
908
+ });
909
+ if (!Array.isArray(data)) {
910
+ data
911
+ .then((res) => {
912
+ res.map((x) => {
913
+ !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
914
+ });
915
+ _that.$set(newData, 'children', res);
916
+ if (_that.selectList && _that.selectList.length > 0) {
917
+ _that.selectList.filter((r) => {
918
+ newData.children.find((i) => {
919
+ if (i[_that.valueKey] === r[_that.valueKey]) {
920
+ _that.$set(i, 'checked', true);
921
+ }
922
+ });
923
+ });
924
+ } else {
925
+ newData.children.find((i) => {
926
+ _that.$set(i, 'checked', false);
927
+ });
928
+ }
929
+ this.$toast.clear();
930
+ })
931
+ .catch((err) => {
932
+ this.$toast('数据返回错误');
933
+ });
934
+ } else {
935
+ data.map((x) => {
936
+ !x[_that.nodeKey] && _that.$set(x, 'nocheck', false);
937
+ });
938
+ _that.$set(newData, 'children', data);
939
+ if (_that.selectList && _that.selectList.length > 0) {
940
+ _that.selectList.filter((r) => {
941
+ newData.children.find((i) => {
942
+ if (i[_that.valueKey] === r[_that.valueKey]) {
943
+ _that.$set(i, 'checked', true);
944
+ }
945
+ });
946
+ });
947
+ } else {
948
+ newData.children.find((i) => {
949
+ _that.$set(i, 'checked', false);
950
+ });
951
+ }
952
+ this.$toast.clear();
953
+ }
954
+ } else {
955
+ if (!res.obj.children || res.obj.children.length == 0) {
956
+ this.getData(res.obj);
957
+ }
958
+ }
959
+ }
960
+ },
961
+ open(res, isStart, isNode, key) {
962
+ const _that = this;
963
+ _that.oldIsSearch = _that.isSearch;
964
+ // debugger
965
+ if (
966
+ this.$listeners['node-click'] &&
967
+ (this.$listeners['left-icon'] ||
968
+ (this.showMore && !this.isDefaultNode)) &&
969
+ !isStart
970
+ ) {
971
+ if (this.$listeners['left-icon'] && key === 'node') {
972
+ this.getChiled(res, isStart, 'left-icon');
973
+ } else if (
974
+ this.showMore &&
975
+ this.$listeners['right-icon'] &&
976
+ key === 'node'
977
+ ) {
978
+ this.getChiled(res, isStart, 'right-icon');
979
+ } else if (
980
+ (!this.isDefaultNode && key === 'title') ||
981
+ (this.$listeners['node-click'] &&
982
+ this.$listeners['left-icon'] &&
983
+ !this.showMore &&
984
+ !this.isDefaultNode)
985
+ ) {
986
+ _that.$listeners['node-click'](res.obj, !!res.obj.children);
987
+ } else {
988
+ this.getChiled(res, isStart, 'node-click');
989
+ }
990
+ } else if (
991
+ this.$listeners['node-click'] ||
992
+ this.$listeners['left-icon'] ||
993
+ (this.showMore && !this.isDefaultNode)
994
+ ) {
995
+ isNode &&
996
+ this.$listeners['node-click'] &&
997
+ this.getChiled(res, isStart, 'node-click');
998
+ this.$listeners['left-icon'] &&
999
+ !isNode &&
1000
+ this.getChiled(res, isStart, 'left-icon');
1001
+ this.showMore &&
1002
+ !this.isDefaultNode &&
1003
+ !isNode &&
1004
+ this.getChiled(res, isStart, 'right-icon');
1005
+ } else {
1006
+ if (!isStart) {
1007
+ if (res.obj.open) {
1008
+ this.$set(res.obj, 'open', false);
1009
+ } else {
1010
+ this.$set(res.obj, 'open', true);
1011
+ }
1012
+ }
1013
+ if (!res.obj.children && !isStart) {
1014
+ this.getData(res.obj);
1015
+ }
1016
+ }
1017
+ },
1018
+ checked(res, model) {
1019
+ this.oldIsSearch = this.isSearch;
1020
+ if (!res.obj.mixType) {
1021
+ this.$set(res.obj, 'mixType', this.newTabs[this.selectIndex].name);
1022
+ }
1023
+ if (res.obj.checked) {
1024
+ if (res.obj.isAllCheck) {
1025
+ model.map((x) => {
1026
+ for (let i in this.list) {
1027
+ if (this.list[i][this.valueKey] == x[this.valueKey]) {
1028
+ this.list.splice(i, 1);
1029
+ }
1030
+ }
1031
+ this.$set(x, 'checked', false);
1032
+ });
1033
+ } else {
1034
+ for (let i in this.list) {
1035
+ if (this.list[i][this.valueKey] == res.obj[this.valueKey]) {
1036
+ this.list.splice(i, 1);
1037
+ }
1038
+ }
1039
+ this.$set(res.obj, 'checked', false);
1040
+ }
1041
+ } else {
1042
+ // if (!this.multiple && this.list.length >= 1) {
1043
+ // this.$toast(this.promptText);
1044
+ // return;
1045
+ // }
1046
+ if (res.obj.isAllCheck) {
1047
+ let selectData = [];
1048
+ this.$set(res.obj, 'checked', true);
1049
+ model.map((x) => {
1050
+
1051
+ if(!x.disabled && !x.nocheck && !x.isAllCheck && (x.selecttype == this.newParam.selecttype || (this.newParam.selecttype == 'persongroup' && x.selecttype == 'employee')) && this.disableds.indexOf(x[this.valueKey]) == -1){
1052
+ this.$set(x, 'checked', true);
1053
+ if (!x.mixType) {
1054
+ this.$set(x, 'mixType', this.newTabs[this.selectIndex].name);
1055
+ }
1056
+ selectData.push(x);
1057
+ }
1058
+ });
1059
+
1060
+ this.list.push(...selectData);
1061
+ // this.$set(res.obj, 'checked', true);
1062
+ } else {
1063
+ this.$set(res.obj, 'checked', true);
1064
+ if (!this.multiple) {
1065
+ this.list = [res.obj];
1066
+ this.setChecked(this.personnel, res.obj);
1067
+ } else {
1068
+ this.list.push(res.obj);
1069
+ }
1070
+ }
1071
+ }
1072
+ if (this.isAllCheck && this.multiple && model[0].isAllCheck) {
1073
+ let checkList = model.slice(1, model.length).filter((x) => x.checked);
1074
+ var obj = {};
1075
+ this.list = this.list.reduce((item, next) => {
1076
+ obj[next.showid] ? '' : (obj[next.showid] = true && item.push(next));
1077
+ return item;
1078
+ }, []);
1079
+ let newArr = model.filter((x) => !x.disabled&&!x.nocheck&& (x.selecttype == this.newParam.selecttype || (this.newParam.selecttype == 'persongroup' && x.selecttype == 'employee')) && this.disableds.indexOf(x[this.valueKey]) == -1);
1080
+ if (newArr.length === checkList.length) {
1081
+ model.map((x) => {
1082
+ if (!x.disabled) {
1083
+ this.$set(model[0], 'checked', true);
1084
+ }
1085
+ });
1086
+ } else {
1087
+ this.$set(model[0], 'checked', false);
1088
+ }
1089
+ }
1090
+ },
1091
+ setChecked(data, item) {
1092
+ data.map((x) => {
1093
+ if (x[this.valueKey] === item[this.valueKey]) {
1094
+ this.$set(x, 'checked', true);
1095
+ } else {
1096
+ this.$set(x, 'checked', false);
1097
+ }
1098
+ if (x.children) {
1099
+ this.setChecked(x.children, item);
1100
+ }
1101
+ });
1102
+ },
1103
+ dispose() {
1104
+ let obj = {
1105
+ list: this.list,
1106
+ label: this.label ? this.label : undefined
1107
+ };
1108
+ this.oldIsSearch = this.isSearch;
1109
+ this.$emit('dispose', $.deepClone(obj));
1110
+ this.$parent.$emit('change', $.deepClone(obj));
1111
+ },
1112
+ navigateBack() {
1113
+ this.$emit('close');
1114
+ }
1115
+ }
1116
+ };
1117
+ </script>