eoss-ui 0.5.24 → 0.5.26

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eoss-ui",
3
- "version": "0.5.24",
3
+ "version": "0.5.26",
4
4
  "description": "eoss内部业务组件",
5
5
  "main": "lib/eoss-ui.common.js",
6
6
  "files": [
@@ -96,7 +96,7 @@
96
96
  "cp-cli": "^1.0.2",
97
97
  "cross-env": "^3.1.3",
98
98
  "css-loader": "^2.1.0",
99
- "eoss-element": "^0.2.79",
99
+ "eoss-element": "^0.2.80",
100
100
  "es6-promise": "^4.0.5",
101
101
  "eslint": "4.18.2",
102
102
  "eslint-config-elemefe": "0.1.1",
@@ -45,7 +45,8 @@ export default {
45
45
  stop: Boolean,
46
46
  syncKeys: Object,
47
47
  text: String,
48
- onClick: Function
48
+ onClick: Function,
49
+ badge: [Object, Number]
49
50
  },
50
51
  computed: {
51
52
  _type() {
@@ -270,6 +271,46 @@ export default {
270
271
  this.size ? `el-button--${this.size}` : ''
271
272
  ]);
272
273
  }
274
+ if (this.badge) {
275
+ let config = {};
276
+ if (typeof this.badge === 'number') {
277
+ config = { class: 'es-button-badge', props: { value: this.badge } };
278
+ } else {
279
+ let { value, max, isDot, hidden, type } = this.badge;
280
+ config = {
281
+ class: this.badge.class
282
+ ? this.badge.class + ' es-button-badge'
283
+ : 'es-button-badge',
284
+ props: { value, max, isDot, hidden, type }
285
+ };
286
+ }
287
+ return h('el-badge', config, [
288
+ h(
289
+ tag,
290
+ {
291
+ class: clas,
292
+ props: { ...this.$attrs, ...props },
293
+ attrs: attrs,
294
+ on: { ...this.$listeners, click: this.handleClick },
295
+ directives: [
296
+ {
297
+ name: 'show',
298
+ value: !this.hide
299
+ }
300
+ ]
301
+ },
302
+ this.iconPlacement === 'start'
303
+ ? [
304
+ this.icon ? h('i', { class: this.icon }) : '',
305
+ this.$slots.default || this.text
306
+ ]
307
+ : [
308
+ this.$slots.default || this.text,
309
+ this.icon ? h('i', { class: this.icon }) : ''
310
+ ]
311
+ )
312
+ ]);
313
+ }
273
314
  return h(
274
315
  tag,
275
316
  {
@@ -178,7 +178,9 @@ export default {
178
178
  },
179
179
  labelVal() {
180
180
  let model =
181
- typeof this.model === 'string' ? this.model.split(',') : this.model;
181
+ typeof this.model === 'string'
182
+ ? this.model.split(',')
183
+ : this.model || [];
182
184
  let label = model.map((item) => {
183
185
  if (util.isObject(item)) {
184
186
  return item[this.label];
@@ -258,10 +258,14 @@
258
258
  }
259
259
  "
260
260
  ></es-selector>
261
- <template v-else-if="type === 'text' || type === 'textarea'">
261
+ <template
262
+ v-else-if="
263
+ type === 'text' || type === 'input' || type === 'textarea'
264
+ "
265
+ >
262
266
  <template v-if="config.lazy">
263
267
  <input
264
- v-if="type === 'text'"
268
+ v-if="type === 'text' || type === 'input'"
265
269
  class="el-input__inner"
266
270
  v-bind="formOption"
267
271
  v-model.lazy="scope.row[field]"
@@ -338,6 +342,7 @@
338
342
  <es-input
339
343
  v-else
340
344
  v-bind="formOption"
345
+ :type="type"
341
346
  :scope="scope"
342
347
  v-model="scope.row[field || prop]"
343
348
  @blur="
@@ -386,6 +391,11 @@
386
391
  <template v-else-if="dateFormat">
387
392
  {{ formatDate(scope.row[field || prop], dateFormat) }}
388
393
  </template>
394
+ <span
395
+ v-else-if="type === 'textarea'"
396
+ v-html="format(scope.row, true)"
397
+ :style="styles ? styles[scope.row[prop]] : {}"
398
+ ></span>
389
399
  <span v-else :style="styles ? styles[scope.row[prop]] : {}">{{
390
400
  format(scope.row)
391
401
  }}</span>
@@ -524,6 +534,18 @@ export default {
524
534
  config = { type: this.type, ...config, ...this.$attrs };
525
535
  return config;
526
536
  }
537
+ let required = this.required;
538
+ if (this.rules && !required) {
539
+ if (Array.isArray(this.rules)) {
540
+ this.rules.map((item) => {
541
+ if (item.required) {
542
+ required = item.required;
543
+ }
544
+ });
545
+ } else if (this.rules.required) {
546
+ required = this.rules.required;
547
+ }
548
+ }
527
549
  let minWidth =
528
550
  this.label || this.title
529
551
  ? (this.label || this.title).length * 14 + 20
@@ -542,7 +564,7 @@ export default {
542
564
  ].join(' '),
543
565
  labelClassName: [
544
566
  this.labelClassName ? this.labelClassName : '',
545
- this.required ? 'es-required' : ''
567
+ required ? 'es-required' : ''
546
568
  ].join(' '),
547
569
  showOverflowTooltip: this.showOverflowTooltip,
548
570
  prop: this.field || this.prop,
@@ -552,7 +574,7 @@ export default {
552
574
  return config;
553
575
  },
554
576
  formOption() {
555
- return {
577
+ let config = {
556
578
  labelKey: this.sysCode ? 'shortName' : this.labelKey,
557
579
  valueKey: this.sysCode ? 'cciValue' : this.valueKey,
558
580
  rules: this.rules,
@@ -560,6 +582,7 @@ export default {
560
582
  ...this.$attrs,
561
583
  data: this.option
562
584
  };
585
+ return config;
563
586
  },
564
587
  icon() {
565
588
  if (this.filterIcon === true) {
@@ -572,6 +595,7 @@ export default {
572
595
  let flag =
573
596
  (this.form &&
574
597
  [
598
+ 'input',
575
599
  'text',
576
600
  'textarea',
577
601
  'checkbox',
@@ -693,49 +717,53 @@ export default {
693
717
  exclAttribute({ data, attrs }) {
694
718
  return util.exclAttribute({ data, attrs });
695
719
  },
696
- format(rows) {
720
+ format(rows, flag) {
697
721
  const field = this.field || this.prop;
698
722
  let data = this.option;
723
+ let str = '';
699
724
  if (util.isObject(rows[field])) {
700
- return (
725
+ str =
701
726
  rows[field][this.labelKey] ||
702
727
  rows[field]['name'] ||
703
728
  rows[field]['label'] ||
704
- rows[field]['shortName']
705
- );
729
+ rows[field]['shortName'];
706
730
  } else if (Array.isArray(rows[field])) {
707
731
  const vals = rows[field].map((item) => {
708
732
  if (util.isObject(item)) {
709
- return (
733
+ str =
710
734
  item[this.labelKey] ||
711
735
  item['name'] ||
712
736
  item['label'] ||
713
- item['shortName']
714
- );
737
+ item['shortName'];
715
738
  } else {
716
739
  if (data && data.length && util.isObject(data[0])) {
717
- return this.getLabel(data, item);
740
+ str = this.getLabel(data, item);
718
741
  }
719
- return item;
742
+ str = item;
720
743
  }
721
744
  });
722
- return vals.join(this.symbol ? this.symbol : '-');
745
+ str = vals.join(this.symbol ? this.symbol : '-');
723
746
  } else {
724
747
  if (this.valueToString) {
725
748
  const vals = rows[field].split(',').map((item) => {
726
749
  if (data && data.length && util.isObject(data[0])) {
727
- return this.getLabel(data, item);
750
+ str = this.getLabel(data, item);
728
751
  }
729
- return item;
752
+ str = item;
730
753
  });
731
- return vals.join(this.symbol ? this.symbol : '-');
754
+ str = vals.join(this.symbol ? this.symbol : '-');
732
755
  } else {
733
756
  if (data && data.length && util.isObject(data[0])) {
734
- return this.getLabel(data, rows[field]);
757
+ str = this.getLabel(data, rows[field]);
735
758
  }
736
- return rows[field];
759
+ str = rows[field];
737
760
  }
738
761
  }
762
+ if (str && flag) {
763
+ str = str.replace(RegExp('\\n', 'g'), '<br/>');
764
+ str = str.replace(RegExp(' ', 'g'), '&nbsp;');
765
+ }
766
+ return str;
739
767
  },
740
768
  getLabel(obj, val) {
741
769
  for (let i = 0; i < obj.length; i++) {
@@ -74,6 +74,7 @@
74
74
  name: name,
75
75
  indexs: index,
76
76
  form: form,
77
+ readonly: readonly,
77
78
  optionData: optionDatas,
78
79
  ...item
79
80
  }"
@@ -442,7 +442,7 @@
442
442
  >
443
443
  <el-button
444
444
  v-show="isSubmitButtonShowAgreeAndDisagree != 1"
445
- v-for="item of btnList.slice(0, 1)"
445
+ v-for="item of hideBtn? btnList.slice(0,1) : btnList"
446
446
  :key="item.name"
447
447
  :type="item.type"
448
448
  :style="btnStyle"
@@ -457,17 +457,18 @@
457
457
  (!isFlow && (rejectObj.fun || pointsReadingObj.fun || moreList))
458
458
  "
459
459
  placement="top"
460
+ :class="{'em-flow-more-btn':!hideBtn}"
460
461
  trigger="click"
461
462
  >
462
- <!-- <div v-if="!isFlow" class="es-footer-btn">
463
- <div
464
- class="es-flow-btn"
465
- style="color: red"
463
+ <div v-if="!isFlow && !hideBtn" class="es-footer-btn">
464
+ <el-button
466
465
  v-if="rejectObj.fun"
467
466
  @click="rejectBtn"
467
+ style="margin-right:10px"
468
+ type="danger"
468
469
  >
469
- 驳回
470
- </div>
470
+ {{ rejectObj.value }}
471
+ </el-button>
471
472
  <el-button
472
473
  v-if="pointsReadingObj.fun"
473
474
  class="btn"
@@ -482,8 +483,8 @@
482
483
  >
483
484
  {{ item.value }}
484
485
  </el-button>
485
- </div> -->
486
- <el-button-group slot="reference" style="margin: 0px 10px">
486
+ </div>
487
+ <el-button-group slot="reference" style="margin: 0px 10px" v-if="hideBtn">
487
488
  <el-button
488
489
  v-show="isSubmitButtonShowAgreeAndDisagree != 1"
489
490
  v-for="item of btnList.slice(1)"
@@ -499,7 +500,7 @@
499
500
  <el-dropdown
500
501
  v-if="
501
502
  !isFlow &&
502
- (rejectObj.fun || pointsReadingObj.fun || moreList.length > 0)
503
+ (rejectObj.fun || pointsReadingObj.fun || moreList.length > 0)
503
504
  "
504
505
  trigger="click"
505
506
  placement="top"
@@ -709,6 +710,7 @@ export default {
709
710
  typeCode: { type: String, default: '' },
710
711
  flowTypeCode: { type: String, default: '' },
711
712
  defaultProcessKey: { type: String, default: '' },
713
+ hideBtn: { type: Boolean, default: false },
712
714
  btnList: {
713
715
  type: Array,
714
716
  default: () => [
@@ -13,6 +13,7 @@
13
13
  'es-form-table': table,
14
14
  'es-form-inside-dialog': dialog
15
15
  }"
16
+ :hide-required-asterisk="hideRequiredAsterisk"
16
17
  :inline="inline"
17
18
  class="es-form"
18
19
  v-loading="loading"
@@ -171,6 +172,7 @@
171
172
  :span="items.span || span"
172
173
  :tableAfter="tableAfter"
173
174
  v-bind="items"
175
+ :after="after"
174
176
  :thead="thead"
175
177
  :readonly="readonly"
176
178
  :contents="items.contents"
@@ -3988,6 +3990,10 @@ export default {
3988
3990
  type: Boolean,
3989
3991
  default: true
3990
3992
  },
3993
+ hideRequiredAsterisk: {
3994
+ type: Boolean,
3995
+ default: false
3996
+ },
3991
3997
  after: {
3992
3998
  type: Boolean,
3993
3999
  default: true
@@ -4700,9 +4706,10 @@ export default {
4700
4706
  let month = ageDate.getMonth() + 1;
4701
4707
  let day = ageDate.getDate();
4702
4708
  let age = ageDate.getFullYear() - id.substring(6, 10) - 1;
4709
+ let _month = parseInt(id.substring(10, 12), 10);
4703
4710
  if (
4704
- id.substring(10, 12) < month ||
4705
- (id.substring(10, 12) === month && id.substring(12, 14) <= day)
4711
+ _month < month ||
4712
+ (_month === month && id.substring(12, 14) <= day)
4706
4713
  ) {
4707
4714
  age++;
4708
4715
  }
@@ -4756,7 +4763,9 @@ export default {
4756
4763
  }
4757
4764
  }
4758
4765
  if (a.portrait) {
4759
- let adjunctId = b[0].response.adjunctId;
4766
+ let adjunctId = b[0].response
4767
+ ? b[0].response.adjunctId
4768
+ : b[0].adjunctId;
4760
4769
  this.$set(
4761
4770
  this.models,
4762
4771
  a.name,
@@ -97,7 +97,11 @@
97
97
  <td
98
98
  v-if="item.label !== false && item.hide !== true"
99
99
  class="es-table-form-label"
100
- :class="{ 'es-align-middle': item.labelRow }"
100
+ :class="{
101
+ 'es-align-middle': item.labelRow,
102
+ 'is-required': required && !hideRequiredAsterisk,
103
+ 'required-after': after
104
+ }"
101
105
  :key="'label' + index"
102
106
  :align="item.type === 'label' ? item.align : ''"
103
107
  :colspan="
@@ -1102,6 +1106,14 @@ export default {
1102
1106
  return [];
1103
1107
  }
1104
1108
  },
1109
+ hideRequiredAsterisk: {
1110
+ type: Boolean,
1111
+ default: false
1112
+ },
1113
+ after: {
1114
+ type: Boolean,
1115
+ default: true
1116
+ },
1105
1117
  labelWidth: {
1106
1118
  type: [Number, String],
1107
1119
  default: 120
@@ -1215,7 +1227,8 @@ export default {
1215
1227
  return {
1216
1228
  col: this.span ? this.span : 2,
1217
1229
  cols: [],
1218
- table: []
1230
+ table: [],
1231
+ required: false
1219
1232
  };
1220
1233
  },
1221
1234
  created() {},
@@ -1232,6 +1245,9 @@ export default {
1232
1245
  if (res.rules && !res.hide) {
1233
1246
  if (Array.isArray(res.rules)) {
1234
1247
  return res.rules.map((item) => {
1248
+ if (item.required) {
1249
+ this.required = item.required;
1250
+ }
1235
1251
  if (rules[item.type]) {
1236
1252
  return {
1237
1253
  pattern: rules[item.type]['pattern'],
@@ -1263,6 +1279,9 @@ export default {
1263
1279
  : 'blur'
1264
1280
  };
1265
1281
  }
1282
+ if (res.rules.required) {
1283
+ this.required = res.rules.required;
1284
+ }
1266
1285
  return res.rules;
1267
1286
  }
1268
1287
  return undefined;
@@ -235,6 +235,11 @@ export default {
235
235
  let cls = [];
236
236
  let doms = [];
237
237
  if (this.readonly) {
238
+ let content = this.text;
239
+ if (this.model) {
240
+ content = this.model.replace(RegExp('\\n', 'g'), '<br/>');
241
+ content = content.replace(RegExp(' ', 'g'), '&nbsp;');
242
+ }
238
243
  return h(
239
244
  'div',
240
245
  {
@@ -245,14 +250,7 @@ export default {
245
250
  { 'es-plain': this.plain }
246
251
  ]
247
252
  },
248
- [
249
- this.model == '' ||
250
- this.model == null ||
251
- this.model == undefined ||
252
- this.model == NaN
253
- ? this.text
254
- : this.model
255
- ]
253
+ [content]
256
254
  );
257
255
  }
258
256
  if (this.$slots.prefix) {
@@ -678,10 +678,13 @@ export default {
678
678
  });
679
679
  }
680
680
  util.win.windowOpen = this.openPage;
681
+ util.win.addEventListener('popstate', this.stateHandle, false);
681
682
  },
682
683
  methods: {
684
+ stateHandle() {
685
+ util.win.location.reload();
686
+ },
683
687
  menuSuccess(res) {
684
- // this.menus
685
688
  this.menuType = 'custom';
686
689
  if (res && res.length) {
687
690
  this.customMenu = res;
@@ -2088,6 +2091,7 @@ export default {
2088
2091
  if (this.webSocket) {
2089
2092
  this.webSocket.destroy();
2090
2093
  }
2094
+ util.win.removeEventListener('popstate', this.tateHandle);
2091
2095
  }
2092
2096
  };
2093
2097
  </script>