eoss-ui 0.7.74 → 0.7.75

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 (161) hide show
  1. package/lib/calogin.js +233 -233
  2. package/lib/eoss-ui.common.js +256 -256
  3. package/lib/flow.js +4 -4
  4. package/lib/index.js +1 -1
  5. package/lib/qr-code.js +13 -13
  6. package/lib/theme-chalk/flow.css +1 -1
  7. package/lib/theme-chalk/index.css +1 -1
  8. package/lib/theme-chalk/login.css +1 -1
  9. package/package.json +1 -1
  10. package/packages/button/index.js +5 -5
  11. package/packages/button/src/main.vue +418 -418
  12. package/packages/button-group/index.js +5 -5
  13. package/packages/calendar/index.js +5 -5
  14. package/packages/calogin/index.js +5 -5
  15. package/packages/calogin/src/plugin.js +915 -915
  16. package/packages/card/index.js +5 -5
  17. package/packages/card/src/main.vue +156 -156
  18. package/packages/cascader/index.js +5 -5
  19. package/packages/cascader/src/main.vue +168 -168
  20. package/packages/checkbox-group/index.js +5 -5
  21. package/packages/checkbox-group/src/main.vue +333 -333
  22. package/packages/clients/index.js +5 -5
  23. package/packages/data-table/index.js +5 -5
  24. package/packages/data-table/src/children.vue +39 -39
  25. package/packages/data-table/src/sizer.vue +195 -195
  26. package/packages/data-table-form/index.js +5 -5
  27. package/packages/data-table-form/src/checkbox.vue +101 -101
  28. package/packages/data-table-form/src/colgroup.vue +17 -17
  29. package/packages/data-table-form/src/main.vue +181 -181
  30. package/packages/data-table-form/src/radio.vue +65 -65
  31. package/packages/data-table-form/src/table.vue +233 -233
  32. package/packages/data-table-form/src/tbody.vue +336 -336
  33. package/packages/data-table-form/src/thead.vue +68 -68
  34. package/packages/date-picker/index.js +5 -5
  35. package/packages/date-picker/src/main.vue +236 -236
  36. package/packages/dialog/index.js +5 -5
  37. package/packages/enable-drag/index.js +5 -5
  38. package/packages/enterprise/index.js +5 -5
  39. package/packages/enterprise/src/main.vue +66 -66
  40. package/packages/error-page/index.js +5 -5
  41. package/packages/error-page/src/main.vue +44 -44
  42. package/packages/flow/index.js +5 -5
  43. package/packages/flow/src/component/TimeLimit.vue +190 -190
  44. package/packages/flow/src/main.vue +2 -2
  45. package/packages/flow/src/table.vue +58 -58
  46. package/packages/flow-group/index.js +5 -5
  47. package/packages/flow-list/index.js +5 -5
  48. package/packages/form/index.js +5 -5
  49. package/packages/handle-user/index.js +5 -5
  50. package/packages/handler/index.js +5 -5
  51. package/packages/icon/index.js +5 -5
  52. package/packages/icons/index.js +5 -5
  53. package/packages/icons/src/main.vue +81 -81
  54. package/packages/input/index.js +5 -5
  55. package/packages/input/src/main.vue +356 -356
  56. package/packages/input-number/index.js +5 -5
  57. package/packages/input-number/src/main.vue +106 -106
  58. package/packages/label/index.js +5 -5
  59. package/packages/label/src/main.vue +457 -457
  60. package/packages/layout/index.js +5 -5
  61. package/packages/layout/src/item.vue +152 -152
  62. package/packages/layout/src/main.vue +31 -31
  63. package/packages/login/index.js +5 -5
  64. package/packages/main/index.js +5 -5
  65. package/packages/main/src/default/message.vue +249 -249
  66. package/packages/main/src/default/notice.vue +157 -157
  67. package/packages/main/src/simplicity/lists.vue +84 -84
  68. package/packages/main/src/simplicity/router-page.vue +45 -45
  69. package/packages/menu/index.js +5 -5
  70. package/packages/nav/index.js +5 -5
  71. package/packages/notify/index.js +5 -5
  72. package/packages/notify/src/main.vue +538 -538
  73. package/packages/page/index.js +5 -5
  74. package/packages/page/src/main.vue +167 -167
  75. package/packages/pagination/index.js +5 -5
  76. package/packages/pagination/src/main.vue +96 -96
  77. package/packages/player/index.js +5 -5
  78. package/packages/player/src/main.vue +194 -194
  79. package/packages/qr-code/index.js +5 -5
  80. package/packages/qr-code/src/main.vue +170 -170
  81. package/packages/radio-group/index.js +6 -6
  82. package/packages/radio-group/src/main.vue +319 -319
  83. package/packages/retrial-auth/index.js +5 -5
  84. package/packages/retrial-auth/src/main.vue +280 -280
  85. package/packages/select/index.js +5 -5
  86. package/packages/select-ganged/index.js +5 -5
  87. package/packages/select-ganged/src/main.vue +724 -724
  88. package/packages/selector/index.js +5 -5
  89. package/packages/selector-panel/index.js +5 -5
  90. package/packages/selector-panel/src/tree.vue +129 -129
  91. package/packages/sizer/index.js +5 -5
  92. package/packages/sizer/src/main.vue +254 -254
  93. package/packages/steps/index.js +5 -5
  94. package/packages/steps/src/main.vue +181 -181
  95. package/packages/switch/index.js +5 -5
  96. package/packages/table-form/index.js +5 -5
  97. package/packages/tabs/index.js +5 -5
  98. package/packages/tabs/src/main.vue +788 -788
  99. package/packages/tabs-panel/index.js +5 -5
  100. package/packages/tabs-panel/src/main.vue +29 -29
  101. package/packages/theme-chalk/lib/flow.css +1 -1
  102. package/packages/theme-chalk/lib/index.css +1 -1
  103. package/packages/theme-chalk/lib/login.css +1 -1
  104. package/packages/theme-chalk/src/base.scss +261 -261
  105. package/packages/theme-chalk/src/button-group.scss +176 -176
  106. package/packages/theme-chalk/src/button.scss +24 -24
  107. package/packages/theme-chalk/src/calendar.scss +113 -113
  108. package/packages/theme-chalk/src/card.scss +99 -99
  109. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  110. package/packages/theme-chalk/src/clients.scss +87 -87
  111. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  112. package/packages/theme-chalk/src/date-picker.scss +7 -7
  113. package/packages/theme-chalk/src/dialog.scss +77 -77
  114. package/packages/theme-chalk/src/enable-drag.scss +181 -181
  115. package/packages/theme-chalk/src/enterprise.scss +5 -5
  116. package/packages/theme-chalk/src/error-page.scss +18 -18
  117. package/packages/theme-chalk/src/flow-group.scss +110 -110
  118. package/packages/theme-chalk/src/flow-list.scss +39 -39
  119. package/packages/theme-chalk/src/flow.scss +5 -0
  120. package/packages/theme-chalk/src/handle-user.scss +40 -40
  121. package/packages/theme-chalk/src/icons.scss +99 -99
  122. package/packages/theme-chalk/src/input.scss +9 -9
  123. package/packages/theme-chalk/src/label.scss +24 -24
  124. package/packages/theme-chalk/src/layout.scss +46 -46
  125. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  126. package/packages/theme-chalk/src/nav.scss +111 -111
  127. package/packages/theme-chalk/src/page.scss +3 -3
  128. package/packages/theme-chalk/src/pagination.scss +29 -29
  129. package/packages/theme-chalk/src/player.scss +9 -9
  130. package/packages/theme-chalk/src/qr-code.scss +17 -17
  131. package/packages/theme-chalk/src/radio-group.scss +9 -9
  132. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  133. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  134. package/packages/theme-chalk/src/select.scss +8 -8
  135. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  136. package/packages/theme-chalk/src/sizer.scss +36 -36
  137. package/packages/theme-chalk/src/steps.scss +88 -88
  138. package/packages/theme-chalk/src/switch.scss +3 -3
  139. package/packages/theme-chalk/src/table-form.scss +1 -1
  140. package/packages/theme-chalk/src/tabs.scss +87 -87
  141. package/packages/theme-chalk/src/tips.scss +7 -7
  142. package/packages/theme-chalk/src/toolbar.scss +179 -179
  143. package/packages/theme-chalk/src/tree-group.scss +72 -72
  144. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  145. package/packages/tips/index.js +5 -5
  146. package/packages/toolbar/index.js +5 -5
  147. package/packages/tree/index.js +5 -5
  148. package/packages/tree-group/index.js +5 -5
  149. package/packages/upload/index.js +5 -5
  150. package/packages/upload/src/picture.js +15 -15
  151. package/packages/wujie/index.js +5 -5
  152. package/packages/wujie/src/main.vue +145 -145
  153. package/packages/wxlogin/index.js +5 -5
  154. package/packages/wxlogin/src/main.vue +128 -128
  155. package/src/config/image.js +2 -2
  156. package/src/index.js +1 -1
  157. package/src/utils/bus.js +3 -3
  158. package/src/utils/date-util.js +312 -312
  159. package/src/utils/http.js +50 -50
  160. package/src/utils/store.js +21 -21
  161. package/src/utils/webSocket.js +107 -107
