meixioacomponent 1.1.42 → 1.1.44

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.
@@ -35,9 +35,10 @@
35
35
  :proScreenConfig="privateProScreenConfig"
36
36
  :proScreenList="proScreenList"
37
37
  :screenList="screenList"
38
- :table-config="tableConfig"
38
+ :table-config="tableConfigColumnList"
39
39
  :use-pro-screen-list="useProScreenList"
40
40
  :use-search="useSearch"
41
+ :use-local-table-config="useLocalTableConfig"
41
42
  @searchContentHeightChange="searchContentHeightChange"
42
43
  >
43
44
  <template slot="table-search-extend">
@@ -145,6 +146,9 @@
145
146
  <slot :scope="props.row" name="tableExpand"></slot>
146
147
  </template>
147
148
  </el-table-column>
149
+ <!--序号-->
150
+ <el-table-column type="index" width="50" v-if="useIndex"></el-table-column>
151
+
148
152
  <el-table-column
149
153
  v-for="(item, index) in showTableHeader"
150
154
  :key="index"
@@ -254,6 +258,7 @@ import Oa_pro_table_row_sp_text from "./oa_pro_table_row_sp_text";
254
258
  import componentConfig from "../../config/componentConfig";
255
259
  import {tableSectionMixins} from "../mixins/tableSectionMixins";
256
260
  import TableCheckControl from "./TableCheckControl";
261
+ import proTableLocalConfigManage from "../../config/ProTableLocalConfigManage/ProTableLocalConfigManage";
257
262
 
258
263
  let canPush = true;
259
264
  export default {
@@ -301,11 +306,14 @@ export default {
301
306
 
302
307
  // 表格勾选的控制
303
308
  tableCheckControl: null,
309
+
310
+
311
+ tableConfigColumnList: []
312
+
304
313
  };
305
314
  },
306
315
  created() {
307
316
  this.init();
308
-
309
317
  componentConfig.eventBus.$on("handleTableBorder", this.handleTableBorder);
310
318
  },
311
319
  mounted() {
@@ -503,6 +511,14 @@ export default {
503
511
  middleSlotHeight: {
504
512
  type: Number,
505
513
  default: 76
514
+ },
515
+ useLocalTableConfig: {
516
+ type: String,
517
+ default: ''
518
+ },
519
+ useIndex: {
520
+ type: Boolean,
521
+ default: false
506
522
  }
507
523
 
508
524
  },
@@ -531,7 +547,7 @@ export default {
531
547
  );
532
548
  },
