eoss-ui 0.5.81-beta9 → 0.5.82

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 (124) hide show
  1. package/lib/button-group.js +82 -55
  2. package/lib/button.js +57 -48
  3. package/lib/checkbox-group.js +55 -47
  4. package/lib/clients.js +4 -3
  5. package/lib/config/api.js +3 -1
  6. package/lib/data-table-form.js +55 -47
  7. package/lib/data-table.js +473 -275
  8. package/lib/date-picker.js +69 -59
  9. package/lib/dialog.js +77 -72
  10. package/lib/eoss-ui.common.js +3985 -3049
  11. package/lib/flow-group.js +102 -65
  12. package/lib/flow-list.js +56 -48
  13. package/lib/flow.js +158 -85
  14. package/lib/form.js +88 -59
  15. package/lib/handle-user.js +66 -51
  16. package/lib/handler.js +69 -50
  17. package/lib/icon.js +55 -47
  18. package/lib/index.js +1 -1
  19. package/lib/input-number.js +55 -47
  20. package/lib/input.js +55 -47
  21. package/lib/login.js +104 -85
  22. package/lib/main.js +1375 -925
  23. package/lib/menu.js +1 -1
  24. package/lib/nav.js +55 -47
  25. package/lib/notify.js +54 -50
  26. package/lib/page.js +55 -47
  27. package/lib/pagination.js +3723 -3
  28. package/lib/player.js +60 -52
  29. package/lib/qr-code.js +55 -47
  30. package/lib/radio-group.js +55 -47
  31. package/lib/retrial-auth.js +56 -48
  32. package/lib/select-ganged.js +55 -47
  33. package/lib/select.js +55 -47
  34. package/lib/selector-panel.js +69 -60
  35. package/lib/selector.js +495 -424
  36. package/lib/sizer.js +55 -47
  37. package/lib/steps.js +55 -47
  38. package/lib/switch.js +55 -47
  39. package/lib/table-form.js +55 -47
  40. package/lib/tabs.js +1532 -1480
  41. package/lib/theme-chalk/base.css +1 -1
  42. package/lib/theme-chalk/button-group.css +1 -1
  43. package/lib/theme-chalk/data-table.css +1 -1
  44. package/lib/theme-chalk/form.css +1 -1
  45. package/lib/theme-chalk/index.css +1 -1
  46. package/lib/theme-chalk/main.css +1 -1
  47. package/lib/theme-chalk/menu.css +1 -1
  48. package/lib/theme-chalk/pagination.css +1 -1
  49. package/lib/theme-chalk/simplicity.css +1 -1
  50. package/lib/theme-chalk/sizer.css +1 -1
  51. package/lib/theme-chalk/tabs.css +1 -1
  52. package/lib/theme-chalk/toolbar.css +1 -1
  53. package/lib/theme-chalk/tree-group.css +1 -1
  54. package/lib/theme-chalk/tree.css +1 -1
  55. package/lib/theme-chalk/upload.css +1 -1
  56. package/lib/tips.js +55 -47
  57. package/lib/tree-group.js +79 -50
  58. package/lib/tree.js +55 -47
  59. package/lib/upload.js +59 -51
  60. package/lib/utils/util.js +6 -2
  61. package/lib/wujie.js +55 -47
  62. package/lib/wxlogin.js +55 -47
  63. package/package.json +3 -3
  64. package/packages/button/src/main.vue +2 -1
  65. package/packages/button-group/src/main.vue +8 -6
  66. package/packages/clients/src/main.vue +2 -1
  67. package/packages/data-table/src/column.vue +137 -54
  68. package/packages/data-table/src/main.vue +77 -67
  69. package/packages/data-table/src/sizer.vue +2 -0
  70. package/packages/date-picker/src/main.vue +22 -14
  71. package/packages/dialog/src/main.vue +17 -23
  72. package/packages/flow/src/main.vue +32 -17
  73. package/packages/flow-group/src/main.vue +18 -11
  74. package/packages/form/src/main.vue +21 -10
  75. package/packages/handle-user/src/main.vue +5 -1
  76. package/packages/handler/src/main.vue +7 -3
  77. package/packages/login/src/main.vue +22 -15
  78. package/packages/main/src/default/index.vue +111 -179
  79. package/packages/main/src/main.vue +233 -4
  80. package/packages/main/src/public/online.vue +89 -0
  81. package/packages/main/src/simplicity/apps.vue +3 -3
  82. package/packages/main/src/simplicity/handler.vue +6 -2
  83. package/packages/main/src/simplicity/index.vue +283 -238
  84. package/packages/main/src/simplicity/menu-list.vue +3 -2
  85. package/packages/main/src/simplicity/router-page.vue +5 -14
  86. package/packages/main/src/simplicity/sub-menu.vue +31 -9
  87. package/packages/menu/src/main.vue +4 -3
  88. package/packages/pagination/src/main.vue +20 -1
  89. package/packages/selector/src/main.vue +147 -135
  90. package/packages/selector-panel/src/main.vue +3 -2
  91. package/packages/selector-panel/src/selection.vue +2 -2
  92. package/packages/tabs/src/main.vue +25 -15
  93. package/packages/theme-chalk/lib/base.css +1 -1
  94. package/packages/theme-chalk/lib/button-group.css +1 -1
  95. package/packages/theme-chalk/lib/data-table.css +1 -1
  96. package/packages/theme-chalk/lib/form.css +1 -1
  97. package/packages/theme-chalk/lib/index.css +1 -1
  98. package/packages/theme-chalk/lib/main.css +1 -1
  99. package/packages/theme-chalk/lib/menu.css +1 -1
  100. package/packages/theme-chalk/lib/pagination.css +1 -1
  101. package/packages/theme-chalk/lib/simplicity.css +1 -1
  102. package/packages/theme-chalk/lib/sizer.css +1 -1
  103. package/packages/theme-chalk/lib/tabs.css +1 -1
  104. package/packages/theme-chalk/lib/toolbar.css +1 -1
  105. package/packages/theme-chalk/lib/tree-group.css +1 -1
  106. package/packages/theme-chalk/lib/tree.css +1 -1
  107. package/packages/theme-chalk/lib/upload.css +1 -1
  108. package/packages/theme-chalk/src/base.scss +39 -0
  109. package/packages/theme-chalk/src/button-group.scss +16 -2
  110. package/packages/theme-chalk/src/common/var.scss +7 -2
  111. package/packages/theme-chalk/src/data-table.scss +60 -23
  112. package/packages/theme-chalk/src/form.scss +42 -40
  113. package/packages/theme-chalk/src/main.scss +11 -0
  114. package/packages/theme-chalk/src/pagination.scss +7 -0
  115. package/packages/theme-chalk/src/simplicity.scss +45 -4
  116. package/packages/theme-chalk/src/tabs.scss +24 -28
  117. package/packages/theme-chalk/src/toolbar.scss +16 -4
  118. package/packages/theme-chalk/src/tree-group.scss +8 -0
  119. package/packages/theme-chalk/src/tree.scss +19 -6
  120. package/packages/tree-group/src/main.vue +16 -7
  121. package/src/config/api.js +3 -1
  122. package/src/index.js +157 -157
  123. package/src/utils/util.js +6 -1
  124. package/CHANGELOG.md +0 -929
