eoss-ui 0.4.85 → 0.4.86

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 (48) hide show
  1. package/lib/button-group.js +4 -0
  2. package/lib/button.js +4 -0
  3. package/lib/checkbox-group.js +4 -0
  4. package/lib/data-table-form.js +4 -0
  5. package/lib/data-table.js +63 -33
  6. package/lib/date-picker.js +4 -0
  7. package/lib/dialog.js +4 -0
  8. package/lib/eoss-ui.common.js +128 -90
  9. package/lib/flow-group.js +4 -0
  10. package/lib/flow-list.js +4 -0
  11. package/lib/flow.js +7 -3
  12. package/lib/form.js +4 -0
  13. package/lib/handle-user.js +4 -0
  14. package/lib/handler.js +4 -0
  15. package/lib/index.js +1 -1
  16. package/lib/input-number.js +4 -0
  17. package/lib/input.js +4 -0
  18. package/lib/login.js +4 -0
  19. package/lib/main.js +4 -0
  20. package/lib/nav.js +7 -4
  21. package/lib/page.js +4 -0
  22. package/lib/player.js +4 -0
  23. package/lib/qr-code.js +4 -0
  24. package/lib/radio-group.js +4 -0
  25. package/lib/retrial-auth.js +4 -0
  26. package/lib/select-ganged.js +4 -0
  27. package/lib/select.js +4 -0
  28. package/lib/selector-panel.js +4 -0
  29. package/lib/selector.js +4 -0
  30. package/lib/sizer.js +4 -0
  31. package/lib/steps.js +4 -0
  32. package/lib/switch.js +4 -0
  33. package/lib/table-form.js +4 -0
  34. package/lib/tabs.js +4 -0
  35. package/lib/tips.js +4 -0
  36. package/lib/tree-group.js +4 -0
  37. package/lib/tree.js +4 -0
  38. package/lib/upload.js +75 -27
  39. package/lib/utils/util.js +4 -0
  40. package/lib/wujie.js +4 -0
  41. package/lib/wxlogin.js +4 -0
  42. package/package.json +1 -1
  43. package/packages/data-table/src/main.vue +58 -40
  44. package/packages/flow/src/main.vue +1 -1
  45. package/packages/nav/src/main.vue +1 -2
  46. package/packages/upload/src/main.vue +43 -29
  47. package/src/index.js +1 -1
  48. package/src/utils/util.js +4 -0
@@ -202,6 +202,7 @@ import children from './children.vue';
202
202
  import sizer from './sizer.vue';
203
203
  import util from 'eoss-ui/src/utils/util';
204
204
  import bus from 'eoss-ui/src/utils/bus';
