meixioacomponent 0.3.29 → 0.3.30
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/lib/meixioacomponent.common.js +2286 -8554
- package/lib/meixioacomponent.umd.js +2286 -8554
- package/lib/meixioacomponent.umd.min.js +23 -25
- package/package.json +41 -41
- package/packages/components/proForm/proForm/pro_form_item.vue +3 -1
- package/packages/components/proPageTable/oa_pro_table.vue +227 -195
- package/src/component/test.vue +66 -65
- package/src/test.js +13 -0
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
:class="{
|
|
54
54
|
'no-row-bordel': !borderRow,
|
|
55
55
|
}"
|
|
56
|
+
@sort-change="sortChange"
|
|
56
57
|
@cell-mouse-enter="cellMouseEnter"
|
|
57
58
|
@cell-mouse-leave="cellMouseLeave"
|
|
58
59
|
@selection-change="handleSelectionChange"
|
|
@@ -88,13 +89,13 @@
|
|
|
88
89
|
<el-table-column
|
|
89
90
|
:key="index"
|
|
90
91
|
:align="align"
|
|
92
|
+
sortable="custom"
|
|
91
93
|
:fixed="item.lock"
|
|
92
94
|
v-show="item.show"
|
|
93
95
|
:prop="item.key"
|
|
94
96
|
:label="item.label"
|
|
95
97
|
:width="isAverageWidth ? '' : item.width"
|
|
96
98
|
v-for="(item, index) in showTableHeader"
|
|
97
|
-
sortable
|
|
98
99
|
>
|
|
99
100
|
<template slot="header" slot-scope="scope">
|
|
100
101
|
<oaProtableHeader
|
|
@@ -109,8 +110,11 @@
|
|
|
109
110
|
</template>
|
|
110
111
|
|
|
111
112
|
<template slot-scope="scope">
|
|
112
|
-
<slot
|
|
113
|
-
|
|
113
|
+
<slot
|
|
114
|
+
:name="item.key"
|
|
115
|
+
:scope="scope.row"
|
|
116
|
+
v-if="item.template"
|
|
117
|
+
></slot>
|
|
114
118
|
|
|
115
119
|
<span
|
|
116
120
|
v-else
|
|
@@ -120,8 +124,9 @@
|
|
|
120
124
|
: `cell-content-text ${item.color}`
|
|
121
125
|
"
|
|
122
126
|
@click="rowClick(item, scope.row)"
|
|
123
|
-
>{{ scope.row[`${item.key}`] }}</span
|
|
124
127
|
>
|
|
128
|
+
{{ scope.row[`${item.key}`] }}
|
|
129
|
+
</span>
|
|
125
130
|
</template>
|
|
126
131
|
</el-table-column>
|
|
127
132
|
</el-table>
|
|
@@ -143,7 +148,7 @@
|
|
|
143
148
|
:visible-arrow="false"
|
|
144
149
|
:content="`${tooltip.content}`"
|
|
145
150
|
>
|
|
146
|
-
<span class="table-tooltip-wrap" :style="toolTipsStyle"
|
|
151
|
+
<span class="table-tooltip-wrap" :style="toolTipsStyle"></span>
|
|
147
152
|
</el-tooltip>
|
|
148
153
|
</div>
|
|
149
154
|
|
|
@@ -185,20 +190,20 @@
|
|
|
185
190
|
</template>
|
|
186
191
|
|
|
187
192
|
<script>
|
|
188
|
-
import oaProHeader from
|
|
189
|
-
import oa_pro_footerVue from
|
|
190
|
-
import oa_pro_screenVue from
|
|
191
|
-
import oaProtableHeader from
|
|
192
|
-
import oa_pro_table_searchVue from
|
|
193
|
-
import oa_pro_colum_configVue from
|
|
194
|
-
import oa_pro_table_skeletonVue from
|
|
195
|
-
import baseDefaultSvgVue from
|
|
196
|
-
import baseButtonHandle from
|
|
193
|
+
import oaProHeader from './oa_pro_header.vue' //表格头部
|
|
194
|
+
import oa_pro_footerVue from './oa_pro_footer.vue' //表格尾部
|
|
195
|
+
import oa_pro_screenVue from './oa_pro_screen.vue' //表格高级搜索组件
|
|
196
|
+
import oaProtableHeader from './oa_pro_table-header.vue' //表格自定义列表头组件
|
|
197
|
+
import oa_pro_table_searchVue from './oa_pro-table-search.vue' //表格搜索组件
|
|
198
|
+
import oa_pro_colum_configVue from './oa_pro_colum_config.vue' //表格列配置组件
|
|
199
|
+
import oa_pro_table_skeletonVue from './oa_pro_table_skeleton.vue' //表格骨架屏
|
|
200
|
+
import baseDefaultSvgVue from '../base/baseDefaultSvg/baseDefaultSvg.vue' //缺省页组件
|
|
201
|
+
import baseButtonHandle from '../base/baseButtonHandle/baseButtonHandle.vue' //通用组件 排列尾部按钮的组件
|
|
197
202
|
|
|
198
203
|
//
|
|
199
|
-
import componentConfig from
|
|
204
|
+
import componentConfig from '../../config/componentConfig'
|
|
200
205
|
export default {
|
|
201
|
-
name:
|
|
206
|
+
name: 'baseProTable',
|
|
202
207
|
data() {
|
|
203
208
|
return {
|
|
204
209
|
/* 表格数据 */
|
|
@@ -223,7 +228,7 @@ export default {
|
|
|
223
228
|
width: null,
|
|
224
229
|
height: null,
|
|
225
230
|
show: false,
|
|
226
|
-
content:
|
|
231
|
+
content: '',
|
|
227
232
|
},
|
|
228
233
|
/* 单选表格 记录之前选择的表格数据 */
|
|
229
234
|
preSingleTableValue: null,
|
|
@@ -238,18 +243,18 @@ export default {
|
|
|
238
243
|
|
|
239
244
|
// 倒计时
|
|
240
245
|
triggerDown: null,
|
|
241
|
-
}
|
|
246
|
+
}
|
|
242
247
|
},
|
|
243
248
|
created() {
|
|
244
|
-
this.init()
|
|
245
|
-
componentConfig.eventBus.$on(
|
|
249
|
+
this.init()
|
|
250
|
+
componentConfig.eventBus.$on('handleTableBorder', this.handleTableBorder)
|
|
246
251
|
},
|
|
247
252
|
mounted() {
|
|
248
253
|
// this.init();
|
|
249
254
|
},
|
|
250
255
|
beforeDestroy() {
|
|
251
|
-
componentConfig.eventBus.$off(
|
|
252
|
-
clearTimeout(this.triggerDown)
|
|
256
|
+
componentConfig.eventBus.$off('handleTableBorder', this.handleTableBorder)
|
|
257
|
+
clearTimeout(this.triggerDown)
|
|
253
258
|
},
|
|
254
259
|
computed: {
|
|
255
260
|
config() {
|
|
@@ -257,7 +262,7 @@ export default {
|
|
|
257
262
|
footHeight: 60,
|
|
258
263
|
headerHeight: this.headerConfig ? 36 : 0,
|
|
259
264
|
searchContentHeight: this.searchContentHeight,
|
|
260
|
-
}
|
|
265
|
+
}
|
|
261
266
|
},
|
|
262
267
|
|
|
263
268
|
tableHeight() {
|
|
@@ -266,27 +271,27 @@ export default {
|
|
|
266
271
|
this.config.footHeight -
|
|
267
272
|
this.config.headerHeight -
|
|
268
273
|
this.config.searchContentHeight
|
|
269
|
-
)
|
|
274
|
+
)
|
|
270
275
|
},
|
|
271
276
|
fixedList() {
|
|
272
277
|
return this.$props.tableConfig.filter((item) => {
|
|
273
|
-
return item.lock
|
|
274
|
-
})
|
|
278
|
+
return item.lock
|
|
279
|
+
})
|
|
275
280
|
},
|
|
276
281
|
|
|
277
282
|
module: {
|
|
278
283
|
get() {
|
|
279
|
-
return this.$props.value
|
|
284
|
+
return this.$props.value
|
|
280
285
|
},
|
|
281
286
|
set(val) {
|
|
282
|
-
this.$emit(
|
|
287
|
+
this.$emit('input', val)
|
|
283
288
|
},
|
|
284
289
|
},
|
|
285
290
|
|
|
286
291
|
showTableHeader() {
|
|
287
292
|
return this.$props.tableConfig.filter((item) => {
|
|
288
|
-
return item.show
|
|
289
|
-
})
|
|
293
|
+
return item.show
|
|
294
|
+
})
|
|
290
295
|
},
|
|
291
296
|
|
|
292
297
|
toolTipsStyle() {
|
|
@@ -295,7 +300,7 @@ export default {
|
|
|
295
300
|
left: `${this.tooltip.left}px`,
|
|
296
301
|
width: `${this.tooltip.width}px`,
|
|
297
302
|
height: `${this.tooltip.height}px`,
|
|
298
|
-
}
|
|
303
|
+
}
|
|
299
304
|
},
|
|
300
305
|
},
|
|
301
306
|
props: {
|
|
@@ -308,9 +313,9 @@ export default {
|
|
|
308
313
|
type: Object,
|
|
309
314
|
default: () => {
|
|
310
315
|
return {
|
|
311
|
-
children:
|
|
312
|
-
hasChildren:
|
|
313
|
-
}
|
|
316
|
+
children: 'children',
|
|
317
|
+
hasChildren: 'hasChildren',
|
|
318
|
+
}
|
|
314
319
|
},
|
|
315
320
|
},
|
|
316
321
|
|
|
@@ -347,13 +352,13 @@ export default {
|
|
|
347
352
|
align: {
|
|
348
353
|
type: String,
|
|
349
354
|
require: false,
|
|
350
|
-
default:
|
|
355
|
+
default: 'left',
|
|
351
356
|
},
|
|
352
357
|
// 宽度
|
|
353
358
|
width: {
|
|
354
359
|
type: String,
|
|
355
360
|
require: false,
|
|
356
|
-
default:
|
|
361
|
+
default: '100%',
|
|
357
362
|
},
|
|
358
363
|
// 宽度
|
|
359
364
|
height: {
|
|
@@ -365,7 +370,7 @@ export default {
|
|
|
365
370
|
*/
|
|
366
371
|
placeholder: {
|
|
367
372
|
type: String,
|
|
368
|
-
default:
|
|
373
|
+
default: '回车键进行搜索',
|
|
369
374
|
},
|
|
370
375
|
/*
|
|
371
376
|
快捷筛选的列表
|
|
@@ -398,11 +403,11 @@ export default {
|
|
|
398
403
|
default: () => {
|
|
399
404
|
return {
|
|
400
405
|
value: [],
|
|
401
|
-
type:
|
|
406
|
+
type: 'single',
|
|
402
407
|
canSelected: () => {
|
|
403
|
-
return true
|
|
408
|
+
return true
|
|
404
409
|
},
|
|
405
|
-
}
|
|
410
|
+
}
|
|
406
411
|
},
|
|
407
412
|
},
|
|
408
413
|
|
|
@@ -425,375 +430,402 @@ export default {
|
|
|
425
430
|
},
|
|
426
431
|
methods: {
|
|
427
432
|
init() {
|
|
428
|
-
this.initProScreenConfig()
|
|
429
|
-
this.initFooterHandleConfig()
|
|
433
|
+
this.initProScreenConfig()
|
|
434
|
+
this.initFooterHandleConfig()
|
|
430
435
|
this.$props.tableConfig.forEach((item, index) => {
|
|
431
|
-
item.preIndex = index
|
|
432
|
-
this.$set(item,
|
|
436
|
+
item.preIndex = index
|
|
437
|
+
this.$set(item, 'show', true)
|
|
433
438
|
if (!item.width || item.width < 100) {
|
|
434
|
-
item.width = 100
|
|
439
|
+
item.width = 100
|
|
435
440
|
}
|
|
436
|
-
})
|
|
441
|
+
})
|
|
437
442
|
|
|
438
443
|
if (!this.isAverageWidth) {
|
|
439
444
|
this.$props.tableConfig.push({
|
|
440
|
-
label:
|
|
441
|
-
key:
|
|
445
|
+
label: '',
|
|
446
|
+
key: 'noData',
|
|
442
447
|
lock: false,
|
|
443
448
|
width: 30,
|
|
444
449
|
show: true,
|
|
445
450
|
template: false,
|
|
446
|
-
})
|
|
451
|
+
})
|
|
447
452
|
}
|
|
448
453
|
|
|
449
|
-
this.refreshData()
|
|
454
|
+
this.refreshData()
|
|
450
455
|
},
|
|
451
456
|
searchContentHeightChange(height) {
|
|
452
|
-
this.searchContentHeight = height
|
|
457
|
+
this.searchContentHeight = height
|
|
453
458
|
},
|
|
454
459
|
|
|
455
460
|
cellMouseEnter(row, column, cell, event) {
|
|
456
|
-
let content = row[`${column.property}`]
|
|
457
|
-
this.tooltip.show = false
|
|
458
|
-
if (typeof content ==
|
|
459
|
-
const { tooltip } = this
|
|
460
|
-
let style = event.target
|
|
461
|
-
let position = style.getBoundingClientRect()
|
|
462
|
-
const { top, left } = position
|
|
463
|
-
const { clientWidth, clientHeight } = style
|
|
464
|
-
tooltip.width = clientWidth
|
|
465
|
-
tooltip.height = clientHeight
|
|
466
|
-
tooltip.top = top
|
|
467
|
-
tooltip.left = left
|
|
468
|
-
tooltip.content = content
|
|
461
|
+
let content = row[`${column.property}`]
|
|
462
|
+
this.tooltip.show = false
|
|
463
|
+
if (typeof content == 'number' || typeof content == 'string') {
|
|
464
|
+
const { tooltip } = this
|
|
465
|
+
let style = event.target
|
|
466
|
+
let position = style.getBoundingClientRect()
|
|
467
|
+
const { top, left } = position
|
|
468
|
+
const { clientWidth, clientHeight } = style
|
|
469
|
+
tooltip.width = clientWidth
|
|
470
|
+
tooltip.height = clientHeight
|
|
471
|
+
tooltip.top = top
|
|
472
|
+
tooltip.left = left
|
|
473
|
+
tooltip.content = content
|
|
469
474
|
this.$nextTick(() => {
|
|
470
|
-
tooltip.show = true
|
|
471
|
-
})
|
|
475
|
+
tooltip.show = true
|
|
476
|
+
})
|
|
472
477
|
}
|
|
473
478
|
},
|
|
474
479
|
|
|
475
480
|
cellMouseLeave() {
|
|
476
|
-
this.tooltip.show = false
|
|
481
|
+
this.tooltip.show = false
|
|
477
482
|
},
|
|
478
483
|
headerItemLock(params) {
|
|
479
|
-
let { preIndex, index } = { ...params }
|
|
480
|
-
let tableConfig = this.$props.tableConfig
|
|
481
|
-
tableConfig[index].lock = true
|
|
484
|
+
let { preIndex, index } = { ...params }
|
|
485
|
+
let tableConfig = this.$props.tableConfig
|
|
486
|
+
tableConfig[index].lock = true
|
|
482
487
|
if (tableConfig[index].preIndex == undefined) {
|
|
483
|
-
tableConfig[index].preIndex = preIndex
|
|
488
|
+
tableConfig[index].preIndex = preIndex
|
|
484
489
|
}
|
|
485
490
|
if (this.fixedList.length == 0) {
|
|
486
|
-
tableConfig.unshift(tableConfig[index])
|
|
491
|
+
tableConfig.unshift(tableConfig[index])
|
|
487
492
|
} else {
|
|
488
|
-
const _fixedList = this.fixedList
|
|
493
|
+
const _fixedList = this.fixedList
|
|
489
494
|
for (let i = 0; i < _fixedList.length; i++) {
|
|
490
495
|
if (tableConfig[index].preIndex < _fixedList[i].preIndex) {
|
|
491
|
-
tableConfig.splice(i, 0, tableConfig[index])
|
|
492
|
-
break
|
|
496
|
+
tableConfig.splice(i, 0, tableConfig[index])
|
|
497
|
+
break
|
|
493
498
|
} else if (i == _fixedList.length - 1) {
|
|
494
|
-
tableConfig.splice(_fixedList.length - 1, 0, tableConfig[index])
|
|
495
|
-
break
|
|
499
|
+
tableConfig.splice(_fixedList.length - 1, 0, tableConfig[index])
|
|
500
|
+
break
|
|
496
501
|
}
|
|
497
502
|
}
|
|
498
503
|
}
|
|
499
|
-
tableConfig.splice(index + 1, 1)
|
|
504
|
+
tableConfig.splice(index + 1, 1)
|
|
500
505
|
},
|
|
501
506
|
headerItemUnlock(params) {
|
|
502
|
-
let { preIndex, index } = { ...params }
|
|
503
|
-
let tableConfig = this.$props.tableConfig
|
|
504
|
-
tableConfig[index].lock = false
|
|
507
|
+
let { preIndex, index } = { ...params }
|
|
508
|
+
let tableConfig = this.$props.tableConfig
|
|
509
|
+
tableConfig[index].lock = false
|
|
505
510
|
|
|
506
511
|
tableConfig.splice(
|
|
507
512
|
preIndex - index + this.fixedList.length,
|
|
508
513
|
0,
|
|
509
|
-
tableConfig.splice(index, 1)[0]
|
|
510
|
-
)
|
|
514
|
+
tableConfig.splice(index, 1)[0],
|
|
515
|
+
)
|
|
511
516
|
},
|
|
512
517
|
rowClick(config, row) {
|
|
513
|
-
if (!config.fun) return
|
|
514
|
-
config.fun(row)
|
|
518
|
+
if (!config.fun) return
|
|
519
|
+
config.fun(row)
|
|
515
520
|
},
|
|
516
521
|
// 计算左下角的统计
|
|
517
522
|
computedTotalList() {
|
|
518
|
-
this.totalList = []
|
|
519
|
-
this.totalList = this.$props.totalPropsList
|
|
523
|
+
this.totalList = []
|
|
524
|
+
this.totalList = this.$props.totalPropsList
|
|
520
525
|
if (this.totalList.length > 0 && this.tableData.length > 0) {
|
|
521
526
|
for (let i = 0; i < this.totalList.length; i++) {
|
|
522
527
|
if (
|
|
523
|
-
typeof this.tableData[0][`${this.totalList[i].value}`] ==
|
|
528
|
+
typeof this.tableData[0][`${this.totalList[i].value}`] == 'number'
|
|
524
529
|
) {
|
|
525
530
|
let total = this.tableData.reduce(
|
|
526
531
|
(preTotal, currentItem) =>
|
|
527
532
|
preTotal + currentItem[`${this.totalList[i].value}`],
|
|
528
|
-
0
|
|
529
|
-
)
|
|
533
|
+
0,
|
|
534
|
+
)
|
|
530
535
|
|
|
531
|
-
this.totalList[i].total = total
|
|
536
|
+
this.totalList[i].total = total
|
|
532
537
|
}
|
|
533
538
|
}
|
|
534
539
|
}
|
|
535
540
|
},
|
|
536
541
|
/* 当快捷筛选的按钮被点击后 */
|
|
537
542
|
handleScreen(index) {
|
|
538
|
-
this.$props.screenList.index = index
|
|
539
|
-
this.refreshData()
|
|
543
|
+
this.$props.screenList.index = index
|
|
544
|
+
this.refreshData()
|
|
540
545
|
},
|
|
541
546
|
// 初始化高级筛选
|
|
542
547
|
initProScreenConfig() {
|
|
543
|
-
let proScreenConfig = this.$props.proScreenConfig
|
|
548
|
+
let proScreenConfig = this.$props.proScreenConfig
|
|
544
549
|
if (proScreenConfig.length > 0) {
|
|
545
550
|
this._proScreenConfig = proScreenConfig.map((item) => {
|
|
546
551
|
let index = this.$props.tableConfig.findIndex((citem) => {
|
|
547
552
|
//console.log(citem);
|
|
548
|
-
return citem.key == item.key
|
|
549
|
-
})
|
|
553
|
+
return citem.key == item.key
|
|
554
|
+
})
|
|
550
555
|
|
|
551
556
|
if (index > -1) {
|
|
552
|
-
this.$set(item,
|
|
553
|
-
this.$set(item,
|
|
554
|
-
return item
|
|
557
|
+
this.$set(item, 'label', this.$props.tableConfig[index].label)
|
|
558
|
+
this.$set(item, 'isCheck', false)
|
|
559
|
+
return item
|
|
555
560
|
}
|
|
556
|
-
})
|
|
561
|
+
})
|
|
557
562
|
|
|
558
563
|
//console.log(this._proScreenConfig);
|
|
559
564
|
}
|
|
560
565
|
},
|
|
561
566
|
// 打开高级筛选
|
|
562
567
|
handleOpenProScreen() {
|
|
563
|
-
this.$refs.dialog.showDialog()
|
|
568
|
+
this.$refs.dialog.showDialog()
|
|
564
569
|
},
|
|
565
570
|
// 插入默认的高级筛选item
|
|
566
571
|
insertDefaultItem() {
|
|
567
572
|
let obj = {
|
|
568
|
-
key:
|
|
569
|
-
value:
|
|
573
|
+
key: '',
|
|
574
|
+
value: '',
|
|
570
575
|
exposed: false,
|
|
571
576
|
type: undefined,
|
|
572
|
-
}
|
|
573
|
-
this.proScreenList.push(obj)
|
|
577
|
+
}
|
|
578
|
+
this.proScreenList.push(obj)
|
|
574
579
|
},
|
|
575
580
|
|
|
576
581
|
handleScreenItem(config) {
|
|
577
582
|
//console.log(config);
|
|
578
583
|
|
|
579
584
|
let index = this.proScreenList.findIndex((item) => {
|
|
580
|
-
return item.key == config.value
|
|
581
|
-
})
|
|
585
|
+
return item.key == config.value
|
|
586
|
+
})
|
|
582
587
|
|
|
583
588
|
if (index < 0) {
|
|
584
589
|
let _configIndex = this.$props.proScreenConfig.findIndex((item) => {
|
|
585
|
-
return item.key == config.value
|
|
586
|
-
})
|
|
590
|
+
return item.key == config.value
|
|
591
|
+
})
|
|
587
592
|
|
|
588
593
|
if (_configIndex >= 0) {
|
|
589
|
-
let _configItem = this.$props.proScreenConfig[_configIndex]
|
|
594
|
+
let _configItem = this.$props.proScreenConfig[_configIndex]
|
|
590
595
|
this.proScreenList.push({
|
|
591
596
|
key: _configItem.key,
|
|
592
|
-
value:
|
|
597
|
+
value: '',
|
|
593
598
|
exposed: false,
|
|
594
599
|
type: _configItem.type,
|
|
595
600
|
configIndex: _configIndex,
|
|
596
|
-
})
|
|
601
|
+
})
|
|
597
602
|
}
|
|
598
603
|
}
|
|
599
604
|
|
|
600
605
|
this.$nextTick(() => {
|
|
601
|
-
this.$refs.dialog.showDialog()
|
|
602
|
-
})
|
|
606
|
+
this.$refs.dialog.showDialog()
|
|
607
|
+
})
|
|
603
608
|
},
|
|
604
609
|
// 删除高级筛选的item
|
|
605
610
|
deleteProscreenItem(index) {
|
|
606
|
-
this.proScreenList[index].isCheck = false
|
|
607
|
-
this.proScreenList.splice(index, 1)
|
|
611
|
+
this.proScreenList[index].isCheck = false
|
|
612
|
+
this.proScreenList.splice(index, 1)
|
|
608
613
|
},
|
|
609
614
|
// 弹框确定的按钮
|
|
610
615
|
dialogProscreenConfirm(type) {
|
|
611
616
|
if (type) {
|
|
612
|
-
this.refreshData()
|
|
617
|
+
this.refreshData()
|
|
613
618
|
}
|
|
614
|
-
this.$refs.dialog.closeDialog()
|
|
619
|
+
this.$refs.dialog.closeDialog()
|
|
615
620
|
},
|
|
616
621
|
// 初始化对话框尾部按钮
|
|
617
622
|
initFooterHandleConfig() {
|
|
618
623
|
this.footerHandleConfig = [
|
|
619
624
|
{
|
|
620
|
-
text:
|
|
621
|
-
type:
|
|
625
|
+
text: '取消',
|
|
626
|
+
type: 'info',
|
|
622
627
|
plain: true,
|
|
623
628
|
click: () => {
|
|
624
|
-
this.dialogProscreenConfirm(false)
|
|
629
|
+
this.dialogProscreenConfirm(false)
|
|
625
630
|
},
|
|
626
631
|
},
|
|
627
632
|
{
|
|
628
|
-
text:
|
|
629
|
-
type:
|
|
633
|
+
text: '确定',
|
|
634
|
+
type: 'primary',
|
|
630
635
|
plain: false,
|
|
631
636
|
click: () => {
|
|
632
|
-
this.dialogProscreenConfirm(true)
|
|
633
|
-
this.$refs.oaProTableSearch.handleProScreenList(true)
|
|
637
|
+
this.dialogProscreenConfirm(true)
|
|
638
|
+
this.$refs.oaProTableSearch.handleProScreenList(true)
|
|
634
639
|
},
|
|
635
640
|
},
|
|
636
|
-
]
|
|
641
|
+
]
|
|
637
642
|
},
|
|
638
643
|
// 返回筛选条件的
|
|
639
644
|
returnProScreenResult() {
|
|
640
|
-
let result = {}
|
|
645
|
+
let result = {}
|
|
641
646
|
if (this.$props.screenList) {
|
|
642
|
-
let _screenListIndexItem =
|
|
643
|
-
this.$props.screenList.
|
|
644
|
-
|
|
647
|
+
let _screenListIndexItem = this.$props.screenList.list[
|
|
648
|
+
this.$props.screenList.index
|
|
649
|
+
]
|
|
650
|
+
result[`${_screenListIndexItem.key}`] = _screenListIndexItem.value
|
|
645
651
|
}
|
|
646
|
-
result[`keyword`] = this.module
|
|
652
|
+
result[`keyword`] = this.module
|
|
647
653
|
this.proScreenList.forEach((item) => {
|
|
648
|
-
const { key, value } = item
|
|
654
|
+
const { key, value } = item
|
|
649
655
|
if (typeof value == Number || typeof value == Boolean || value) {
|
|
650
|
-
result[`${key}`] = value
|
|
656
|
+
result[`${key}`] = value
|
|
651
657
|
}
|
|
652
|
-
})
|
|
653
|
-
result = Object.assign(result, this.$props.pageProps)
|
|
654
|
-
return result
|
|
658
|
+
})
|
|
659
|
+
result = Object.assign(result, this.$props.pageProps)
|
|
660
|
+
return result
|
|
655
661
|
},
|
|
656
662
|
// 开始调用http请求
|
|
657
663
|
async refreshData(init = true) {
|
|
658
|
-
this.loading = true
|
|
659
|
-
this.defaultSvg = false
|
|
660
|
-
this.cleanCheckValue()
|
|
661
|
-
clearTimeout(this.triggerDown)
|
|
664
|
+
this.loading = true
|
|
665
|
+
this.defaultSvg = false
|
|
666
|
+
this.cleanCheckValue()
|
|
667
|
+
clearTimeout(this.triggerDown)
|
|
662
668
|
if (init) {
|
|
663
|
-
this.$props.pageProps[this.$props.pageConfig.page] = 1
|
|
669
|
+
this.$props.pageProps[this.$props.pageConfig.page] = 1
|
|
664
670
|
}
|
|
665
671
|
|
|
666
|
-
let screenResult = this.returnProScreenResult()
|
|
672
|
+
let screenResult = this.returnProScreenResult()
|
|
667
673
|
this.$props.httpRequire(screenResult).then((res) => {
|
|
668
|
-
this.setTableData(res)
|
|
669
|
-
})
|
|
674
|
+
this.setTableData(res)
|
|
675
|
+
})
|
|
670
676
|
},
|
|
671
677
|
// 设置表格数据
|
|
672
678
|
setTableData(data, immediately = true) {
|
|
673
|
-
this.tableData = []
|
|
674
|
-
this.tableData = data
|
|
679
|
+
this.tableData = []
|
|
680
|
+
this.tableData = data
|
|
675
681
|
if (immediately) {
|
|
676
|
-
this.tableDataCompleted()
|
|
682
|
+
this.tableDataCompleted()
|
|
677
683
|
} else {
|
|
678
|
-
this.setTriggerDown()
|
|
684
|
+
this.setTriggerDown()
|
|
679
685
|
}
|
|
680
686
|
},
|
|
681
687
|
|
|
682
688
|
// 表格如果有滚动条将滚动条拉到顶部
|
|
683
689
|
scrollToTop() {
|
|
684
|
-
let elTable = this.$refs.elTable.$el
|
|
685
|
-
let target = elTable.querySelector(
|
|
690
|
+
let elTable = this.$refs.elTable.$el
|
|
691
|
+
let target = elTable.querySelector('.el-table__body-wrapper')
|
|
686
692
|
if (target) {
|
|
687
|
-
target.scrollTop = 0
|
|
693
|
+
target.scrollTop = 0
|
|
688
694
|
}
|
|
689
695
|
},
|
|
690
696
|
// element表格的重新渲染方法
|
|
691
697
|
daLayoutTable() {
|
|
692
698
|
this.$nextTick(() => {
|
|
693
|
-
this.$refs.elTable.doLayout()
|
|
694
|
-
})
|
|
699
|
+
this.$refs.elTable.doLayout()
|
|
700
|
+
})
|
|
695
701
|
},
|
|
696
702
|
// 清空高级筛选的条件
|
|
697
703
|
cleanProscreenCondition(flag = false) {
|
|
698
|
-
if (this.proScreenList.length <= 0) return
|
|
704
|
+
if (this.proScreenList.length <= 0) return
|
|
699
705
|
this.proScreenList.forEach((item) => {
|
|
700
|
-
item.value = null
|
|
701
|
-
})
|
|
706
|
+
item.value = null
|
|
707
|
+
})
|
|
702
708
|
if (flag) {
|
|
703
|
-
this.refreshData(true)
|
|
709
|
+
this.refreshData(true)
|
|
704
710
|
}
|
|
705
711
|
},
|
|
706
712
|
// 自定义表格的列
|
|
707
713
|
setTableHeaderConfig(configList) {
|
|
708
714
|
//console.log(configList);
|
|
709
715
|
const index = this.$props.tableConfig.filter((item) => {
|
|
710
|
-
return item.lock
|
|
711
|
-
}).length
|
|
712
|
-
this.$props.tableConfig.splice(index, configList.length + 1)
|
|
716
|
+
return item.lock
|
|
717
|
+
}).length
|
|
718
|
+
this.$props.tableConfig.splice(index, configList.length + 1)
|
|
713
719
|
this.$nextTick(() => {
|
|
714
720
|
configList.forEach((item) => {
|
|
715
|
-
this.$props.tableConfig.push(item)
|
|
716
|
-
})
|
|
721
|
+
this.$props.tableConfig.push(item)
|
|
722
|
+
})
|
|
717
723
|
this.$props.tableConfig.push({
|
|
718
|
-
label:
|
|
719
|
-
key:
|
|
724
|
+
label: '',
|
|
725
|
+
key: 'noData',
|
|
720
726
|
lock: false,
|
|
721
727
|
width: 30,
|
|
722
728
|
show: true,
|
|
723
729
|
template: false,
|
|
724
|
-
})
|
|
725
|
-
})
|
|
730
|
+
})
|
|
731
|
+
})
|
|
726
732
|
},
|
|
727
733
|
// 表格行被选中时
|
|
728
734
|
handleSelectionChange(val) {
|
|
729
|
-
let tableCheckboxConfig = this.$props.tableCheckboxConfig
|
|
730
|
-
if (tableCheckboxConfig.type ==
|
|
735
|
+
let tableCheckboxConfig = this.$props.tableCheckboxConfig
|
|
736
|
+
if (tableCheckboxConfig.type == 'single') {
|
|
731
737
|
if (!this.preSingleTableValue) {
|
|
732
|
-
this.preSingleTableValue = val[0]
|
|
733
|
-
tableCheckboxConfig.value = val
|
|
738
|
+
this.preSingleTableValue = val[0]
|
|
739
|
+
tableCheckboxConfig.value = val
|
|
734
740
|
} else {
|
|
735
741
|
let index = val.findIndex((item) => {
|
|
736
|
-
return item == this.preSingleTableValue
|
|
737
|
-
})
|
|
742
|
+
return item == this.preSingleTableValue
|
|
743
|
+
})
|
|
738
744
|
if (index > -1) {
|
|
739
745
|
this.$refs.elTable.toggleRowSelection(
|
|
740
746
|
tableCheckboxConfig.value[index],
|
|
741
|
-
false
|
|
742
|
-
)
|
|
743
|
-
val.splice(index, 1)
|
|
744
|
-
tableCheckboxConfig.value = val
|
|
745
|
-
this.preSingleTableValue = val[0]
|
|
747
|
+
false,
|
|
748
|
+
)
|
|
749
|
+
val.splice(index, 1)
|
|
750
|
+
tableCheckboxConfig.value = val
|
|
751
|
+
this.preSingleTableValue = val[0]
|
|
746
752
|
}
|
|
747
753
|
}
|
|
748
754
|
} else {
|
|
749
|
-
tableCheckboxConfig.value = val
|
|
755
|
+
tableCheckboxConfig.value = val
|
|
750
756
|
}
|
|
751
757
|
//console.log(tableCheckboxConfig.value);
|
|
752
758
|
},
|
|
753
759
|
|
|
754
760
|
// 返回被选中的值
|
|
755
761
|
returnCheckValue() {
|
|
756
|
-
return this.$props.tableCheckboxConfig.value
|
|
762
|
+
return this.$props.tableCheckboxConfig.value
|
|
757
763
|
},
|
|
758
764
|
|
|
759
765
|
// 清空被单选框选中的值
|
|
760
766
|
cleanCheckValue() {
|
|
761
|
-
this.preSingleTableValue = null
|
|
762
|
-
this.tableCheckboxConfig.value = []
|
|
763
|
-
this.$refs.elTable?.clearSelection()
|
|
767
|
+
this.preSingleTableValue = null
|
|
768
|
+
this.tableCheckboxConfig.value = []
|
|
769
|
+
this.$refs.elTable?.clearSelection()
|
|
764
770
|
},
|
|
765
771
|
// 判断表格的行能否点击
|
|
766
772
|
selected(row, index) {
|
|
767
|
-
let _tableCheckboxConfig = this.$props.tableCheckboxConfig
|
|
768
|
-
if (!_tableCheckboxConfig.canSelected) return true
|
|
773
|
+
let _tableCheckboxConfig = this.$props.tableCheckboxConfig
|
|
774
|
+
if (!_tableCheckboxConfig.canSelected) return true
|
|
769
775
|
|
|
770
|
-
return _tableCheckboxConfig.canSelected(row, index)
|
|
776
|
+
return _tableCheckboxConfig.canSelected(row, index)
|
|
771
777
|
},
|
|
772
778
|
|
|
773
779
|
handleTableBorder(params) {
|
|
774
|
-
this[`${params.key}`] = params.value
|
|
780
|
+
this[`${params.key}`] = params.value
|
|
775
781
|
},
|
|
776
782
|
|
|
777
783
|
setTriggerDown() {
|
|
778
|
-
clearTimeout(this.triggerDown)
|
|
784
|
+
clearTimeout(this.triggerDown)
|
|
779
785
|
this.triggerDown = setTimeout(() => {
|
|
780
|
-
this.tableDataCompleted()
|
|
781
|
-
}, 1000)
|
|
786
|
+
this.tableDataCompleted()
|
|
787
|
+
}, 1000)
|
|
782
788
|
},
|
|
783
789
|
|
|
784
790
|
tableDataCompleted() {
|
|
785
791
|
if (this.tableData.length == 0) {
|
|
786
|
-
this.defaultSvg = true
|
|
792
|
+
this.defaultSvg = true
|
|
787
793
|
}
|
|
788
|
-
this.loading = false
|
|
789
|
-
this.computedTotalList()
|
|
794
|
+
this.loading = false
|
|
795
|
+
this.computedTotalList()
|
|
790
796
|
this.$nextTick(() => {
|
|
791
|
-
this.scrollToTop()
|
|
792
|
-
})
|
|
797
|
+
this.scrollToTop()
|
|
798
|
+
})
|
|
799
|
+
},
|
|
800
|
+
sortChange(column) {
|
|
801
|
+
this.tableData = this.tableData.sort(
|
|
802
|
+
this.sortFun(
|
|
803
|
+
column.prop,
|
|
804
|
+
column.order ? column.order == 'descending' : undefined,
|
|
805
|
+
),
|
|
806
|
+
)
|
|
807
|
+
},
|
|
808
|
+
sortFun(attr, rev) {
|
|
809
|
+
if (rev == undefined) {
|
|
810
|
+
rev = 1
|
|
811
|
+
} else {
|
|
812
|
+
rev = rev ? 1 : -1
|
|
813
|
+
}
|
|
814
|
+
return function (a, b) {
|
|
815
|
+
a = a[attr]
|
|
816
|
+
b = b[attr]
|
|
817
|
+
if (a < b) {
|
|
818
|
+
return rev * -1
|
|
819
|
+
}
|
|
820
|
+
if (a > b) {
|
|
821
|
+
return rev * 1
|
|
822
|
+
}
|
|
823
|
+
return 0
|
|
824
|
+
}
|
|
793
825
|
},
|
|
794
826
|
},
|
|
795
827
|
watch: {},
|
|
796
|
-
}
|
|
828
|
+
}
|
|
797
829
|
</script>
|
|
798
830
|
|
|
799
831
|
<style lang="less" scoped>
|