@@ -10,10 +10,49 @@
10
10
  :rules="isNotRule(scope) ? [] : rules"
11
11
  :index="scope.$index"
12
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>
13
51
  <es-select
14
- v-if="type === 'select'"
15
- v-bind="formOption"
52
+ v-else-if="getType(scope.row.formConfigs, 'select')"
53
+ v-bind="getOptions(scope.row.formConfigs)"
16
54
  v-model="scope.row[field || prop]"
55
+ :data="getData(scope.row.formOptions)"
17
56
  @blur="
18
57
  (event) => {
19
58
  handleBlur({
@@ -45,11 +84,13 @@
45
84
  });
46
85
  }
47
86
  "
48
- ></es-select>
87
+ >
88
+ </es-select>
49
89
  <es-cascader
50
- v-else-if="type == 'cascader'"
51
- v-bind="formOption"
90
+ v-else-if="getType(scope.row.formConfigs, 'cascader')"
91
+ v-bind="getOptions(scope.row.formConfigs)"
52
92
  v-model="scope.row[field || prop]"
93
+ :data="getData(scope.row.formOptions)"
53
94
  @blur="
54
95
  (event) => {
55
96
  handleBlur({
@@ -84,10 +125,10 @@
84
125
  >
85
126
  </es-cascader>
86
127
  <es-select-ganged
87
- v-else-if="type === 'ganged'"
88
- v-bind="formOption"
128
+ v-else-if="getType(scope.row.formConfigs, 'ganged')"
129
+ v-bind="getOptions(scope.row.formConfigs)"
89
130
  v-model="scope.row[field || prop]"
90
- :data="init(option, config)"
131
+ :data="init(getData(scope.row.formOptions), config)"
91
132
  @change="
92
133
  (value) => {
93
134
  handleChange({
@@ -98,11 +139,13 @@
98
139
  });
99
140
  }
100
141
  "
101
- ></es-select-ganged>
142
+ >
143
+ </es-select-ganged>
102
144
  <es-radio-group
103
- v-else-if="type === 'radio'"
104
- v-bind="formOption"
145
+ v-else-if="getType(scope.row.formConfigs, 'radio')"
146
+ v-bind="getOptions(scope.row.formConfigs)"
105
147
  v-model="scope.row[field || prop]"
148
+ :data="getData(scope.row.formOptions)"
106
149
  @change="
107
150
  (value) => {
108
151
  handleChange({
@@ -113,11 +156,13 @@
113
156
  });
114
157
  }
115
158
  "
116
- ></es-radio-group>
159
+ >
160
+ </es-radio-group>
117
161
  <es-checkbox-group
118
- v-else-if="type === 'checkbox'"
119
- v-bind="formOption"
162
+ v-else-if="getType(scope.row.formConfigs, 'checkbox')"
163
+ v-bind="getOptions(scope.row.formConfigs)"
120
164
  v-model="scope.row[field || prop]"
165
+ :data="getData(scope.row.formOptions)"
121
166
  @change="
122
167
  (value) => {
123
168
  handleChange({
@@ -128,11 +173,13 @@
128
173
  });
129
174
  }
130
175
  "
131
- ></es-checkbox-group>
176
+ >
177
+ </es-checkbox-group>
132
178
  <es-switch
133
- v-else-if="type === 'switch'"
134
- v-bind="formOption"
179
+ v-else-if="getType(scope.row.formConfigs, 'switch')"
180
+ v-bind="getOptions(scope.row.formConfigs)"
135
181
  v-model="scope.row[field || prop]"
182
+ :data="getData(scope.row.formOptions)"
136
183
  @change="
137
184
  (value) => {
138
185
  handleChange({
@@ -143,24 +190,27 @@
143
190
  });
144
191
  }
145
192
  "
146
- ></es-switch>
193
+ >
194
+ </es-switch>
147
195
  <es-date-picker
148
196
  v-else-if="
149
197
  config.date ||
150
- type == 'date' ||
151
- type == 'year' ||
152
- type == 'month' ||
153
- type == 'date' ||
154
- type == 'dates' ||
155
- type == 'week' ||
156
- type == 'datetime' ||
157
- type == 'datetimerange' ||
158
- type == 'daterange' ||
159
- type == 'monthrange' ||
160
- type == 'quarter' ||
161
- type == 'halfyear'
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
+ ])
162
212
  "
163
- v-bind="formOption"
213
+ v-bind="getOptions(scope.row.formConfigs)"
164
214
  v-model="scope.row[field || prop]"
165
215
  :type="type"
166
216
  @blur="
@@ -194,10 +244,11 @@
194
244
  });