205
+ import qs from 'qs';
205
206
  export default {
206
207
  name: 'EsDataTable',
207
208
  inheritAttrs: false,
@@ -416,6 +417,7 @@ export default {
416
417
  },
417
418
  data() {
418
419
  return {
420
+ requests: [],
419
421
  theadData: [],
420
422
  list: null,
421
423
  tableLoading: this.loading,
@@ -447,7 +449,7 @@ export default {
447
449
  },
448
450
  theads: {
449
451
  get() {
450
- return this.theadData.length ? this.theadData : this.thead;
452
+ return typeof this.thead === 'string' ? this.theadData : this.thead;
451
453
  },
452
454
  set(val) {
453
455
  return val;
@@ -544,20 +546,19 @@ export default {
544
546
  this.datas.length && this.checkSelect(newVal);
545
547
  },
546
548
  thead: {
547
- immediate: true,
549
+ deep: true,
548
550
  handler(val) {
549
551
  if (typeof val === 'string') {
550
552
  this.getTheads();
553
+ } else {
554
+ this.getOptions(val);
551
555
  }
552
556
  }
553
557
  },
554
558
  theads: {
555
- immediate: true,
556
- handler(val) {
559
+ deep: true,
560
+ handler() {
557
561
  this.chekOpenTotalArea();
558
- if (val && val.length) {
559
- this.getOptions(val);
560
- }
561
562
  }
562
563
  },
563
564
  param: {
@@ -597,6 +598,9 @@ export default {
597
598
  }
598
599
  },
599
600
  created() {
601
+ if (Array.isArray(this.thead) && this.thead.length) {
602
+ this.getOptions(this.thead);
603
+ }
600
604
  this.immediate && this.getTableData();
601
605
  },
602
606
  mounted() {
@@ -604,6 +608,10 @@ export default {
604
608
  this.resetHeight();
605
609
  },
606
610
  methods: {
611
+ getRequestKey(config) {
612
+ const { method, url, params, data } = config;
613
+ return [method, url, qs.stringify(params), qs.stringify(data)].join('&');
614
+ },
607
615
  getIcon(res) {
608
616
  if (
609
617
  this.sizer &&
@@ -627,36 +635,45 @@ export default {
627
635
  item.sysCode ? { sysAppCode: item.sysCode } : {},
628
636
  item.param ? item.param : {}
629
637
  );
630
- util
631
- .ajax({
632
- url: item.sysCode ? findSysCode : item.url,
633
- method: this.method,
634
- params: params,
635
- data: params
636
- })
637
- .then((res) => {
638
- if (res.rCode === 0) {
639
- if (item.type == 'ganged') {
640
- this.$set(this.options, item.field || item.prop, [
641
- JSON.parse(JSON.stringify(res.results))
642
- ]);
638
+ let key = this.getRequestKey({
639
+ method: this.method,
640
+ url: item.sysCode ? findSysCode : item.url,
641
+ params: params,
642
+ data: {}
643
+ });
644
+ if (!this.requests.includes(key)) {
645
+ util
646
+ .ajax({
647
+ url: item.sysCode ? findSysCode : item.url,
648
+ method: this.method,
649
+ params: params,
650
+ data: params
651
+ })
652
+ .then((res) => {
653
+ if (res.rCode === 0) {
654
+ if (item.type == 'ganged') {
655
+ this.$set(this.options, item.field || item.prop, [
656
+ JSON.parse(JSON.stringify(res.results))
657
+ ]);
658
+ } else {
659
+ this.$set(
660
+ this.options,
661
+ item.field || item.prop,
662
+ JSON.parse(JSON.stringify(res.results))
663
+ );
664
+ }
665
+ this.requests.push(key);
643
666
  } else {
644
- this.$set(
645
- this.options,
646
- item.field || item.prop,
647
- JSON.parse(JSON.stringify(res.results))
648
- );
667
+ let msg = res.msg || '系统错误,请联系管理员!';
668
+ this.$message.error(msg);
649
669
  }
650
- } else {
651
- let msg = res.msg || '系统错误,请联系管理员!';
652
- this.$message.error(msg);
653
- }
654
- })
655
- .catch((err) => {
656
- if (err.message && err.message !== 'canceled') {
657
- this.$message.error(err.message);
658
- }
659
- });
670
+ })
671
+ .catch((err) => {
672
+ if (err.message && err.message !== 'canceled') {
673
+ this.$message.error(err.message);
674
+ }
675
+ });
676
+ }
660
677
  } else {
661
678
  if (item.childHead && item.childHead.length) {
662
679
  this.getOptions(item.childHead);
@@ -675,7 +692,7 @@ export default {
675
692
  this.showTotal = true;
676
693
  return;
677
694
  }
678
- const arr = JSON.parse(JSON.stringify(this.thead));
695
+ const arr = JSON.parse(JSON.stringify(this.theads));
679
696
  arr.forEach((item) => {
680
697
  if (item.total) {
681
698
  this.showTotal = true;
@@ -748,6 +765,7 @@ export default {
748
765
  this.list = results.data || results.records || [];
749
766
  this.config.totalCount =
750
767
  results.count || results.total || results.totalCount;
768
+ this.getOptions(this.theadData);
751
769
  }
752
770
  } else {
753
771
  this.theadData = [];
@@ -991,7 +1009,7 @@ export default {
991
1009
  } else if (row) {
992
1010
  rows = JSON.parse(JSON.stringify(row));
993
1011
  }
994
- let thead = this.thead;
1012
+ let thead = this.theads;
995
1013
  if (this.$refs.oaTable) {
996
1014
  thead = this.$refs.oaTable.getThead();
997
1015
  }
@@ -1102,10 +1120,10 @@ export default {
1102
1120
  if (handle.exportXls) {
1103
1121
  let text = '操作';
1104
1122
  if (
1105
- this.thead[this.thead.length - 1] &&
1106
- this.thead[this.thead.length - 1].type === 'handle'
1123
+ this.theads[this.theads.length - 1] &&
1124
+ this.theads[this.theads.length - 1].type === 'handle'
1107
1125
  ) {
1108
- text = this.thead[this.thead.length - 1].title;
1126
+ text = this.theads[this.theads.length - 1].title;
1109
1127
  }
1110
1128
  thead = thead.map((item) => {
1111
1129
  return item.filter((ele) => {
@@ -451,7 +451,7 @@
451
451
 
452
452
  <div
453
453
  v-if="
454
- btnList.length > 2 ||
454
+ btnList.length > 1 ||
455
455
  (!isFlow && (rejectObj.fun || pointsReadingObj.fun || moreList))
456
456
  "
457
457
  placement="top"
@@ -122,8 +122,7 @@ export default {
122
122
  return '70px';
123
123
  }
124
124
  }
125
-
126
- return this.subMenu.length && this.isShow
125
+ return this.subMenu && this.subMenu.length && this.isShow
127
126
  ? parseInt(this.width, 10) + 70 + 'px'
128
127
  : '70px';
129
128
  }
@@ -190,6 +190,7 @@ import {
190
190
  } from 'eoss-ui/src/config/api.js';
191
191
  import util from 'eoss-ui/src/utils/util.js';
192
192
  import picture from './picture.js';
193
+ import store from 'eoss-ui/src/utils/store';
193
194
  export default {
194
195
  name: 'EsUpload',
195
196
  components: {
@@ -694,37 +695,50 @@ export default {
694
695
  //根据code获取附件参数配置
695
696
  getAdjunctPropertie() {
696
697
  if (this.code !== undefined) {
697
- util
698
- .ajax({
699
- method: this.method,
700
- url: this.properties,
701
- data: { code: this.code, ...this.param },
702
- params: { code: this.code, ...this.param }
703
- })
704
- .then((res) => {
705
- if (res.rCode === 0) {
706
- if (res.results) {
707
- this.excludeNames = res.results.excludeName;
708
- if (res.results.fileTypeExtName) {
709
- let fileTypeExtName = res.results.fileTypeExtName.split(';');
710
- this.fileAccept = fileTypeExtName
711
- .filter((item) => {
712
- return item;
713
- })
714
- .join(',');
698
+ let config = store.get(this.code);
699
+ if (config) {
700
+ this.fileAccept = config.accept;
701
+ this.fileSize = config.size;
702
+ this.fileTotalSize = config.totalSize;
703
+ } else {
704
+ util
705
+ .ajax({
706
+ method: this.method,
707
+ url: this.properties,
708
+ data: { code: this.code, ...this.param },
709
+ params: { code: this.code, ...this.param }
710
+ })
711
+ .then((res) => {
712
+ if (res.rCode === 0) {
713
+ if (res.results) {
714
+ this.excludeNames = res.results.excludeName;
715
+ if (res.results.fileTypeExtName) {
716
+ let fileTypeExtName =
717
+ res.results.fileTypeExtName.split(';');
718
+ this.fileAccept = fileTypeExtName
719
+ .filter((item) => {
720
+ return item;
721
+ })
722
+ .join(',');
723
+ }
724
+ this.fileSize = res.results.limitFileSize
725
+ ? res.results.limitFileSize
726
+ : 0;
727
+ this.fileTotalSize = res.results.limitTotalSize;
728
+ store.set(this.code, {
729
+ accept: this.fileAccept,
730
+ size: this.fileSize,
731
+ totalSize: this.fileTotalSize
732
+ });
715
733
  }
716
- this.fileSize = res.results.limitFileSize
717
- ? res.results.limitFileSize
718
- : 0;
719
- this.fileTotalSize = res.results.limitTotalSize;
720
734
  }
721
- }
722
- })
723
- .catch((err) => {
724
- if (err.message && err.message !== 'canceled') {
725
- this.$message.error(err.message);
726
- }
727
- });
735
+ })
736
+ .catch((err) => {
737
+ if (err.message && err.message !== 'canceled') {
738
+ this.$message.error(err.message);
739
+ }
740
+ });
741
+ }
728
742
  }
729
743
  },
730
744
  getFiles(params) {
package/src/index.js CHANGED
@@ -117,7 +117,7 @@ if (typeof window !== 'undefined' && window.Vue) {
117
117
  }
118
118
 
119
119
  export default {
120
- version: '0.4.85',
120
+ version: '0.4.86',
121
121
  install,
122
122
  Button,
123
123
  ButtonGroup,
package/src/utils/util.js CHANGED
@@ -396,6 +396,10 @@ const ajax = function ({
396
396
  if (!header['content-type']) {
397
397
  header['content-type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
398
398
  }
399
+ } else {
400
+ if (!header['content-type']) {
401
+ header['content-type'] = 'application/json;charset=UTF-8';
402
+ }
399
403
  }
400
404
  return http({
401
405
  method,