resolver-egretimp-plus 0.0.63 → 0.0.64
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
|
<script setup>
|
|
2
|
-
import { commonPropsType } from '../../utils/index.js'
|
|
3
|
-
import { computed, inject, ref, useAttrs, watch } from 'vue'
|
|
2
|
+
import { commonPropsType, hasOwn } from '../../utils/index.js'
|
|
3
|
+
import { computed, inject, reactive, ref, useAttrs, watch } from 'vue'
|
|
4
4
|
|
|
5
5
|
const attrs = useAttrs()
|
|
6
6
|
const lang = inject('lang')
|
|
@@ -10,15 +10,101 @@ const props = defineProps({
|
|
|
10
10
|
})
|
|
11
11
|
const tableData = ref([])
|
|
12
12
|
const modelValue = defineModel()
|
|
13
|
+
|
|
14
|
+
const isFrontPage = computed(() => {
|
|
15
|
+
return props.config?.frontPageFlag === '1'
|
|
16
|
+
})
|
|
13
17
|
const tableProps = computed(() => {
|
|
14
18
|
return {
|
|
15
19
|
stripe: props.config?.stripe === '1',
|
|
16
20
|
card: props.config?.displayType === 'card',
|
|
17
21
|
display: props.config?.display,
|
|
18
|
-
open: props.config?.
|
|
22
|
+
open: props.config?.defaultOpenFlag === '1',
|
|
19
23
|
showlandscape: props.config?.showLandscape === '1',
|
|
20
24
|
}
|
|
21
25
|
})
|
|
26
|
+
const page = reactive({
|
|
27
|
+
pageNum: 1,
|
|
28
|
+
pageSize: 3,
|
|
29
|
+
total: 0,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const normalTableData = computed(() => {
|
|
33
|
+
return !isFrontPage.value ?
|
|
34
|
+
tableData.value :
|
|
35
|
+
tableData.value.slice((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const normalPageTotal = computed(() => {
|
|
39
|
+
return !isFrontPage.value ? page.total : (tableData.value?.length || 0)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const paginationProps = computed(() => {
|
|
43
|
+
return {
|
|
44
|
+
pagesizes: props.config?.pagesizes || [3, 10, 20, 50],
|
|
45
|
+
showHomeEnd: hasOwn(props.config, 'showHomeEnd') ? props.config.showHomeEnd === '1' : hasOwn(props.config, 'show-home-end') ? props.config['show-home-end'] === '1' : true,
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
const pagenationEvents = computed(() => {
|
|
49
|
+
const ret = {
|
|
50
|
+
onSizeChange: (e) => {
|
|
51
|
+
if (attrs.onSizeChange) {
|
|
52
|
+
attrs.onSizeChange?.(e)
|
|
53
|
+
}
|
|
54
|
+
page.pageSize = e?.detail?.value || 3
|
|
55
|
+
},
|
|
56
|
+
onCurrentChange: (e) => {
|
|
57
|
+
if (attrs.onCurrentChange) {
|
|
58
|
+
attrs.onCurrentChange?.(e)
|
|
59
|
+
}
|
|
60
|
+
page.pageNum = e?.detail?.value || 1
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return ret
|
|
64
|
+
})
|
|
65
|
+
// 是否配置分页功能 ====== start======
|
|
66
|
+
const pageable = computed(() => {
|
|
67
|
+
return props.config?.pageable === '1'
|
|
68
|
+
})
|
|
69
|
+
const pageAlign = computed(() => {
|
|
70
|
+
return props.config?.pageAlign
|
|
71
|
+
})
|
|
72
|
+
const PAGE_LEFT = 'left'
|
|
73
|
+
const PAGE_CENTER = 'center'
|
|
74
|
+
const PAGE_RIGHT = 'right'
|
|
75
|
+
const pageAlignEnmu = {
|
|
76
|
+
[PAGE_LEFT]: 'flex-start',
|
|
77
|
+
[PAGE_RIGHT]: 'flex-end',
|
|
78
|
+
[PAGE_CENTER]: 'center'
|
|
79
|
+
}
|
|
80
|
+
// 页码变动
|
|
81
|
+
watch(() => page.pageNum, (val) => {
|
|
82
|
+
const fn = props.config?.currentChange
|
|
83
|
+
const ret = fn && fn(val, props, page)
|
|
84
|
+
if (ret) {
|
|
85
|
+
if (isPromise(ret)) {
|
|
86
|
+
ret.then((res) => {
|
|
87
|
+
res && (modelValue.value = res)
|
|
88
|
+
})
|
|
89
|
+
} else {
|
|
90
|
+
modelValue.value = ret
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
// 页面大小变动
|
|
95
|
+
watch(() => page.pageSize, (val) => {
|
|
96
|
+
const fn = props.config?.sizeChange
|
|
97
|
+
const ret = fn && fn(val, props, page)
|
|
98
|
+
if (ret) {
|
|
99
|
+
if (isPromise(ret)) {
|
|
100
|
+
ret.then((res) => {
|
|
101
|
+
res && (modelValue.value = res)
|
|
102
|
+
})
|
|
103
|
+
} else {
|
|
104
|
+
modelValue.value = ret
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
22
108
|
|
|
23
109
|
const pmPageMetaList = computed(() => {
|
|
24
110
|
return (props.config.pmPageMetaList || [])
|
|
@@ -36,7 +122,7 @@ const getTableColumnProps = (config) => {
|
|
|
36
122
|
|
|
37
123
|
watch(modelValue, (val) => {
|
|
38
124
|
setTimeout(() => {
|
|
39
|
-
tableData.value = val || (tableProps.value.card ? [
|
|
125
|
+
tableData.value = val || (tableProps.value.card ? [] : [])
|
|
40
126
|
}, 100);
|
|
41
127
|
tableRef.value?.setTableData(val || [])
|
|
42
128
|
}, {
|
|
@@ -44,7 +130,7 @@ watch(modelValue, (val) => {
|
|
|
44
130
|
})
|
|
45
131
|
</script>
|
|
46
132
|
<template>
|
|
47
|
-
<cmi-table ref="tableRef" :key="`${tableProps.card}${tableProps.display}`" v-bind="tableProps" :data="
|
|
133
|
+
<cmi-table ref="tableRef" :key="`${tableProps.card}${tableProps.display}`" v-bind="tableProps" :data="normalTableData">
|
|
48
134
|
<cmi-table-column
|
|
49
135
|
v-for="column in pmPageMetaList" :key="column.metaCode"
|
|
50
136
|
v-bind="{
|
|
@@ -54,5 +140,16 @@ watch(modelValue, (val) => {
|
|
|
54
140
|
>
|
|
55
141
|
</cmi-table-column>
|
|
56
142
|
</cmi-table>
|
|
143
|
+
<div v-if="pageable" :style="{'justify-content': pageAlignEnmu[pageAlign || PAGE_RIGHT]}" style="margin-bottom: 12px;">
|
|
144
|
+
<cmi-pagination
|
|
145
|
+
:key="normalPageTotal"
|
|
146
|
+
v-bind="{...paginationProps, ...pagenationEvents}"
|
|
147
|
+
@sizeChange="pagenationEvents.onSizeChange"
|
|
148
|
+
@currentChange="pagenationEvents.onCurrentChange"
|
|
149
|
+
:total="normalPageTotal"
|
|
150
|
+
:pagesize="page.pageSize"
|
|
151
|
+
:current="page.pageNum"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
57
154
|
</template>
|
|
58
155
|
<style></style>
|
package/src/utils/render.jsx
CHANGED
|
@@ -222,16 +222,20 @@ export function normalConfig({
|
|
|
222
222
|
cbs.push(() => {
|
|
223
223
|
const tabsServices = getTableServices(pageConfig.lcpPageServiceMapVOList, {dynamicMapComp: mapComp, dynamicMapCompKeys: Object.keys(mapComp), hireRelat})
|
|
224
224
|
tabsServices.forEach((({tableConfig, service}) => {
|
|
225
|
+
const orginCurrentChange = tableConfig.currentChange
|
|
225
226
|
tableConfig.currentChange = (val, props, page) => {
|
|
226
227
|
// setTimeout(() => {
|
|
228
|
+
orginCurrentChange && orginCurrentChange(val, props, page)
|
|
227
229
|
const dynamicMapComp = props.config.dynamicMapComp
|
|
228
230
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
229
231
|
const dynamicHireRelat = props.config.dynamicHireRelat
|
|
230
232
|
dispatchClickEvent(service, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, rootValue, messageCb, compConfig: pageConfig, axiosInstance, messageInstance })
|
|
231
233
|
// }, 0);
|
|
232
234
|
}
|
|
235
|
+
const orginSizeChange = tableConfig.sizeChange
|
|
233
236
|
tableConfig.sizeChange = (val, props, page) => {
|
|
234
237
|
// setTimeout(() => {
|
|
238
|
+
orginSizeChange && orginSizeChange(val, props, page)
|
|
235
239
|
const dynamicMapComp = props.config.dynamicMapComp
|
|
236
240
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
237
241
|
const dynamicHireRelat = props.config.dynamicHireRelat
|
|
@@ -392,6 +396,9 @@ export function getRenderComponentProps({ props, component, modelValue, selects,
|
|
|
392
396
|
...defprops,
|
|
393
397
|
...commonProps
|
|
394
398
|
}
|
|
399
|
+
if (config.class) {
|
|
400
|
+
retObj.class = config.class
|
|
401
|
+
}
|
|
395
402
|
return retObj
|
|
396
403
|
}
|
|
397
404
|
// 一些组件并且没有占居满格
|