195
245
  }
196
246
  "
197
- ></es-date-picker>
247
+ >
248
+ </es-date-picker>
198
249
  <es-input-number
199
- v-else-if="type == 'number'"
200
- v-bind="formOption"
250
+ v-else-if="getType(scope.row.formConfigs, 'number')"
251
+ v-bind="getOptions(scope.row.formConfigs)"
201
252
  v-model="scope.row[field || prop]"
202
253
  @blur="
203
254
  (event) => {
@@ -230,10 +281,11 @@
230
281
  });
231
282
  }
232
283
  "
233
- ></es-input-number>
284
+ >
285
+ </es-input-number>
234
286
  <es-selector
235
- v-else-if="type == 'selector'"
236
- v-bind="formOption"
287
+ v-else-if="getType(scope.row.formConfigs, 'selector')"
288
+ v-bind="getOptions(scope.row.formConfigs)"
237
289
  v-model="scope.row[field || prop]"
238
290
  v-on="
239
291
  exclAttribute({
@@ -251,17 +303,18 @@
251
303
  });
252
304
  }
253
305
  "
254
- ></es-selector>
306
+ >
307
+ </es-selector>
255
308
  <template
256
309
  v-else-if="
257
- type === 'text' || type === 'input' || type === 'textarea'
310
+ getType(scope.row.formConfigs, ['text', 'input', 'textarea'])
258
311
  "
