agilebuilder-ui 1.1.13-tmp3 → 1.1.13-tmp5
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-1e79cd95.js +11 -0
- package/lib/404-afa1bc45.js +8 -0
- package/lib/authredirect-294d14ef.js +7 -0
- package/lib/iframe-page-61a1b570.js +12 -0
- package/lib/index-1cc4db24.js +8 -0
- package/lib/index-e8b65d1a.js +72062 -0
- package/lib/super-ui.css +1 -1
- package/lib/super-ui.js +39 -69076
- package/lib/super-ui.umd.cjs +119 -87
- package/lib/tab-content-iframe-index-e32d4b3f.js +12 -0
- package/lib/tab-content-index-5f743a94.js +115 -0
- package/lib/tache-subprocess-history-344d409e.js +12 -0
- package/package.json +1 -1
- package/packages/super-grid/src/apis.js +46 -3
- package/packages/super-grid/src/components/mobile-table-card.jsx +180 -125
- package/packages/super-grid/src/dynamic-input.vue +1 -1
- package/packages/super-grid/src/super-grid.vue +114 -80
- package/packages/super-grid/src/utils.js +1 -1
- 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
|
@@ -648,8 +648,8 @@ export default {
|
|
|
648
648
|
userAgent = 'browser'
|
|
649
649
|
}
|
|
650
650
|
console.log('superGrid----window.location.protocol---', window.location.protocol)
|
|
651
|
-
const isShowScanIcon = isMobile && window.location.protocol === 'https:' ? true : false
|
|
652
651
|
const isApk = isMobile && userAgent && userAgent === 'app' ? true : false
|
|
652
|
+
const isShowScanIcon = isApk || (isMobile && scanEnable && window.location.protocol === 'https:' ? true : false)
|
|
653
653
|
|
|
654
654
|
let baseURL = gridParams.options.backendUrl
|
|
655
655
|
if (!baseURL) {
|
|
@@ -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,25 @@
|
|
|
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
|
+
:listCode="code"
|
|
43
|
+
:getColumnComponentData="getColumnComponentData"
|
|
44
|
+
:data="tableDatas"
|
|
45
|
+
v-model:current-page="currentPage"
|
|
46
|
+
:page-size="pagination?.pageSizes?.[0]"
|
|
47
|
+
:page-total="pagination?.total"
|
|
48
|
+
@select="selectRecord"
|
|
49
|
+
@selection-change="cardSelectionChangeEvent"
|
|
50
|
+
@current-change="handleCurrentChange"
|
|
51
|
+
@row-click="rowClickEvent"
|
|
52
|
+
@row-dblclick="rowDblclickEvent"
|
|
53
|
+
/>
|
|
39
54
|
|
|
40
55
|
<el-table
|
|
41
|
-
v-if="refreshGrid && hasLoadedColumns"
|
|
56
|
+
v-if="refreshGrid && hasLoadedColumns && !isShowCard"
|
|
42
57
|
ref="superGrid"
|
|
43
58
|
:data="tableDatas"
|
|
44
59
|
:row-key="getRowKeyProp"
|
|
@@ -56,8 +71,8 @@
|
|
|
56
71
|
:highlight-current-row="true"
|
|
57
72
|
:span-method="rowSpan"
|
|
58
73
|
:max-height="maxHeight"
|
|
59
|
-
:height="tableHeight"
|
|
60
|
-
:class="
|
|
74
|
+
:height="maxHeight && maxHeight <= tableHeight ? maxHeight : tableHeight"
|
|
75
|
+
:class="tableClass"
|
|
61
76
|
:tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
|
|
62
77
|
@sort-change="handleSortChange"
|
|
63
78
|
@select="selectRecord"
|
|
@@ -84,7 +99,7 @@
|
|
|
84
99
|
/>
|
|
85
100
|
|
|
86
101
|
</el-table>
|
|
87
|
-
<div v-if="showPagination" style="position: relative; margin-top: 5px"
|
|
102
|
+
<div v-if="showPagination && !isShowCard" style="position: relative; margin-top: 5px">
|
|
88
103
|
<el-row>
|
|
89
104
|
<!-- <el-col
|
|
90
105
|
v-if="
|
|
@@ -234,7 +249,8 @@ import headerContextMenu from './header-context-menu.vue'
|
|
|
234
249
|
import { isMobileBrowser, isPromise } from '../../../src/utils/common-util'
|
|
235
250
|
import { checkPermission } from '../../../src/utils/permission'
|
|
236
251
|
import { getGuId } from '../../../src/utils/guid.js';
|
|
237
|
-
import resizeMixin from '../../../src/mixins/resizeMixin.js';
|
|
252
|
+
// import resizeMixin from '../../../src/mixins/resizeMixin.js';
|
|
253
|
+
import storeVuex from '../../../src/store';
|
|
238
254
|
|
|
239
255
|
export default {
|
|
240
256
|
components: {
|
|
@@ -252,7 +268,7 @@ export default {
|
|
|
252
268
|
MobileCard
|
|
253
269
|
},
|
|
254
270
|
name: 'SuperGrid',
|
|
255
|
-
mixins: [resizeMixin],
|
|
271
|
+
// mixins: [resizeMixin],
|
|
256
272
|
props: {
|
|
257
273
|
// 是否自适应卡片
|
|
258
274
|
isShowAutoCard: {
|
|
@@ -454,6 +470,9 @@ export default {
|
|
|
454
470
|
}
|
|
455
471
|
},
|
|
456
472
|
computed: {
|
|
473
|
+
isMobileResize() {
|
|
474
|
+
return storeVuex.getters.isMobileResize
|
|
475
|
+
},
|
|
457
476
|
// 是否显示卡片
|
|
458
477
|
isShowCard() {
|
|
459
478
|
return this.isShowAutoCard && this.isMobileResize
|
|
@@ -462,6 +481,9 @@ export default {
|
|
|
462
481
|
const gridParams = store.get(this.code)
|
|
463
482
|
const operations = this.getOptionOperations()
|
|
464
483
|
gridParams.canntEdit = false
|
|
484
|
+
|
|
485
|
+
const setAttrs = data => data.map(item => ({ property: item.prop, ...item}))
|
|
486
|
+
|
|
465
487
|
if (operations && operations.operation && operations.operation.length > 0) {
|
|
466
488
|
operations.operation.forEach((buttonInfo) => {
|
|
467
489
|
if (buttonInfo.props.code === 'lineEditUpdate') {
|
|
@@ -476,48 +498,50 @@ export default {
|
|
|
476
498
|
this.options.isAdministerListView != null &&
|
|
477
499
|
this.options.isAdministerListView === true
|
|
478
500
|
) {
|
|
479
|
-
return this.columns
|
|
501
|
+
return setAttrs(this.columns)
|
|
480
502
|
} 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
|
|
503
|
+
return setAttrs(
|
|
504
|
+
this.columns.filter((column) => {
|
|
505
|
+
if (
|
|
506
|
+
typeof this.options.multiple !== 'undefined' &&
|
|
507
|
+
this.options.multiple === false &&
|
|
508
|
+
column.prop === '$selection'
|
|
509
|
+
) {
|
|
510
|
+
// 表示不显示“多选”列
|
|
511
|
+
return false
|
|
506
512
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
513
|
+
if (
|
|
514
|
+
typeof this.options.showIndex !== 'undefined' &&
|
|
515
|
+
this.options.showIndex === false &&
|
|
516
|
+
column.prop === '$index'
|
|
517
|
+
) {
|
|
518
|
+
// 表示不显示“序号”列
|
|
519
|
+
return false
|
|
511
520
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
+
let isVisible
|
|
522
|
+
if (column.show === undefined || column.show) {
|
|
523
|
+
isVisible = true
|
|
524
|
+
const hiddenColumns = this.options.hiddenColumns
|
|
525
|
+
if (hiddenColumns && hiddenColumns.length > 0 && column.prop && hiddenColumns.indexOf(column.prop) !== -1) {
|
|
526
|
+
// 如果当前字段包含在隐藏字段集合中,则不显示该字段
|
|
527
|
+
isVisible = false
|
|
528
|
+
return isVisible
|
|
529
|
+
}
|
|
530
|
+
// 给列配置操作属性
|
|
531
|
+
this.initColumnOperation(column, operations)
|
|
532
|
+
if (!gridParams.$dataTypeMap) {
|
|
533
|
+
gridParams.$dataTypeMap = {}
|
|
534
|
+
}
|
|
535
|
+
// sql时行编辑保存后台代码需要
|
|
536
|
+
gridParams.$dataTypeMap[column.prop] = column.dataType
|
|
537
|
+
} else {
|
|
538
|
+
isVisible = false
|
|
539
|
+
}
|
|
540
|
+
// 存储有默认值的字段集合
|
|
541
|
+
this.storeHasDefaultValueColumns(column, gridParams)
|
|
542
|
+
return isVisible
|
|
543
|
+
})
|
|
544
|
+
)
|
|
521
545
|
}
|
|
522
546
|
},
|
|
523
547
|
visibleColumnsComponentData() {
|
|
@@ -571,14 +595,25 @@ export default {
|
|
|
571
595
|
// }
|
|
572
596
|
},
|
|
573
597
|
watch: {
|
|
574
|
-
//
|
|
575
|
-
'
|
|
598
|
+
// 切换表格 与 卡片是否
|
|
599
|
+
'isShowCard': {
|
|
576
600
|
deep: true,
|
|
577
|
-
handler() {
|
|
601
|
+
handler(is) {
|
|
578
602
|
// 是否开启卡片,如果开启则平台切换时候重新回到第一页
|
|
579
603
|
if(this.isShowAutoCard) {
|
|
580
|
-
this.currentPage
|
|
581
|
-
|
|
604
|
+
if (this.currentPage > 1) {
|
|
605
|
+
this.currentPage = 1
|
|
606
|
+
this.handleCurrentChange()
|
|
607
|
+
} else {
|
|
608
|
+
this.$nextTick()
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
if(!is) {
|
|
612
|
+
// 显示表格后重新格式化展示
|
|
613
|
+
this.$nextTick(() => {
|
|
614
|
+
this.resizeTableHeight()
|
|
615
|
+
this.$refs.superGrid?.doLayout()
|
|
616
|
+
})
|
|
582
617
|
}
|
|
583
618
|
}
|
|
584
619
|
},
|
|
@@ -710,6 +745,7 @@ export default {
|
|
|
710
745
|
return {}
|
|
711
746
|
},
|
|
712
747
|
created() {
|
|
748
|
+
storeVuex?.dispatch?.('startListeningToResize');
|
|
713
749
|
store.set(this.code, getGridParams())
|
|
714
750
|
store.set('_list_code', this.code)
|
|
715
751
|
this.initSetting()
|
|
@@ -1858,18 +1894,20 @@ export default {
|
|
|
1858
1894
|
if (typeof resove !== 'undefined' && resove !== null) {
|
|
1859
1895
|
// 首次加载或点击三角展开父节点时走该分支
|
|
1860
1896
|
// 刷新数据后,移除该父节点下的所有已选中的子节点记录。
|
|
1861
|
-
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid
|
|
1897
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid?.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1862
1898
|
this.removeGridStoreSelection(parentRowIds)
|
|
1863
1899
|
resove(data[parentRowIds[0]])
|
|
1864
1900
|
} else {
|
|
1865
1901
|
// 刷新父记录对应的子记录集合时需要,例如:删除时
|
|
1866
1902
|
parentRowIds.forEach((parentRowId) => {
|
|
1867
1903
|
// 单行父记录id
|
|
1868
|
-
this.$refs.superGrid
|
|
1869
|
-
|
|
1904
|
+
if (this.$refs.superGrid) {
|
|
1905
|
+
this.$refs.superGrid.store.states.lazyTreeNodeMap[parentRowId] = data[parentRowId]
|
|
1906
|
+
this.$refs.superGrid.store.states.treeData[parentRowId].children = data[parentRowId]
|
|
1907
|
+
}
|
|
1870
1908
|
})
|
|
1871
1909
|
// 刷新数据后,移除该父节点下的所有已选中的子节点记录
|
|
1872
|
-
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid
|
|
1910
|
+
// 必须调用该方法,否则在删除记录时,数据即使刷新了,已选中集合this.$refs.superGrid?.store.states.selection中仍会有该已删除记录,导致再次执行删除报id不存在
|
|
1873
1911
|
this.removeGridStoreSelection(parentRowIds)
|
|
1874
1912
|
}
|
|
1875
1913
|
this.hasLoadData = true
|
|
@@ -2277,7 +2315,7 @@ export default {
|
|
|
2277
2315
|
changePage() {
|
|
2278
2316
|
console.log('点击了分页')
|
|
2279
2317
|
// 翻页操作会导致筛选项发生变化,所以需要清空已有的
|
|
2280
|
-
this.$refs.superGrid
|
|
2318
|
+
this.$refs.superGrid?.clearFilter()
|
|
2281
2319
|
// TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
|
|
2282
2320
|
if (this.isSubTableShowPage) {
|
|
2283
2321
|
this.gridData = this.getSubTableGridData(this.subTableData)
|
|
@@ -2302,7 +2340,7 @@ export default {
|
|
|
2302
2340
|
// 如果最后编辑行没有保存或撤销编辑,则给出提示
|
|
2303
2341
|
const gridParams = store.get(this.code)
|
|
2304
2342
|
console.log('请先保存或撤销编辑第' + gridParams.$rowIndex + 1 + '行记录,再排序')
|
|
2305
|
-
this.$refs.superGrid
|
|
2343
|
+
this.$refs.superGrid?.clearSort()
|
|
2306
2344
|
} else {
|
|
2307
2345
|
// TODO: 应该调用fetchData来获取信息,把当前页数、查询条件、排序信息传回后台
|
|
2308
2346
|
if (prop !== null && columnSetting && columnSetting !== null) {
|
|
@@ -2508,30 +2546,30 @@ export default {
|
|
|
2508
2546
|
},
|
|
2509
2547
|
expandChange(row, expanded) {
|
|
2510
2548
|
if (this.isLazy) {
|
|
2511
|
-
// console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid
|
|
2549
|
+
// console.log('expandChange==row, expanded', row, expanded, this.$refs.superGrid?.store.states)
|
|
2512
2550
|
if (expanded === false) {
|
|
2513
2551
|
// 折叠时清空表格缓存的已加载的标识位,使其能够动态更新子集合
|
|
2514
2552
|
// 必须添加这句,否则不会重新走load
|
|
2515
|
-
if (this.$refs.superGrid
|
|
2553
|
+
if (this.$refs.superGrid?.store.states.treeData) {
|
|
2516
2554
|
this.$refs.superGrid.store.states.treeData[row.id ? row.id : row.ID].loaded = false
|
|
2517
2555
|
}
|
|
2518
2556
|
} else {
|
|
2519
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2520
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2521
|
-
// console.log('expandChange=this.$refs.superGrid
|
|
2557
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.lazyTreeNodeMap', this.$refs.superGrid?.store.states.lazyTreeNodeMap)
|
|
2558
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.treeData', this.$refs.superGrid?.store.states.treeData)
|
|
2559
|
+
// console.log('expandChange=this.$refs.superGrid?.store.states.selection', this.$refs.superGrid?.store.states.selection)
|
|
2522
2560
|
}
|
|
2523
2561
|
}
|
|
2524
2562
|
},
|
|
2525
2563
|
removeGridStoreSelection(parentRowIds) {
|
|
2526
2564
|
let selection = []
|
|
2527
|
-
if (this.$refs.superGrid
|
|
2528
|
-
selection = [].concat(JSON.parse(JSON.stringify(this.$refs.superGrid
|
|
2565
|
+
if (this.$refs.superGrid?.store.states.selection) {
|
|
2566
|
+
selection = [].concat(JSON.parse(JSON.stringify(this.$refs.superGrid?.store.states.selection)))
|
|
2529
2567
|
}
|
|
2530
2568
|
for (let i = 0; i < selection.length; i++) {
|
|
2531
2569
|
if (parentRowIds && parentRowIds.indexOf(selection[i][this.parentProp]) >= 0) {
|
|
2532
2570
|
// 移除第i个元素
|
|
2533
|
-
this.$refs.superGrid
|
|
2534
|
-
if (this.$refs.superGrid
|
|
2571
|
+
this.$refs.superGrid?.store.states.selection.splice(i, 1)
|
|
2572
|
+
if (this.$refs.superGrid?.store.states.selection.length > 0) {
|
|
2535
2573
|
this.removeGridStoreSelection(parentRowIds)
|
|
2536
2574
|
}
|
|
2537
2575
|
break
|
|
@@ -2614,7 +2652,7 @@ export default {
|
|
|
2614
2652
|
this.createBackgroundColorMap()
|
|
2615
2653
|
this.backgroundColorMap[item.prop] = '#409EFF'
|
|
2616
2654
|
if (this.$refs && this.$refs.superGrid) {
|
|
2617
|
-
this.$refs.superGrid
|
|
2655
|
+
this.$refs.superGrid?.doLayout()
|
|
2618
2656
|
}
|
|
2619
2657
|
}
|
|
2620
2658
|
},
|
|
@@ -2638,7 +2676,7 @@ export default {
|
|
|
2638
2676
|
this.backgroundColorMap = backgroundColorMap
|
|
2639
2677
|
this.externalClickFlag = false
|
|
2640
2678
|
if (this.$refs && this.$refs.superGrid) {
|
|
2641
|
-
this.$refs.superGrid
|
|
2679
|
+
this.$refs.superGrid?.doLayout()
|
|
2642
2680
|
}
|
|
2643
2681
|
},
|
|
2644
2682
|
// 根据element事件传递的column来获取自定义封装的column
|
|
@@ -2744,7 +2782,7 @@ export default {
|
|
|
2744
2782
|
return this.isSubTableShowPage ? this.subTableData : this.gridData
|
|
2745
2783
|
},
|
|
2746
2784
|
rowDblclickEvent(row, column, event) {
|
|
2747
|
-
|
|
2785
|
+
debugger;
|
|
2748
2786
|
const gridParams = store.get(this.code)
|
|
2749
2787
|
if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
|
|
2750
2788
|
// 如果是子表并且是pdf模式
|
|
@@ -2754,6 +2792,7 @@ export default {
|
|
|
2754
2792
|
let canEdit = true
|
|
2755
2793
|
const gridParams = store.get(this.code)
|
|
2756
2794
|
if (isEditOptionFunction('beforeEdit', this.code)) {
|
|
2795
|
+
debugger;
|
|
2757
2796
|
const isSubTableShowPage = gridParams.isSubTableShowPage
|
|
2758
2797
|
// 每页显示多少条
|
|
2759
2798
|
const pageSize = gridParams.pagination && gridParams.pagination.pageSize
|
|
@@ -2792,7 +2831,6 @@ export default {
|
|
|
2792
2831
|
if (index < 0) {
|
|
2793
2832
|
index = 0
|
|
2794
2833
|
}
|
|
2795
|
-
console.log('我点击了。。。。。。。。。。。。。。。。。。。', index, this.code)
|
|
2796
2834
|
this.editRow(index, this.code)
|
|
2797
2835
|
}
|
|
2798
2836
|
}
|
|
@@ -3023,7 +3061,6 @@ export default {
|
|
|
3023
3061
|
},
|
|
3024
3062
|
// 选择记录
|
|
3025
3063
|
selectRecord(selection, row) {
|
|
3026
|
-
console.log('selectRecord====>', selection, row)
|
|
3027
3064
|
this.selectionTableData = row
|
|
3028
3065
|
let selectRecordEventResult = true
|
|
3029
3066
|
const gridParams = store.get(this.code)
|
|
@@ -3042,15 +3079,13 @@ export default {
|
|
|
3042
3079
|
})
|
|
3043
3080
|
if (selectRecordEventResult !== undefined && selectRecordEventResult === false) {
|
|
3044
3081
|
// 最后选中的记录取消选中状态
|
|
3045
|
-
this.$refs.superGrid
|
|
3082
|
+
this.$refs.superGrid?.toggleRowSelection(row, false)
|
|
3046
3083
|
}
|
|
3047
3084
|
}
|
|
3048
3085
|
this.select(selection, row)
|
|
3049
|
-
console.log('查看页面数据', this, gridParams.options, this.row, this.selection)
|
|
3050
3086
|
},
|
|
3051
3087
|
// 取消选择记录
|
|
3052
3088
|
selectAllRecord(selection) {
|
|
3053
|
-
console.log('selectAllRecord====>', selection)
|
|
3054
3089
|
let selectAllRecordsEventResult = true
|
|
3055
3090
|
const gridParams = store.get(this.code)
|
|
3056
3091
|
if (isHasOptionFunction('selectAllRecords', this.code)) {
|
|
@@ -3067,17 +3102,17 @@ export default {
|
|
|
3067
3102
|
})
|
|
3068
3103
|
if (selectAllRecordsEventResult !== undefined && selectAllRecordsEventResult === false) {
|
|
3069
3104
|
// 取消所有记录选中状态
|
|
3070
|
-
this.$refs.superGrid
|
|
3105
|
+
this.$refs.superGrid?.toggleAllSelection()
|
|
3071
3106
|
}
|
|
3072
3107
|
}
|
|
3073
3108
|
this.selectAll(selection)
|
|
3074
3109
|
},
|
|
3075
3110
|
cardSelectionChangeEvent(newSelection) {
|
|
3076
3111
|
try {
|
|
3077
|
-
this.$refs.superGrid
|
|
3112
|
+
this.$refs.superGrid?.clearSelection()
|
|
3078
3113
|
for(const i in newSelection) {
|
|
3079
3114
|
const row = newSelection[i]
|
|
3080
|
-
this.$refs.superGrid
|
|
3115
|
+
this.$refs.superGrid?.toggleRowSelection(row, true)
|
|
3081
3116
|
}
|
|
3082
3117
|
} catch (error) {
|
|
3083
3118
|
console.error(error)
|
|
@@ -3087,7 +3122,6 @@ export default {
|
|
|
3087
3122
|
// 选择记录发生改变时
|
|
3088
3123
|
selectionChangeEvent(newSelection) {
|
|
3089
3124
|
this.selectionTableData = newSelection
|
|
3090
|
-
console.log('selectionChangeEvent====>', newSelection)
|
|
3091
3125
|
const gridParams = store.get(this.code)
|
|
3092
3126
|
if (isHasOptionFunction('selectionChange', this.code)) {
|
|
3093
3127
|
gridParams.options.selectionChange.call(this, {
|
|
@@ -3103,7 +3137,7 @@ export default {
|
|
|
3103
3137
|
})
|
|
3104
3138
|
// if(selectionChangeEventResult !== undefined && selectionChangeEventResult=== false){
|
|
3105
3139
|
// // 最后选中的记录取消选中状态
|
|
3106
|
-
// this.$refs.superGrid
|
|
3140
|
+
// this.$refs.superGrid?.toggleRowSelection(newSelection[newSelection.length - 1], false)
|
|
3107
3141
|
// }
|
|
3108
3142
|
}
|
|
3109
3143
|
this.selectionChange(newSelection)
|
|
@@ -564,7 +564,7 @@ export function getTableHeight(superGrid, listCode, pageHeight) {
|
|
|
564
564
|
if (superGrid) {
|
|
565
565
|
rect = superGrid.$el.getBoundingClientRect()
|
|
566
566
|
}
|
|
567
|
-
const totalHeight = window.innerHeight - rect
|
|
567
|
+
const totalHeight = window.innerHeight - (rect?.y ?? 0) - 110
|
|
568
568
|
console.log('rect=', rect, 'window.innerHeight=', window.innerHeight, 'totalHeight=', totalHeight)
|
|
569
569
|
return totalHeight
|
|
570
570
|
|
|
@@ -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()
|