@@ -1,418 +1,418 @@
1
- <script>
2
- import util from 'eoss-ui/src/utils/util';
3
- export default {
4
- name: 'EsButton',
5
- inject: {
6
- esSelect: {
7
- default: ''
8
- },
9
- esForm: {
10
- default: ''
11
- },
12
- esTable: {
13
- default: ''
14
- },
15
- btnGroup: {
16
- default: ''
17
- }
18
- },
19
- props: {
20
- data: {},
21
- icon: String,
22
- iconPlacement: {
23
- type: String,
24
- default: 'start'
25
- },
26
- link: String,
27
- hide: Boolean,
28
- param: Object,
29
- type: String,
30
- mold: String,
31
- size: String,
32
- open: Boolean,
33
- reload: Boolean,
34
- name: {
35
- type: String,
36
- default: ''
37
- },
38
- specs: [Boolean, String],
39
- required: [String, Array, Object],
40
- fields: [String, Array, Object],
41
- message: [Object, Boolean],
42
- alert: [Object, Boolean],
43
- mapFields: Object,
44
- useCaseCode: String,
45
- closed: Function,
46
- stop: Boolean,
47
- syncKeys: Object,
48
- text: String,
49
- onClick: Function,
50
- badge: [Object, Number, Function],
51
- float: String,
52
- selector: Boolean,
53
- upload: Boolean,
54
- outside: {
55
- type: Boolean,
56
- default: true
57
- }
58
- },
59
- computed: {
60
- _type() {
61
- return this.type ? this.type : this.mold;
62
- }
63
- },
64
- data() {
65
- return {};
66
- },
67
- methods: {
68
- handleClick(evt) {
69
- if (this.onClick) {
70
- this.onClick(evt);
71
- } else {
72
- if (this.open && this.link) {
73
- let windows;
74
- let fields = [];
75
- let param = this.param ? this.param : {};
76
- evt.stopPropagation();
77
- evt.preventDefault();
78
- let width = 0;
79
- let height = 0;
80
- width = util.win.top.screen.availWidth - 10;
81
- height = util.win.top.screen.availHeight - 60;
82
- let flag = true;
83
- if (this.esForm) {
84
- let params = util.getParams({ url: this.link });
85
- let modal = this.esForm.models;
86
- let models = util.extend({}, params || {}, modal);
87
- if (this.required) {
88
- if (Array.isArray(this.required)) {
89
- this.esForm.validateField(this.required, (res) => {
90
- if (res) {
91
- flag = false;
92
- } else {
93
- flag = true;
94
- }
95
- });
96
- if (flag) {
97
- fields = this.required;
98
- this.required.forEach((item) => {
99
- param[item] = models[item];
100
- });
101
- }
102
- } else if (typeof this.required === 'object') {
103
- for (let i in this.required) {
104
- fields.push(this.required[i]);
105
- param[i] = models[this.required[i]];
106
- }
107
- this.esForm.validateField(fields, (res) => {
108
- if (res) {
109
- flag = false;
110
- } else {
111
- flag = true;
112
- }
113
- });
114
- } else {
115
- this.esForm.validateField(this.required, (res) => {
116
- if (res) {
117
- flag = false;
118
- } else {
119
- flag = true;
120
- }
121
- });
122
- if (flag) {
123
- fields = this.required;
124
- if (
125
- models[this.required] == null ||
126
- models[this.required] == undefined ||
127
- models[this.required] == ''
128
- ) {
129
- param[this.required] = models[this.required];
130
- }
131
- }
132
- }
133
- }
134
- if (this.fields) {
135
- let empty = [];
136
- if (Array.isArray(this.fields)) {
137
- this.fields.forEach((item) => {
138
- if (models[item] == undefined || models[item] == '') {
139
- empty.push(item);
140
- }
141
- param[item] = models[item];
142
- });
143
- } else if (typeof this.fields === 'object') {
144
- for (let i in this.fields) {
145
- if (
146
- models[this.fields[i]] == undefined ||
147
- models[this.fields[i]] == ''
148
- ) {
149
- empty.push(this.fields[i]);
150
- }
151
- param[i] = models[this.fields[i]];
152
- }
153
- } else {
154
- if (
155
- models[this.fields] == undefined ||
156
- models[this.fields] == ''
157
- ) {
158
- empty.push(this.fields);
159
- }
160
- param[this.fields] = models[this.fields];
161
- }
162
- if (empty.length) {
163
- let msg = [];
164
- if (this.mapFields) {
165
- empty.forEach((item) => {
166
- msg.push(this.mapFields[item]);
167
- });
168
- } else {
169
- msg = empty;
170
- }
171
- if (this.message) {
172
- flag = false;
173
- if (typeof this.message == 'boolean') {
174
- this.$message.error(msg.join(',') + '不能为空!');
175
- } else {
176
- let message =
177
- msg.join(',') + (this.message.message || '不能为空!');
178
- this.$message({
179
- type: 'error',
180
- ...this.message,
181
- message: message
182
- });
183
- }
184
- }
185
- if (this.alert) {
186
- flag = false;
187
- if (typeof this.alert == 'boolean') {
188
- this.$alert(msg.join(',') + '不能为空!', '提示', {
189
- type: 'error',
190
- confirmButtonText: '确定'
191
- }).catch();
192
- } else {
193
- let message =
194
- msg.join(',') + (this.alert.message || '不能为空!');
195
- this.$alert(
196
- message,
197
- this.alert.titl || '提示',
198
- this.alert.config || {
199
- type: 'error',
200
- confirmButtonText: '确定'
201
- }
202
- ).catch();
203
- }
204
- }
205
- }
206
- }
207
- }
208
- if (this.btnGroup && this.syncKeys) {
209
- let data = this.btnGroup.data;
210
- if (
211
- data &&
212
- Object.keys(data).length &&
213
- Object.keys(this.syncKeys).length
214
- ) {
215
- for (let i in this.syncKeys) {
216
- param[i] = data[this.syncKeys[i]];
217
- }
218
- }
219
- }
220
- if (flag) {
221
- if (this.specs) {
222
- if (typeof this.specs === 'boolean') {
223
- windows = util.win.open(
224
- util.urlJoinParams({ url: this.link, param: param }),
225
- this.name,
226
- `width=${width}px,height=${height}px,resizable=yes,status=yes,menubar=no,scrollbars=yes`
227
- );
228
- } else {
229
- windows = util.win.open(
230
- util.urlJoinParams({ url: this.link, param: param }),
231
- this.name,
232
- this.specs
233
- );
234
- }
235
- } else {
236
- windows = util.win.open(
237
- util.urlJoinParams({ url: this.link, param: param })
238
- );
239
- }
240
- }
241
- if (windows) {
242
- let times = setInterval(() => {
243
- if (windows.closed) {
244
- clearInterval(times);
245
- this.closed && this.closed(param);
246
- if (this.reload) {
247
- this.esSelect && this.esSelect.reload(null, param, true);
248
- this.esTable && this.esTable.reload(param);
249
- }
250
- }
251
- }, 1000);
252
- }
253
- } else if (this.stop) {
254
- evt.stopPropagation();
255
- evt.preventDefault();
256
- }
257
- this.$emit('click', evt, this.text);
258
- }
259
- }
260
- },
261
- render(h) {
262
- let useCaseCodes = util.getStorage('useCaseCodes');
263
- if (useCaseCodes && this.useCaseCode) {
264
- if (useCaseCodes.indexOf(this.useCaseCode) == -1) {
265
- return false;
266
- }
267
- }
268
- let tag = 'el-button';
269
- let clas = '';
270
- let props = {};
271
- let attrs = {};
272
- let listeners = {};
273
- let config = {};
274
- let badgeConfig;
275
- if (this.selector) {
276
- tag = 'es-selector';
277
- props = {
278
- reset: true,
279
- ...this.$attrs,
280
- button: { type: this._type, size: this.size }
281
- };
282
- listeners = this.$listeners;
283
- } else if (this.upload) {
284
- tag = 'es-upload';
285
- props = { ...this.$attrs, showFileList: false };
286
- listeners = this.$listeners;
287
- config = {
288
- type: this._type,
289
- size: this.size
290
- };
291
- } else {
292
- clas = ['es-button'];
293
- props = { ...this.$attrs, type: this._type, size: this.size };
294
- listeners = { ...this.$listeners, click: this.handleClick };
295
- if (this.link && !this.open) {
296
- const link = this.param
297
- ? util.urlJoinParams({ url: this.link, param: this.param })
298
- : this.link;
299
- attrs = { href: link };
300
- tag = 'a';
301
- clas = clas.concat([
302
- 'el-button',
303
- this._type ? `el-button--${this._type}` : 'el-button--default',
304
- this.size ? `el-button--${this.size}` : '',
305
- this.float ? `es-button--${this.float}` : ''
306
- ]);
307
- }
308
- if (this.badge) {
309
- if (typeof this.badge === 'number') {
310
- badgeConfig = {
311
- class: 'es-button-badge',
312
- props: { value: this.badge }
313
- };
314
- } else if (typeof this.badge === 'function') {
315
- let badge = this.badge(this.data);
316
- if (badge) {
317
- if (typeof badge === 'number') {
318
- badgeConfig = {
319
- class: 'es-button-badge',
320
- props: { value: badge }
321
- };
322
- } else {
323
- let { value, max, isDot, hidden, type } = badge;
324
- badgeConfig = {
325
- class: this.badge.class
326
- ? this.badge.class + ' es-button-badge'
327
- : 'es-button-badge',
328
- props: { value, max, isDot, hidden, type }
329
- };
330
- }
331
- }
332
- } else {
333
- let { value, max, isDot, hidden, type } = this.badge;
334
- badgeConfig = {
335
- class: this.badge.class
336
- ? this.badge.class + ' es-button-badge'
337
- : 'es-button-badge',
338
- props: { value, max, isDot, hidden, type }
339
- };
340
- }
341
- if (badgeConfig && Object.keys(badgeConfig).length && this.outside) {
342
- return h('el-badge', badgeConfig, [
343
- h(
344
- tag,
345
- {
346
- class: clas,
347
- props: { ...this.$attrs, ...props },
348
- attrs: attrs,
349
- on: { ...this.$listeners, click: this.handleClick },
350
- directives: [
351
- {
352
- name: 'show',
353
- value: !this.hide
354
- }
355
- ]
356
- },
357
- this.iconPlacement === 'start'
358
- ? [
359
- this.icon ? h('i', { class: this.icon }) : '',
360
- this.$slots.default || this.text
361
- ]
362
- : [
363
- this.$slots.default || this.text,
364
- this.icon ? h('i', { class: this.icon }) : ''
365
- ]
366
- )
367
- ]);
368
- }
369
- }
370
- }
371
- return h(
372
- tag,
373
- {
374
- class: clas,
375
- props: props,
376
- attrs: attrs,
377
- on: listeners,
378
- directives: [
379
- {
380
- name: 'show',
381
- value: !this.hide
382
- }
383
- ]
384
- },
385
- [
386
- ...(this.iconPlacement === 'start'
387
- ? [
388
- this.icon ? h('i', { class: this.icon }) : '',
389
- this.upload
390
- ? h(
391
- 'el-button',
392
- {
393
- props: config
394
- },
395
- [this.$slots.default || this.text]
396
- )
397
- : this.$slots.default || this.text
398
- ]
399
- : [
400
- this.upload
401
- ? h(
402
- 'el-button',
403
- {
404
- props: config
405
- },
406
- [this.$slots.default || this.text]
407
- )
408
- : this.$slots.default || this.text,
409
- this.icon ? h('i', { class: this.icon }) : ''
410
- ]),
411
- !this.outside && badgeConfig && Object.keys(badgeConfig).length
412
- ? h('el-badge', badgeConfig)
413
- : ''
414
- ]
415
- );
416
- }
417
- };
418
- </script>
1
+ <script>
2
+ import util from 'eoss-ui/src/utils/util';
3
+ export default {
4
+ name: 'EsButton',
5
+ inject: {
6
+ esSelect: {
7
+ default: ''
8
+ },
9
+ esForm: {
10
+ default: ''
11
+ },
12
+ esTable: {
13
+ default: ''
14
+ },
15
+ btnGroup: {
16
+ default: ''
17
+ }
18
+ },
19
+ props: {
20
+ data: {},
21
+ icon: String,
22
+ iconPlacement: {
23
+ type: String,
24
+ default: 'start'
25
+ },
26
+ link: String,
27
+ hide: Boolean,
28
+ param: Object,
29
+ type: String,
30
+ mold: String,
31
+ size: String,
32
+ open: Boolean,
33
+ reload: Boolean,
34
+ name: {
35
+ type: String,
36
+ default: ''
37
+ },
38
+ specs: [Boolean, String],
39
+ required: [String, Array, Object],
40
+ fields: [String, Array, Object],
41
+ message: [Object, Boolean],
42
+ alert: [Object, Boolean],
43
+ mapFields: Object,
44
+ useCaseCode: String,
45
+ closed: Function,
46
+ stop: Boolean,
47
+ syncKeys: Object,
48
+ text: String,
49
+ onClick: Function,
50
+ badge: [Object, Number, Function],
51
+ float: String,
52
+ selector: Boolean,
53
+ upload: Boolean,
54
+ outside: {
55
+ type: Boolean,
56
+ default: true
57
+ }
58
+ },
59
+ computed: {
60
+ _type() {
61
+ return this.type ? this.type : this.mold;
62
+ }
63
+ },
64
+ data() {
65
+ return {};
66
+ },
67
+ methods: {
68
+ handleClick(evt) {
69
+ if (this.onClick) {
70
+ this.onClick(evt);
71
+ } else {
72
+ if (this.open && this.link) {
73
+ let windows;
74
+ let fields = [];
75
+ let param = this.param ? this.param : {};
76
+ evt.stopPropagation();
77
+ evt.preventDefault();
78
+ let width = 0;
79
+ let height = 0;
80
+ width = util.win.top.screen.availWidth - 10;
81
+ height = util.win.top.screen.availHeight - 60;
82
+ let flag = true;
83
+ if (this.esForm) {
84
+ let params = util.getParams({ url: this.link });
85
+ let modal = this.esForm.models;
86
+ let models = util.extend({}, params || {}, modal);
87
+ if (this.required) {
88
+ if (Array.isArray(this.required)) {
89
+ this.esForm.validateField(this.required, (res) => {
90
+ if (res) {
91
+ flag = false;
92
+ } else {
93
+ flag = true;
94
+ }
95
+ });
96
+ if (flag) {
97
+ fields = this.required;
98
+ this.required.forEach((item) => {
99
+ param[item] = models[item];
100
+ });
101
+ }
102
+ } else if (typeof this.required === 'object') {
103
+ for (let i in this.required) {
104
+ fields.push(this.required[i]);
105
+ param[i] = models[this.required[i]];
106
+ }
107
+ this.esForm.validateField(fields, (res) => {
108
+ if (res) {
109
+ flag = false;
110
+ } else {
111
+ flag = true;
112
+ }
113
+ });
114
+ } else {
115
+ this.esForm.validateField(this.required, (res) => {
116
+ if (res) {
117
+ flag = false;
118
+ } else {
119
+ flag = true;
120
+ }
121
+ });
122
+ if (flag) {
123
+ fields = this.required;
124
+ if (
125
+ models[this.required] == null ||
126
+ models[this.required] == undefined ||
127
+ models[this.required] == ''
128
+ ) {
129
+ param[this.required] = models[this.required];
130
+ }
131
+ }
132
+ }
133
+ }
134
+ if (this.fields) {
135
+ let empty = [];
136
+ if (Array.isArray(this.fields)) {
137
+ this.fields.forEach((item) => {
138
+ if (models[item] == undefined || models[item] == '') {
139
+ empty.push(item);
140
+ }
141
+ param[item] = models[item];
142
+ });
143
+ } else if (typeof this.fields === 'object') {
144
+ for (let i in this.fields) {
145
+ if (
146
+ models[this.fields[i]] == undefined ||
147
+ models[this.fields[i]] == ''
148
+ ) {
149
+ empty.push(this.fields[i]);
150
+ }
151
+ param[i] = models[this.fields[i]];
152
+ }
153
+ } else {
154
+ if (
155
+ models[this.fields] == undefined ||
156
+ models[this.fields] == ''
157
+ ) {
158
+ empty.push(this.fields);
159
+ }
160
+ param[this.fields] = models[this.fields];
161
+ }
162
+ if (empty.length) {
163
+ let msg = [];
164
+ if (this.mapFields) {
165
+ empty.forEach((item) => {
166
+ msg.push(this.mapFields[item]);
167
+ });
168
+ } else {
169
+ msg = empty;
170
+ }
171
+ if (this.message) {
172
+ flag = false;
173
+ if (typeof this.message == 'boolean') {
174
+ this.$message.error(msg.join(',') + '不能为空!');
175
+ } else {
176
+ let message =
177
+ msg.join(',') + (this.message.message || '不能为空!');
178
+ this.$message({
179
+ type: 'error',
180
+ ...this.message,
181
+ message: message
182
+ });
183
+ }
184
+ }
185
+ if (this.alert) {
186
+ flag = false;
187
+ if (typeof this.alert == 'boolean') {
188
+ this.$alert(msg.join(',') + '不能为空!', '提示', {
189
+ type: 'error',
190
+ confirmButtonText: '确定'
191
+ }).catch();
192
+ } else {
193
+ let message =
194
+ msg.join(',') + (this.alert.message || '不能为空!');
195
+ this.$alert(
196
+ message,
197
+ this.alert.titl || '提示',
198
+ this.alert.config || {
199
+ type: 'error',
200
+ confirmButtonText: '确定'
201
+ }
202
+ ).catch();
203
+ }
204
+ }
205
+ }
206
+ }
207
+ }
208
+ if (this.btnGroup && this.syncKeys) {
209
+ let data = this.btnGroup.data;
210
+ if (
211
+ data &&
212
+ Object.keys(data).length &&
213
+ Object.keys(this.syncKeys).length
214
+ ) {
215
+ for (let i in this.syncKeys) {
216
+ param[i] = data[this.syncKeys[i]];
217
+ }
218
+ }
219
+ }
220
+ if (flag) {
221
+ if (this.specs) {
222
+ if (typeof this.specs === 'boolean') {
223
+ windows = util.win.open(
224
+ util.urlJoinParams({ url: this.link, param: param }),
225
+ this.name,
226
+ `width=${width}px,height=${height}px,resizable=yes,status=yes,menubar=no,scrollbars=yes`
227
+ );
228
+ } else {
229
+ windows = util.win.open(
230
+ util.urlJoinParams({ url: this.link, param: param }),
231
+ this.name,
232
+ this.specs
233
+ );
234
+ }
235
+ } else {
236
+ windows = util.win.open(
237
+ util.urlJoinParams({ url: this.link, param: param })
238
+ );
239
+ }
240
+ }
241
+ if (windows) {
242
+ let times = setInterval(() => {
243
+ if (windows.closed) {
244
+ clearInterval(times);
245
+ this.closed && this.closed(param);
246
+ if (this.reload) {
247
+ this.esSelect && this.esSelect.reload(null, param, true);
248
+ this.esTable && this.esTable.reload(param);
249
+ }
250
+ }
251
+ }, 1000);
252
+ }
253
+ } else if (this.stop) {
254
+ evt.stopPropagation();
255
+ evt.preventDefault();
256
+ }
257
+ this.$emit('click', evt, this.text);
258
+ }
259
+ }
260
+ },
261
+ render(h) {
262
+ let useCaseCodes = util.getStorage('useCaseCodes');
263
+ if (useCaseCodes && this.useCaseCode) {
264
+ if (useCaseCodes.indexOf(this.useCaseCode) == -1) {
265
+ return false;
266
+ }
267
+ }
268
+ let tag = 'el-button';
269
+ let clas = '';
270
+ let props = {};
271
+ let attrs = {};
272
+ let listeners = {};
273
+ let config = {};
274
+ let badgeConfig;
275
+ if (this.selector) {
276
+ tag = 'es-selector';
277
+ props = {
278
+ reset: true,
279
+ ...this.$attrs,
280
+ button: { type: this._type, size: this.size }
281
+ };
282
+ listeners = this.$listeners;
283
+ } else if (this.upload) {
284
+ tag = 'es-upload';
285
+ props = { ...this.$attrs, showFileList: false };
286
+ listeners = this.$listeners;
287
+ config = {
288
+ type: this._type,
289
+ size: this.size
290
+ };
291
+ } else {
292
+ clas = ['es-button'];
293
+ props = { ...this.$attrs, type: this._type, size: this.size };
294
+ listeners = { ...this.$listeners, click: this.handleClick };
295
+ if (this.link && !this.open) {
296
+ const link = this.param
297
+ ? util.urlJoinParams({ url: this.link, param: this.param })
298
+ : this.link;
299
+ attrs = { href: link };
300
+ tag = 'a';
301
+ clas = clas.concat([
302
+ 'el-button',
303
+ this._type ? `el-button--${this._type}` : 'el-button--default',
304
+ this.size ? `el-button--${this.size}` : '',
305
+ this.float ? `es-button--${this.float}` : ''
306
+ ]);
307
+ }
308
+ if (this.badge) {
309
+ if (typeof this.badge === 'number') {
310
+ badgeConfig = {
311
+ class: 'es-button-badge',
312
+ props: { value: this.badge }
313
+ };
314
+ } else if (typeof this.badge === 'function') {
315
+ let badge = this.badge(this.data);
316
+ if (badge) {
317
+ if (typeof badge === 'number') {
318
+ badgeConfig = {
319
+ class: 'es-button-badge',
320
+ props: { value: badge }
321
+ };
322
+ } else {
323
+ let { value, max, isDot, hidden, type } = badge;
324
+ badgeConfig = {
325
+ class: this.badge.class
326
+ ? this.badge.class + ' es-button-badge'
327
+ : 'es-button-badge',
328
+ props: { value, max, isDot, hidden, type }
329
+ };
330
+ }
331
+ }
332
+ } else {
333
+ let { value, max, isDot, hidden, type } = this.badge;
334
+ badgeConfig = {
335
+ class: this.badge.class
336
+ ? this.badge.class + ' es-button-badge'
337
+ : 'es-button-badge',
338
+ props: { value, max, isDot, hidden, type }
339
+ };
340
+ }
341
+ if (badgeConfig && Object.keys(badgeConfig).length && this.outside) {
342
+ return h('el-badge', badgeConfig, [
343
+ h(
344
+ tag,
345
+ {
346
+ class: clas,
347
+ props: { ...this.$attrs, ...props },
348
+ attrs: attrs,
349
+ on: { ...this.$listeners, click: this.handleClick },
350
+ directives: [
351
+ {
352
+ name: 'show',
353
+ value: !this.hide
354
+ }
355
+ ]
356
+ },
357
+ this.iconPlacement === 'start'
358
+ ? [
359
+ this.icon ? h('i', { class: this.icon }) : '',
360
+ this.$slots.default || this.text
361
+ ]
362
+ : [
363
+ this.$slots.default || this.text,
364
+ this.icon ? h('i', { class: this.icon }) : ''
365
+ ]
366
+ )
367
+ ]);
368
+ }
369
+ }
370
+ }
371
+ return h(
372
+ tag,
373
+ {
374
+ class: clas,
375
+ props: props,
376
+ attrs: attrs,
377
+ on: listeners,
378
+ directives: [
379
+ {
380
+ name: 'show',
381
+ value: !this.hide
382
+ }
383
+ ]
384
+ },
385
+ [
386
+ ...(this.iconPlacement === 'start'
387
+ ? [
388
+ this.icon ? h('i', { class: this.icon }) : '',
389
+ this.upload
390
+ ? h(
391
+ 'el-button',
392
+ {
393
+ props: config
394
+ },
395
+ [this.$slots.default || this.text]
396
+ )
397
+ : this.$slots.default || this.text
398
+ ]
399
+ : [
400
+ this.upload
401
+ ? h(
402
+ 'el-button',
403
+ {
404
+ props: config
405
+ },
406
+ [this.$slots.default || this.text]
407
+ )
408
+ : this.$slots.default || this.text,
409
+ this.icon ? h('i', { class: this.icon }) : ''
410
+ ]),
411
+ !this.outside && badgeConfig && Object.keys(badgeConfig).length
412
+ ? h('el-badge', badgeConfig)
413
+ : ''
414
+ ]
415
+ );
416
+ }
417
+ };
418
+ </script>