259
312
  >
260
313
  <template v-if="config.lazy">
261
314
  <input
262
- v-if="type === 'text' || type === 'input'"
315
+ v-if="getType(scope.row.formConfigs, ['text', 'input'])"
263
316
  class="el-input__inner"
264
- v-bind="formOption"
317
+ v-bind="getOptions(scope.row.formConfigs)"
265
318
  v-model.lazy="scope.row[field]"
266
319
  @blur="
267
320
  (event) => {
@@ -298,7 +351,7 @@
298
351
  <textarea
299
352
  v-else
300
353
  class="el-textarea__inner"
301
- v-bind="formOption"
354
+ v-bind="getOptions(scope.row.formConfigs)"
302
355
  v-model.lazy="scope.row[field]"
303
356
  @blur="
304
357
  (event) => {
@@ -335,7 +388,7 @@
335
388
  </template>
336
389
  <es-input
337
390
  v-else
338
- v-bind="formOption"
391
+ v-bind="getOptions(scope.row.formConfigs)"
339
392
  :type="type"
340
393
  :scope="scope"
341
394
  v-model="scope.row[field || prop]"
@@ -370,7 +423,8 @@
370
423
  });
371
424
  }
372
425
  "
373
- ></es-input>
426
+ >
427
+ </es-input>
374
428
  </template>
375
429
  </el-form-item>
376
430
  </template>
@@ -402,6 +456,7 @@
402
456
  })
403
457
  "
404
458
  stop
459
+ :mode="mode"
405
460
  :contents="contents || events"
406
461
  :data="scope"
407
462
  @handleClick="handleClick"
@@ -459,6 +514,8 @@ export default {
459
514
  }
460
515
  },
461
516
  props: {
517
+ tag: String,
518
+ mode: String,
462
519
  service: String,
463
520
  form: Boolean,
464
521
  readonly: Boolean,
@@ -484,6 +541,10 @@ export default {
484
541
  contents: Array,
485
542
  events: [Array, Object],
486
543
  dateFormat: String,
544
+ dateValue: {
545
+ type: String,
546
+ default: ''
547
+ },
487
548
  styles: [Array, Object],
488
549
  sysCode: String,
489
550
  valueToString: Boolean,
@@ -582,8 +643,7 @@ export default {
582
643
  : this.valueKey,
583
644
  rules: this.rules,
584
645
  events: this.events,
585
- ...this.$attrs,
586
- data: this.option
646
+ ...this.$attrs
587
647
  };
588
648
  return config;
589
649
  },
@@ -725,6 +785,25 @@ export default {
725
785
  }
726
786
  return data;
727
787
  },
788
+ getType(config, types) {
789
+ let type =
790
+ config && config[this.field || this.prop]
791
+ ? config[this.field || this.prop]['type'] ||
792
+ config[this.field || this.prop]
793
+ : this.type;
794
+ return Array.isArray(types) ? types.includes(type) : type == types;
795
+ },
796
+ getOptions(config) {
797
+ let option = config && config[this.field || this.prop];
798
+ return option && typeof option == 'object'
799
+ ? { ...this.formOption, ...option }
800
+ : this.formOption;
801
+ },
802
+ getData(res) {
803
+ return res && res[this.field || this.prop]
804
+ ? res[this.field || this.prop]
805
+ : this.option;
806
+ },
728
807
  exclAttribute({ data, attrs }) {
729
808
  return util.exclAttribute({ data, attrs });
730
809
  },
@@ -824,10 +903,14 @@ export default {
824
903
  this.$emit('formFocus', data);
825
904
  this.$emit('form-focus', data);
826
905
  },
