resolver-egretimp-plus 0.0.29 → 0.0.31
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/dist/h5/index.js +1 -1
- package/dist/web/index.js +1 -1
- package/package.json +1 -1
- package/src/components/helper/button.js +96 -10
- package/src/components/helper/resolver.js +10 -0
- package/src/components/packages-web/CustomComponentTable.jsx +6 -2
- package/src/components/packages-web/ElButton.vue +7 -3
- package/src/components/packages-web/ElSelect.vue +8 -1
- package/src/components/packages-web/ElText.vue +1 -1
- package/src/hooks/mock.js +3651 -0
- package/src/hooks/pageConfig.js +20 -3
- package/src/index.jsx +22 -4
- package/src/resolver-common.vue +2 -2
- package/src/rules/ruleUtils.js +26 -0
- package/src/utils/render.jsx +76 -4
package/package.json
CHANGED
|
@@ -1,15 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
import { getRelateConfigKeys } from "../../rules/ruleUtils"
|
|
2
|
+
|
|
3
|
+
export async function dispatchClickEvents ({serviceList = [], axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageInstance}) {
|
|
4
|
+
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
2
5
|
for (let i = 0; i < serviceList.length; i++) {
|
|
3
6
|
const service = serviceList[i]
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
dispatchClickEvent(service, {dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageInstance})
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function dispatchClickEvent(service, { dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageInstance }) {
|
|
12
|
+
let reqData = rootValue
|
|
13
|
+
let tableConfig = null
|
|
14
|
+
if (service.transactionType == '1') {
|
|
15
|
+
reqData = getReqData(service.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
|
|
16
|
+
tableConfig = getTableConfig(service.outParamMappingList, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat })
|
|
17
|
+
if (tableConfig?.vm) {
|
|
18
|
+
reqData[service.pageNum || 'pageNum'] = tableConfig.vm.page?.pageNum
|
|
19
|
+
reqData[service.pageSize || 'pageSize'] = tableConfig.vm.page?.pageSize
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const url = service.serviceCode
|
|
23
|
+
const ret = await (axiosInstance.value && axiosInstance.value({
|
|
24
|
+
url,
|
|
25
|
+
method: "post",
|
|
26
|
+
data: reqData
|
|
27
|
+
}))
|
|
28
|
+
// if (!ret?.data?.success) {
|
|
29
|
+
// messageInstance?.value?.error(ret?.data?.resultMessage || '')
|
|
30
|
+
// await Promise.reject()
|
|
31
|
+
// return
|
|
32
|
+
// }
|
|
33
|
+
ret.data = {result: {pageTotalCount: 100, result: [{},{},{},{},{}]}}
|
|
34
|
+
initOutParamData(service.outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: ret.data})
|
|
35
|
+
if (tableConfig?.vm) {
|
|
36
|
+
const total = parseInt(ret.data?.result?.[service.pageTotalCount || 'pageTotalCount'])
|
|
37
|
+
tableConfig.vm.page.total = total
|
|
38
|
+
// tableConfig.vm?.changePage(total, 'total')
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat}) {
|
|
43
|
+
return inParamMappingList.reduce((ret, params) => {
|
|
44
|
+
const { orignParam = '', destParam = '' } = params
|
|
45
|
+
const configCodes = getRelateConfigKeys(dynamicMapCompKeys, orignParam, dynamicHireRelat)
|
|
46
|
+
if (configCodes.length > 1) {
|
|
47
|
+
console.error('search arg muti', params, configCodes)
|
|
48
|
+
}
|
|
49
|
+
const configCode = configCodes[0]
|
|
50
|
+
const destParamArr = destParam?.split('.') || []
|
|
51
|
+
let currentObj = ret
|
|
52
|
+
destParamArr.forEach((item, idx) => {
|
|
53
|
+
if (idx + 1 === destParamArr.length) {
|
|
54
|
+
currentObj[item] = dynamicMapComp[configCode]?.refValue
|
|
55
|
+
} else {
|
|
56
|
+
if (!currentObj[item]) {
|
|
57
|
+
currentObj[item] = {}
|
|
58
|
+
}
|
|
59
|
+
currentObj = currentObj[item]
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
return ret
|
|
63
|
+
}, {})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult = {} }) {
|
|
67
|
+
outParamMappingList.forEach(params => {
|
|
68
|
+
const { orignParam = '', destParam = '' } = params
|
|
69
|
+
const configCodes = getRelateConfigKeys(dynamicMapCompKeys, destParam, dynamicHireRelat)
|
|
70
|
+
if (configCodes.length > 1) {
|
|
71
|
+
console.error('search arg muti', params, configCodes)
|
|
72
|
+
}
|
|
73
|
+
const configCode = configCodes[0]
|
|
74
|
+
const compConfig = dynamicMapComp[configCode]
|
|
75
|
+
|
|
76
|
+
if (compConfig) {
|
|
77
|
+
const orignParamArr = orignParam?.split('.') || []
|
|
78
|
+
const val = orignParamArr.reduce((ret, item) => {
|
|
79
|
+
if (!ret) return
|
|
80
|
+
return ret[item]
|
|
81
|
+
}, outResult)
|
|
82
|
+
compConfig.refValue = val
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function getTableConfig(outParamMappingList = [], { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat }) {
|
|
88
|
+
for(let i = 0; i < outParamMappingList.length; i ++) {
|
|
89
|
+
const params = outParamMappingList[i]
|
|
90
|
+
const { destParam = '' } = params
|
|
91
|
+
const configCodes = getRelateConfigKeys(dynamicMapCompKeys, destParam, dynamicHireRelat)
|
|
92
|
+
if (configCodes.length > 1) {
|
|
93
|
+
console.error('search arg muti', params, configCodes)
|
|
94
|
+
}
|
|
95
|
+
const configCode = configCodes[0]
|
|
96
|
+
const compConfig = dynamicMapComp[configCode]
|
|
97
|
+
if (compConfig.metaType === 'CustomComponentTable') {
|
|
98
|
+
return compConfig
|
|
13
99
|
}
|
|
14
100
|
}
|
|
15
101
|
}
|
|
@@ -26,4 +26,14 @@ export async function executeLoadServices(services = [], { axiosInstance, messag
|
|
|
26
26
|
}
|
|
27
27
|
respCb && respCb(ret?.data?.result)
|
|
28
28
|
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function normalPageConfigs(pageConfig) {
|
|
32
|
+
const rootOptionComp = pageConfig?.pmPageMetaList?.find(item => item.metaCode === 'PC-root-panel' || item.metaCode === 'H5-root-panel')
|
|
33
|
+
if (rootOptionComp) {
|
|
34
|
+
pageConfig.pmPageMetaList = rootOptionComp.pmPageMetaList
|
|
35
|
+
delete rootOptionComp.pmPageMetaList
|
|
36
|
+
pageConfig.rootOptionComp = rootOptionComp
|
|
37
|
+
}
|
|
38
|
+
return pageConfig
|
|
29
39
|
}
|
|
@@ -6,6 +6,7 @@ import { commonPropsType, TABLE_COLUMN_NOT_RENDER_META_TYPE, DISPLAY_SHOW, compa
|
|
|
6
6
|
import '../styles/CustomComponenTable.scss'
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
+
name: 'CustomComponentTable',
|
|
9
10
|
props: {
|
|
10
11
|
...commonPropsType,
|
|
11
12
|
...ElTable.props,
|
|
@@ -133,7 +134,7 @@ export default {
|
|
|
133
134
|
*/
|
|
134
135
|
const rowColumnConfgsMap = new Map()
|
|
135
136
|
watch(() => {
|
|
136
|
-
return props.refValue?.value
|
|
137
|
+
return props.refValue?.value?.length
|
|
137
138
|
}, (length) => {
|
|
138
139
|
let list = []
|
|
139
140
|
if (length) {
|
|
@@ -167,7 +168,7 @@ export default {
|
|
|
167
168
|
props.config.multiPmPageMetaList = list
|
|
168
169
|
}, {
|
|
169
170
|
immediate: true,
|
|
170
|
-
deep: true,
|
|
171
|
+
// deep: true,
|
|
171
172
|
})
|
|
172
173
|
// 统计行定义 ====start======
|
|
173
174
|
const totalMetaCodes = computed(() => {
|
|
@@ -342,6 +343,9 @@ export default {
|
|
|
342
343
|
multipleSelection,
|
|
343
344
|
selectedRow,
|
|
344
345
|
page,
|
|
346
|
+
changePage: (val, key) => {
|
|
347
|
+
page[key || 'pageNum'] = val
|
|
348
|
+
},
|
|
345
349
|
...tableExpose
|
|
346
350
|
})
|
|
347
351
|
|
|
@@ -9,6 +9,7 @@ import { defineProps, inject, getCurrentInstance, computed, useAttrs } from 'vue
|
|
|
9
9
|
import { commonPropsType } from '../../utils/index.js'
|
|
10
10
|
import { useRoute } from 'vue-router'
|
|
11
11
|
import { dispatchClickEvents } from '../helper/button.js';
|
|
12
|
+
import { getRelateConfigKeys } from '../../rules/ruleUtils.js';
|
|
12
13
|
|
|
13
14
|
const appContext = getCurrentInstance()?.appContext
|
|
14
15
|
|
|
@@ -64,8 +65,8 @@ const rootForm = inject('rootForm')
|
|
|
64
65
|
const _axiosInstance = inject('_axiosInstance')
|
|
65
66
|
const routeQuery= route?.query
|
|
66
67
|
|
|
67
|
-
const buttonAction = () => {
|
|
68
|
-
attrs?.onClick?.(
|
|
68
|
+
const buttonAction = (...arg) => {
|
|
69
|
+
attrs?.onClick?.(...arg) // 如果配置中有点击事件
|
|
69
70
|
const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
|
|
70
71
|
const actionFn = buttonActions[actionKey]
|
|
71
72
|
actionFn && actionFn(props, {
|
|
@@ -81,10 +82,13 @@ const buttonAction = () => {
|
|
|
81
82
|
|
|
82
83
|
const PageServiceMapVOList = props.config.lcpPageServiceMapVOList
|
|
83
84
|
if (PageServiceMapVOList?.length) {
|
|
85
|
+
const dynamicHireRelat = props.config?.dynamicHireRelat
|
|
84
86
|
dispatchClickEvents({
|
|
85
87
|
serviceList: PageServiceMapVOList,
|
|
86
88
|
axiosInstance: _axiosInstance,
|
|
87
|
-
|
|
89
|
+
rootValue: rootValue?.value,
|
|
90
|
+
dynamicMapComp,
|
|
91
|
+
dynamicHireRelat,
|
|
88
92
|
messageInstance
|
|
89
93
|
})
|
|
90
94
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ElSelect class="custom-self-select" v-bind="{...
|
|
2
|
+
<ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
|
|
3
3
|
<ElOption v-for="option in props.options"
|
|
4
4
|
:key="option.columnValue"
|
|
5
5
|
:label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
|
|
@@ -60,6 +60,13 @@ const selectProps = computed(() => {
|
|
|
60
60
|
if (attrs.placeholder === null || attrs.placeholder === undefined) {
|
|
61
61
|
attrs.placeholder = ''
|
|
62
62
|
}
|
|
63
|
+
if (typeof attrs.filterable === 'string') {
|
|
64
|
+
attrs.filterable = attrs.filterable == '1'
|
|
65
|
+
}
|
|
66
|
+
if (typeof attrs.multiple === 'string') {
|
|
67
|
+
attrs.multiple = attrs.multiple == '1'
|
|
68
|
+
}
|
|
69
|
+
attrs.multipleLimit = parseInt(attrs.multipleLimit)
|
|
63
70
|
return attrs
|
|
64
71
|
})
|
|
65
72
|
const lang = inject('lang')
|