533
549
  fixedList() {
534
- return this.$props.tableConfig.filter((item) => {
550
+ return this.tableConfigColumnList.filter((item) => {
535
551
  const {lock} = item;
536
552
  return lock && lock !== "right";
537
553
  });
@@ -547,22 +563,21 @@ export default {
547
563
  },
548
564
 
549
565
  showTableHeader() {
550
- if (this.$props.tableConfig) {
551
- return this.$props.tableConfig.filter((item) => {
552
566
 
553
- if (item.hasOwnProperty('disabledSortable')) {
554
- if (!item.disabledSortable) {
555
- item.disabledSortable = false;
556
- }
557
- } else {
567
+ return this.tableConfigColumnList.filter((item) => {
568
+
569
+ if (item.hasOwnProperty('disabledSortable')) {
570
+ if (!item.disabledSortable) {
558
571
  item.disabledSortable = false;
559
572
  }
573
+ } else {
574
+ item.disabledSortable = false;
575
+ }
560
576
 
561
577
 
562
- return item.show;
563
- });
564
- }
565
- return [];
578
+ return item.show;
579
+ });
580
+
566
581
  },
567
582
 
568
583
  isCheckTableRow() {
@@ -622,6 +637,7 @@ export default {
622
637
  return value.toString().length > 10;
623
638
  },
624
639
  init() {
640
+ this.setTableConfigColumList();
625
641
  const {rowKey} = this.$props;
626
642
  if (rowKey) {
627
643
  this.initTableControl();
@@ -629,15 +645,15 @@ export default {
629
645
  // canPush = !this.isAverageWidth;
630
646
  this.initProScreenConfig();
631
647
  this.initFooterHandleConfig();
632
- this.$props.tableConfig.forEach((item, index) => {
648
+ this.tableConfigColumnList.forEach((item, index) => {
633
649
  item.preIndex = index;
634
- this.$set(item, "show", true);
650
+
651
+ if (!item.hasOwnProperty('show')) {
652
+ this.$set(item, "show", true);
653
+ }
635
654
  if (!item.width || item.width <= 80) {
636
655
  item.width = 80;
637
656
  }
638
- // if (item.lock === "right") {
639
- // canPush = false;
640
- // }
641
657
  });
642
658
 
643
659
  // if (canPush) {
@@ -647,16 +663,44 @@ export default {
647
663
  this.refreshData();
648
664
  },
649
665
 
666
+ setTableConfigColumList() {
667
+ if (this.$props.tableConfig) {
668
+
669
+
670
+ const useLocalTableConfig = this.$props.useLocalTableConfig;
671
+
672
+ if (useLocalTableConfig) {
673
+
674
+
675
+ const checkAccordFlag = proTableLocalConfigManage.checkRenderTableConfigAccordLocal(useLocalTableConfig, this.$props.tableConfig);
676
+
677
+ if (checkAccordFlag) {
678
+ proTableLocalConfigManage.hasConfigByTableKey(useLocalTableConfig).forEach(item => {
679
+ this.tableConfigColumnList.push(item);
680
+ })
681
+ return;
682
+ }
683
+
684
+ }
685
+
686
+
687
+ this.tableConfigColumnList = JSON.parse(JSON.stringify(this.$props.tableConfig));
688
+
689
+ console.log(this.tableConfigColumnList);
690
+ }
691
+ },
692
+
693
+
650
694
  tableConfigPushEmpty() {
651
- const {tableConfig} = this.$props;
652
- tableConfig.push({
653
- label: "",
654
- key: "noData",
655
- lock: false,
656
- width: 40,
657
- show: true,
658
- template: false,
659
- });
695
+ //
696
+ // this.tableConfigColumnList.push({
697
+ // label: "",
698
+ // key: "noData",
699
+ // lock: false,
700
+ // width: 40,
701
+ // show: true,
702
+ // template: false,
703
+ // });
660
704
  },
661
705
 
662
706
  initTableControl() {
@@ -677,7 +721,7 @@ export default {
677
721
  const tableWidth = this.$refs.elTable.$el.offsetWidth;
678
722
  let totalWidth = 0;
679
723
  let staticLength = 0;
680
- const {tableConfig} = this.$props;
724
+ const tableConfig = this.tableConfigColumnList;
681
725
  tableConfig.forEach((item) => {
682
726
  if (item.lock || item.staticWidth) {
683
727
  staticLength += 1;
@@ -706,7 +750,7 @@ export default {
706
750
 
707
751
  headerItemLock(params) {
708
752
  let {preIndex, index} = {...params};
709
- let tableConfig = this.$props.tableConfig;
753
+ let tableConfig = this.tableConfigColumnList;
710
754
  tableConfig[index].lock = true;
711
755
  if (tableConfig[index].preIndex === undefined) {
712
756
  tableConfig[index].preIndex = preIndex;
@@ -729,7 +773,7 @@ export default {
729
773
  },
730
774
  headerItemUnlock(params) {
731
775
  let {preIndex, index} = {...params};
732
- let tableConfig = this.$props.tableConfig;
776
+ let tableConfig = this.tableConfigColumnList;
733
777
  tableConfig[index].lock = false;
734
778
 
735
779
  tableConfig.splice(
@@ -770,7 +814,7 @@ export default {
770
814
  // 初始化高级筛选
771
815
  initProScreenConfig() {
772
816
  this.privateProScreenConfig = [];
773
- this.$props.tableConfig.forEach((item) => {
817
+ this.tableConfigColumnList.forEach((item) => {
774
818
  if (item.proScreenItem) {
775
819
  this.$set(item.proScreenItem, "label", item.label);
776
820
  this.$set(item.proScreenItem, "isCheck", false);
@@ -1107,6 +1151,11 @@ export default {
1107
1151
 
1108
1152
 
1109
1153
  },
1154
+ watch: {
1155
+ tableConfig() {
1156
+ this.setTableConfigColumList();
1157
+ }
1158
+ }
1110
1159
  };
1111
1160
  </script>
1112
1161
 
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var ProTableLocalConfigManage = /** @class */ (function () {
4
+ function ProTableLocalConfigManage() {
5
+ var _this = this;
6
+ this.setProTableLocalConfigByTableKey = function (tableKey, value) {
7
+ _this.localConfig["".concat(tableKey)] = value;
8
+ console.log(_this.localConfig);
9
+ _this.setProTableLocalConfigByLocalStorage();
10
+ };
11
+ this.checkRenderTableConfigAccordLocal = function (tableKey, renderTable) {
12
+ var _value = _this.hasConfigByTableKey(tableKey);
13
+ var checkFlag = true;
14
+ if (_value) {
15
+ console.log(renderTable);
16
+ console.log(_value);
17
+ if (_value.length !== renderTable.length) {
18
+ checkFlag = false;
19
+ _this.deleteProTableLocalConfigByTableKey(tableKey);
20
+ return checkFlag;
21
+ }
22
+ var _loop_1 = function (i) {
23
+ var item = renderTable[i];
24
+ var index = _value.findIndex(function (cItem) {
25
+ return item.key === cItem.key;
26
+ });
27
+ if (index < 0) {
28
+ checkFlag = false;
29
+ _this.deleteProTableLocalConfigByTableKey(tableKey);
30
+ return "break";
31
+ }
32
+ };
33
+ for (var i = 0; i < renderTable.length; i++) {
34
+ var state_1 = _loop_1(i);
35
+ if (state_1 === "break")
36
+ break;
37
+ }
38
+ return checkFlag;
39
+ }
40
+ return false;
41
+ };
42
+ this.deleteProTableLocalConfigByTableKey = function (tableKey) {
43
+ console.log('deleteProTableLocalConfigByTableKey');
44
+ var _value = _this.hasConfigByTableKey(tableKey);
45
+ if (_value) {
46
+ delete _this.localConfig["".concat(tableKey)];
47
+ _this.setProTableLocalConfigByLocalStorage();
48
+ }
49
+ };
50
+ this.hasConfigByTableKey = function (tableKey) {
51
+ var value = _this.localConfig["".concat(tableKey)];
52
+ if (value) {
53
+ return value;
54
+ }
55
+ return false;
56
+ };
57
+ this.setProTableLocalConfigByLocalStorage = function () {
58
+ window.localStorage.setItem('proTableLocalConfig', JSON.stringify(_this.localConfig));
59
+ console.log('setProTableLocalConfigByLocalStorage');
60
+ };
61
+ this.localConfig = {};
62
+ }
63
+ ProTableLocalConfigManage.prototype.initByProTableLocalConfigManage = function () {
64
+ var _localConfig = window.localStorage.getItem('proTableLocalConfig');
65
+ if (_localConfig) {
66
+ this.localConfig = JSON.parse(_localConfig);
67
+ }
68
+ else {
69
+ this.setProTableLocalConfigByLocalStorage();
70
+ }
71
+ };
72
+ return ProTableLocalConfigManage;
73
+ }());
74
+ var proTableLocalConfigManage = new ProTableLocalConfigManage();
75
+ exports["default"] = proTableLocalConfigManage;
@@ -0,0 +1,99 @@
1
+ class ProTableLocalConfigManage {
2
+
3
+ public localConfig: Record<string, any>;
4
+
5
+
6
+ constructor() {
7
+
8
+ this.localConfig = {};
9
+ }
10
+
11
+ public initByProTableLocalConfigManage() {
12
+ const _localConfig = window.localStorage.getItem('proTableLocalConfig');
13
+ if (_localConfig) {
14
+ this.localConfig = JSON.parse(_localConfig);
15
+ } else {
16
+ this.setProTableLocalConfigByLocalStorage();
17
+ }
18
+ }
19
+
20
+
21
+ public setProTableLocalConfigByTableKey = (tableKey: string, value: any) => {
22
+
23
+ this.localConfig[`${tableKey}`] = value;
24
+ console.log(this.localConfig);
25
+ this.setProTableLocalConfigByLocalStorage();
26
+
27
+ }
28
+
29
+
30
+ public checkRenderTableConfigAccordLocal = (tableKey: string, renderTable: Array<any>) => {
31
+ const _value = this.hasConfigByTableKey(tableKey);
32
+ let checkFlag = true;
33
+ if (_value) {
34
+ console.log(renderTable);
35
+ console.log(_value);
36
+ if (_value.length !== renderTable.length) {
37
+ checkFlag = false;
38
+ this.deleteProTableLocalConfigByTableKey(tableKey);
39
+ return checkFlag;
40
+ }
41
+
42
+ for (let i = 0; i < renderTable.length; i++) {
43
+
44
+ const item = renderTable[i];
45
+
46
+ const index = _value.findIndex(cItem => {
47
+ return item.key === cItem.key;
48
+ })
49
+ if (index < 0) {
50
+ checkFlag = false;
51
+ this.deleteProTableLocalConfigByTableKey(tableKey);
52
+ break;
53
+ }
54
+ }
55
+
56
+ return checkFlag;
57
+ }
58
+ return false
59
+
60
+
61
+ }
62
+
63
+
64
+ public deleteProTableLocalConfigByTableKey = (tableKey: string) => {
65
+
66
+ console.log('deleteProTableLocalConfigByTableKey');
67
+ const _value = this.hasConfigByTableKey(tableKey);
68
+
69
+ if (_value) {
70
+ delete this.localConfig[`${tableKey}`];
71
+ this.setProTableLocalConfigByLocalStorage();
72
+ }
73
+
74
+ }
75
+
76
+
77
+ public hasConfigByTableKey = (tableKey: string) => {
78
+
79
+ const value = this.localConfig[`${tableKey}`];
80
+
81
+ if (value) {
82
+ return value;
83
+ }
84
+ return false;
85
+
86
+ }
87
+
88
+
89
+ private setProTableLocalConfigByLocalStorage = () => {
90
+ window.localStorage.setItem('proTableLocalConfig', JSON.stringify(this.localConfig));
91
+ console.log('setProTableLocalConfigByLocalStorage')
92
+ }
93
+ }
94
+
95
+
96
+ const proTableLocalConfigManage = new ProTableLocalConfigManage();
97
+
98
+
99
+ export default proTableLocalConfigManage;