827
- handleChange(data) {
828
- let { item } = data;
829
- if (item && this.type == 'ganged') {
830
- let { index, value } = data.value;
906
+ handleChange(datas) {
907
+ let { item, name, data } = datas;
908
+ if (
909
+ item &&
910
+ ((data.formConfigs && data.formConfigs[name] == 'ganged') ||
911
+ this.type == 'ganged')
912
+ ) {
913
+ let { index, value } = datas.value;
831
914
  if (
832
915
  (item.url || this.sysCode) &&
833
916
  ((item.ganged && index > item.ganged - 1) || value.hasSub)
@@ -888,16 +971,16 @@ export default {
888
971
  }
889
972
  }
890
973
  }
891
- this.events && this.events.change && this.events.change(data);
892
- this.$emit('formChange', data);
893
- this.$emit('form-change', data);
974
+ this.events && this.events.change && this.events.change(datas);
975
+ this.$emit('formChange', datas);
976
+ this.$emit('form-change', datas);
894
977
  },
895
978
  handleClick(data) {
896
979
  this.$emit('handleClick', data);
897
980
  this.$emit('handle-click', data);
898
981
  },
899
982
  formatDate(date, fmt) {
900
- return util.formatDate(date, fmt);
983
+ return date ? util.formatDate(date, fmt) : this.dateValue;
901
984
  }
902
985
  }
903
986
  };
@@ -12,6 +12,9 @@
12
12
  <es-toolbar
13
13
  v-if="showToolbar"
14
14
  ref="toolbar"
15
+ :class="{
16
+ 'es-table-toolbar-plus': mode == 'plus'
17
+ }"
15
18
  v-bind="{
16
19
  contents: toolbars,
17
20
  showLabel: showLabel,
@@ -35,7 +38,10 @@
35
38
  <div
36
39
  style="styles"
37
40
  class="es-data-table-content"
38
- :class="border == 'none' ? 'es-table-border-none' : ''"
41
+ :class="{
42
+ 'es-table-border-none': border == 'none',
43
+ 'es-table-plus': mode == 'plus'
44
+ }"
39
45
  ref="esTableContent"
40
46
  v-if="show"
41
47
  >
@@ -71,11 +77,6 @@
71
77
  (theadBorder && border != 'none' ? ' es-thead-border' : '')
72
78
  "
73
79
  >
74
- <!-- <el-table-column v-if="dragSort" width="32" fixed>
75
- <template slot-scope="scope">
76
- <es-icon :contents="dragSortIcon"></es-icon>
77
- </template>
78
- </el-table-column> -->
79
80
  <slot name="prepend"></slot>
80
81
  <slot></slot>
81
82
  <template v-for="(item, index) in theads">
@@ -99,7 +100,9 @@
99
100
  <children
100
101
  v-else
101
102
  :key="item.label || item.title"
103
+ :tag="item.tag"
102
104
  v-bind="{
105
+ mode: mode,
103
106
  name: name,
104
107
  indexs: index,
105
108
  form: form,
@@ -153,9 +156,11 @@
153
156
  </div>
154
157
  <es-pagination
155
158
  v-else-if="page"
159
+ ref="pagination"
156
160
  v-bind="config"
157
161
  class="es-table-page"
158
- :style="{ 'text-align': page.position || 'center' }"
162
+ :position="page.position"
163
+ :style="{ 'text-align': page.position }"
159
164
  v-on="{
160
165
  change: sizeChange,
161
166
  current: currentChange,
@@ -166,7 +171,7 @@
166
171
  <slot name="dialog"></slot>
167
172
  <slot name="other"></slot>
168
173
  </div>
169
- <sizer ref="sizer" :data="theads"></sizer>
174
+ <sizer ref="sizer" :data="theads" :mode="mode"></sizer>
170
175
  </component>
171
176
  </template>
172
177
  <script>
@@ -177,6 +182,8 @@ import sizer from './sizer.vue';
177
182
  import util from 'eoss-ui/src/utils/util';
178
183
  import bus from 'eoss-ui/src/utils/bus';
179
184
  import qs from 'qs';
185
+ const dataTableMode =
186
+ util.win.top.dataTableMode || util.win.dataTableMode || 'default';
180
187
  export default {
181
188
  name: 'EsDataTable',
182
189
  inheritAttrs: false,
@@ -202,6 +209,10 @@ export default {
202
209
  }
203
210
  },
