resolver-egretimp-plus 0.0.59 → 0.0.61
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/analysisComponent.jsx +1 -1
- package/src/components/childDialog/index.js +1 -0
- package/src/components/childDialog/src/index.vue +16 -1
- package/src/components/helper/eventOrchestration.js +26 -15
- package/src/components/helper/resolver.js +7 -1
- package/src/components/packages-H5/CmiButton.vue +4 -1
- package/src/components/packages-web/CustomComponentTable.jsx +64 -10
- package/src/components/packages-web/ElButton.vue +3 -1
- package/src/hooks/pageConfig.js +2 -0
- package/src/index.jsx +19 -2
- package/src/utils/const.js +17 -2
- package/src/utils/is.js +4 -0
- package/src/utils/render.jsx +18 -11
package/package.json
CHANGED
|
@@ -195,7 +195,7 @@ export default {
|
|
|
195
195
|
})
|
|
196
196
|
}
|
|
197
197
|
return () => {
|
|
198
|
-
const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects})
|
|
198
|
+
const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects, lang: lang.value})
|
|
199
199
|
const compPropsOnClick = compProps?.onClick
|
|
200
200
|
delete compProps.onClick
|
|
201
201
|
const formItemPolyfill = generateFormItemPolyfill(props.config, lang.value, compProps, _isH5?.value, {
|
|
@@ -37,6 +37,16 @@ const props = defineProps({
|
|
|
37
37
|
type: Object,
|
|
38
38
|
default: () => ({})
|
|
39
39
|
},
|
|
40
|
+
parentRootValue: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({})
|
|
43
|
+
},
|
|
44
|
+
selectionsObj: {
|
|
45
|
+
type: Object,
|
|
46
|
+
// selections
|
|
47
|
+
// primaryKeys
|
|
48
|
+
default: () => ({})
|
|
49
|
+
},
|
|
40
50
|
rootStoreChange: Function
|
|
41
51
|
})
|
|
42
52
|
const formData = ref({})
|
|
@@ -64,7 +74,10 @@ function rootStoreChange(rootStore) {
|
|
|
64
74
|
|
|
65
75
|
|
|
66
76
|
defineExpose({
|
|
67
|
-
dialogVisible
|
|
77
|
+
dialogVisible,
|
|
78
|
+
clearData: () => {
|
|
79
|
+
formData.value = {}
|
|
80
|
+
}
|
|
68
81
|
})
|
|
69
82
|
</script>
|
|
70
83
|
<template>
|
|
@@ -79,6 +92,8 @@ defineExpose({
|
|
|
79
92
|
@loadedConfigCompeted="loadedConfigCompeted"
|
|
80
93
|
@rootStoreChange="rootStoreChange"
|
|
81
94
|
v-model="formData"
|
|
95
|
+
:parentRootValue="props.parentRootValue"
|
|
96
|
+
:selectionsObj="props.selectionsObj"
|
|
82
97
|
:busiIdentityId="busiIdentityId"
|
|
83
98
|
:lang="props.lang"
|
|
84
99
|
:buttonActions="props.buttonActions"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isArray } from "../../utils/is"
|
|
1
|
+
import { isArray, isHasVal } from "../../utils/is"
|
|
2
2
|
import { DATA_VALID_RULE_EXECUTE } from "../../api/builtIn"
|
|
3
3
|
import { getRelateConfigKeys } from "../../rules/ruleUtils"
|
|
4
4
|
import { RESULT_CODE, resultToast } from "../../utils/respone"
|
|
@@ -45,7 +45,7 @@ export async function dispatchClickEvent(service, { dynamicMapComp, mixinService
|
|
|
45
45
|
// ret.data = {result: {pageTotalCount: 100, result: [{},{},{},{},{}]}}
|
|
46
46
|
initOutParamData(service.outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: ret.data})
|
|
47
47
|
if (tableConfig?.vm) {
|
|
48
|
-
const total = parseInt(ret.data?.result?.[service.pageTotalCount || '
|
|
48
|
+
const total = parseInt(ret.data?.result?.[service.pageTotalCount || 'pageCount'])
|
|
49
49
|
tableConfig.vm.page.total = total
|
|
50
50
|
// tableConfig.vm?.changePage(total, 'total')
|
|
51
51
|
}
|
|
@@ -98,7 +98,8 @@ function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMap
|
|
|
98
98
|
val = isArray(compConfig.refValue) ? compConfig.refValue : []
|
|
99
99
|
} else if (isArray(compConfig.refValue) && isArray(val)) {
|
|
100
100
|
val = unionWith(compConfig.refValue, val, (arrVal, othVal) => {
|
|
101
|
-
|
|
101
|
+
const ret = (primaryKeys && primaryKeys.length) ? primaryKeys.map(key => ((isHasVal(arrVal[key]) || isHasVal(othVal[key])) && arrVal[key] == othVal[key]))?.every(item => item) : false
|
|
102
|
+
return ret
|
|
102
103
|
})
|
|
103
104
|
}
|
|
104
105
|
}
|
|
@@ -126,6 +127,7 @@ export function getTableConfig(outParamMappingList = [], { dynamicMapComp, dynam
|
|
|
126
127
|
}
|
|
127
128
|
|
|
128
129
|
export function openDailg({
|
|
130
|
+
rootValue,
|
|
129
131
|
pagePopupMap,
|
|
130
132
|
axiosInstance,
|
|
131
133
|
dynamicMapComp,
|
|
@@ -139,17 +141,26 @@ export function openDailg({
|
|
|
139
141
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
140
142
|
const reqData = getReqData(pagePopupMap.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
|
|
141
143
|
|
|
144
|
+
let outParamMappingList = pagePopupMap?.outParamMappingList?.map(item => {
|
|
145
|
+
const orignParamArr = item.orignParam ? item.orignParam.split('->') : []
|
|
146
|
+
return {
|
|
147
|
+
...item,
|
|
148
|
+
orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
|
|
149
|
+
}
|
|
150
|
+
}) || []
|
|
142
151
|
let mapList = {}
|
|
143
|
-
let
|
|
152
|
+
let selectionsObj = {}
|
|
144
153
|
// 是表格还是list
|
|
145
154
|
const isList = pagePopupMap?.objOrList == '1'
|
|
146
155
|
if (isList ) {
|
|
147
156
|
const primaryKeys = []
|
|
148
157
|
mapList = pagePopupMap?.outParamMappingList?.reduce((ret, item) => {
|
|
149
158
|
const { orignParam, destParam, primaryKeyFlag = '' } = item
|
|
150
|
-
|
|
159
|
+
const destParamArr = destParam ? destParam.split('->') : []
|
|
160
|
+
const transDestParam = destParam ? destParamArr[destParamArr.length - 1] : ''
|
|
161
|
+
ret[transDestParam] = orignParam
|
|
151
162
|
if (primaryKeyFlag == '1') {
|
|
152
|
-
primaryKeys.push(
|
|
163
|
+
primaryKeys.push(transDestParam)
|
|
153
164
|
}
|
|
154
165
|
return ret
|
|
155
166
|
}, {})
|
|
@@ -162,14 +173,9 @@ export function openDailg({
|
|
|
162
173
|
isList: true
|
|
163
174
|
}
|
|
164
175
|
]
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
...item,
|
|
170
|
-
orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
|
|
171
|
-
}
|
|
172
|
-
}) || []
|
|
176
|
+
const orginTableConfig = getTableConfig(outParamMappingList, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat })
|
|
177
|
+
selectionsObj.selections = (orginTableConfig.refValue || [])
|
|
178
|
+
selectionsObj.primaryKeys = primaryKeys
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
|
|
@@ -185,7 +191,9 @@ export function openDailg({
|
|
|
185
191
|
...item
|
|
186
192
|
}
|
|
187
193
|
Object.keys(mapList).forEach(key => {
|
|
188
|
-
|
|
194
|
+
if (mapList[key]) {
|
|
195
|
+
retItem[key] = item[mapList[key]]
|
|
196
|
+
}
|
|
189
197
|
})
|
|
190
198
|
return retItem
|
|
191
199
|
})
|
|
@@ -206,6 +214,8 @@ export function openDailg({
|
|
|
206
214
|
}
|
|
207
215
|
dialogClose = openChildDialog({
|
|
208
216
|
buttonActions,
|
|
217
|
+
parentRootValue: rootValue,
|
|
218
|
+
selectionsObj,
|
|
209
219
|
busiIdentityId,
|
|
210
220
|
axiosInstance: axiosInstance,
|
|
211
221
|
lang,
|
|
@@ -325,6 +335,7 @@ export async function executeEventOrchestration({props, axiosInstance, buttonAct
|
|
|
325
335
|
if (lcpPagePopupMapVO) {
|
|
326
336
|
const dynamicHireRelat = props.config?.dynamicHireRelat
|
|
327
337
|
openDailg({
|
|
338
|
+
rootValue,
|
|
328
339
|
pagePopupMap: lcpPagePopupMapVO,
|
|
329
340
|
axiosInstance,
|
|
330
341
|
dynamicMapComp,
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { resultToast } from "../../utils/respone"
|
|
2
2
|
|
|
3
3
|
export async function executeLoadServices(services = [], { axiosInstance, messageInstance, reqData, respCb }) {
|
|
4
|
+
if (reqData?.notLoad) {
|
|
5
|
+
return
|
|
6
|
+
}
|
|
7
|
+
const noramlReqData = {
|
|
8
|
+
...(reqData || {})
|
|
9
|
+
}
|
|
10
|
+
delete noramlReqData.notLoad
|
|
4
11
|
const loadServices = services.filter(ser => ser.eventType == '1')
|
|
5
12
|
const mixinServiceConfig = services.find(service => service.serviceType === '1')
|
|
6
|
-
|
|
7
13
|
for (let i = 0; i < loadServices.length; i++) {
|
|
8
14
|
const service = loadServices[i]
|
|
9
15
|
const url = service.serviceCode
|
|
@@ -58,6 +58,8 @@ const rootValue = inject('rootValue')
|
|
|
58
58
|
const dataLoad = inject('dataLoad')
|
|
59
59
|
const rootForm = inject('rootForm')
|
|
60
60
|
const validate = inject('_validate', () => {})
|
|
61
|
+
const parentRootValue = inject('_parentRootValue', {})
|
|
62
|
+
|
|
61
63
|
const routeQuery= route?.query
|
|
62
64
|
|
|
63
65
|
const buttonAction = (...arg) => {
|
|
@@ -79,7 +81,8 @@ const buttonAction = (...arg) => {
|
|
|
79
81
|
rootForm,
|
|
80
82
|
routeQuery,
|
|
81
83
|
validate,
|
|
82
|
-
lastClick
|
|
84
|
+
lastClick,
|
|
85
|
+
parentRootValue
|
|
83
86
|
}, appContext)
|
|
84
87
|
}
|
|
85
88
|
if (actionFnRet !== null && actionFnRet !== undefined) {
|
|
@@ -36,7 +36,7 @@ export default {
|
|
|
36
36
|
emitKeys = Object.keys(emitKeys)
|
|
37
37
|
}
|
|
38
38
|
return emitKeys.reduce((ret, key) => {
|
|
39
|
-
const eventKey = capitalize(camelize(
|
|
39
|
+
const eventKey = `on${capitalize(camelize(key))}`
|
|
40
40
|
if (hasOwn(attrs, eventKey)) {
|
|
41
41
|
ret[eventKey] = attrs[eventKey]
|
|
42
42
|
}
|
|
@@ -47,10 +47,17 @@ export default {
|
|
|
47
47
|
const tableEvents = computed(() => {
|
|
48
48
|
return getCompEvents(ElTable)
|
|
49
49
|
})
|
|
50
|
+
const sliceTableEvents = computed(() => {
|
|
51
|
+
const ret = {
|
|
52
|
+
...(tableEvents.value || {})
|
|
53
|
+
}
|
|
54
|
+
delete ret.onSortChange
|
|
55
|
+
return ret
|
|
56
|
+
})
|
|
50
57
|
const pagenationEvents = computed(() => {
|
|
51
58
|
return getCompEvents(ElPagination)
|
|
52
59
|
})
|
|
53
|
-
|
|
60
|
+
const selectionsObj = inject('_selectionsObj', {})
|
|
54
61
|
const rootStore = inject('_rootStore', {})
|
|
55
62
|
const lang = inject('lang')
|
|
56
63
|
const rootValue = inject('rootValue')
|
|
@@ -65,6 +72,34 @@ export default {
|
|
|
65
72
|
return normalColumnConfig(config)
|
|
66
73
|
})
|
|
67
74
|
})
|
|
75
|
+
/** 自定义排序逻辑 ===start==== */
|
|
76
|
+
const sortObj = ref(null)
|
|
77
|
+
// "ascending", "descending", null
|
|
78
|
+
const onSortChange = ({ prop, order }) => {
|
|
79
|
+
tableEvents.value?.onSortChange?.(data)
|
|
80
|
+
|
|
81
|
+
sortObj.value = null
|
|
82
|
+
if (order) {
|
|
83
|
+
sortObj.value = {prop, order}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const sortTable = computed(() => {
|
|
87
|
+
if (!sortObj.value) {
|
|
88
|
+
return []
|
|
89
|
+
}
|
|
90
|
+
const sortList = [sortObj.value]
|
|
91
|
+
const ret = sortList.reduce((ret, item) => {
|
|
92
|
+
ret = ret.sort((a, b) => (a[item.prop] > b[item.prop] ? (item.order === 'descending' ? 1 : -1) : a[item.prop] === b[item.prop] ? 0 : (item.order === 'descending' ? -1 : 1)))
|
|
93
|
+
return ret
|
|
94
|
+
}, [...(props.refValue.value || [])])
|
|
95
|
+
return ret
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
const tableData = computed(() => {
|
|
99
|
+
return sortObj.value ? sortTable.value : (props.refValue.value || [])
|
|
100
|
+
})
|
|
101
|
+
/** 自定义排序逻辑 ===end==== */
|
|
102
|
+
|
|
68
103
|
|
|
69
104
|
// 获取表格列的属性配置
|
|
70
105
|
const getTableColumnProps = (config, idx) => {
|
|
@@ -92,6 +127,23 @@ export default {
|
|
|
92
127
|
if (isPlainColumn({...config, isColumn: true}, calcDisable(config, props.mode))) {
|
|
93
128
|
props['show-overflow-tooltip'] = true
|
|
94
129
|
}
|
|
130
|
+
if (config.type === 'selection') {
|
|
131
|
+
const orginSelectable = props.selectable
|
|
132
|
+
props.selectable = (row, index) => {
|
|
133
|
+
let orginRet = true
|
|
134
|
+
if (orginSelectable && typeof orginSelectable === 'function') {
|
|
135
|
+
orginRet = orginSelectable(row, index)
|
|
136
|
+
}
|
|
137
|
+
let parentSelectionsRet = true
|
|
138
|
+
if (selectionsObj.selections && selectionsObj.selections.length && selectionsObj.primaryKeys && selectionsObj.primaryKeys.length) {
|
|
139
|
+
const hasRow = selectionsObj.selections?.some(selectRow => {
|
|
140
|
+
return selectionsObj.primaryKeys.map(key => key && selectRow[key] == row[key]).every(item => item)
|
|
141
|
+
})
|
|
142
|
+
parentSelectionsRet = !hasRow
|
|
143
|
+
}
|
|
144
|
+
return orginRet && parentSelectionsRet
|
|
145
|
+
}
|
|
146
|
+
}
|
|
95
147
|
return props
|
|
96
148
|
}
|
|
97
149
|
|
|
@@ -114,9 +166,10 @@ export default {
|
|
|
114
166
|
const metaTypeNotRender = TABLE_COLUMN_NOT_RENDER_META_TYPE.some(metaType => compareComponet(metaType, config.metaType)) || !config.metaType
|
|
115
167
|
return !config.renderby && metaTypeNotRender
|
|
116
168
|
}
|
|
169
|
+
|
|
117
170
|
|
|
118
171
|
const getValue = (idx) => {
|
|
119
|
-
return
|
|
172
|
+
return tableData.value?.[idx]
|
|
120
173
|
}
|
|
121
174
|
const onUpdateModelValue = (val, idx) => {
|
|
122
175
|
if (!props.refValue.value) {
|
|
@@ -136,11 +189,11 @@ export default {
|
|
|
136
189
|
*/
|
|
137
190
|
const rowColumnConfgsMap = new Map()
|
|
138
191
|
watch(() => {
|
|
139
|
-
return
|
|
192
|
+
return tableData?.value?.length
|
|
140
193
|
}, (length) => {
|
|
141
194
|
let list = []
|
|
142
195
|
if (length) {
|
|
143
|
-
const newVal =
|
|
196
|
+
const newVal = tableData?.value
|
|
144
197
|
list = newVal.map((row, idx) => {
|
|
145
198
|
const columnsCgs = rowColumnConfgsMap.get(row)
|
|
146
199
|
if (columnsCgs) {
|
|
@@ -219,11 +272,11 @@ export default {
|
|
|
219
272
|
return total + (numFlag ? Number(val) : val)
|
|
220
273
|
}
|
|
221
274
|
const totalRow = computed(() => {
|
|
222
|
-
if (!
|
|
275
|
+
if (!tableData.value?.length || !totalMetaCodes.value.length || !normalTotalCodes.value.length) {
|
|
223
276
|
return []
|
|
224
277
|
}
|
|
225
278
|
// 进行统计的计算
|
|
226
|
-
const row = (
|
|
279
|
+
const row = (tableData.value || []).reduce((total, row) => {
|
|
227
280
|
normalTotalCodes.value.forEach(codeInfo => {
|
|
228
281
|
const { code, totalFn } = codeInfo
|
|
229
282
|
total[code] = totalFn(total[code], row[code], row)
|
|
@@ -357,12 +410,13 @@ export default {
|
|
|
357
410
|
return () => {
|
|
358
411
|
return (
|
|
359
412
|
<div class="custom-component-table">
|
|
360
|
-
<ElTable {...tableProps.value} {...
|
|
413
|
+
<ElTable {...tableProps.value} {...sliceTableEvents.value}
|
|
361
414
|
ref={(e) => {tableRef.value = e}}
|
|
362
415
|
highlight-current-row={selectable.value || tableProps.value?.highlightCurrentRow ? true : false}
|
|
363
416
|
onCurrentChange={selectable.value || tableProps.value?.highlightCurrentRow ? currentChange : () => {}}
|
|
364
|
-
data={[...
|
|
417
|
+
data={[...tableData.value, ...totalRow.value]}
|
|
365
418
|
onSelectionChange={handleSelectionChange}
|
|
419
|
+
onSortChange={onSortChange}
|
|
366
420
|
>
|
|
367
421
|
{
|
|
368
422
|
tableColumnConfigs.value.map((columnConfg, configIdx) => {
|
|
@@ -391,7 +445,7 @@ export default {
|
|
|
391
445
|
const config = multiPmPageMetaList.value?.[$index]?.[configIdx]
|
|
392
446
|
return (
|
|
393
447
|
tableColumnNotRender(config) ? null :
|
|
394
|
-
|
|
448
|
+
<Renderer key={`${config.columnId}-${config.rowIndex}`} class="error-tip-block" modelValue={getValue($index)} rowScope={{row, $index}} onUpdate:modelValue={(val) => { onUpdateModelValue(val, $index) }} config={config}></Renderer>
|
|
395
449
|
)
|
|
396
450
|
}
|
|
397
451
|
}}
|
|
@@ -70,6 +70,7 @@ const rootValue = inject('rootValue')
|
|
|
70
70
|
const dataLoad = inject('dataLoad')
|
|
71
71
|
const rootForm = inject('rootForm')
|
|
72
72
|
const validate = inject('_validate', () => {})
|
|
73
|
+
const parentRootValue = inject('_parentRootValue', {})
|
|
73
74
|
|
|
74
75
|
const routeQuery= route?.query
|
|
75
76
|
|
|
@@ -92,7 +93,8 @@ const buttonAction = async (...arg) => {
|
|
|
92
93
|
rootForm,
|
|
93
94
|
routeQuery,
|
|
94
95
|
validate,
|
|
95
|
-
lastClick
|
|
96
|
+
lastClick,
|
|
97
|
+
parentRootValue
|
|
96
98
|
}, appContext)
|
|
97
99
|
}
|
|
98
100
|
if (actionFnRet !== null && actionFnRet !== undefined) {
|
package/src/hooks/pageConfig.js
CHANGED
|
@@ -17,6 +17,7 @@ export function usePageConfig() {
|
|
|
17
17
|
instance,
|
|
18
18
|
isH5,
|
|
19
19
|
rootValue,
|
|
20
|
+
parentRootValue,
|
|
20
21
|
axiosInstance,
|
|
21
22
|
messageInstance,
|
|
22
23
|
messageCb
|
|
@@ -24,6 +25,7 @@ export function usePageConfig() {
|
|
|
24
25
|
const { pageConfig, mapComp, hireRelatMapRules } = parsePageConfig({
|
|
25
26
|
config, lang, polyfillConfigs, instance, isH5,
|
|
26
27
|
rootValue,
|
|
28
|
+
parentRootValue,
|
|
27
29
|
axiosInstance,
|
|
28
30
|
messageInstance,
|
|
29
31
|
messageCb
|
package/src/index.jsx
CHANGED
|
@@ -98,6 +98,18 @@ export default {
|
|
|
98
98
|
type: Object,
|
|
99
99
|
default: () => ({})
|
|
100
100
|
},
|
|
101
|
+
// 如果当前页面是弹框,这个是父页面传入的根数据
|
|
102
|
+
parentRootValue: {
|
|
103
|
+
type: Object,
|
|
104
|
+
default: () => ({})
|
|
105
|
+
},
|
|
106
|
+
// 如果当前页面是弹框,这个是父页面已经选中的数据,控制表格选中的禁用
|
|
107
|
+
selectionsObj: {
|
|
108
|
+
type: Object,
|
|
109
|
+
// selections
|
|
110
|
+
// primaryKeys
|
|
111
|
+
default: () => ({})
|
|
112
|
+
},
|
|
101
113
|
// 提示语的回调
|
|
102
114
|
messageCb: Function,
|
|
103
115
|
},
|
|
@@ -133,7 +145,8 @@ export default {
|
|
|
133
145
|
instance,
|
|
134
146
|
isH5: props.isH5,
|
|
135
147
|
rootValue: props.modelValue,
|
|
136
|
-
|
|
148
|
+
parentRootValue: props.parentRootValue,
|
|
149
|
+
axiosInstance: axiosInstance.value,
|
|
137
150
|
messageInstance: props.messageInstance,
|
|
138
151
|
messageCb: props.messageCb
|
|
139
152
|
})
|
|
@@ -160,7 +173,8 @@ export default {
|
|
|
160
173
|
instance,
|
|
161
174
|
isH5: props.isH5,
|
|
162
175
|
rootValue: props.modelValue,
|
|
163
|
-
|
|
176
|
+
parentRootValue: props.parentRootValue,
|
|
177
|
+
axiosInstance: axiosInstance.value,
|
|
164
178
|
messageInstance: props.messageInstance,
|
|
165
179
|
messageCb: props.messageCb
|
|
166
180
|
})
|
|
@@ -201,6 +215,9 @@ export default {
|
|
|
201
215
|
provide('dialogComponents', props.dialogComponents) // 是否可以开始执行规则初始化
|
|
202
216
|
provide('_isH5', toRef(props, 'isH5')) // 是否是H5配置
|
|
203
217
|
|
|
218
|
+
provide('_parentRootValue', props.parentRootValue)
|
|
219
|
+
provide('_selectionsObj', props.selectionsObj)
|
|
220
|
+
|
|
204
221
|
const rootForm = ref(null)
|
|
205
222
|
provide('rootForm', rootForm)
|
|
206
223
|
|
package/src/utils/const.js
CHANGED
|
@@ -45,7 +45,8 @@ export const H5_PREFIX_FLAG = 'cmi-'
|
|
|
45
45
|
export const H5_REPLACE_PREFIX_FLAG = 'H5-'
|
|
46
46
|
export const DISPLAY_SHOW = '1'
|
|
47
47
|
export const DISPLAY_HIDDEN = '0'
|
|
48
|
-
export const
|
|
48
|
+
export const PLAIN_TYPE_ALONG_COLUMNS = ['ElText']
|
|
49
|
+
export const PLAIN_TYPE_COLUMNS = ['ElInput', 'ElDatePicker', 'ElInputNumber']
|
|
49
50
|
export const PLAIN_TYPE_OPTIONS_COLUMNS = ['ElSelect']
|
|
50
51
|
export const MAIL_SEND_URL = '/gcweb/External_Mail'
|
|
51
52
|
export const commonPropsType = {
|
|
@@ -160,7 +161,21 @@ export const commonPropsType = {
|
|
|
160
161
|
const options = (selects?.value && selects?.value?.[selectKey]) || (selects?.value && selects?.value?.[`${config.metaCode}ListValue`]) || (selects?.value && selects?.value?.[referenceOptions]) || optionItemsList || []
|
|
161
162
|
return options
|
|
162
163
|
}
|
|
163
|
-
}
|
|
164
|
+
},
|
|
165
|
+
placeholder: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: () => [],
|
|
168
|
+
getValue(config, props, modelValue, selects, lang) {
|
|
169
|
+
return (lang?.indexOf('zh') > -1 ? config.defPlacehold : config.defPlaceholdEn) || ''
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
placeholderEn: {
|
|
173
|
+
type: String,
|
|
174
|
+
default: () => [],
|
|
175
|
+
getValue(config, props, modelValue, selects, lang) {
|
|
176
|
+
return config.defPlaceholdEn
|
|
177
|
+
}
|
|
178
|
+
},
|
|
164
179
|
}
|
|
165
180
|
|
|
166
181
|
export function calcDisable(config, mode) {
|
package/src/utils/is.js
CHANGED
|
@@ -54,6 +54,10 @@ export function isWindow(val) {
|
|
|
54
54
|
return typeof window !== 'undefined' && is(val, 'Window');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
export function isHasVal(val) {
|
|
58
|
+
return val !== null && val !== undefined
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
export const isServer = typeof window === 'undefined';
|
|
58
62
|
|
|
59
63
|
export const isClient = !isServer;
|
package/src/utils/render.jsx
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
META_TYPE_MAP,
|
|
21
21
|
H5_REPLACE_PREFIX_FLAG,
|
|
22
22
|
H5_PREFIX_FLAG,
|
|
23
|
+
PLAIN_TYPE_ALONG_COLUMNS,
|
|
23
24
|
} from './const.js'
|
|
24
25
|
import { preserveCheck } from './preserveFunc.js'
|
|
25
26
|
import { isArray, isFunction, isString } from './is.js'
|
|
@@ -105,6 +106,7 @@ function generateFormConfig(lang = 'zh', isH5) {
|
|
|
105
106
|
export function parsePageConfig({
|
|
106
107
|
config, lang, polyfillConfigs, instance, isH5,
|
|
107
108
|
rootValue,
|
|
109
|
+
parentRootValue,
|
|
108
110
|
axiosInstance,
|
|
109
111
|
messageInstance,
|
|
110
112
|
messageCb
|
|
@@ -121,7 +123,8 @@ export function parsePageConfig({
|
|
|
121
123
|
rootValue,
|
|
122
124
|
axiosInstance,
|
|
123
125
|
messageInstance,
|
|
124
|
-
messageCb
|
|
126
|
+
messageCb,
|
|
127
|
+
parentRootValue
|
|
125
128
|
}, formConfig)
|
|
126
129
|
cbs.forEach((cb) => {
|
|
127
130
|
cb()
|
|
@@ -146,7 +149,8 @@ export function normalConfig({
|
|
|
146
149
|
rootValue,
|
|
147
150
|
axiosInstance,
|
|
148
151
|
messageInstance,
|
|
149
|
-
messageCb
|
|
152
|
+
messageCb,
|
|
153
|
+
parentRootValue
|
|
150
154
|
}, config, hireRelat = '', mapComp = {}, needformItem = false) {
|
|
151
155
|
const metaCode = config.metaCode || ''
|
|
152
156
|
hireRelat += hireRelat ? `->${metaCode}` : metaCode
|
|
@@ -188,7 +192,8 @@ export function normalConfig({
|
|
|
188
192
|
rootValue,
|
|
189
193
|
axiosInstance,
|
|
190
194
|
messageInstance ,
|
|
191
|
-
messageCb
|
|
195
|
+
messageCb,
|
|
196
|
+
parentRootValue
|
|
192
197
|
}, metaItem, hireRelat, mapComp, needformItem || [FORM_META_TYPE, FORM_META_TYPE_H5].includes(metaType))
|
|
193
198
|
return pageConfig
|
|
194
199
|
})?.sort((a, b) => a.seqNo - b.seqNo)
|
|
@@ -212,7 +217,7 @@ export function normalConfig({
|
|
|
212
217
|
pageConfig.needWrap = '1'
|
|
213
218
|
}
|
|
214
219
|
mapComp[hireRelat] = pageConfig
|
|
215
|
-
parsePolyfillConfigs({ polyfillConfigs, instance }, pageConfig)
|
|
220
|
+
parsePolyfillConfigs({ polyfillConfigs, instance, parentRootValue }, pageConfig)
|
|
216
221
|
if(pageConfig.lcpPageServiceMapVOList?.length) {
|
|
217
222
|
cbs.push(() => {
|
|
218
223
|
const tabsServices = getTableServices(pageConfig.lcpPageServiceMapVOList, {dynamicMapComp: mapComp, dynamicMapCompKeys: Object.keys(mapComp), hireRelat})
|
|
@@ -259,14 +264,14 @@ function getTableServices(lcpPageServiceMapVOList = [], { dynamicMapComp, dynami
|
|
|
259
264
|
return []
|
|
260
265
|
}
|
|
261
266
|
|
|
262
|
-
function parsePolyfillConfigs({ polyfillConfigs, instance }, config) {
|
|
267
|
+
function parsePolyfillConfigs({ polyfillConfigs, instance, parentRootValue }, config) {
|
|
263
268
|
const hireRelat = config.hireRelat
|
|
264
269
|
const findKeys = Object.keys(polyfillConfigs).filter(key => hireRelat.endsWith(key))
|
|
265
270
|
if (!findKeys.length) {
|
|
266
271
|
return
|
|
267
272
|
}
|
|
268
273
|
const findKey = findKeys.reduce((ret, key) => (hireRelat.lastIndexOf(ret) < hireRelat.lastIndexOf(key) ? ret : key))
|
|
269
|
-
const polyObj = polyfillConfigs[findKey] && polyfillConfigs[findKey](config, instance)
|
|
274
|
+
const polyObj = polyfillConfigs[findKey] && polyfillConfigs[findKey](config, instance, {parentRootValue})
|
|
270
275
|
polyObj && Object.keys(polyObj).forEach(key => {
|
|
271
276
|
config[key] = polyObj[key]
|
|
272
277
|
})
|
|
@@ -289,7 +294,9 @@ function normalMetaType(metaType) {
|
|
|
289
294
|
|
|
290
295
|
export function isPlainColumn(config, disabled) {
|
|
291
296
|
// 表格中中的列,可以根据配置进行转换为普通形式,表格原生支持的tooltip
|
|
292
|
-
|
|
297
|
+
if (findComponent(PLAIN_TYPE_ALONG_COLUMNS, config.renderby || config.metaType) !== -1) {
|
|
298
|
+
return true
|
|
299
|
+
}
|
|
293
300
|
if (config.isColumn && disabled) {
|
|
294
301
|
if (config.plainColumn) {
|
|
295
302
|
return true
|
|
@@ -350,7 +357,7 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
|
|
|
350
357
|
}
|
|
351
358
|
|
|
352
359
|
// 获取渲染组件的props配置数据
|
|
353
|
-
export function getRenderComponentProps({ props, component, modelValue, selects }) {
|
|
360
|
+
export function getRenderComponentProps({ props, component, modelValue, selects, lang }) {
|
|
354
361
|
if (!component) return {}
|
|
355
362
|
let config = props.config
|
|
356
363
|
if (findComponent(['CustomComponentTabs'], config.renderby || config.metaType) !== -1) {
|
|
@@ -373,7 +380,7 @@ export function getRenderComponentProps({ props, component, modelValue, selects
|
|
|
373
380
|
}
|
|
374
381
|
})
|
|
375
382
|
}
|
|
376
|
-
const commonProps = getCommonProps(config, props, modelValue, selects)
|
|
383
|
+
const commonProps = getCommonProps(config, props, modelValue, selects, lang)
|
|
377
384
|
defprops.style = {
|
|
378
385
|
...config.style,
|
|
379
386
|
...getRenderCompMargins(config),
|
|
@@ -393,9 +400,9 @@ function getBuildCompDefaultWidth(config) {
|
|
|
393
400
|
}
|
|
394
401
|
}
|
|
395
402
|
// 获取渲染组件开放的配置props,提供给所有自定义组件
|
|
396
|
-
function getCommonProps(config, props, modelValue, selects) {
|
|
403
|
+
function getCommonProps(config, props, modelValue, selects, lang) {
|
|
397
404
|
return Object.keys(commonPropsType).reduce((ret, key) => {
|
|
398
|
-
ret[key] = commonPropsType[key].getValue(config, props, modelValue, selects)
|
|
405
|
+
ret[key] = commonPropsType[key].getValue(config, props, modelValue, selects, lang)
|
|
399
406
|
return ret
|
|
400
407
|
}, {})
|
|
401
408
|
}
|