agilebuilder-ui 1.1.13-tmp2 → 1.1.13-tmp4
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/401-e6404818.js +11 -0
- package/lib/404-3556013d.js +8 -0
- package/lib/authredirect-294d14ef.js +7 -0
- package/lib/iframe-page-1d95c5c4.js +12 -0
- package/lib/index-1a87600f.js +72054 -0
- package/lib/index-1cc4db24.js +8 -0
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +39 -69068
- package/lib/super-ui.umd.cjs +118 -86
- package/lib/tab-content-iframe-index-728fe039.js +12 -0
- package/lib/tab-content-index-5481253a.js +115 -0
- package/lib/tache-subprocess-history-051a2d26.js +12 -0
- package/package.json +1 -1
- package/packages/super-grid/src/components/mobile-table-card.jsx +75 -43
- package/packages/super-grid/src/dynamic-input.vue +1 -1
- package/packages/super-grid/src/super-grid.vue +113 -80
- package/{packages/super-grid/src/components/card-view.jsx → src/components/Card/index.jsx} +54 -11
- package/src/components/Scrollbar/index.vue +197 -0
- package/src/store/getters.js +3 -0
- package/src/store/modules/app.js +33 -18
- package/src/styles/display-layout.scss +98 -1
- package/src/views/layout/tab-content-index.vue +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :style="subTableStyle">
|
|
2
|
+
<div data-v="1.0.0" :style="subTableStyle">
|
|
3
3
|
<search-form
|
|
4
4
|
v-if="!isFormSubTable && hasLoadedColumns && query && query.showType === 'embedded'"
|
|
5
5
|
v-show="!isMobile || (isMobile && isShowMobileSearch)"
|
|
@@ -35,10 +35,24 @@
|
|
|
35
35
|
@close="closeSearchFormDialog"
|
|
36
36
|
/>
|
|
37
37
|
<div :class="'grid-area ' + code">
|
|
38
|
-
<MobileCard
|
|
38
|
+
<MobileCard
|
|
39
|
+
v-if="isShowCard"
|
|
40
|
+
:selection="selectionTableData"
|
|
41
|
+
:columns="visibleColumns"
|
|
42
|
+
:getColumnComponentData="getColumnComponentData"
|
|
43
|
+
:data="tableDatas"
|
|
44
|
+
v-model:current-page="currentPage"
|
|
45
|
+
:page-size="pagination?.pageSizes?.[0]"
|
|
46
|
+
:page-total="pagination?.total"
|
|
47
|
+
@select="selectRecord"
|
|
48
|
+
@selection-change="cardSelectionChangeEvent"
|
|
49
|
+
@current-change="handleCurrentChange"
|
|
50
|
+
@row-click="rowClickEvent"
|
|
51
|
+
@row-dblclick="rowDblclickEvent"
|
|
52
|
+
/>
|
|
39
53
|
|
|
40
54
|
<el-table
|
|
41
|
-
v-if="refreshGrid && hasLoadedColumns"
|
|
55
|
+
v-if="refreshGrid && hasLoadedColumns && !isShowCard"
|
|
42
56
|
ref="superGrid"
|
|
43
57
|
:data="tableDatas"
|
|
44
58
|
:row-key="getRowKeyProp"
|
|
@@ -56,8 +70,8 @@
|
|
|
56
70
|
:highlight-current-row="true"
|
|
57
71
|
:span-method="rowSpan"
|
|
58
72
|
:max-height="maxHeight"
|
|
59
|
-
:height="tableHeight"
|
|
60
|
-
:class="
|
|
73
|
+
:height="maxHeight && maxHeight >= tableHeight ? maxHeight : tableHeight"
|
|
74
|
+
:class="tableClass"
|
|
61
75
|
:tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
|
|
62
76
|
@sort-change="handleSortChange"
|
|
63
77
|
@select="selectRecord"
|
|
@@ -84,7 +98,7 @@
|
|
|
84
98
|
/>
|
|
85
99
|
|
|
86
100
|
</el-table>
|
|
87
|
-
<div v-if="showPagination" style="position: relative; margin-top: 5px"
|
|
101
|
+
<div v-if="showPagination && !isShowCard" style="position: relative; margin-top: 5px">
|
|
88
102
|
<el-row>
|
|
89
103
|
<!-- <el-col
|
|
90
104
|
v-if="
|
|
@@ -234,7 +248,8 @@ import headerContextMenu from './header-context-menu.vue'
|
|
|
234
248
|
import { isMobileBrowser, isPromise } from '../../../src/utils/common-util'
|
|
235
249
|
import { checkPermission } from '../../../src/utils/permission'
|
|
236
250
|
import { getGuId } from '../../../src/utils/guid.js';
|
|
237
|
-
import resizeMixin from '../../../src/mixins/resizeMixin.js';
|
|
251
|
+
// import resizeMixin from '../../../src/mixins/resizeMixin.js';
|
|
252
|
+
import storeVuex from '../../../src/store';
|
|
238
253
|
|
|
239
254
|
export default {
|
|
240
255
|
components: {
|
|
@@ -252,7 +267,7 @@ export default {
|
|
|
252
267
|
MobileCard
|
|
253
268
|
},
|
|
254
269
|
name: 'SuperGrid',
|
|
255
|
-
mixins: [resizeMixin],
|
|
270
|
+
// mixins: [resizeMixin],
|
|
256
271
|
props: {
|
|
257
272
|
// 是否自适应卡片
|
|
258
273
|
isShowAutoCard: {
|
|
@@ -454,6 +469,9 @@ export default {
|
|
|
454
469
|
}
|
|
455
470
|
},
|
|
456
471
|
computed: {
|
|
472
|
+
isMobileResize() {
|
|
473
|
+
return storeVuex.getters.isMobileResize
|
|
474
|
+
},
|
|
457
475
|
// 是否显示卡片
|
|
458
476
|
isShowCard() {
|
|
459
477
|
return this.isShowAutoCard && this.isMobileResize
|
|
@@ -462,6 +480,9 @@ export default {
|
|
|
462
480
|
const gridParams = store.get(this.code)
|
|
463
481
|
const operations = this.getOptionOperations()
|
|
464
482
|
gridParams.canntEdit = false
|
|
483
|
+
|
|
484
|
+
const setAttrs = data => data.map(item => ({ property: item.prop, ...item}))
|
|
485
|
+
|
|
465
486
|
if (operations && operations.operation && operations.operation.length > 0) {
|
|
466
487
|
operations.operation.forEach((buttonInfo) => {
|
|
467
488
|
if (buttonInfo.props.code === 'lineEditUpdate') {
|
|
@@ -476,48 +497,50 @@ export default {
|
|
|
476
497
|
this.options.isAdministerListView != null &&
|
|
477
498
|
this.options.isAdministerListView === true
|
|
478
499
|
) {
|
|
479
|
-
return this.columns
|
|
500
|
+
return setAttrs(this.columns)
|
|
480
501
|
} else {
|
|
481
|
-
return
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
if (
|
|
491
|
-
typeof this.options.showIndex !== 'undefined' &&
|
|
492
|
-
this.options.showIndex === false &&
|
|
493
|
-
column.prop === '$index'
|
|
494
|
-
) {
|
|
495
|
-
// 表示不显示“序号”列
|
|
496
|
-
return false
|
|
497
|
-
}
|
|
498
|
-
let isVisible
|
|
499
|
-
if (column.show === undefined || column.show) {
|
|
500
|
-
isVisible = true
|
|
501
|
-
const hiddenColumns = this.options.hiddenColumns
|
|
502
|
-
if (hiddenColumns && hiddenColumns.length > 0 && column.prop && hiddenColumns.indexOf(column.prop) !== -1) {
|
|
503
|
-
// 如果当前字段包含在隐藏字段集合中,则不显示该字段
|
|
504
|
-
isVisible = false
|
|
505
|
-
return isVisible
|
|
502
|
+
return setAttrs(
|
|
503
|
+
this.columns.filter((column) => {
|
|
504
|
+
if (
|
|
505
|
+
typeof this.options.multiple !== 'undefined' &&
|
|
506
|
+
this.options.multiple === false &&
|
|
507
|
+
column.prop === '$selection'
|
|
508
|
+
) {
|
|
509
|
+
// 表示不显示“多选”列
|
|
510
|
+
return false
|
|
506
511
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
512
|
+
if (
|
|
513
|
+
typeof this.options.showIndex !== 'undefined' &&
|
|
514
|
+
this.options.showIndex === false &&
|
|
515
|
+
column.prop === '$index'
|
|
516
|
+
) {
|
|
517
|
+
// 表示不显示“序号”列
|
|
518
|
+
return false
|
|
511
519
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
520
|
+
let isVisible
|
|
521
|
+
if (column.show === undefined || column.show) {
|
|
522
|
+
isVisible = true
|
|
523
|
+
const hiddenColumns = this.options.hiddenColumns
|
|
524
|
+
if (hiddenColumns && hiddenColumns.length > 0 && column.prop && hiddenColumns.indexOf(column.prop) !== -1) {
|
|
525
|
+
// 如果当前字段包含在隐藏字段集合中,则不显示该字段
|
|
526
|
+
isVisible = false
|
|
527
|
+
return isVisible
|
|
528
|
+
}
|
|
529
|
+
// 给列配置操作属性
|
|
530
|
+
this.initColumnOperation(column, operations)
|
|
531
|
+
if (!gridParams.$dataTypeMap) {
|
|
532
|
+
gridParams.$dataTypeMap = {}
|
|
533
|
+
}
|
|
534
|
+
// sql时行编辑保存后台代码需要
|
|
535
|
+
gridParams.$dataTypeMap[column.prop] = column.dataType
|
|
536
|
+
} else {
|
|
537
|
+
isVisible = false
|
|
538
|
+
}
|
|
539
|
+
// 存储有默认值的字段集合
|
|
540
|
+
this.storeHasDefaultValueColumns(column, gridParams)
|
|
541
|
+
return isVisible
|
|
542
|
+
})
|
|
543
|
+
)
|
|
521
544
|
}
|
|
522
545
|
},
|
|
523
546
|
visibleColumnsComponentData() {
|
|
@@ -571,14 +594,25 @@ export default {
|
|
|
571
594
|
// }
|
|
572
595
|
},
|
|
573
596
|
watch: {
|
|
574
|
-
//
|
|
575
|
-
'
|
|
597
|
+
// 切换表格 与 卡片是否
|
|
598
|
+
'isShowCard': {
|
|
576
599
|
deep: true,
|
|
577
|
-
handler() {
|
|
600
|
+
handler(is) {
|
|
578
601
|
// 是否开启卡片,如果开启则平台切换时候重新回到第一页
|
|
579
602
|
if(this.isShowAutoCard) {
|
|
580
|
-
this.currentPage
|
|
581
|
-
|
|
603
|
+
if (this.currentPage > 1) {
|
|
604
|
+
this.currentPage = 1
|
|
605
|
+
this.handleCurrentChange()
|
|
606
|
+
} else {
|
|
607
|
+
this.$nextTick()
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if(!is) {
|
|
611
|
+
// 显示表格后重新格式化展示
|
|
612
|
+
this.$nextTick(() => {
|
|
613
|
+
this.resizeTableHeight()
|
|
614
|
+
this.$refs.superGrid?.doLayout()
|
|
615
|
+
})
|
|
582
616
|
}
|
|
583
617
|
}
|
|
584
618
|
},
|
|
@@ -710,6 +744,7 @@ export default {
|
|
|
710
744
|
return {}
|
|
711
745
|
},
|
|
712
746
|
created() {
|
|
747
|
+
storeVuex?.dispatch?.('startListeningToResize');
|
|
713
748
|
store.set(this.code, getGridParams())
|
|
714
749
|
store.set('_list_code', this.code)
|
|
715
750
|
this.initSetting()
|
|
@@ -1858,18 +1893,20 @@ export default {
|
|
|
1858
1893
|
if (typeof resove !== 'undefined' && resove !== null) {
|
|
1859
1894
|
// 首次加载或点击三角展开父节点时走该分支
|
|
1860
1895
|
// 刷新数据后,移除该父节点下的所有已选中的子节点记录。
|
|
1861
|
-
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid
|
|
1896
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid?.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1862
1897
|
this.removeGridStoreSelection(parentRowIds)
|
|
1863
1898
|
resove(data[parentRowIds[0]])
|
|
1864
1899
|
} else {
|
|
1865
1900
|
// 刷新父记录对应的子记录集合时需要,例如:删除时
|
|
1866
1901
|
parentRowIds.forEach((parentRowId) => {
|
|
1867
1902
|
// 单行父记录id
|
|
1868
|
-
this.$refs.superGrid
|
|
1869
|
-
|
|
1903
|
+
if (this.$refs.superGrid) {
|
|
1904
|
+
this.$refs.superGrid.store.states.lazyTreeNodeMap[parentRowId] = data[parentRowId]
|
|
1905
|
+
this.$refs.superGrid.store.states.treeData[parentRowId].children = data[parentRowId]
|
|
1906
|
+
}
|
|
1870
1907
|
})
|
|
1871
1908
|
// 刷新数据后,移除该父节点下的所有已选中的子节点记录
|
|
1872
|
-
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid
|
|
1909
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid?.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1873
1910
|
this.removeGridStoreSelection(parentRowIds)
|
|
1874
1911
|
}
|
|
1875
1912
|
this.hasLoadData = true
|
|
@@ -2277,7 +2314,7 @@ export default {
|
|
|
2277
2314
|
changePage() {
|
|
2278
2315
|
console.log('点击了分页')
|
|
2279
2316
|
// 翻页操作会导致筛选项发生变化,所以需要清空已有的
|
|
2280
|
-
this.$refs.superGrid
|
|
2317
|
+
this.$refs.superGrid?.clearFilter()
|
|
2281
2318
|
// TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
|
|
2282
2319
|
if (this.isSubTableShowPage) {
|
|
2283
2320
|
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
@@ -2302,7 +2339,7 @@ export default {
|
|
|
2302
2339
|
// 如果最后编辑行没有保存或撤销编辑,则给出提示
|
|
2303
2340
|
const gridParams = store.get(this.code)
|
|
2304
2341
|
console.log('请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序')
|
|
2305
|
-
this.$refs.superGrid
|
|
2342
|
+
this.$refs.superGrid?.clearSort()
|
|
2306
2343
|
} else {
|
|
2307
2344
|
// TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
|
|
2308
2345
|
if (prop !== null && columnSetting && columnSetting !== null) {
|
|
@@ -2508,30 +2545,30 @@ export default {
|
|
|
2508
2545
|
},
|
|
2509
2546
|
expandChange(row, expanded) {
|
|
2510
2547
|
if (this.isLazy) {
|
|
2511
|
-
// console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid
|
|
2548
|
+
// console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid?.store.states)
|
|
2512
2549
|
if (expanded === false) {
|
|
2513
2550
|
// 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
|
|
2514
2551
|
// 必须添加这句,否则不会重新走load
|
|
2515
|
-
if (this.$refs.superGrid
|
|
2552
|
+
if (this.$refs.superGrid?.store.states.treeData) {
|
|
2516
2553
|
this.$refs.superGrid.store.states.treeData[row.id ? row.id : row.ID].loaded = false
|
|
2517
2554
|
}
|
|
2518
2555
|
} else {
|
|
2519
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2520
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2521
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2556
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.lazyTreeNodeMap', this.$refs.superGrid?.store.states.lazyTreeNodeMap)
|
|
2557
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.treeData', this.$refs.superGrid?.store.states.treeData)
|
|
2558
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.selection', this.$refs.superGrid?.store.states.selection)
|
|
2522
2559
|
}
|
|
2523
2560
|
}
|
|
2524
2561
|
},
|
|
2525
2562
|
removeGridStoreSelection(parentRowIds) {
|
|
2526
2563
|
let selection = []
|
|
2527
|
-
if (this.$refs.superGrid
|
|
2528
|
-
selection = [].concat(JSON.parse(JSON.stringify(this.$refs.superGrid
|
|
2564
|
+
if (this.$refs.superGrid?.store.states.selection) {
|
|
2565
|
+
selection = [].concat(JSON.parse(JSON.stringify(this.$refs.superGrid?.store.states.selection)))
|
|
2529
2566
|
}
|
|
2530
2567
|
for (let i = 0; i < selection.length; i++) {
|
|
2531
2568
|
if (parentRowIds && parentRowIds.indexOf(selection[i][this.parentProp]) >= 0) {
|
|
2532
2569
|
// 移除第i个元素
|
|
2533
|
-
this.$refs.superGrid
|
|
2534
|
-
if (this.$refs.superGrid
|
|
2570
|
+
this.$refs.superGrid?.store.states.selection.splice(i, 1)
|
|
2571
|
+
if (this.$refs.superGrid?.store.states.selection.length > 0) {
|
|
2535
2572
|
this.removeGridStoreSelection(parentRowIds)
|
|
2536
2573
|
}
|
|
2537
2574
|
break
|
|
@@ -2614,7 +2651,7 @@ export default {
|
|
|
2614
2651
|
this.createBackgroundColorMap()
|
|
2615
2652
|
this.backgroundColorMap[item.prop] = '#409EFF'
|
|
2616
2653
|
if (this.$refs && this.$refs.superGrid) {
|
|
2617
|
-
this.$refs.superGrid
|
|
2654
|
+
this.$refs.superGrid?.doLayout()
|
|
2618
2655
|
}
|
|
2619
2656
|
}
|
|
2620
2657
|
},
|
|
@@ -2638,7 +2675,7 @@ export default {
|
|
|
2638
2675
|
this.backgroundColorMap = backgroundColorMap
|
|
2639
2676
|
this.externalClickFlag = false
|
|
2640
2677
|
if (this.$refs && this.$refs.superGrid) {
|
|
2641
|
-
this.$refs.superGrid
|
|
2678
|
+
this.$refs.superGrid?.doLayout()
|
|
2642
2679
|
}
|
|
2643
2680
|
},
|
|
2644
2681
|
// 根据element事件传递的column来获取自定义封装的column
|
|
@@ -2744,7 +2781,7 @@ export default {
|
|
|
2744
2781
|
return this.isSubTableShowPage ? this.subTableData : this.gridData
|
|
2745
2782
|
},
|
|
2746
2783
|
rowDblclickEvent(row, column, event) {
|
|
2747
|
-
|
|
2784
|
+
debugger;
|
|
2748
2785
|
const gridParams = store.get(this.code)
|
|
2749
2786
|
if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
|
|
2750
2787
|
// 如果是子表并且是pdf模式
|
|
@@ -2754,6 +2791,7 @@ export default {
|
|
|
2754
2791
|
let canEdit = true
|
|
2755
2792
|
const gridParams = store.get(this.code)
|
|
2756
2793
|
if (isEditOptionFunction('beforeEdit', this.code)) {
|
|
2794
|
+
debugger;
|
|
2757
2795
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
2758
2796
|
// 每页显示多少条
|
|
2759
2797
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
@@ -2792,7 +2830,6 @@ export default {
|
|
|
2792
2830
|
if (index < 0) {
|
|
2793
2831
|
index = 0
|
|
2794
2832
|
}
|
|
2795
|
-
console.log('我点击了。。。。。。。。。。。。。。。。。。。', index, this.code)
|
|
2796
2833
|
this.editRow(index, this.code)
|
|
2797
2834
|
}
|
|
2798
2835
|
}
|
|
@@ -3023,7 +3060,6 @@ export default {
|
|
|
3023
3060
|
},
|
|
3024
3061
|
// 选择记录
|
|
3025
3062
|
selectRecord(selection, row) {
|
|
3026
|
-
console.log('selectRecord====>', selection, row)
|
|
3027
3063
|
this.selectionTableData = row
|
|
3028
3064
|
let selectRecordEventResult = true
|
|
3029
3065
|
const gridParams = store.get(this.code)
|
|
@@ -3042,15 +3078,13 @@ export default {
|
|
|
3042
3078
|
})
|
|
3043
3079
|
if (selectRecordEventResult !== undefined && selectRecordEventResult === false) {
|
|
3044
3080
|
// 最后选中的记录取消选中状态
|
|
3045
|
-
this.$refs.superGrid
|
|
3081
|
+
this.$refs.superGrid?.toggleRowSelection(row, false)
|
|
3046
3082
|
}
|
|
3047
3083
|
}
|
|
3048
3084
|
this.select(selection, row)
|
|
3049
|
-
console.log('查看页面数据', this, gridParams.options, this.row, this.selection)
|
|
3050
3085
|
},
|
|
3051
3086
|
// 取消选择记录
|
|
3052
3087
|
selectAllRecord(selection) {
|
|
3053
|
-
console.log('selectAllRecord====>', selection)
|
|
3054
3088
|
let selectAllRecordsEventResult = true
|
|
3055
3089
|
const gridParams = store.get(this.code)
|
|
3056
3090
|
if (isHasOptionFunction('selectAllRecords', this.code)) {
|
|
@@ -3067,17 +3101,17 @@ export default {
|
|
|
3067
3101
|
})
|
|
3068
3102
|
if (selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult === false) {
|
|
3069
3103
|
// 取消所有记录选中状态
|
|
3070
|
-
this.$refs.superGrid
|
|
3104
|
+
this.$refs.superGrid?.toggleAllSelection()
|
|
3071
3105
|
}
|
|
3072
3106
|
}
|
|
3073
3107
|
this.selectAll(selection)
|
|
3074
3108
|
},
|
|
3075
3109
|
cardSelectionChangeEvent(newSelection) {
|
|
3076
3110
|
try {
|
|
3077
|
-
this.$refs.superGrid
|
|
3111
|
+
this.$refs.superGrid?.clearSelection()
|
|
3078
3112
|
for(const i in newSelection) {
|
|
3079
3113
|
const row = newSelection[i]
|
|
3080
|
-
this.$refs.superGrid
|
|
3114
|
+
this.$refs.superGrid?.toggleRowSelection(row, true)
|
|
3081
3115
|
}
|
|
3082
3116
|
} catch (error) {
|
|
3083
3117
|
console.error(error)
|
|
@@ -3087,7 +3121,6 @@ export default {
|
|
|
3087
3121
|
// 选择记录发生改变时
|
|
3088
3122
|
selectionChangeEvent(newSelection) {
|
|
3089
3123
|
this.selectionTableData = newSelection
|
|
3090
|
-
console.log('selectionChangeEvent====>', newSelection)
|
|
3091
3124
|
const gridParams = store.get(this.code)
|
|
3092
3125
|
if (isHasOptionFunction('selectionChange', this.code)) {
|
|
3093
3126
|
gridParams.options.selectionChange.call(this, {
|
|
@@ -3103,7 +3136,7 @@ export default {
|
|
|
3103
3136
|
})
|
|
3104
3137
|
// if(selectionChangeEventResult !== undefined && selectionChangeEventResult=== false){
|
|
3105
3138
|
// // 最后选中的记录取消选中状态
|
|
3106
|
-
// this.$refs.superGrid
|
|
3139
|
+
// this.$refs.superGrid?.toggleRowSelection(newSelection[newSelection.length - 1], false)
|
|
3107
3140
|
// }
|
|
3108
3141
|
}
|
|
3109
3142
|
this.selectionChange(newSelection)
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/** @jsxImportSource vue */
|
|
2
|
-
import { defineComponent, ref, computed, watch,
|
|
3
|
-
import { ElCard,
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { defineComponent, ref, computed, watch, onMounted } from 'vue';
|
|
3
|
+
import { ElCard, ElTag, ElButton, ElIcon, ElCheckbox } from 'element-plus';
|
|
4
|
+
import { Bottom, Tickets } from '@element-plus/icons-vue';
|
|
5
|
+
import Scrollbar from '../Scrollbar';
|
|
6
6
|
// import { $emit, $off, $on } from '@/utils/gogocodeTransfer'
|
|
7
7
|
|
|
8
8
|
export default defineComponent({
|
|
9
9
|
name: 'CardView',
|
|
10
|
+
components: {
|
|
11
|
+
Scrollbar
|
|
12
|
+
},
|
|
10
13
|
props: {
|
|
11
14
|
// 当前行数据
|
|
12
15
|
form: {
|
|
@@ -38,10 +41,22 @@ export default defineComponent({
|
|
|
38
41
|
type: Boolean,
|
|
39
42
|
default: () => false
|
|
40
43
|
},
|
|
44
|
+
setMaxHeight: {
|
|
45
|
+
type: [Function, undefined],
|
|
46
|
+
default: () => undefined
|
|
47
|
+
},
|
|
48
|
+
setHeight: {
|
|
49
|
+
type: [Function, undefined],
|
|
50
|
+
default: () => undefined
|
|
51
|
+
},
|
|
41
52
|
},
|
|
42
53
|
setup(props, { attrs, emit, slots }) {
|
|
43
54
|
console.log('*card-view.jsx**********************************************=>', props, attrs, slots)
|
|
44
55
|
const isMore = ref(props.isShowDetailsMore)
|
|
56
|
+
|
|
57
|
+
const scrollHeight = ref(undefined);
|
|
58
|
+
|
|
59
|
+
const scrollbarRef = ref(null);
|
|
45
60
|
|
|
46
61
|
// 点击了卡片事件
|
|
47
62
|
const onChecked = () => {
|
|
@@ -56,17 +71,45 @@ export default defineComponent({
|
|
|
56
71
|
return getSlotHtml(slots.footerSlot).filter(item => item?.children) ?? []
|
|
57
72
|
});
|
|
58
73
|
|
|
74
|
+
const setMaxHeight = data => {
|
|
75
|
+
if (props.setMaxHeight) return props.setMaxHeight(data)
|
|
76
|
+
if (data?.windowHeight) {
|
|
77
|
+
// const height = data?.windowHeight - 200
|
|
78
|
+
if (data.windowHeight * 0.4 <= scrollHeight.value) return 300
|
|
79
|
+
return scrollHeight.value && scrollHeight.value >= 300 ? scrollHeight : 300
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
59
83
|
watch(() => props.isShowDetailsMore, (newValue) => {
|
|
60
84
|
isMore.value = newValue
|
|
61
85
|
});
|
|
62
86
|
|
|
87
|
+
onMounted(() => {
|
|
88
|
+
const scrollElement = scrollbarRef.value?.$el?.querySelector?.('.el-scrollbar__view');
|
|
89
|
+
if (scrollElement) {
|
|
90
|
+
scrollHeight.value = scrollElement.clientHeight
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// 点击事件
|
|
95
|
+
const onClick = (event) => {
|
|
96
|
+
onChecked()
|
|
97
|
+
emit('rowClick', event)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 双击事件
|
|
101
|
+
const onDblclick = (event) => {
|
|
102
|
+
emit('rowDblclick', event)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
63
106
|
return () => (
|
|
64
107
|
<ElCard key={`card_${props.form?.$rowDataGuId || `${props.form?.id}_${props.no}`}`} header-padding body-padding shadow="hover" class={{ 'yx-card-main': true, 'is-checked': props.isChecked}} v-slots={{
|
|
65
108
|
header: () => (
|
|
66
|
-
<div class="yx-flex-wrap" justify='space-between' align='center'
|
|
67
|
-
<div class="yx-flex-wrap" align='center' style={{gap: '10px'}}>
|
|
109
|
+
<div class="yx-flex-wrap" justify='space-between' align='center' onClick={onClick} onDblclick={onDblclick}>
|
|
110
|
+
<div class="yx-flex-wrap" align='center' style={{gap: '10px' , flex: '1 1 auto',maxWidth: 'calc(100% - 80px)'}}>
|
|
68
111
|
{ props.no && <ElTag type="primary" size='small'>{props.no}</ElTag>}
|
|
69
|
-
{ getSlotHtml(slots.titleSlot) }
|
|
112
|
+
<div layout-title class='ellipsis'>{ getSlotHtml(slots.titleSlot) }</div>
|
|
70
113
|
</div>
|
|
71
114
|
<div class="yx-flex-wrap" align='center' style={{gap: '10px'}}>
|
|
72
115
|
{ getSlotHtml(slots.headerRightSlot) }
|
|
@@ -84,12 +127,12 @@ export default defineComponent({
|
|
|
84
127
|
footer: footerSlot.value
|
|
85
128
|
} : {})
|
|
86
129
|
}}>
|
|
87
|
-
<div class="yx-flex-wrap" vertical style={{gap: '0', height: '100%'}} onClick={
|
|
88
|
-
<
|
|
89
|
-
<div
|
|
130
|
+
<div class="yx-flex-wrap" vertical style={{gap: '0', height: '100%'}} onClick={onClick} onDblclick={onDblclick}>
|
|
131
|
+
<Scrollbar ref={scrollbarRef} scrollable-main max-height={!isMore.value ? '50vh' : '100%'} set-max-height={setMaxHeight} set-height={props.setHeight}>
|
|
132
|
+
<div class='yx-card-body'>
|
|
90
133
|
{ getSlotHtml(slots.children) }
|
|
91
134
|
</div>
|
|
92
|
-
</
|
|
135
|
+
</Scrollbar>
|
|
93
136
|
{
|
|
94
137
|
props.isShowDetailsMore && (<ElButton text icon={<ElIcon>{!isMore.value ? <Top /> : <Bottom /> }</ElIcon>} onClick={(event) => {
|
|
95
138
|
event.stopPropagation()
|