204
211
  props: {
212
+ mode: {
213
+ type: String,
214
+ default: dataTableMode
215
+ },
205
216
  service: String,
206
217
  loading: {
207
218
  type: Boolean,
@@ -340,7 +351,7 @@ export default {
340
351
  },
341
352
  // 单元格配置
342
353
  thead: {
343
- type: [Array, String],
354
+ type: Array,
344
355
  default() {
345
356
  return [];
346
357
  }
@@ -431,11 +442,13 @@ export default {
431
442
  dragSortIcon: {
432
443
  type: String,
433
444
  default: 'es-icon-caidan'
434
- }
445
+ },
446
+ fields: Boolean
435
447
  },
436
448
  data() {
437
449
  return {
438
450
  requests: [],
451
+ toolbars: [],
439
452
  theadData: [],
440
453
  list: [],
441
454
  tableLoading: this.loading,
@@ -445,11 +458,14 @@ export default {
445
458
  editValue: {},
446
459
  restotalRow: null,
447
460
  showTotal: false,
448
- toolbars: [],
449
461
  config: {
450
462
  pageNum: 1,
451
463
  pageSize: 20,
452
- totalCount: 0
464
+ totalCount: 0,
465
+ layout:
466
+ this.mode == 'plus'
467
+ ? 'total, sizes, prev, pager, next, jumper'
468
+ : undefined
453
469
  },
454
470
  searchWhere: {},
455
471
  advanceWhere: {},
@@ -657,10 +673,6 @@ export default {
657
673
  this.list = this.setData();
658
674
  }
659
675
  },
660
- page() {
661
- this.resetHeight();
662
- this.doLayout();
663
- },
664
676
  scale: {
665
677
  deep: true,
666
678
  handler(val) {
@@ -675,7 +687,7 @@ export default {
675
687
  }
676
688
  },
677
689
  zoom: {
678
- handler(val) {
690
+ handler() {
679
691
  if (
680
692
  this.tableHeight != 'auto' &&
681
693
  this.tableHeight !== false &&
@@ -692,10 +704,15 @@ export default {
692
704
  thead: {
693
705
  deep: true,
694
706
  handler(val) {
695
- if (typeof val === 'string') {
696
- this.getTheads();
697
- } else {
698
- this.getOptions(val);
707
+ this.getOptions(val);
708
+
709
+ if (
710
+ Array.isArray(val) &&
711
+ val.length &&
712
+ this.fields &&
713
+ this.datas.length == 0
714
+ ) {
715
+ this.getTableData();
699
716
  }
700
717
  }
701
718
  },
@@ -707,7 +724,7 @@ export default {
707
724
  },
708
725
  param: {
709
726
  deep: true,
710
- handler(val) {
727
+ handler() {
711
728
  this.getTableData();
712
729
  }
713
730
  },
@@ -715,14 +732,12 @@ export default {
715
732
  immediate: true,
716
733
  deep: true,
717
734
  handler(val) {
735
+ if (this.$el) {
736
+ this.resetHeight();
737
+ this.doLayout();
738
+ }
718
739
  if (typeof val === 'object') {
719
740
  this.config = util.extend({}, this.config, val);
720
- } else {
721
- this.config = {
722
- pageNum: 1,
723
- pageSize: 20,
724
- totalCount: 0
725
- };
726
741
  }
727
742
  }
728
743
  },
@@ -765,9 +780,15 @@ export default {
765
780
  created() {
766
781
  if (Array.isArray(this.thead) && this.thead.length) {
767
782
  this.getOptions(this.thead);
783
+ if (this.fields) {
784
+ this.immediate && this.getTableData();
785
+ this.chekOpenTotalArea();
786
+ }
787
+ }
788
+ if (!this.fields) {
789
+ this.immediate && this.getTableData();
790
+ this.chekOpenTotalArea();
768
791
  }
769
- this.immediate && this.getTableData();
770
- this.chekOpenTotalArea();
771
792
  },
772
793
  mounted() {
773
794
  if (this.data.length) {
@@ -775,6 +796,9 @@ export default {
775
796
  }
776
797
  this.list.length && this.checkSelect(this.checked);
777
798
  this.resetHeight();
799
+ if (util.win.top != util.win.self) {
800
+ util.win.onresize = debounce(500, this.resetHeight);
801
+ }
778
802
  },
779
803
  methods: {
780
804
  setData() {
@@ -986,40 +1010,6 @@ export default {
986
1010
  }
987
1011
  });
988
1012
  },
989
- getTheads() {
990
- util
991
- .ajax({
992
- url: this.thead,
993
- method: this.method,
994
- format: this.format,
995
- params: this.param,
996
- data: this.param
997
- })
998
- .then((res) => {
999
- if (res.rCode === 0) {
1000
- let results = res.results;
1001
- if (Array.isArray(results)) {
1002
- this.theadData = results;
1003
- } else {
1004
- this.theadData = results.theadData || [];
1005
- this.list = results.data || results.records || [];
1006
- this.config.totalCount =
1007
- results.count || results.total || results.totalCount;
1008
- this.getOptions(this.theadData);
1009
- }
1010
- } else {
1011
- this.theadData = [];
1012
- let msg = res.msg || '系统错误,请联系管理员!';
1013
- this.$message.error(msg);
1014
- }
1015
- this.$emit('success', res);
1016
- })
1017
- .catch((err) => {
1018
- if (err.message && err.message !== 'canceled') {
1019
- this.$message.error(err.message);
1020
- }
1021
- });
1022
- },
1023
1013
  getTableDatas(res) {
1024
1014
  let where;
1025
1015
  let first;
@@ -1057,6 +1047,22 @@ export default {
1057
1047
  }
1058
1048
  }
1059
1049
  }
1050
+ if (this.fields) {
1051
+ let fields = [];
1052
+ this.thead.forEach((item) => {
1053
+ if (item.field || item.prop) {
1054
+ fields.push(item.field || item.prop);
1055
+ }
1056
+ });
1057
+ let initLogin = util.getStorage('initLogin');
1058
+ initLogin && (initLogin = JSON.parse(initLogin));
1059
+ reqData['fields'] = initLogin.secret
1060
+ ? util.esmEncrypt({
1061
+ data: fields.join(','),
1062
+ key: initLogin.secret
1063
+ })
1064
+ : fields.join(',');
1065
+ }
1060
1066
  this.tableLoading = true;
1061
1067
  util
1062
1068
  .ajax({
@@ -1093,6 +1099,7 @@ export default {
1093
1099
  }
1094
1100
  this.config.totalCount =
1095
1101
  results.count || results.total || results.totalCount;
1102
+ this.config.pageCount = results.pageCount;
1096
1103
  this.checked &&
1097
1104
  this.$nextTick(() => {
1098
1105
  this.checkSelect(this.checked);
@@ -1146,7 +1153,7 @@ export default {
1146
1153
  this.$refs.oaTable.clearFilter(columnKey);
1147
1154
  },
1148
1155
  doLayout() {
1149
- this.$refs.oaTable.doLayout();
1156
+ this.$refs.oaTable && this.$refs.oaTable.doLayout();
1150
1157
  },
1151
1158
  sort(prop, order) {
1152
1159
  this.$refs.oaTable.sort(prop, order);
@@ -1536,8 +1543,11 @@ export default {
1536
1543
  parseInt(util.getStyle(ele, 'margin-bottom'), 10);
1537
1544
  }
1538
1545
  }
1539
- height -= this.showToolbar ? 45 : 0;
1540
- height -= this.page === false ? 0 : 46;
1546
+ height -= this.showToolbar
1547
+ ? this.$refs.toolbar.$el.offsetHeight
1548
+ : 0;
1549
+ height -=
1550
+ this.page === false ? 0 : this.$refs.pagination.$el.offsetHeight;
1541
1551
  height -= this.title ? this.$refs.title.offsetHeight : 0;
1542
1552
  height -= parseInt(
1543
1553
  util.getStyle(this.$refs.esTableContent, 'padding-top'),
@@ -7,6 +7,7 @@
7
7
  row-key="id"
8
8
  default-expand-all
9
9
  height="500px"
10
+ :mode="mode"
10
11
  :data="theads"
11
12
  :thead="thead"
12
13
  :tree-props="{ children: 'childHead' }"
@@ -26,6 +27,7 @@ import util from 'eoss-ui/src/utils/util';
26
27
  export default {
27
28
  name: 'Sizer',
28
29
  props: {
30
+ mode: String,
29
31
  data: Array
30
32
  },
31
33
  computed: {