eoss-ui 0.6.18 → 0.6.20

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 (101) hide show
  1. package/lib/eoss-ui.common.js +761 -657
  2. package/lib/flow.js +619 -515
  3. package/lib/index.js +1 -1
  4. package/lib/main.js +132 -132
  5. package/lib/qr-code.js +13 -13
  6. package/lib/theme-chalk/index.css +1 -1
  7. package/lib/theme-chalk/login.css +1 -1
  8. package/package.json +157 -157
  9. package/packages/button/src/main.vue +418 -418
  10. package/packages/button-group/src/main.vue +298 -298
  11. package/packages/checkbox-group/src/main.vue +333 -333
  12. package/packages/clients/src/main.vue +144 -144
  13. package/packages/data-table/src/children.vue +39 -39
  14. package/packages/data-table/src/column.vue +983 -983
  15. package/packages/data-table/src/main.vue +1812 -1812
  16. package/packages/data-table/src/sizer.vue +195 -195
  17. package/packages/date-picker/src/main.vue +236 -236
  18. package/packages/flow/src/component/CustomPreset.vue +1 -1
  19. package/packages/flow/src/component/Preset.vue +1 -1
  20. package/packages/flow/src/component/SendMsg.vue +3 -1
  21. package/packages/flow/src/component/taskUnionExamine.vue +38 -20
  22. package/packages/flow/src/main.vue +2731 -2711
  23. package/packages/flow/src/processForm.vue +13 -2
  24. package/packages/flow/src/processReject.vue +14 -3
  25. package/packages/flow/src/startTaskRead.vue +23 -5
  26. package/packages/flow-group/src/main.vue +684 -684
  27. package/packages/form/src/main.vue +3582 -3582
  28. package/packages/form/src/table.vue +1420 -1420
  29. package/packages/handle-user/src/main.vue +134 -134
  30. package/packages/handler/src/main.vue +374 -374
  31. package/packages/icon/src/main.vue +101 -101
  32. package/packages/input/src/main.vue +356 -356
  33. package/packages/login/src/main.vue +1851 -1851
  34. package/packages/login/src/resetPassword.vue +557 -557
  35. package/packages/main/src/default/message.vue +249 -249
  36. package/packages/main/src/default/notice.vue +157 -157
  37. package/packages/main/src/default/userinfo.vue +494 -494
  38. package/packages/main/src/public/online.vue +89 -89
  39. package/packages/main/src/public/search.vue +454 -454
  40. package/packages/main/src/public/settings.vue +221 -221
  41. package/packages/main/src/simplicity/apps.vue +388 -388
  42. package/packages/main/src/simplicity/avatar.vue +82 -82
  43. package/packages/main/src/simplicity/handler.vue +183 -183
  44. package/packages/main/src/simplicity/index.vue +1930 -1930
  45. package/packages/main/src/simplicity/lists.vue +84 -84
  46. package/packages/main/src/simplicity/menu-list.vue +128 -128
  47. package/packages/main/src/simplicity/message.vue +259 -259
  48. package/packages/main/src/simplicity/notice.vue +190 -190
  49. package/packages/main/src/simplicity/router-page.vue +45 -45
  50. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  51. package/packages/main/src/simplicity/user.vue +248 -248
  52. package/packages/main/src/simplicity/userinfo.vue +304 -304
  53. package/packages/menu/src/main.vue +536 -536
  54. package/packages/pagination/src/main.vue +96 -96
  55. package/packages/qr-code/src/main.vue +170 -170
  56. package/packages/radio-group/src/main.vue +319 -319
  57. package/packages/select/src/main.vue +761 -761
  58. package/packages/selector/src/main.vue +677 -677
  59. package/packages/selector-panel/src/main.vue +1020 -1020
  60. package/packages/selector-panel/src/selection.vue +160 -160
  61. package/packages/tabs/src/main.vue +788 -788
  62. package/packages/theme-chalk/lib/index.css +1 -1
  63. package/packages/theme-chalk/lib/login.css +1 -1
  64. package/packages/theme-chalk/src/base.scss +260 -260
  65. package/packages/theme-chalk/src/button-group.scss +175 -175
  66. package/packages/theme-chalk/src/calendar.scss +113 -113
  67. package/packages/theme-chalk/src/clients.scss +87 -87
  68. package/packages/theme-chalk/src/common/var.scss +1 -4
  69. package/packages/theme-chalk/src/data-table.scss +276 -276
  70. package/packages/theme-chalk/src/dialog.scss +77 -77
  71. package/packages/theme-chalk/src/flow-group.scss +110 -110
  72. package/packages/theme-chalk/src/form.scss +496 -496
  73. package/packages/theme-chalk/src/handler.scss +133 -133
  74. package/packages/theme-chalk/src/icon.scss +1745 -1745
  75. package/packages/theme-chalk/src/icons.scss +99 -99
  76. package/packages/theme-chalk/src/login.scss +917 -926
  77. package/packages/theme-chalk/src/main.scss +632 -632
  78. package/packages/theme-chalk/src/menu.scss +222 -222
  79. package/packages/theme-chalk/src/nav.scss +125 -125
  80. package/packages/theme-chalk/src/pagination.scss +29 -29
  81. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  82. package/packages/theme-chalk/src/simplicity.scss +1246 -1246
  83. package/packages/theme-chalk/src/tabs.scss +87 -87
  84. package/packages/theme-chalk/src/toolbar.scss +179 -179
  85. package/packages/theme-chalk/src/tree-group.scss +72 -72
  86. package/packages/theme-chalk/src/tree.scss +165 -165
  87. package/packages/upload/src/main.vue +1313 -1313
  88. package/packages/wujie/src/main.vue +145 -145
  89. package/src/config/api.js +236 -236
  90. package/src/config/image.js +2 -2
  91. package/src/index.js +157 -157
  92. package/packages/.DS_Store +0 -0
  93. package/packages/checkbox-group/.DS_Store +0 -0
  94. package/packages/data-table/.DS_Store +0 -0
  95. package/packages/dialog/.DS_Store +0 -0
  96. package/packages/handler/.DS_Store +0 -0
  97. package/packages/login/.DS_Store +0 -0
  98. package/packages/main/.DS_Store +0 -0
  99. package/packages/main/src/.DS_Store +0 -0
  100. package/packages/theme-chalk/src/.DS_Store +0 -0
  101. package/src/.DS_Store +0 -0
