tenghui-ui 2.4.12 → 2.4.13

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": "tenghui-ui",
3
- "version": "2.4.12",
3
+ "version": "2.4.13",
4
4
  "description": "vue 2x, tenghui-ui",
5
5
  "files": [
6
6
  "dist",
@@ -396,7 +396,7 @@ export default {
396
396
 
397
397
  async setConfigCache(key, value) {
398
398
 
399
- if (!this.$UICONFIG.setCacheApi) {
399
+ if (!this.$UICONFIG || !this.$UICONFIG.setCacheApi) {
400
400
 
401
401
  localStorage.setItem(key, JSON.stringify(value));
402
402
  return;
@@ -411,7 +411,7 @@ export default {
411
411
 
412
412
  async getConfigCache(key) {
413
413
 
414
- if (!this.$UICONFIG.getCacheApi) {
414
+ if (!this.$UICONFIG || !this.$UICONFIG.getCacheApi) {
415
415
  this.loadingConfig = false;
416
416
  return JSON.parse(localStorage.getItem(key) || "{}");
417
417
  }
@@ -2,13 +2,7 @@
2
2
  <div class="ui-table" :class="{ 'remove-hover-css': !hoverStyle }">
3
3
  <div class="ui-table__tab" :style="{ height: showTab ? '32px' : 'unset' }">
4
4
  <slot>
5
- <el-tabs
6
- v-if="tabList.length"
7
- v-model="checkTab"
8
- type="card"
9
- size="mini"
10
- @tab-click="(val) => $emit('tabChange', val)"
11
- >
5
+ <el-tabs v-if="tabList.length" v-model="checkTab" type="card" size="mini" @tab-click="(val) => $emit('tabChange', val)">
12
6
  <el-tab-pane v-for="item in tabList" :key="item.value" :name="item.value">
13
7
  <template v-slot:label>
14
8
  <el-badge :value="item.num" :max="999">
@@ -28,34 +22,11 @@
28
22
  <ColumnConfig v-if="showConfig" :tableName="tableName" :options="useMaps" @change="handleMapChange" />
29
23
  </div>
30
24
 
31
- <el-table
32
- ref="myTable"
33
- @select="manualSelectchange"
34
- v-loading="renderLoading"
35
- v-bind="{ highlightRow: true, border: true, stripe: true, ...$attrs }"
36
- v-on="polyfillListeners($listeners)"
37
- :data="tableData"
38
- :[isBindHeight]="tableHeight"
39
- :[isBindMaxHeight]="maxHeight"
40
- :span-method="spanMethod"
41
- :row-class-name="rowClassName"
42
- @row-click="handleRowClick"
43
- >
25
+ <el-table ref="myTable" @select="manualSelectchange" v-loading="renderLoading" v-bind="{ highlightRow: true, border: true, stripe: true, ...$attrs }" v-on="polyfillListeners($listeners)" :data="tableData" :[isBindHeight]="tableHeight" :[isBindMaxHeight]="maxHeight" :span-method="spanMethod" :row-class-name="rowClassName" @row-click="handleRowClick">
44
26
  <!-- :cell-class-name="cellClassName" -->
45
27
  <el-table-column type="selection" width="35" v-if="showSelect" :selectable="selectable"></el-table-column>
46
28
  <slot name="column"></slot>
47
- <el-table-column
48
- v-for="(item, index) in tableTitle"
49
- :minWidth="tableColsMinWidth[index] || '60px'"
50
- :label="item"
51
- :fixed="fixedMap[tableProps[index]]"
52
- :key="tableProps[index]"
53
- :render-header="typeof item === 'function' ? item : null"
54
- :show-overflow-tooltip="tooltips.includes(tableProps[index])"
55
- :prop="tableProps[index]"
56
- :width="tableProps[index] === 'index' ? '60px' : tableColsWidth[index] || ''"
57
- :sortable="getSortable(tableProps[index])"
58
- >
29
+ <el-table-column v-for="(item, index) in tableTitle" :minWidth="tableColsMinWidth[index] || '60px'" :label="item" :fixed="fixedMap[tableProps[index]]" :key="tableProps[index]" :render-header="typeof item === 'function' ? item : null" :show-overflow-tooltip="tooltips.includes(tableProps[index])" :prop="tableProps[index]" :width="tableProps[index] === 'index' ? '60px' : tableColsWidth[index] || ''" :sortable="getSortable(tableProps[index])">
59
30
  <!-- 表头插槽 自定义表头-->
60
31
  <template v-slot:header="scope">
61
32
  <slot :name="tableProps[index] + 'Title'" :row="item" :$index="scope.$index">
@@ -70,8 +41,8 @@
70
41
  </template>
71
42
  <slot v-else :name="tableProps[index]" :row="scope.row" :$index="scope.$index">
72
43
  <span :class="{ 'text--number': tableProps[index] != 'index' && Number.isFinite(Number(scope.row[tableProps[index]])) }">{{
73
- tableProps[index] === 'index' ? changeTableInx(scope.$index) : scope.row[tableProps[index]]
74
- }}</span>
44
+ tableProps[index] === 'index' ? changeTableInx(scope.$index) : scope.row[tableProps[index]]
45
+ }}</span>
75
46
  </slot>
76
47
  </template>
77
48
  <template v-if="multiHeaderKey.includes(tableProps[index])">
@@ -92,17 +63,7 @@
92
63
  <!-- 新汇总数据槽位 -->
93
64
  <slot name="summarydata"></slot>
94
65
  </div>
95
- <el-pagination
96
- ref="pageRef"
97
- layout="total, sizes, prev, pager, next, jumper"
98
- v-loading="loadingPageTotal"
99
- :current-page="Number(pageData.offset)"
100
- :page-sizes="defaultPageSizes"
101
- :page-size="Number(pageData.limit)"
102
- :total="Number(pageData.total)"
103
- @size-change="(val) => handlePageChange('limit', val)"
104
- @current-change="(val) => handlePageChange('offset', val)"
105
- >
66
+ <el-pagination ref="pageRef" layout="total, sizes, prev, pager, next, jumper" v-loading="loadingPageTotal" :current-page="Number(pageData.offset)" :page-sizes="defaultPageSizes" :page-size="Number(pageData.limit)" :total="Number(pageData.total)" @size-change="(val) => handlePageChange('limit', val)" @current-change="(val) => handlePageChange('offset', val)">
106
67
  </el-pagination>
107
68
  </div>
108
69
  </div>
@@ -129,7 +90,7 @@ export default {
129
90
  selectable: {
130
91
  type: Function,
131
92
  default() {
132
- return () => {};
93
+ return () => { };
133
94
  },
134
95
  },
135
96
 
@@ -215,7 +176,7 @@ export default {
215
176
 
216
177
  rowClassName: {
217
178
  type: Function,
218
- default({ row }) {},
179
+ default({ row }) { },
219
180
  },
220
181
  tooltips: {
221
182
  type: Array,
@@ -241,7 +202,7 @@ export default {
241
202
  return [];
242
203
  },
243
204
  },
244
-
205
+
245
206
  fixedMap: {
246
207
  type: Object,
247
208
  default() {
@@ -408,14 +369,14 @@ export default {
408
369
  this.$toChildren.$on('changePageTotal', async totalId => {
409
370
  try {
410
371
  this.loadingPageTotal = true;
411
- const { data:res } = await this.$http.post(this.$UICONFIG.getPageTotalApi, {
372
+ const { data: res } = await this.$http.post(this.$UICONFIG.getPageTotalApi, {
412
373
  id: totalId
413
374
  });
414
375
 
415
376
  this.pageData.total = res.data.total;
416
377
  this.loadingPageTotal = false;
417
378
  this.$refs.pageRef.internalCurrentPage = Number(this.pageData.offset || 0);
418
- } catch(e) {
379
+ } catch (e) {
419
380
  this.loadingPageTotal = false;
420
381
  }
421
382
  })
@@ -424,6 +385,18 @@ export default {
424
385
  },
425
386
 
426
387
  created() {
388
+
389
+ if (!this.$UICONFIG) {
390
+ this.$UICONFIG = {
391
+ tablePreset: {
392
+ separator: '@',
393
+ presetPropMap: {},
394
+ },
395
+
396
+ getPageTotalApi: '',
397
+ }
398
+ }
399
+
427
400
  // 设置默认tab
428
401
  this.checkTab = this.defaultTab;
429
402
  this.defaultPageSizes = this.pageSizes || this.$UICONFIG?.pageSizes || [20, 50, 100, 200, 500, 1000];
@@ -435,7 +408,7 @@ export default {
435
408
  },
436
409
 
437
410
  async mounted() {
438
-
411
+
439
412
  await this.$nextTick();
440
413
  setTimeout(() => {
441
414
  this.isInit = true;
@@ -469,7 +442,7 @@ export default {
469
442
  window.removeEventListener('resize', this.handleWindowResize);
470
443
  this.$toChildren.$off('changePageTotal');
471
444
  },
472
-
445
+
473
446
  deactivated() {
474
447
  console.log('off');
475
448
  this.$toChildren.$off('changePageTotal');
@@ -511,9 +484,9 @@ export default {
511
484
  line-height: 28px;
512
485
  }
513
486
 
514
- /deep/ .el-tabs--card > .el-tabs__header .el-tabs__item.is-active {
487
+ /deep/ .el-tabs--card>.el-tabs__header .el-tabs__item.is-active {
515
488
  // background: linear-gradient(to right bottom, #cee3ff, #66a8ff) no-repeat;
516
- // color: #FFF;
489
+ // color: #FFF;
517
490
  color: #FFF;
518
491
  background: #409eff;
519
492
  box-shadow: 0 0 3px 1px #cee3ff;
@@ -574,11 +547,11 @@ export default {
574
547
  z-index: 1;
575
548
  }
576
549
 
577
- .ui-page__main > .ui-table {
550
+ .ui-page__main>.ui-table {
578
551
  background: #FFF;
579
- box-shadow: 0 0 4px 1px #eee;
580
- margin-left: 10px;
581
- border-radius: 4px;
552
+ box-shadow: 0 0 4px 1px #eee;
553
+ margin-left: 10px;
554
+ border-radius: 4px;
582
555
  padding-left: 10px;
583
556
  margin-right: 10px;
584
557
  }