meixioacomponent 2.0.36 → 2.0.38

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": "meixioacomponent",
3
- "version": "2.0.36",
3
+ "version": "2.0.38",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -2,6 +2,7 @@
2
2
  <div class="table-wrap">
3
3
  <t-enhanced-table
4
4
  ref="tTable"
5
+ :footData="footData"
5
6
  :rowKey="rowKey"
6
7
  :data="tableData"
7
8
  :bordered="bordered"
@@ -54,7 +55,7 @@ import baseDefaultSvgVue from '../baseDefaultSvg/baseDefaultSvg.vue'
54
55
  import baseText from "../baseText";
55
56
 
56
57
  //
57
- import {FilterTime, TransomTableConfig} from '../../../utils/utils'
58
+ import {FilterTime, TableFooterSummary, TransomTableConfig} from '../../../utils/utils'
58
59
  import {tableSectionMixins} from "../../mixins/tableSectionMixins";
59
60
 
60
61
  export default {
@@ -145,25 +146,21 @@ export default {
145
146
  type: Boolean,
146
147
  default: false
147
148
  },
148
- tree:{
149
- type:Object,
150
- default:()=>{
149
+ tree: {
150
+ type: Object,
151
+ default: () => {
151
152
  return null
152
153
  }
154
+ },
155
+ showSummary: {
156
+ type: Boolean,
157
+ default: false
153
158
  }
154
159
 
155
160
  },
156
161
  computed: {
157
162
  renderColumns() {
158
163
 
159
- const config = this.tableColumns.map((item, index) => {
160
- item['key'] = item.value;
161
- item['colkey'] = item.key;
162
- TransomTableConfig(item, index)
163
- return item;
164
- });
165
- console.log('checkType')
166
- console.log(this.$props.checkType);
167
164
  if (this.$props.checkType) {
168
165
  const checkConfig = {
169
166
  colKey: 'row-select',
@@ -171,18 +168,44 @@ export default {
171
168
  label: 'row-select',
172
169
  disabled: (scope) => {
173
170
  if (this.$props.canSelected) {
174
- return !(this.$props.canSelected(scope))
171
+ return !(this.$props.canSelected(scope))
175
172
  } else {
176
173
  return false
177
174
  }
178
175
 
179
176
  }
180
177
  }
178
+ this.tableColumns.push(checkConfig);
179
+ }
181
180
 
182
- return [checkConfig, ...config]
183
- } else {
181
+ return this.tableColumns.map((item, index) => {
182
+ item['key'] = item.value;
183
+ item['colkey'] = item.key;
184
+ TransomTableConfig(item, index)
185
+ if (this.$props.showSummary) {
186
+ if (index === 0) {
187
+ item['foot'] = '合计:'
188
+ } else {
189
+ item['foot'] = () => {
190
+ const value = TableFooterSummary(this.tableData, item.key);
191
+ return typeof value === 'number' ? value : '-'
192
+ }
193
+ }
194
+
195
+ }
196
+ return item;
197
+ })
198
+ },
199
+ footData() {
200
+ if (this.$props.showSummary) {
201
+ return [{
202
+ index: 'foot',
203
+ type: '汇总',
204
+ default: '',
205
+ description: '合计:',
206
+ }]
184
207
  }
185
- return config
208
+ return []
186
209
  }
187
210
 
188
211
  },
@@ -236,4 +259,13 @@ export default {
236
259
 
237
260
  <style lang="less" scoped>
238
261
  @import url("../../style/tableStyle.less");
262
+
263
+ .table-wrap {
264
+ height: 100%;
265
+
266
+ /deep/ .t-table {
267
+ height: 100%;
268
+ }
269
+ }
270
+
239
271
  </style>
@@ -21,6 +21,7 @@
21
21
  <!-- </basePopoverButton>-->
22
22
 
23
23
  <base-pagination
24
+ :page-sizes="pageSizes"
24
25
  :config="pageConfig"
25
26
  :pageProps="pageProps"
26
27
  @currentChange="currentChange"
@@ -50,6 +51,10 @@ export default {
50
51
  pageConfig: {
51
52
  type: Object,
52
53
  },
54
+ pageSizes: {
55
+ type: Array,
56
+ default: () => [15, 30, 60, 100, 200, 300],
57
+ },
53
58
  },
54
59
  components: {
55
60
  basePopoverButton,
@@ -97,8 +97,6 @@
97
97
  >
98
98
 
99
99
 
100
-
101
-
102
100
  <template #expanded-row="{row}" v-if="expandId">
103
101
  <slot name="expandedRow" :scope="row"></slot>
104
102
  </template>
@@ -193,6 +191,7 @@
193
191
  class="oa-pro-table-footer"
194
192
  >
195
193
  <oa_pro_footerVue
194
+ :page-sizes="pageSizes"
196
195
  :pageConfig="pageConfig"
197
196
  :pageProps="pageProps"
198
197
  :totalList="totalList"
@@ -510,16 +509,20 @@ export default {
510
509
  default: false
511
510
  },
512
511
 
513
- expandId:{
514
- type:String,
515
- default:null
512
+ expandId: {
513
+ type: String,
514
+ default: null
516
515
  },
517
516
  rowspanAndColspan: {
518
517
  type: Function,
519
518
  default: () => {
520
519
  return null
521
520
  }
522
- }
521
+ },
522
+ pageSizes: {
523
+ type: Array,
524
+ default: () => [15, 30, 60, 100, 200, 300],
525
+ },
523
526
  },
524
527
  computed: {
525
528
  checkType() {
@@ -630,8 +633,8 @@ export default {
630
633
  },
631
634
  mixins: [tableSectionMixins],
632
635
  methods: {
633
- rehandleExpandChange(value,params){
634
- this.$emit('rehandleExpandChange',value)
636
+ rehandleExpandChange(value, params) {
637
+ this.$emit('rehandleExpandChange', value)
635
638
  },
636
639
  isToolTip(value) {
637
640
  if (!value) {
@@ -903,11 +906,17 @@ export default {
903
906
  }
904
907
 
905
908
  result[`keyword`] = this.module;
906
- if(this.sort.sortBy){
907
- result[`sortField`] = this.sort?.sortBy;
908
- result[`sortOrder`] = this.sort?.descending ? 'desc' : 'asc';
909
+ try {
910
+ if (this.sort[`sortBy`]) {
911
+ result[`sortField`] = this.sort?.sortBy;
912
+ result[`sortOrder`] = this.sort?.descending ? 'desc' : 'asc';
913
+ }
914
+ } catch (error) {
915
+ result[`sortField`] = null;
916
+ result[`sortOrder`] = '';
909
917
  }
910
918
 
919
+
911
920
  // 高级筛选的结果
912
921
  const searchList = [];
913
922
 
@@ -385,3 +385,13 @@ export const TransomComponentSize = (size) => {
385
385
  return 'medium'
386
386
  }
387
387
  }
388
+
389
+
390
+ export const TableFooterSummary = (tableData, key) => {
391
+ if (Array.isArray(tableData)) {
392
+ return tableData.reduce((preValue, currentValue, currentIndex) => {
393
+ return preValue + currentValue[`${key}`];
394
+ }, 0);
395
+ }
396
+ return 0;
397
+ }