@@ -1,983 +1,983 @@
1
- <template>
2
- <el-table-column v-bind="config" :key="field">
3
- <slot> </slot>
4
- <template slot-scope="scope">
5
- <template v-if="isForm && !isReadOnly(scope)">
6
- <el-form-item
7
- v-if="!(type === 'handle' && !scope.row.hideHandle)"
8
- :name="name"
9
- :prop="field || prop"
10
- :rules="isNotRule(scope) ? [] : rules"
11
- :index="scope.$index"
12
- >
13
- <component
14
- v-if="getType(scope.row.formConfigs, 'component')"
15
- :is="tag"
16
- v-bind="getOptions(scope.row.formConfigs)"
17
- v-model="scope.row[field || prop]"
18
- :data="getData(scope.row.formOptions)"
19
- @blur="
20
- (event) => {
21
- handleBlur({
22
- item: config,
23
- event: event,
24
- data: scope.row,
25
- scope: scope
26
- });
27
- }
28
- "
29
- @focus="
30
- (event) => {
31
- handleFocus({
32
- item: config,
33
- event: event,
34
- data: scope.row,
35
- scope: scope
36
- });
37
- }
38
- "
39
- @change="
40
- (value) => {
41
- handleChange({
42
- item: config,
43
- name: field || prop,
44
- value: value,
45
- data: scope.row,
46
- scope: scope
47
- });
48
- }
49
- "
50
- ></component>
51
- <es-select
52
- v-else-if="getType(scope.row.formConfigs, 'select')"
53
- v-bind="getOptions(scope.row.formConfigs)"
54
- v-model="scope.row[field || prop]"
55
- :data="getData(scope.row.formOptions)"
56
- @blur="
57
- (event) => {
58
- handleBlur({
59
- item: config,
60
- event: event,
61
- data: scope.row,
62
- scope: scope
63
- });
64
- }
65
- "
66
- @focus="
67
- (event) => {
68
- handleFocus({
69
- item: config,
70
- event: event,
71
- data: scope.row,
72
- scope: scope
73
- });
74
- }
75
- "
76
- @change="
77
- (value) => {
78
- handleChange({
79
- item: config,
80
- name: field || prop,
81
- value: value,
82
- data: scope.row,
83
- scope: scope
84
- });
85
- }
86
- "
87
- >
88
- </es-select>
89
- <es-cascader
90
- v-else-if="getType(scope.row.formConfigs, 'cascader')"
91
- v-bind="getOptions(scope.row.formConfigs)"
92
- v-model="scope.row[field || prop]"
93
- :data="getData(scope.row.formOptions)"
94
- @blur="
95
- (event) => {
96
- handleBlur({
97
- item: config,
98
- event: event,
99
- data: scope.row,
100
- scope: scope
101
- });
102
- }
103
- "
104
- @focus="
105
- (event) => {
106
- handleFocus({
107
- item: config,
108
- event: event,
109
- data: scope.row,
110
- scope: scope
111
- });
112
- }
113
- "
114
- @change="
115
- (value) => {
116
- handleChange({
117
- item: config,
118
- name: field || prop,
119
- value: value,
120
- data: scope.row,
121
- scope: scope
122
- });
123
- }
124
- "
125
- >
126
- </es-cascader>
127
- <es-select-ganged
128
- v-else-if="getType(scope.row.formConfigs, 'ganged')"
129
- v-bind="getOptions(scope.row.formConfigs)"
130
- v-model="scope.row[field || prop]"
131
- :data="init(getData(scope.row.formOptions), config)"
132
- @change="
133
- (value) => {
134
- handleChange({
135
- name: field || prop,
136
- value: value,
137
- data: scope.row,
138
- item: item
139
- });
140
- }
141
- "
142
- >
143
- </es-select-ganged>
144
- <es-radio-group
145
- v-else-if="getType(scope.row.formConfigs, 'radio')"
146
- v-bind="getOptions(scope.row.formConfigs)"
147
- v-model="scope.row[field || prop]"
148
- :data="getData(scope.row.formOptions)"
149
- @change="
150
- (value) => {
151
- handleChange({
152
- item: config,
153
- name: field || prop,
154
- value: value,
155
- data: scope.row
156
- });
157
- }
158
- "
159
- >
160
- </es-radio-group>
161
- <es-checkbox-group
162
- v-else-if="getType(scope.row.formConfigs, 'checkbox')"
163
- v-bind="getOptions(scope.row.formConfigs)"
164
- v-model="scope.row[field || prop]"
165
- :data="getData(scope.row.formOptions)"
166
- @change="
167
- (value) => {
168
- handleChange({
169
- item: config,
170
- name: field || prop,
171
- value: value,
172
- data: scope.row
173
- });
174
- }
175
- "
176
- >
177
- </es-checkbox-group>
178
- <es-switch
179
- v-else-if="getType(scope.row.formConfigs, 'switch')"
180
- v-bind="getOptions(scope.row.formConfigs)"
181
- v-model="scope.row[field || prop]"
182
- :data="getData(scope.row.formOptions)"
183
- @change="
184
- (value) => {
185
- handleChange({
186
- item: config,
187
- name: field || prop,
188
- value: value,
189
- data: scope.row
190
- });
191
- }
192
- "
193
- >
194
- </es-switch>
195
- <es-date-picker
196
- v-else-if="
197
- config.date ||
198
- getType(scope.row.formConfigs, [
199
- 'date',
200
- 'year',
201
- 'month',
202
- 'date',
203
- 'dates',
204
- 'week',
205
- 'datetime',
206
- 'datetimerange',
207
- 'daterange',
208
- 'monthrange',
209
- 'quarter',
210
- 'halfyear'
211
- ])
212
- "
213
- v-bind="getOptions(scope.row.formConfigs)"
214
- v-model="scope.row[field || prop]"
215
- :type="type"
216
- @blur="
217
- (event) => {
218
- handleBlur({
219
- item: config,
220
- event: event,
221
- data: scope.row,
222
- scope: scope
223
- });
224
- }
225
- "
226
- @focus="
227
- (event) => {
228
- handleFocus({
229
- item: config,
230
- event: event,
231
- data: scope.row,
232
- scope: scope
233
- });
234
- }
235
- "
236
- @change="
237
- (value) => {
238
- handleChange({
239
- item: config,
240
- name: field || prop,
241
- value: value,
242
- data: scope.row,
243
- scope: scope
244
- });
245
- }
246
- "
247
- >
248
- </es-date-picker>
249
- <es-input-number
250
- v-else-if="getType(scope.row.formConfigs, 'number')"
251
- v-bind="getOptions(scope.row.formConfigs)"
252
- v-model="scope.row[field || prop]"
253
- @blur="
254
- (event) => {
255
- handleBlur({
256
- item: config,
257
- event: event,
258
- data: scope.row,
259
- scope: scope
260
- });
261
- }
262
- "
263
- @focus="
264
- (event) => {
265
- handleFocus({
266
- item: config,
267
- event: event,
268
- data: scope.row,
269
- scope: scope
270
- });
271
- }
272
- "
273
- @change="
274
- (value) => {
275
- handleChange({
276
- item: config,
277
- name: field || prop,
278
- value: value,
279
- data: scope.row,
280
- scope: scope
281
- });
282
- }
283
- "
284
- >
285
- </es-input-number>
286
- <es-selector
287
- v-else-if="getType(scope.row.formConfigs, 'selector')"
288
- v-bind="getOptions(scope.row.formConfigs)"
289
- v-model="scope.row[field || prop]"
290
- v-on="
291
- exclAttribute({
292
- data: events,
293
- attrs: 'change'
294
- })
295
- "
296
- @change="
297
- (value) => {
298
- handleChange({
299
- item: config,
300
- name: field || prop,
301
- value: value,
302
- data: scope.row
303
- });
304
- }
305
- "
306
- >
307
- </es-selector>
308
- <template
309
- v-else-if="
310
- getType(scope.row.formConfigs, ['text', 'input', 'textarea'])
311
- "
312
- >
313
- <template v-if="config.lazy">
314
- <input
315
- v-if="getType(scope.row.formConfigs, ['text', 'input'])"
316
- class="el-input__inner"
317
- v-bind="getOptions(scope.row.formConfigs)"
318
- v-model.lazy="scope.row[field]"
319
- @blur="
320
- (event) => {
321
- handleBlur({
322
- item: config,
323
- event: event,
324
- data: scope.row,
325
- scope: scope
326
- });
327
- }
328
- "
329
- @focus="
330
- (event) => {
331
- handleFocus({
332
- item: config,
333
- event: event,
334
- data: scope.row,
335
- scope: scope
336
- });
337
- }
338
- "
339
- @change="
340
- (value) => {
341
- handleChange({
342
- item: config,
343
- name: field || prop,
344
- value: value,
345
- data: scope.row,
346
- scope: scope
347
- });
348
- }
349
- "
350
- />
351
- <textarea
352
- v-else
353
- class="el-textarea__inner"
354
- v-bind="getOptions(scope.row.formConfigs)"
355
- v-model.lazy="scope.row[field]"
356
- @blur="
357
- (event) => {
358
- handleBlur({
359
- item: config,
360
- event: event,
361
- data: scope.row,
362
- scope: scope
363
- });
364
- }
365
- "
366
- @focus="
367
- (event) => {
368
- handleFocus({
369
- item: config,
370
- event: event,
371
- data: scope.row,
372
- scope: scope
373
- });
374
- }
375
- "
376
- @change="
377
- (value) => {
378
- handleChange({
379
- item: config,
380
- name: field || prop,
381
- value: value,
382
- data: scope.row,
383
- scope: scope
384
- });
385
- }
386
- "
387
- ></textarea>
388
- </template>
389
- <es-input
390
- v-else
391
- v-bind="getOptions(scope.row.formConfigs)"
392
- :type="type"
393
- :scope="scope"
394
- v-model="scope.row[field || prop]"
395
- @blur="
396
- (event) => {
397
- handleBlur({
398
- item: config,
399
- event: event,
400
- data: scope.row,
401
- scope: scope
402
- });
403
- }
404
- "
405
- @focus="
406
- (event) => {
407
- handleFocus({
408
- item: config,
409
- event: event,
410
- data: scope.row,
411
- scope: scope
412
- });
413
- }
414
- "
415
- @change="
416
- (value) => {
417
- handleChange({
418
- item: config,
419
- name: field || prop,
420
- value: value,
421
- data: scope.row,
422
- scope: scope
423
- });
424
- }
425
- "
426
- >
427
- </es-input>
428
- </template>
429
- </el-form-item>
430
- </template>
431
- <expand-dom
432
- v-else-if="render"
433
- :column="config"
434
- :row="scope.row"
435
- :render="render"
436
- :index="indexs"
437
- >
438
- </expand-dom>
439
- <template v-else-if="dateFormat">
440
- {{ formatDate(scope.row[field || prop], dateFormat) }}
441
- </template>
442
- <span
443
- v-else-if="type === 'textarea'"
444
- v-html="format(scope.row, true)"
445
- :style="styles ? styles[scope.row[prop]] : {}"
446
- ></span>
447
- <span v-else :style="styles ? styles[scope.row[prop]] : {}">{{
448
- format(scope.row)
449
- }}</span>
450
- <es-button-group
451
- v-if="type === 'handle' && !scope.row.hideHandle"
452
- v-bind="
453
- exclAttribute({
454
- data: config,
455
- attrs: ['contents', 'events', 'type', 'width', 'template', 'title']
456
- })
457
- "
458
- stop
459
- :mode="mode"
460
- :contents="contents || events"
461
- :data="scope"
462
- @handleClick="handleClick"
463
- v-model="btnWidth"
464
- ></es-button-group>
465
- </template>
466
- </el-table-column>
467
- </template>
468
-
469
- <script type="text/babel">
470
- import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
471
- import util from 'eoss-ui/src/utils/util';
472
- export default {
473
- name: 'Column',
474
- components: {
475
- expandDom: {
476
- functional: true,
477
- props: {
478
- row: Object,
479
- render: [Function, String],
480
- index: Number,
481
- column: {
482
- type: Object,
483
- default: null
484
- }
485
- },
486
- render: (h, ctx) => {
487
- const params = {
488
- row: ctx.props.row,
489
- index: ctx.props.index
490
- };
491
- if (ctx.props.column) {
492
- params.column = ctx.props.column;
493
- }
494
- if (typeof ctx.props.render == 'string') {
495
- try {
496
- return util.toFunction(ctx.props.render)(h, params);
497
- } catch (error) {
498
- throw error;
499
- }
500
- }
501
- return ctx.props.render(h, params);
502
- }
503
- }
504
- },
505
- inject: {
506
- elForm: {
507
- default: ''
508
- },
509
- tableReload: {
510
- default: ''
511
- },
512
- table: {
513
- default: ''
514
- }
515
- },
516
- props: {
517
- tag: String,
518
- mode: String,
519
- service: String,
520
- form: Boolean,
521
- readonly: Boolean,
522
- name: String,
523
- filterIcon: [Boolean, String],
524
- title: String,
525
- label: String,
526
- labelKey: String,
527
- valueKey: String,
528
- field: String,
529
- prop: String,
530
- sortable: [Boolean, String],
531
- sort: [Boolean, String],
532
- className: String,
533
- labelClassName: String,
534
- type: String,
535
- required: Boolean,
536
- width: [Number, String],
537
- minWidth: [Number, String],
538
- hide: Boolean,
539
- showOverflowTooltip: [Boolean, Number],
540
- render: [Function, String],
541
- contents: Array,
542
- events: [Array, Object],
543
- dateFormat: String,
544
- dateValue: {
545
- type: String,
546
- default: ''
547
- },
548
- styles: [Array, Object],
549
- sysCode: String,
550
- valueToString: Boolean,
551
- symbol: String,
552
- rules: [Array, Object],
553
- method: String,
554
- indexs: {
555
- type: Number,
556
- default: null
557
- },
558
- data: [Object, Array],
559
- optionData: {
560
- type: Object,
561
- default() {
562
- return {};
563
- }
564
- }
565
- },
566
- watch: {
567
- optionData: {
568
- deep: true,
569
- handler(val) {
570
- this.optionDatas = val;
571
- }
572
- },
573
- width: {
574
- immediate: true,
575
- handler(val) {
576
- if (val) {
577
- this.btnWidth = parseInt(val, 10) + 'px';
578
- }
579
- }
580
- }
581
- },
582
- computed: {
583
- config() {
584
- let config = {
585
- label: this.label || this.title,
586
- width: this.btnWidth || this.width
587
- };
588
- if (this.type === 'expand') {
589
- config = { type: this.type, ...config, ...this.$attrs };
590
- return config;
591
- }
592
- let required = this.required;
593
- if (this.rules && !required) {
594
- if (Array.isArray(this.rules)) {
595
- this.rules.map((item) => {
596
- if (item.required) {
597
- required = item.required;
598
- }
599
- });
600
- } else if (this.rules.required) {
601
- required = this.rules.required;
602
- }
603
- }
604
- if (this.type === 'handle') {
605
- config.sort = true;
606
- config.outside = false;
607
- }
608
- return {
609
- ...config,
610
- filterIcon: this.icon,
611
- sortable: this.sortable || this.sort,
612
- minWidth: this.minWidth || this.table.minWidth,
613
- className: [
614
- this.className ? this.className : '',
615
- this.type ? ' es-table-' + this.type + '-box' : '',
616
- this.showOverflowTooltip ? ' es-text-ellipsis' : ''
617
- ].join(' '),
618
- labelClassName: [
619
- this.labelClassName ? this.labelClassName : '',
620
- required ? 'es-required' : ''
621
- ].join(' '),
622
- showOverflowTooltip: this.showOverflowTooltip,
623
- prop: this.field || this.prop,
624
- field: this.field,
625
- ...this.$attrs
626
- };
627
- },
628
- formOption() {
629
- let config = {
630
- labelKey: this.sysCode
631
- ? this.service
632
- ? 'label'
633
- : 'shortName'
634
- : this.labelKey,
635
- valueKey: this.sysCode
636
- ? this.service
637
- ? 'value'
638
- : 'cciValue'
639
- : this.valueKey,
640
- rules: this.rules,
641
- events: this.events,
642
- ...this.$attrs
643
- };
644
- return config;
645
- },
646
- icon() {
647
- if (this.filterIcon === true) {
648
- return 'es-icon-biao';
649
- }
650
- return false;
651
- },
652
- isForm() {
653
- let type = this.type ? this.type.toLowerCase() : '';
654
- let flag =
655
- (this.form &&
656
- [
657
- 'input',
658
- 'text',
659
- 'textarea',
660
- 'checkbox',
661
- 'radio',
662
- 'select',
663
- 'handle',
664
- 'date',
665
- 'year',
666
- 'month',
667
- 'date',
668
- 'dates',
669
- 'week',
670
- 'datetime',
671
- 'datetimerange',
672
- 'daterange',
673
- 'monthrange',
674
- 'quarter',
675
- 'halfyear',
676
- 'switch',
677
- 'selector',
678
- 'ganged',
679
- 'number'
680
- ].indexOf(type) > -1) ||
681
- ['space', 'slot'].indexOf(type) > -1;
682
- return flag;
683
- },
684
- option() {
685
- const field = this.field || this.prop;
686
- return this.data ? this.data : this.optionDatas[this.sysCode || field];
687
- },
688
- findCode() {
689
- if (this.service) {
690
- return `/${this.service}${getDictList}`;
691
- }
692
- return findSysCode;
693
- }
694
- },
695
- data() {
696
- return {
697
- btnWidth: '',
698
- searchs: [],
699
- optionDatas: this.optionData
700
- };
701
- },
702
- mounted() {},
703
- methods: {
704
- init(data, value, item) {
705
- if (data && value) {
706
- if (Array.isArray(value) && value.length) {
707
- if (item.url || this.sysCode) {
708
- value.forEach(async (val, index) => {
709
- if (
710
- val.hasSub == false ||
711
- this.searchs.indexOf(val[this.valueKey] || val.value) > -1
712
- ) {
713
- return;
714
- }
715
- this.searchs.push(val[this.valueKey] || val.value);
716
- if ((item.ganged && index < item.ganged - 1) || val.hasSub) {
717
- let option = data[index + 1];
718
- let lists = [];
719
- if (option) {
720
- let v = val[this.valueKey] || val.value;
721
- lists = option.filter((list) => {
722
- return list[item.filtrateKey] == v;
723
- });
724
- }
725
- if (lists.length == 0) {
726
- let queryKey = item.queryKey;
727
- let param = {};
728
- if (queryKey) {
729
- for (let i in queryKey) {
730
- param[i] = val[queryKey[i]];
731
- }
732
- }
733
- let params = util.extend(
734
- true,
735
- this.sysCode
736
- ? { sysAppCode: this.sysCode, code: sysCode }
737
- : {},
738
- item.param ? item.param : {},
739
- param
740
- );
741
- await util
742
- .ajax({
743
- url: this.sysCode ? this.findCode : item.url,
744
- method: this.method,
745
- params: params,
746
- data: params
747
- })
748
- .then((res) => {
749
- if (res.rCode === 0) {
750
- let options = JSON.parse(JSON.stringify(data));
751
- if (options[index + 1]) {
752
- this.$set(
753
- data,
754
- index + 1,
755
- options[index + 1].concat(
756
- JSON.parse(JSON.stringify(res.results))
757
- )
758
- );
759
- } else {
760
- this.$set(
761
- data,
762
- index + 1,
763
- JSON.parse(JSON.stringify(res.results))
764
- );
765
- }
766
- } else {
767
- let msg = res.msg || '系统错误,请联系管理员!';
768
- this.$message.error(msg);
769
- }
770
- })
771
- .catch((err) => {
772
- if (err.message && err.message !== 'canceled') {
773
- this.$message.error(err.message);
774
- }
775
- });
776
- }
777
- }
778
- });
779
- }
780
- }
781
- }
782
- return data;
783
- },
784
- getType(config, types) {
785
- let type =
786
- config && config[this.field || this.prop]
787
- ? config[this.field || this.prop]['type'] ||
788
- config[this.field || this.prop]
789
- : this.type;
790
- return Array.isArray(types) ? types.includes(type) : type == types;
791
- },
792
- getOptions(config) {
793
- let option = config && config[this.field || this.prop];
794
- return option && typeof option == 'object'
795
- ? { ...this.formOption, ...option }
796
- : this.formOption;
797
- },
798
- getData(res) {
799
- return res && res[this.field || this.prop]
800
- ? res[this.field || this.prop]
801
- : this.option;
802
- },
803
- exclAttribute({ data, attrs }) {
804
- return util.exclAttribute({ data, attrs });
805
- },
806
- format(rows, flag) {
807
- const field = this.field || this.prop;
808
- let data = this.option;
809
- let str = '';
810
- if (util.isObject(rows[field])) {
811
- str =
812
- rows[field][this.labelKey] ||
813
- rows[field]['name'] ||
814
- rows[field]['label'] ||
815
- rows[field]['shortName'];
816
- } else if (Array.isArray(rows[field])) {
817
- const vals = rows[field].map((item) => {
818
- if (util.isObject(item)) {
819
- return (
820
- item[this.labelKey] ||
821
- item['name'] ||
822
- item['label'] ||
823
- item['shortName']
824
- );
825
- } else {
826
- if (data && data.length && util.isObject(data[0])) {
827
- return this.getLabel(data, item);
828
- }
829
- return item;
830
- }
831
- });
832
- str = vals.join(this.symbol ? this.symbol : '-');
833
- } else {
834
- if (this.valueToString) {
835
- const vals = rows[field].split(',').map((item) => {
836
- if (data && data.length && util.isObject(data[0])) {
837
- return this.getLabel(data, item);
838
- }
839
- return item;
840
- });
841
- str = vals.join(this.symbol ? this.symbol : '-');
842
- } else {
843
- if (data && data.length && util.isObject(data[0])) {
844
- str = this.getLabel(data, rows[field]);
845
- } else {
846
- str = rows[field];
847
- }
848
- }
849
- }
850
- if (str && flag) {
851
- str = str.replace(RegExp('\\n', 'g'), '<br/>');
852
- str = str.replace(RegExp(' ', 'g'), '&nbsp;');
853
- }
854
- return str;
855
- },
856
- getLabel(obj, val) {
857
- for (let i = 0; i < obj.length; i++) {
858
- let item = obj[i];
859
- let value = item[this.valueKey || 'cciValue'] || item['value'];
860
- if (value == val) {
861
- return (
862
- item[this.labelKey] ||
863
- item['name'] ||
864
- item['label'] ||
865
- item['shortName']
866
- );
867
- } else if (item.children && item.children.length) {
868
- return this.getLabel(item.children, val);
869
- }
870
- }
871
- },
872
- isReadOnly(scope) {
873
- return (
874
- scope.row.canEdit === false ||
875
- this.readonly ||
876
- this.$attrs.editable === false ||
877
- (scope.row.cantEditKey &&
878
- scope.row.cantEditKey.indexOf(this.field || this.prop) > -1)
879
- );
880
- },
881
- isNotRule(scope) {
882
- if (
883
- scope.row.canRule === false ||
884
- (scope.row.notRules &&
885
- scope.row.notRules.indexOf(this.field || this.prop) > -1)
886
- ) {
887
- this.elForm && this.elForm.clearValidate(this.field || this.prop);
888
- return true;
889
- }
890
- return false;
891
- },
892
- handleBlur(data) {
893
- this.events && this.events.blur && this.events.blur(data);
894
- this.$emit('formBlur', data);
895
- this.$emit('form-blur', data);
896
- },
897
- handleFocus(data) {
898
- this.events && this.events.focus && this.events.focus(data);
899
- this.$emit('formFocus', data);
900
- this.$emit('form-focus', data);
901
- },
902
- handleChange(datas) {
903
- let { item, name, data } = datas;
904
- if (
905
- item &&
906
- ((data.formConfigs && data.formConfigs[name] == 'ganged') ||
907
- this.type == 'ganged')
908
- ) {
909
- let { index, value } = datas.value;
910
- if (
911
- (item.url || this.sysCode) &&
912
- ((item.ganged && index > item.ganged - 1) || value.hasSub)
913
- ) {
914
- let filte = value[this.valueKey] || value.value;
915
- let datas = [];
916
- if (this.optionDatas[this.field || this.prop][index + 1]) {
917
- datas = this.optionDatas[this.field || this.prop][index + 1].filter(
918
- (items) => {
919
- return filte == items[item.filtrateKey];
920
- }
921
- );
922
- }
923
- if (datas.length == 0) {
924
- let queryKey = item.queryKey;
925
- let param = {};
926
- if (queryKey) {
927
- for (let i in queryKey) {
928
- param[i] = value[queryKey[i]];
929
- }
930
- }
931
- let params = util.extend(
932
- true,
933
- this.sysCode ? { sysAppCode: this.sysCode, code: sysCode } : {},
934
- item.param ? item.param : {},
935
- param
936
- );
937
- util
938
- .ajax({
939
- url: this.sysCode ? this.findCode : item.url,
940
- method: this.method,
941
- params: params,
942
- data: params
943
- })
944
- .then((res) => {
945
- if (res.rCode === 0) {
946
- let options = JSON.parse(
947
- JSON.stringify(this.optionDatas[this.sysCode])
948
- );
949
- if (options[index + 1]) {
950
- options[index + 1] = options[index + 1].concat(
951
- JSON.parse(JSON.stringify(res.results))
952
- );
953
- } else {
954
- options.push(JSON.parse(JSON.stringify(res.results)));
955
- }
956
- this.$set(this.optionDatas, this.sysCode, options);
957
- } else {
958
- let msg = res.msg || '系统错误,请联系管理员!';
959
- this.$message.error(msg);
960
- }
961
- })
962
- .catch((err) => {
963
- if (err.message && err.message !== 'canceled') {
964
- this.$message.error(err.message);
965
- }
966
- });
967
- }
968
- }
969
- }
970
- this.events && this.events.change && this.events.change(datas);
971
- this.$emit('formChange', datas);
972
- this.$emit('form-change', datas);
973
- },
974
- handleClick(data) {
975
- this.$emit('handleClick', data);
976
- this.$emit('handle-click', data);
977
- },
978
- formatDate(date, fmt) {
979
- return date ? util.formatDate(date, fmt) : this.dateValue;
980
- }
981
- }
982
- };
983
- </script>
1
+ <template>
2
+ <el-table-column v-bind="config" :key="field">
3
+ <slot> </slot>
4
+ <template slot-scope="scope">
5
+ <template v-if="isForm && !isReadOnly(scope)">
6
+ <el-form-item
7
+ v-if="!(type === 'handle' && !scope.row.hideHandle)"
8
+ :name="name"
9
+ :prop="field || prop"
10
+ :rules="isNotRule(scope) ? [] : rules"
11
+ :index="scope.$index"
12
+ >
13
+ <component
14
+ v-if="getType(scope.row.formConfigs, 'component')"
15
+ :is="tag"
16
+ v-bind="getOptions(scope.row.formConfigs)"
17
+ v-model="scope.row[field || prop]"
18
+ :data="getData(scope.row.formOptions)"
19
+ @blur="
20
+ (event) => {
21
+ handleBlur({
22
+ item: config,
23
+ event: event,
24
+ data: scope.row,
25
+ scope: scope
26
+ });
27
+ }
28
+ "
29
+ @focus="
30
+ (event) => {
31
+ handleFocus({
32
+ item: config,
33
+ event: event,
34
+ data: scope.row,
35
+ scope: scope
36
+ });
37
+ }
38
+ "
39
+ @change="
40
+ (value) => {
41
+ handleChange({
42
+ item: config,
43
+ name: field || prop,
44
+ value: value,
45
+ data: scope.row,
46
+ scope: scope
47
+ });
48
+ }
49
+ "
50
+ ></component>
51
+ <es-select
52
+ v-else-if="getType(scope.row.formConfigs, 'select')"
53
+ v-bind="getOptions(scope.row.formConfigs)"
54
+ v-model="scope.row[field || prop]"
55
+ :data="getData(scope.row.formOptions)"
56
+ @blur="
57
+ (event) => {
58
+ handleBlur({
59
+ item: config,
60
+ event: event,
61
+ data: scope.row,
62
+ scope: scope
63
+ });
64
+ }
65
+ "
66
+ @focus="
67
+ (event) => {
68
+ handleFocus({
69
+ item: config,
70
+ event: event,
71
+ data: scope.row,
72
+ scope: scope
73
+ });
74
+ }
75
+ "
76
+ @change="
77
+ (value) => {
78
+ handleChange({
79
+ item: config,
80
+ name: field || prop,
81
+ value: value,
82
+ data: scope.row,
83
+ scope: scope
84
+ });
85
+ }
86
+ "
87
+ >
88
+ </es-select>
89
+ <es-cascader
90
+ v-else-if="getType(scope.row.formConfigs, 'cascader')"
91
+ v-bind="getOptions(scope.row.formConfigs)"
92
+ v-model="scope.row[field || prop]"
93
+ :data="getData(scope.row.formOptions)"
94
+ @blur="
95
+ (event) => {
96
+ handleBlur({
97
+ item: config,
98
+ event: event,
99
+ data: scope.row,
100
+ scope: scope
101
+ });
102
+ }
103
+ "
104
+ @focus="
105
+ (event) => {
106
+ handleFocus({
107
+ item: config,
108
+ event: event,
109
+ data: scope.row,
110
+ scope: scope
111
+ });
112
+ }
113
+ "
114
+ @change="
115
+ (value) => {
116
+ handleChange({
117
+ item: config,
118
+ name: field || prop,
119
+ value: value,
120
+ data: scope.row,
121
+ scope: scope
122
+ });
123
+ }
124
+ "
125
+ >
126
+ </es-cascader>
127
+ <es-select-ganged
128
+ v-else-if="getType(scope.row.formConfigs, 'ganged')"
129
+ v-bind="getOptions(scope.row.formConfigs)"
130
+ v-model="scope.row[field || prop]"
131
+ :data="init(getData(scope.row.formOptions), config)"
132
+ @change="
133
+ (value) => {
134
+ handleChange({
135
+ name: field || prop,
136
+ value: value,
137
+ data: scope.row,
138
+ item: item
139
+ });
140
+ }
141
+ "
142
+ >
143
+ </es-select-ganged>
144
+ <es-radio-group
145
+ v-else-if="getType(scope.row.formConfigs, 'radio')"
146
+ v-bind="getOptions(scope.row.formConfigs)"
147
+ v-model="scope.row[field || prop]"
148
+ :data="getData(scope.row.formOptions)"
149
+ @change="
150
+ (value) => {
151
+ handleChange({
152
+ item: config,
153
+ name: field || prop,
154
+ value: value,
155
+ data: scope.row
156
+ });
157
+ }
158
+ "
159
+ >
160
+ </es-radio-group>
161
+ <es-checkbox-group
162
+ v-else-if="getType(scope.row.formConfigs, 'checkbox')"
163
+ v-bind="getOptions(scope.row.formConfigs)"
164
+ v-model="scope.row[field || prop]"
165
+ :data="getData(scope.row.formOptions)"
166
+ @change="
167
+ (value) => {
168
+ handleChange({
169
+ item: config,
170
+ name: field || prop,
171
+ value: value,
172
+ data: scope.row
173
+ });
174
+ }
175
+ "
176
+ >
177
+ </es-checkbox-group>
178
+ <es-switch
179
+ v-else-if="getType(scope.row.formConfigs, 'switch')"
180
+ v-bind="getOptions(scope.row.formConfigs)"
181
+ v-model="scope.row[field || prop]"
182
+ :data="getData(scope.row.formOptions)"
183
+ @change="
184
+ (value) => {
185
+ handleChange({
186
+ item: config,
187
+ name: field || prop,
188
+ value: value,
189
+ data: scope.row
190
+ });
191
+ }
192
+ "
193
+ >
194
+ </es-switch>
195
+ <es-date-picker
196
+ v-else-if="
197
+ config.date ||
198
+ getType(scope.row.formConfigs, [
199
+ 'date',
200
+ 'year',
201
+ 'month',
202
+ 'date',
203
+ 'dates',
204
+ 'week',
205
+ 'datetime',
206
+ 'datetimerange',
207
+ 'daterange',
208
+ 'monthrange',
209
+ 'quarter',
210
+ 'halfyear'
211
+ ])
212
+ "
213
+ v-bind="getOptions(scope.row.formConfigs)"
214
+ v-model="scope.row[field || prop]"
215
+ :type="type"
216
+ @blur="
217
+ (event) => {
218
+ handleBlur({
219
+ item: config,
220
+ event: event,
221
+ data: scope.row,
222
+ scope: scope
223
+ });
224
+ }
225
+ "
226
+ @focus="
227
+ (event) => {
228
+ handleFocus({
229
+ item: config,
230
+ event: event,
231
+ data: scope.row,
232
+ scope: scope
233
+ });
234
+ }
235
+ "
236
+ @change="
237
+ (value) => {
238
+ handleChange({
239
+ item: config,
240
+ name: field || prop,
241
+ value: value,
242
+ data: scope.row,
243
+ scope: scope
244
+ });
245
+ }
246
+ "
247
+ >
248
+ </es-date-picker>
249
+ <es-input-number
250
+ v-else-if="getType(scope.row.formConfigs, 'number')"
251
+ v-bind="getOptions(scope.row.formConfigs)"
252
+ v-model="scope.row[field || prop]"
253
+ @blur="
254
+ (event) => {
255
+ handleBlur({
256
+ item: config,
257
+ event: event,
258
+ data: scope.row,
259
+ scope: scope
260
+ });
261
+ }
262
+ "
263
+ @focus="
264
+ (event) => {
265
+ handleFocus({
266
+ item: config,
267
+ event: event,
268
+ data: scope.row,
269
+ scope: scope
270
+ });
271
+ }
272
+ "
273
+ @change="
274
+ (value) => {
275
+ handleChange({
276
+ item: config,
277
+ name: field || prop,
278
+ value: value,
279
+ data: scope.row,
280
+ scope: scope
281
+ });
282
+ }
283
+ "
284
+ >
285
+ </es-input-number>
286
+ <es-selector
287
+ v-else-if="getType(scope.row.formConfigs, 'selector')"
288
+ v-bind="getOptions(scope.row.formConfigs)"
289
+ v-model="scope.row[field || prop]"
290
+ v-on="
291
+ exclAttribute({
292
+ data: events,
293
+ attrs: 'change'
294
+ })
295
+ "
296
+ @change="
297
+ (value) => {
298
+ handleChange({
299
+ item: config,
300
+ name: field || prop,
301
+ value: value,
302
+ data: scope.row
303
+ });
304
+ }
305
+ "
306
+ >
307
+ </es-selector>
308
+ <template
309
+ v-else-if="
310
+ getType(scope.row.formConfigs, ['text', 'input', 'textarea'])
311
+ "
312
+ >
313
+ <template v-if="config.lazy">
314
+ <input
315
+ v-if="getType(scope.row.formConfigs, ['text', 'input'])"
316
+ class="el-input__inner"
317
+ v-bind="getOptions(scope.row.formConfigs)"
318
+ v-model.lazy="scope.row[field]"
319
+ @blur="
320
+ (event) => {
321
+ handleBlur({
322
+ item: config,
323
+ event: event,
324
+ data: scope.row,
325
+ scope: scope
326
+ });
327
+ }
328
+ "
329
+ @focus="
330
+ (event) => {
331
+ handleFocus({
332
+ item: config,
333
+ event: event,
334
+ data: scope.row,
335
+ scope: scope
336
+ });
337
+ }
338
+ "
339
+ @change="
340
+ (value) => {
341
+ handleChange({
342
+ item: config,
343
+ name: field || prop,
344
+ value: value,
345
+ data: scope.row,
346
+ scope: scope
347
+ });
348
+ }
349
+ "
350
+ />
351
+ <textarea
352
+ v-else
353
+ class="el-textarea__inner"
354
+ v-bind="getOptions(scope.row.formConfigs)"
355
+ v-model.lazy="scope.row[field]"
356
+ @blur="
357
+ (event) => {
358
+ handleBlur({
359
+ item: config,
360
+ event: event,
361
+ data: scope.row,
362
+ scope: scope
363
+ });
364
+ }
365
+ "
366
+ @focus="
367
+ (event) => {
368
+ handleFocus({
369
+ item: config,
370
+ event: event,
371
+ data: scope.row,
372
+ scope: scope
373
+ });
374
+ }
375
+ "
376
+ @change="
377
+ (value) => {
378
+ handleChange({
379
+ item: config,
380
+ name: field || prop,
381
+ value: value,
382
+ data: scope.row,
383
+ scope: scope
384
+ });
385
+ }
386
+ "
387
+ ></textarea>
388
+ </template>
389
+ <es-input
390
+ v-else
391
+ v-bind="getOptions(scope.row.formConfigs)"
392
+ :type="type"
393
+ :scope="scope"
394
+ v-model="scope.row[field || prop]"
395
+ @blur="
396
+ (event) => {
397
+ handleBlur({
398
+ item: config,
399
+ event: event,
400
+ data: scope.row,
401
+ scope: scope
402
+ });
403
+ }
404
+ "
405
+ @focus="
406
+ (event) => {
407
+ handleFocus({
408
+ item: config,
409
+ event: event,
410
+ data: scope.row,
411
+ scope: scope
412
+ });
413
+ }
414
+ "
415
+ @change="
416
+ (value) => {
417
+ handleChange({
418
+ item: config,
419
+ name: field || prop,
420
+ value: value,
421
+ data: scope.row,
422
+ scope: scope
423
+ });
424
+ }
425
+ "
426
+ >
427
+ </es-input>
428
+ </template>
429
+ </el-form-item>
430
+ </template>
431
+ <expand-dom
432
+ v-else-if="render"
433
+ :column="config"
434
+ :row="scope.row"
435
+ :render="render"
436
+ :index="indexs"
437
+ >
438
+ </expand-dom>
439
+ <template v-else-if="dateFormat">
440
+ {{ formatDate(scope.row[field || prop], dateFormat) }}
441
+ </template>
442
+ <span
443
+ v-else-if="type === 'textarea'"
444
+ v-html="format(scope.row, true)"
445
+ :style="styles ? styles[scope.row[prop]] : {}"
446
+ ></span>
447
+ <span v-else :style="styles ? styles[scope.row[prop]] : {}">{{
448
+ format(scope.row)
449
+ }}</span>
450
+ <es-button-group
451
+ v-if="type === 'handle' && !scope.row.hideHandle"
452
+ v-bind="
453
+ exclAttribute({
454
+ data: config,
455
+ attrs: ['contents', 'events', 'type', 'width', 'template', 'title']
456
+ })
457
+ "
458
+ stop
459
+ :mode="mode"
460
+ :contents="contents || events"
461
+ :data="scope"
462
+ @handleClick="handleClick"
463
+ v-model="btnWidth"
464
+ ></es-button-group>
465
+ </template>
466
+ </el-table-column>
467
+ </template>
468
+
469
+ <script type="text/babel">
470
+ import { findSysCode, getDictList } from 'eoss-ui/src/config/api.js';
471
+ import util from 'eoss-ui/src/utils/util';
472
+ export default {
473
+ name: 'Column',
474
+ components: {
475
+ expandDom: {
476
+ functional: true,
477
+ props: {
478
+ row: Object,
479
+ render: [Function, String],
480
+ index: Number,
481
+ column: {
482
+ type: Object,
483
+ default: null
484
+ }
485
+ },
486
+ render: (h, ctx) => {
487
+ const params = {
488
+ row: ctx.props.row,
489
+ index: ctx.props.index
490
+ };
491
+ if (ctx.props.column) {
492
+ params.column = ctx.props.column;
493
+ }
494
+ if (typeof ctx.props.render == 'string') {
495
+ try {
496
+ return util.toFunction(ctx.props.render)(h, params);
497
+ } catch (error) {
498
+ throw error;
499
+ }
500
+ }
501
+ return ctx.props.render(h, params);
502
+ }
503
+ }
504
+ },
505
+ inject: {
506
+ elForm: {
507
+ default: ''
508
+ },
509
+ tableReload: {
510
+ default: ''
511
+ },
512
+ table: {
513
+ default: ''
514
+ }
515
+ },
516
+ props: {
517
+ tag: String,
518
+ mode: String,
519
+ service: String,
520
+ form: Boolean,
521
+ readonly: Boolean,
522
+ name: String,
523
+ filterIcon: [Boolean, String],
524
+ title: String,
525
+ label: String,
526
+ labelKey: String,
527
+ valueKey: String,
528
+ field: String,
529
+ prop: String,
530
+ sortable: [Boolean, String],
531
+ sort: [Boolean, String],
532
+ className: String,
533
+ labelClassName: String,
534
+ type: String,
535
+ required: Boolean,
536
+ width: [Number, String],
537
+ minWidth: [Number, String],
538
+ hide: Boolean,
539
+ showOverflowTooltip: [Boolean, Number],
540
+ render: [Function, String],
541
+ contents: Array,
542
+ events: [Array, Object],
543
+ dateFormat: String,
544
+ dateValue: {
545
+ type: String,
546
+ default: ''
547
+ },
548
+ styles: [Array, Object],
549
+ sysCode: String,
550
+ valueToString: Boolean,
551
+ symbol: String,
552
+ rules: [Array, Object],
553
+ method: String,
554
+ indexs: {
555
+ type: Number,
556
+ default: null
557
+ },
558
+ data: [Object, Array],
559
+ optionData: {
560
+ type: Object,
561
+ default() {
562
+ return {};
563
+ }
564
+ }
565
+ },
566
+ watch: {
567
+ optionData: {
568
+ deep: true,
569
+ handler(val) {
570
+ this.optionDatas = val;
571
+ }
572
+ },
573
+ width: {
574
+ immediate: true,
575
+ handler(val) {
576
+ if (val) {
577
+ this.btnWidth = parseInt(val, 10) + 'px';
578
+ }
579
+ }
580
+ }
581
+ },
582
+ computed: {
583
+ config() {
584
+ let config = {
585
+ label: this.label || this.title,
586
+ width: this.btnWidth || this.width
587
+ };
588
+ if (this.type === 'expand') {
589
+ config = { type: this.type, ...config, ...this.$attrs };
590
+ return config;
591
+ }
592
+ let required = this.required;
593
+ if (this.rules && !required) {
594
+ if (Array.isArray(this.rules)) {
595
+ this.rules.map((item) => {
596
+ if (item.required) {
597
+ required = item.required;
598
+ }
599
+ });
600
+ } else if (this.rules.required) {
601
+ required = this.rules.required;
602
+ }
603
+ }
604
+ if (this.type === 'handle') {
605
+ config.sort = true;
606
+ config.outside = false;
607
+ }
608
+ return {
609
+ ...config,
610
+ filterIcon: this.icon,
611
+ sortable: this.sortable || this.sort,
612
+ minWidth: this.minWidth || this.table.minWidth,
613
+ className: [
614
+ this.className ? this.className : '',
615
+ this.type ? ' es-table-' + this.type + '-box' : '',
616
+ this.showOverflowTooltip ? ' es-text-ellipsis' : ''
617
+ ].join(' '),
618
+ labelClassName: [
619
+ this.labelClassName ? this.labelClassName : '',
620
+ required ? 'es-required' : ''
621
+ ].join(' '),
622
+ showOverflowTooltip: this.showOverflowTooltip,
623
+ prop: this.field || this.prop,
624
+ field: this.field,
625
+ ...this.$attrs
626
+ };
627
+ },
628
+ formOption() {
629
+ let config = {
630
+ labelKey: this.sysCode
631
+ ? this.service
632
+ ? 'label'
633
+ : 'shortName'
634
+ : this.labelKey,
635
+ valueKey: this.sysCode
636
+ ? this.service
637
+ ? 'value'
638
+ : 'cciValue'
639
+ : this.valueKey,
640
+ rules: this.rules,
641
+ events: this.events,
642
+ ...this.$attrs
643
+ };
644
+ return config;
645
+ },
646
+ icon() {
647
+ if (this.filterIcon === true) {
648
+ return 'es-icon-biao';
649
+ }
650
+ return false;
651
+ },
652
+ isForm() {
653
+ let type = this.type ? this.type.toLowerCase() : '';
654
+ let flag =
655
+ (this.form &&
656
+ [
657
+ 'input',
658
+ 'text',
659
+ 'textarea',
660
+ 'checkbox',
661
+ 'radio',
662
+ 'select',
663
+ 'handle',
664
+ 'date',
665
+ 'year',
666
+ 'month',
667
+ 'date',
668
+ 'dates',
669
+ 'week',
670
+ 'datetime',
671
+ 'datetimerange',
672
+ 'daterange',
673
+ 'monthrange',
674
+ 'quarter',
675
+ 'halfyear',
676
+ 'switch',
677
+ 'selector',
678
+ 'ganged',
679
+ 'number'
680
+ ].indexOf(type) > -1) ||
681
+ ['space', 'slot'].indexOf(type) > -1;
682
+ return flag;
683
+ },
684
+ option() {
685
+ const field = this.field || this.prop;
686
+ return this.data ? this.data : this.optionDatas[this.sysCode || field];
687
+ },
688
+ findCode() {
689
+ if (this.service) {
690
+ return `/${this.service}${getDictList}`;
691
+ }
692
+ return findSysCode;
693
+ }
694
+ },
695
+ data() {
696
+ return {
697
+ btnWidth: '',
698
+ searchs: [],
699
+ optionDatas: this.optionData
700
+ };
701
+ },
702
+ mounted() {},
703
+ methods: {
704
+ init(data, value, item) {
705
+ if (data && value) {
706
+ if (Array.isArray(value) && value.length) {
707
+ if (item.url || this.sysCode) {
708
+ value.forEach(async (val, index) => {
709
+ if (
710
+ val.hasSub == false ||
711
+ this.searchs.indexOf(val[this.valueKey] || val.value) > -1
712
+ ) {
713
+ return;
714
+ }
715
+ this.searchs.push(val[this.valueKey] || val.value);
716
+ if ((item.ganged && index < item.ganged - 1) || val.hasSub) {
717
+ let option = data[index + 1];
718
+ let lists = [];
719
+ if (option) {
720
+ let v = val[this.valueKey] || val.value;
721
+ lists = option.filter((list) => {
722
+ return list[item.filtrateKey] == v;
723
+ });
724
+ }
725
+ if (lists.length == 0) {
726
+ let queryKey = item.queryKey;
727
+ let param = {};
728
+ if (queryKey) {
729
+ for (let i in queryKey) {
730
+ param[i] = val[queryKey[i]];
731
+ }
732
+ }
733
+ let params = util.extend(
734
+ true,
735
+ this.sysCode
736
+ ? { sysAppCode: this.sysCode, code: sysCode }
737
+ : {},
738
+ item.param ? item.param : {},
739
+ param
740
+ );
741
+ await util
742
+ .ajax({
743
+ url: this.sysCode ? this.findCode : item.url,
744
+ method: this.method,
745
+ params: params,
746
+ data: params
747
+ })
748
+ .then((res) => {
749
+ if (res.rCode === 0) {
750
+ let options = JSON.parse(JSON.stringify(data));
751
+ if (options[index + 1]) {
752
+ this.$set(
753
+ data,
754
+ index + 1,
755
+ options[index + 1].concat(
756
+ JSON.parse(JSON.stringify(res.results))
757
+ )
758
+ );
759
+ } else {
760
+ this.$set(
761
+ data,
762
+ index + 1,
763
+ JSON.parse(JSON.stringify(res.results))
764
+ );
765
+ }
766
+ } else {
767
+ let msg = res.msg || '系统错误,请联系管理员!';
768
+ this.$message.error(msg);
769
+ }
770
+ })
771
+ .catch((err) => {
772
+ if (err.message && err.message !== 'canceled') {
773
+ this.$message.error(err.message);
774
+ }
775
+ });
776
+ }
777
+ }
778
+ });
779
+ }
780
+ }
781
+ }
782
+ return data;
783
+ },
784
+ getType(config, types) {
785
+ let type =
786
+ config && config[this.field || this.prop]
787
+ ? config[this.field || this.prop]['type'] ||
788
+ config[this.field || this.prop]
789
+ : this.type;
790
+ return Array.isArray(types) ? types.includes(type) : type == types;
791
+ },
792
+ getOptions(config) {
793
+ let option = config && config[this.field || this.prop];
794
+ return option && typeof option == 'object'
795
+ ? { ...this.formOption, ...option }
796
+ : this.formOption;
797
+ },
798
+ getData(res) {
799
+ return res && res[this.field || this.prop]
800
+ ? res[this.field || this.prop]
801
+ : this.option;
802
+ },
803
+ exclAttribute({ data, attrs }) {
804
+ return util.exclAttribute({ data, attrs });
805
+ },
806
+ format(rows, flag) {
807
+ const field = this.field || this.prop;
808
+ let data = this.option;
809
+ let str = '';
810
+ if (util.isObject(rows[field])) {
811
+ str =
812
+ rows[field][this.labelKey] ||
813
+ rows[field]['name'] ||
814
+ rows[field]['label'] ||
815
+ rows[field]['shortName'];
816
+ } else if (Array.isArray(rows[field])) {
817
+ const vals = rows[field].map((item) => {
818
+ if (util.isObject(item)) {
819
+ return (
820
+ item[this.labelKey] ||
821
+ item['name'] ||
822
+ item['label'] ||
823
+ item['shortName']
824
+ );
825
+ } else {
826
+ if (data && data.length && util.isObject(data[0])) {
827
+ return this.getLabel(data, item);
828
+ }
829
+ return item;
830
+ }
831
+ });
832
+ str = vals.join(this.symbol ? this.symbol : '-');
833
+ } else {
834
+ if (this.valueToString) {
835
+ const vals = rows[field].split(',').map((item) => {
836
+ if (data && data.length && util.isObject(data[0])) {
837
+ return this.getLabel(data, item);
838
+ }
839
+ return item;
840
+ });
841
+ str = vals.join(this.symbol ? this.symbol : '-');
842
+ } else {
843
+ if (data && data.length && util.isObject(data[0])) {
844
+ str = this.getLabel(data, rows[field]);
845
+ } else {
846
+ str = rows[field];
847
+ }
848
+ }
849
+ }
850
+ if (str && flag) {
851
+ str = str.replace(RegExp('\\n', 'g'), '<br/>');
852
+ str = str.replace(RegExp(' ', 'g'), '&nbsp;');
853
+ }
854
+ return str;
855
+ },
856
+ getLabel(obj, val) {
857
+ for (let i = 0; i < obj.length; i++) {
858
+ let item = obj[i];
859
+ let value = item[this.valueKey || 'cciValue'] || item['value'];
860
+ if (value == val) {
861
+ return (
862
+ item[this.labelKey] ||
863
+ item['name'] ||
864
+ item['label'] ||
865
+ item['shortName']
866
+ );
867
+ } else if (item.children && item.children.length) {
868
+ return this.getLabel(item.children, val);
869
+ }
870
+ }
871
+ },
872
+ isReadOnly(scope) {
873
+ return (
874
+ scope.row.canEdit === false ||
875
+ this.readonly ||
876
+ this.$attrs.editable === false ||
877
+ (scope.row.cantEditKey &&
878
+ scope.row.cantEditKey.indexOf(this.field || this.prop) > -1)
879
+ );
880
+ },
881
+ isNotRule(scope) {
882
+ if (
883
+ scope.row.canRule === false ||
884
+ (scope.row.notRules &&
885
+ scope.row.notRules.indexOf(this.field || this.prop) > -1)
886
+ ) {
887
+ this.elForm && this.elForm.clearValidate(this.field || this.prop);
888
+ return true;
889
+ }
890
+ return false;
891
+ },
892
+ handleBlur(data) {
893
+ this.events && this.events.blur && this.events.blur(data);
894
+ this.$emit('formBlur', data);
895
+ this.$emit('form-blur', data);
896
+ },
897
+ handleFocus(data) {
898
+ this.events && this.events.focus && this.events.focus(data);
899
+ this.$emit('formFocus', data);
900
+ this.$emit('form-focus', data);
901
+ },
902
+ handleChange(datas) {
903
+ let { item, name, data } = datas;
904
+ if (
905
+ item &&
906
+ ((data.formConfigs && data.formConfigs[name] == 'ganged') ||
907
+ this.type == 'ganged')
908
+ ) {
909
+ let { index, value } = datas.value;
910
+ if (
911
+ (item.url || this.sysCode) &&
912
+ ((item.ganged && index > item.ganged - 1) || value.hasSub)
913
+ ) {
914
+ let filte = value[this.valueKey] || value.value;
915
+ let datas = [];
916
+ if (this.optionDatas[this.field || this.prop][index + 1]) {
917
+ datas = this.optionDatas[this.field || this.prop][index + 1].filter(
918
+ (items) => {
919
+ return filte == items[item.filtrateKey];
920
+ }
921
+ );
922
+ }
923
+ if (datas.length == 0) {
924
+ let queryKey = item.queryKey;
925
+ let param = {};
926
+ if (queryKey) {
927
+ for (let i in queryKey) {
928
+ param[i] = value[queryKey[i]];
929
+ }
930
+ }
931
+ let params = util.extend(
932
+ true,
933
+ this.sysCode ? { sysAppCode: this.sysCode, code: sysCode } : {},
934
+ item.param ? item.param : {},
935
+ param
936
+ );
937
+ util
938
+ .ajax({
939
+ url: this.sysCode ? this.findCode : item.url,
940
+ method: this.method,
941
+ params: params,
942
+ data: params
943
+ })
944
+ .then((res) => {
945
+ if (res.rCode === 0) {
946
+ let options = JSON.parse(
947
+ JSON.stringify(this.optionDatas[this.sysCode])
948
+ );
949
+ if (options[index + 1]) {
950
+ options[index + 1] = options[index + 1].concat(
951
+ JSON.parse(JSON.stringify(res.results))
952
+ );
953
+ } else {
954
+ options.push(JSON.parse(JSON.stringify(res.results)));
955
+ }
956
+ this.$set(this.optionDatas, this.sysCode, options);
957
+ } else {
958
+ let msg = res.msg || '系统错误,请联系管理员!';
959
+ this.$message.error(msg);
960
+ }
961
+ })
962
+ .catch((err) => {
963
+ if (err.message && err.message !== 'canceled') {
964
+ this.$message.error(err.message);
965
+ }
966
+ });
967
+ }
968
+ }
969
+ }
970
+ this.events && this.events.change && this.events.change(datas);
971
+ this.$emit('formChange', datas);
972
+ this.$emit('form-change', datas);
973
+ },
974
+ handleClick(data) {
975
+ this.$emit('handleClick', data);
976
+ this.$emit('handle-click', data);
977
+ },
978
+ formatDate(date, fmt) {
979
+ return date ? util.formatDate(date, fmt) : this.dateValue;
980
+ }
981
+ }
982
+ };
983
+ </script>