resolver-egretimp-plus 0.0.37 → 0.0.39
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/confirmInstance-H5/index.js +53 -0
- package/src/components/confirmInstance-H5/src/index.vue +54 -0
- package/src/components/helper/{button.js → eventOrchestration.js} +102 -8
- package/src/components/packages-H5/CmiButton.vue +1 -1
- package/src/components/packages-web/ElButton.vue +16 -27
- package/src/hooks/pageConfig.js +5 -3
- package/src/index.jsx +22 -3
- package/src/resolver-H5.vue +21 -1
- package/src/resolver-common.vue +1 -1
- package/src/resolver-web.vue +22 -2
- package/src/utils/render.jsx +11 -7
- package/src/utils/respone.js +27 -8
- package/dist/3/index.js +0 -1
- package/dist/661/index.js +0 -2
- package/dist/661/index.js.LICENSE.txt +0 -6
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import confirmInstance from './src/index.vue'
|
|
2
|
+
import { createVNode, render } from 'vue'
|
|
3
|
+
|
|
4
|
+
let instance = null
|
|
5
|
+
|
|
6
|
+
export function confirmDialog(content, title, opts = {}, appContext) {
|
|
7
|
+
const options = {
|
|
8
|
+
...opts,
|
|
9
|
+
content,
|
|
10
|
+
title
|
|
11
|
+
}
|
|
12
|
+
let resolver = null
|
|
13
|
+
let inject = null
|
|
14
|
+
const cancelFn = () => {
|
|
15
|
+
inject && inject()
|
|
16
|
+
}
|
|
17
|
+
const confirmFn = () => {
|
|
18
|
+
resolver && resolver()
|
|
19
|
+
}
|
|
20
|
+
const retPromise = new Promise((reso, inj) => {
|
|
21
|
+
resolver = reso
|
|
22
|
+
inject = inj
|
|
23
|
+
})
|
|
24
|
+
if (instance) {
|
|
25
|
+
Object.keys(options).forEach(key => {
|
|
26
|
+
instance.props[key] = options[key]
|
|
27
|
+
})
|
|
28
|
+
instance.props.cancel = cancelFn
|
|
29
|
+
instance.props.confirm = confirmFn
|
|
30
|
+
instance.vm.exposed.dialogVisible.value = true
|
|
31
|
+
return retPromise
|
|
32
|
+
}
|
|
33
|
+
const container = document.createElement('div')
|
|
34
|
+
const vnode = createVNode(confirmInstance, {
|
|
35
|
+
...options,
|
|
36
|
+
cancel: cancelFn,
|
|
37
|
+
confirm: confirmFn
|
|
38
|
+
})
|
|
39
|
+
appContext && (vnode.appContext = appContext)
|
|
40
|
+
render(vnode, container)
|
|
41
|
+
document.body.appendChild(container.firstElementChild)
|
|
42
|
+
|
|
43
|
+
instance = {
|
|
44
|
+
vnode,
|
|
45
|
+
vm: vnode.component,
|
|
46
|
+
props: vnode.component?.props,
|
|
47
|
+
close: () => {
|
|
48
|
+
vnode.component.exposed.dialogVisible.value = false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
vnode.component.exposed.dialogVisible.value = true
|
|
52
|
+
return retPromise
|
|
53
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
title: String,
|
|
6
|
+
content: String,
|
|
7
|
+
confirm: {
|
|
8
|
+
type: Function,
|
|
9
|
+
default: () => {}
|
|
10
|
+
},
|
|
11
|
+
cancel: {
|
|
12
|
+
type: Function,
|
|
13
|
+
default: () => {}
|
|
14
|
+
},
|
|
15
|
+
showCancelButton: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: true
|
|
18
|
+
},
|
|
19
|
+
type: String
|
|
20
|
+
})
|
|
21
|
+
const dialogType = computed(() => {
|
|
22
|
+
return props.showCancelButton === false ? 'confirm' : 'modal'
|
|
23
|
+
})
|
|
24
|
+
const dialogVisible = ref(true)
|
|
25
|
+
|
|
26
|
+
const confirm = () => {
|
|
27
|
+
props.confirm()
|
|
28
|
+
dialogVisible.value = false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const cancel = () => {
|
|
32
|
+
props.cancel()
|
|
33
|
+
dialogVisible.value = false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
defineExpose({
|
|
38
|
+
dialogVisible
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<cmi-dialog
|
|
43
|
+
:type="dialogType"
|
|
44
|
+
:zIndex="10000"
|
|
45
|
+
:open="dialogVisible"
|
|
46
|
+
:title="props.title"
|
|
47
|
+
:content="props.content"
|
|
48
|
+
@confirm="confirm"
|
|
49
|
+
@cancel="cancel"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<style lang="scss">
|
|
54
|
+
</style>
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { getRelateConfigKeys } from "../../rules/ruleUtils"
|
|
2
|
-
import { resultToast } from "../../utils/respone"
|
|
3
|
-
import { openChildDialog } from "../childDialog"
|
|
2
|
+
import { RESULT_CODE, resultToast } from "../../utils/respone"
|
|
4
3
|
|
|
5
|
-
export async function dispatchClickEvents ({serviceList = [], axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageInstance}) {
|
|
4
|
+
export async function dispatchClickEvents ({serviceList = [], axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
|
|
6
5
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
7
6
|
for (let i = 0; i < serviceList.length; i++) {
|
|
8
7
|
const service = serviceList[i]
|
|
9
|
-
dispatchClickEvent(service, {dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageInstance})
|
|
8
|
+
dispatchClickEvent(service, {dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance})
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
export async function dispatchClickEvent(service, { dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageInstance }) {
|
|
12
|
+
export async function dispatchClickEvent(service, { dynamicMapComp, rootValue, dynamicMapCompKeys, dynamicHireRelat, axiosInstance, messageCb, compConfig, messageInstance }) {
|
|
14
13
|
let reqData = rootValue
|
|
15
14
|
let tableConfig = null
|
|
16
15
|
if (service.transactionType == '1') {
|
|
@@ -22,12 +21,12 @@ export async function dispatchClickEvent(service, { dynamicMapComp, rootValue, d
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
const url = service.serviceCode
|
|
25
|
-
const ret = await (axiosInstance
|
|
24
|
+
const ret = await (axiosInstance && axiosInstance({
|
|
26
25
|
url,
|
|
27
26
|
method: "post",
|
|
28
27
|
data: reqData
|
|
29
28
|
}))
|
|
30
|
-
if (!resultToast(ret?.data, messageInstance)) {
|
|
29
|
+
if (!resultToast(ret?.data, messageInstance, {messageCb, service, compConfig})) {
|
|
31
30
|
await Promise.reject()
|
|
32
31
|
return
|
|
33
32
|
}
|
|
@@ -111,6 +110,7 @@ export function openDailg({
|
|
|
111
110
|
dynamicMapComp,
|
|
112
111
|
dynamicHireRelat,
|
|
113
112
|
lang,
|
|
113
|
+
openChildDialog,
|
|
114
114
|
appContext,
|
|
115
115
|
}) {
|
|
116
116
|
const busiIdentityId = pagePopupMap.popupBusiIdentityId
|
|
@@ -148,7 +148,7 @@ export function openDailg({
|
|
|
148
148
|
}
|
|
149
149
|
dialogClose = openChildDialog({
|
|
150
150
|
busiIdentityId,
|
|
151
|
-
axiosInstance: axiosInstance
|
|
151
|
+
axiosInstance: axiosInstance,
|
|
152
152
|
lang,
|
|
153
153
|
loadEvnetsReq: reqData,
|
|
154
154
|
polyfillConfigs,
|
|
@@ -157,3 +157,97 @@ export function openDailg({
|
|
|
157
157
|
}
|
|
158
158
|
}, appContext)
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
// 数据校验服务
|
|
162
|
+
export async function executeDataValid(validConfig, { dynamicMapComp, rootValue, axiosInstance, lang}) {
|
|
163
|
+
let reqData = rootValue
|
|
164
|
+
const url = service.serviceCode
|
|
165
|
+
const ret = await (axiosInstance && axiosInstance({
|
|
166
|
+
url,
|
|
167
|
+
method: "post",
|
|
168
|
+
data: reqData
|
|
169
|
+
}))
|
|
170
|
+
const result = ret.data || {}
|
|
171
|
+
const resultCode = result.resultCode
|
|
172
|
+
const resultMessage = result?.resultMessage || ''
|
|
173
|
+
let type = ''
|
|
174
|
+
if (RESULT_CODE.SUCCESS !== resultCode) {
|
|
175
|
+
switch (resultCode) {
|
|
176
|
+
case RESULT_CODE.INFO:
|
|
177
|
+
type = 'info'
|
|
178
|
+
break;
|
|
179
|
+
case RESULT_CODE.WARNING:
|
|
180
|
+
type = 'warning'
|
|
181
|
+
break;
|
|
182
|
+
case RESULT_CODE.ERROR:
|
|
183
|
+
type = 'error'
|
|
184
|
+
break;
|
|
185
|
+
case RESULT_CODE.OTHER:
|
|
186
|
+
type = 'error'
|
|
187
|
+
break;
|
|
188
|
+
default:
|
|
189
|
+
type = 'error'
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
let weakFlag = false
|
|
194
|
+
if (validConfig?.validationType === '2') {
|
|
195
|
+
weakFlag = true
|
|
196
|
+
}
|
|
197
|
+
return new Promise((resolver, inject) => {
|
|
198
|
+
confirmInstance(resultMessage, lang?.indexOf('zh') > -1 ? '提示' : 'Hint', {
|
|
199
|
+
type,
|
|
200
|
+
showCancelButton: weakFlag
|
|
201
|
+
}).then(() => {
|
|
202
|
+
if (!weakFlag) {
|
|
203
|
+
resolver(false)
|
|
204
|
+
} else {
|
|
205
|
+
resolver(true)
|
|
206
|
+
}
|
|
207
|
+
}).catch(() => {
|
|
208
|
+
inject(false)
|
|
209
|
+
})
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export async function executeEventOrchestration({props, axiosInstance, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
|
|
214
|
+
// 数据校验服务
|
|
215
|
+
const valid = await executeDataValid(null, {
|
|
216
|
+
dynamicMapComp,
|
|
217
|
+
rootValue,
|
|
218
|
+
axiosInstance,
|
|
219
|
+
lang
|
|
220
|
+
})
|
|
221
|
+
if (!valid) {
|
|
222
|
+
return
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const PageServiceMapVOList = props.config.lcpPageServiceMapVOList
|
|
226
|
+
if (PageServiceMapVOList?.length) {
|
|
227
|
+
const dynamicHireRelat = props.config?.dynamicHireRelat
|
|
228
|
+
dispatchClickEvents({
|
|
229
|
+
serviceList: PageServiceMapVOList,
|
|
230
|
+
axiosInstance,
|
|
231
|
+
rootValue,
|
|
232
|
+
dynamicMapComp,
|
|
233
|
+
dynamicHireRelat,
|
|
234
|
+
messageInstance,
|
|
235
|
+
messageCb,
|
|
236
|
+
compConfig: props.config
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
const lcpPagePopupMapVO = props.config.lcpPagePopupMapVO
|
|
240
|
+
if (lcpPagePopupMapVO) {
|
|
241
|
+
const dynamicHireRelat = props.config?.dynamicHireRelat
|
|
242
|
+
openDailg({
|
|
243
|
+
pagePopupMap: lcpPagePopupMapVO,
|
|
244
|
+
axiosInstance,
|
|
245
|
+
dynamicMapComp,
|
|
246
|
+
dynamicHireRelat,
|
|
247
|
+
appContext,
|
|
248
|
+
lang,
|
|
249
|
+
messageCb,
|
|
250
|
+
openChildDialog
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineProps, inject, getCurrentInstance, computed, useAttrs } from 'vue'
|
|
3
3
|
import { commonPropsType } from '../../utils/index.js'
|
|
4
4
|
import { useRoute } from 'vue-router'
|
|
5
|
-
import { dispatchClickEvents } from '../helper/
|
|
5
|
+
import { dispatchClickEvents } from '../helper/eventOrchestration.js';
|
|
6
6
|
|
|
7
7
|
const appContext = getCurrentInstance()?.appContext
|
|
8
8
|
|
|
@@ -8,7 +8,7 @@ import { ElButton } from 'element-plus'
|
|
|
8
8
|
import { defineProps, inject, getCurrentInstance, computed, useAttrs } from 'vue'
|
|
9
9
|
import { commonPropsType } from '../../utils/index.js'
|
|
10
10
|
import { useRoute } from 'vue-router'
|
|
11
|
-
import {
|
|
11
|
+
import { executeEventOrchestration } from '../helper/eventOrchestration.js';
|
|
12
12
|
import { getRelateConfigKeys } from '../../rules/ruleUtils.js';
|
|
13
13
|
|
|
14
14
|
defineOptions({
|
|
@@ -63,6 +63,7 @@ const label = computed(() => {
|
|
|
63
63
|
})
|
|
64
64
|
const route = useRoute()
|
|
65
65
|
const buttonActions = inject('buttonActions', {})
|
|
66
|
+
const messageCb = inject('_messageCb')
|
|
66
67
|
|
|
67
68
|
const messageInstance = inject('_messageInstance')
|
|
68
69
|
const dynamicMapComp = inject('dynamicMapComp')
|
|
@@ -73,9 +74,12 @@ const rootValue = inject('rootValue')
|
|
|
73
74
|
const dataLoad = inject('dataLoad')
|
|
74
75
|
const rootForm = inject('rootForm')
|
|
75
76
|
const _axiosInstance = inject('_axiosInstance')
|
|
77
|
+
const confirmInstance = inject('_confirmInstance')
|
|
78
|
+
const openChildDialogInstance = inject('_openChildDialogInstance')
|
|
79
|
+
|
|
76
80
|
const routeQuery= route?.query
|
|
77
81
|
|
|
78
|
-
const buttonAction = (...arg) => {
|
|
82
|
+
const buttonAction = async (...arg) => {
|
|
79
83
|
attrs?.onClick?.(...arg) // 如果配置中有点击事件
|
|
80
84
|
const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
|
|
81
85
|
const actionFn = buttonActions[actionKey]
|
|
@@ -84,34 +88,19 @@ const buttonAction = (...arg) => {
|
|
|
84
88
|
hireRelatMapRules,
|
|
85
89
|
components,
|
|
86
90
|
selects,
|
|
87
|
-
rootValue,
|
|
91
|
+
rootValue: rootValue?.value,
|
|
88
92
|
dataLoad,
|
|
89
93
|
rootForm,
|
|
90
94
|
routeQuery
|
|
91
95
|
}, appContext)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
messageInstance: messageInstance?.value
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
const lcpPagePopupMapVO = props.config.lcpPagePopupMapVO
|
|
105
|
-
if (lcpPagePopupMapVO) {
|
|
106
|
-
const dynamicHireRelat = props.config?.dynamicHireRelat
|
|
107
|
-
openDailg({
|
|
108
|
-
pagePopupMap: lcpPagePopupMapVO,
|
|
109
|
-
axiosInstance: _axiosInstance,
|
|
110
|
-
dynamicMapComp,
|
|
111
|
-
dynamicHireRelat,
|
|
112
|
-
appContext,
|
|
113
|
-
lang: lang?.value
|
|
114
|
-
})
|
|
115
|
-
}
|
|
96
|
+
|
|
97
|
+
executeEventOrchestration({
|
|
98
|
+
props, axiosInstance: _axiosInstance?.value, rootValue, confirmInstance: confirmInstance?.value,
|
|
99
|
+
dynamicMapComp,
|
|
100
|
+
openChildDialog: openChildDialogInstance?.value,
|
|
101
|
+
messageInstance: messageInstance?.value,
|
|
102
|
+
messageCb, lang: lang?.value,
|
|
103
|
+
appContext
|
|
104
|
+
})
|
|
116
105
|
}
|
|
117
106
|
</script>
|
package/src/hooks/pageConfig.js
CHANGED
|
@@ -18,13 +18,15 @@ export function usePageConfig() {
|
|
|
18
18
|
isH5,
|
|
19
19
|
rootValue,
|
|
20
20
|
axiosInstance,
|
|
21
|
-
messageInstance
|
|
21
|
+
messageInstance,
|
|
22
|
+
messageCb
|
|
22
23
|
}) {
|
|
23
24
|
const { pageConfig, mapComp, hireRelatMapRules } = parsePageConfig({
|
|
24
25
|
config, lang, polyfillConfigs, instance, isH5,
|
|
25
26
|
rootValue,
|
|
26
27
|
axiosInstance,
|
|
27
|
-
messageInstance
|
|
28
|
+
messageInstance,
|
|
29
|
+
messageCb
|
|
28
30
|
})
|
|
29
31
|
pageConfigRef.value = pageConfig
|
|
30
32
|
hireRelatMapRulesRef.value = hireRelatMapRules
|
|
@@ -67,7 +69,7 @@ export function useBuildInData(messageTipInstance, loadingInstance) {
|
|
|
67
69
|
buildInRequest(GET_SYS_PARAM_CACHE, {
|
|
68
70
|
tenantId
|
|
69
71
|
}).then(ret => {
|
|
70
|
-
if (resultToast(ret.data, messageTipInstance)) {
|
|
72
|
+
if (resultToast(ret.data, messageTipInstance, { noSuccessIip: true })) {
|
|
71
73
|
selects.value = JSON.parse(ret.data.result || '{}')
|
|
72
74
|
return
|
|
73
75
|
}
|
package/src/index.jsx
CHANGED
|
@@ -82,10 +82,24 @@ export default {
|
|
|
82
82
|
type: [Object, Function],
|
|
83
83
|
default: () => null
|
|
84
84
|
},
|
|
85
|
+
openChildDialogInstance: {
|
|
86
|
+
type: [Function],
|
|
87
|
+
default: () => {
|
|
88
|
+
return () => {}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
confirmInstance: {
|
|
92
|
+
type: [Object, Function],
|
|
93
|
+
default: () => {
|
|
94
|
+
return () => {}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
85
97
|
loadEvnetsReq: {
|
|
86
98
|
type: Object,
|
|
87
99
|
default: () => ({})
|
|
88
|
-
}
|
|
100
|
+
},
|
|
101
|
+
// 提示语的回调
|
|
102
|
+
messageCb: Function,
|
|
89
103
|
},
|
|
90
104
|
setup(props, { emit, attrs, expose }) {
|
|
91
105
|
const rootStore = reactive({})
|
|
@@ -120,7 +134,8 @@ export default {
|
|
|
120
134
|
isH5: props.isH5,
|
|
121
135
|
rootValue: props.modelValue,
|
|
122
136
|
axiosInstance,
|
|
123
|
-
messageInstance: props.messageInstance
|
|
137
|
+
messageInstance: props.messageInstance,
|
|
138
|
+
messageCb: props.messageCb
|
|
124
139
|
})
|
|
125
140
|
// 触发加载事件执行
|
|
126
141
|
executeLoadServices(
|
|
@@ -146,7 +161,8 @@ export default {
|
|
|
146
161
|
isH5: props.isH5,
|
|
147
162
|
rootValue: props.modelValue,
|
|
148
163
|
axiosInstance,
|
|
149
|
-
messageInstance: props.messageInstance
|
|
164
|
+
messageInstance: props.messageInstance,
|
|
165
|
+
messageCb: props.messageCb
|
|
150
166
|
})
|
|
151
167
|
executeLoadServices(
|
|
152
168
|
props.config?.pmPageServiceMapVOList || [],
|
|
@@ -163,7 +179,10 @@ export default {
|
|
|
163
179
|
)
|
|
164
180
|
})
|
|
165
181
|
|
|
182
|
+
provide('_messageCb', props.messageCb)
|
|
166
183
|
provide('_rootStore', rootStore)
|
|
184
|
+
provide('_openChildDialogInstance', toRef(props, 'openChildDialogInstance'))
|
|
185
|
+
provide('_confirmInstance', toRef(props, 'confirmInstance'))
|
|
167
186
|
provide('_messageInstance', toRef(props, 'messageInstance'))
|
|
168
187
|
provide('_loadingInstance', toRef(props, 'loadingInstance'))
|
|
169
188
|
provide('_getNativeComps', props.getNativeComps)
|
package/src/resolver-H5.vue
CHANGED
|
@@ -4,6 +4,7 @@ import { useAttrs } from 'vue';
|
|
|
4
4
|
import Resolver from './resolver-common.vue'
|
|
5
5
|
import CmiToast from "cmid/lib/toast"
|
|
6
6
|
import CmiFullLoading from "cmid/lib/fullloading"
|
|
7
|
+
import { confirmDialog } from './components/confirmInstance-H5/index.js';
|
|
7
8
|
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
loadingInstance: {
|
|
@@ -16,6 +17,18 @@ const props = defineProps({
|
|
|
16
17
|
default: () => CmiToast
|
|
17
18
|
// default: () => null
|
|
18
19
|
},
|
|
20
|
+
confirmInstance: {
|
|
21
|
+
type: [Object, Function],
|
|
22
|
+
default: () => {
|
|
23
|
+
return confirmDialog
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
openChildDialogInstance: {
|
|
27
|
+
type: [Function],
|
|
28
|
+
default: () => {
|
|
29
|
+
return () => {}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
19
32
|
})
|
|
20
33
|
|
|
21
34
|
defineOptions({
|
|
@@ -25,5 +38,12 @@ const attrs = useAttrs()
|
|
|
25
38
|
|
|
26
39
|
</script>
|
|
27
40
|
<template>
|
|
28
|
-
<Resolver
|
|
41
|
+
<Resolver
|
|
42
|
+
v-bind="attrs"
|
|
43
|
+
:isH5="true" :getNativeComps="getNativeComps"
|
|
44
|
+
:messageInstance="props.messageInstance"
|
|
45
|
+
:confirmInstance="props.confirmInstance"
|
|
46
|
+
:openChildDialogInstance="props.openChildDialogInstance"
|
|
47
|
+
:loadingInstance="props.loadingInstance"
|
|
48
|
+
></Resolver>
|
|
29
49
|
</template>
|
package/src/resolver-common.vue
CHANGED
package/src/resolver-web.vue
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import getNativeComps from './components/patchComponents-web'
|
|
3
|
-
import { ElMessage } from "element-plus"
|
|
3
|
+
import { ElMessage, ElMessageBox } from "element-plus"
|
|
4
4
|
import { loadingInstance } from './components/loading'
|
|
5
5
|
import { useAttrs } from 'vue';
|
|
6
6
|
import Resolver from './resolver-common.vue'
|
|
7
|
+
import { openChildDialog } from './components/childDialog';
|
|
7
8
|
|
|
8
9
|
const props = defineProps({
|
|
9
10
|
loadingInstance: {
|
|
@@ -15,6 +16,18 @@ const props = defineProps({
|
|
|
15
16
|
type: [Object, Function],
|
|
16
17
|
default: () => ElMessage
|
|
17
18
|
},
|
|
19
|
+
confirmInstance: {
|
|
20
|
+
type: [Object, Function],
|
|
21
|
+
default: () => {
|
|
22
|
+
return ElMessageBox.confirm.bind(ElMessageBox)
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
openChildDialogInstance: {
|
|
26
|
+
type: [Function],
|
|
27
|
+
default: () => {
|
|
28
|
+
return openChildDialog
|
|
29
|
+
}
|
|
30
|
+
},
|
|
18
31
|
})
|
|
19
32
|
|
|
20
33
|
defineOptions({
|
|
@@ -24,5 +37,12 @@ const attrs = useAttrs()
|
|
|
24
37
|
|
|
25
38
|
</script>
|
|
26
39
|
<template>
|
|
27
|
-
<Resolver
|
|
40
|
+
<Resolver
|
|
41
|
+
v-bind="attrs"
|
|
42
|
+
:getNativeComps="getNativeComps"
|
|
43
|
+
:messageInstance="props.messageInstance"
|
|
44
|
+
:confirmInstance="props.confirmInstance"
|
|
45
|
+
:openChildDialogInstance="props.openChildDialogInstance"
|
|
46
|
+
:loadingInstance="props.loadingInstance"
|
|
47
|
+
></Resolver>
|
|
28
48
|
</template>
|
package/src/utils/render.jsx
CHANGED
|
@@ -25,7 +25,7 @@ import { preserveCheck } from './preserveFunc.js'
|
|
|
25
25
|
import { isArray, isFunction, isString } from './is.js'
|
|
26
26
|
import CustomComponentPlain from '../components/packages-web/CustomComponentPlain.vue'
|
|
27
27
|
import QuestionFilled from '../components/icons/question-filled.vue'
|
|
28
|
-
import { dispatchClickEvent, dispatchClickEvents, getTableConfig } from '../components/helper/
|
|
28
|
+
import { dispatchClickEvent, dispatchClickEvents, getTableConfig } from '../components/helper/eventOrchestration.js'
|
|
29
29
|
|
|
30
30
|
// 解析配置中的defStyle属性
|
|
31
31
|
export function parseDefStyle(defStyle) {
|
|
@@ -105,7 +105,8 @@ export function parsePageConfig({
|
|
|
105
105
|
config, lang, polyfillConfigs, instance, isH5,
|
|
106
106
|
rootValue,
|
|
107
107
|
axiosInstance,
|
|
108
|
-
messageInstance
|
|
108
|
+
messageInstance,
|
|
109
|
+
messageCb
|
|
109
110
|
}) {
|
|
110
111
|
if (!config) return {}
|
|
111
112
|
const formConfig = generateFormConfig(lang, isH5)
|
|
@@ -118,7 +119,8 @@ export function parsePageConfig({
|
|
|
118
119
|
cbs,
|
|
119
120
|
rootValue,
|
|
120
121
|
axiosInstance,
|
|
121
|
-
messageInstance
|
|
122
|
+
messageInstance,
|
|
123
|
+
messageCb
|
|
122
124
|
}, formConfig)
|
|
123
125
|
cbs.forEach((cb) => {
|
|
124
126
|
cb()
|
|
@@ -142,7 +144,8 @@ export function normalConfig({
|
|
|
142
144
|
cbs = [],
|
|
143
145
|
rootValue,
|
|
144
146
|
axiosInstance,
|
|
145
|
-
messageInstance
|
|
147
|
+
messageInstance,
|
|
148
|
+
messageCb
|
|
146
149
|
}, config, hireRelat = '', mapComp = {}, needformItem = false) {
|
|
147
150
|
const metaCode = config.metaCode || ''
|
|
148
151
|
hireRelat += hireRelat ? `->${metaCode}` : metaCode
|
|
@@ -183,7 +186,8 @@ export function normalConfig({
|
|
|
183
186
|
instance,
|
|
184
187
|
rootValue,
|
|
185
188
|
axiosInstance,
|
|
186
|
-
messageInstance
|
|
189
|
+
messageInstance ,
|
|
190
|
+
messageCb
|
|
187
191
|
}, metaItem, hireRelat, mapComp, needformItem || [FORM_META_TYPE].includes(metaType))
|
|
188
192
|
return pageConfig
|
|
189
193
|
})?.sort((a, b) => a.seqNo - b.seqNo)
|
|
@@ -217,7 +221,7 @@ export function normalConfig({
|
|
|
217
221
|
const dynamicMapComp = props.config.dynamicMapComp
|
|
218
222
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
219
223
|
const dynamicHireRelat = props.config.dynamicHireRelat
|
|
220
|
-
dispatchClickEvent(service, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, rootValue, axiosInstance, messageInstance })
|
|
224
|
+
dispatchClickEvent(service, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, rootValue, messageCb, compConfig: pageConfig, axiosInstance, messageInstance })
|
|
221
225
|
// }, 0);
|
|
222
226
|
}
|
|
223
227
|
tableConfig.sizeChange = (val, props, page) => {
|
|
@@ -225,7 +229,7 @@ export function normalConfig({
|
|
|
225
229
|
const dynamicMapComp = props.config.dynamicMapComp
|
|
226
230
|
const dynamicMapCompKeys = Object.keys(dynamicMapComp)
|
|
227
231
|
const dynamicHireRelat = props.config.dynamicHireRelat
|
|
228
|
-
dispatchClickEvent(service, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, rootValue, axiosInstance, messageInstance })
|
|
232
|
+
dispatchClickEvent(service, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, rootValue, messageCb, compConfig: pageConfig, axiosInstance, messageInstance })
|
|
229
233
|
// }, 0);
|
|
230
234
|
}
|
|
231
235
|
}))
|
package/src/utils/respone.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isPromise } from "./common"
|
|
2
|
+
|
|
1
3
|
export const RESULT_CODE = {
|
|
2
4
|
SUCCESS: '000000',
|
|
3
5
|
INFO: '000088',
|
|
@@ -5,37 +7,54 @@ export const RESULT_CODE = {
|
|
|
5
7
|
ERROR: '000000',
|
|
6
8
|
OTHER: '020002'
|
|
7
9
|
}
|
|
8
|
-
export function resultToast(result = {}, messageInstance, {noSuccessIip = false} = {}) {
|
|
10
|
+
export function resultToast(result = {}, messageInstance, {messageCb, service, compConfig, noSuccessIip = false} = {}) {
|
|
9
11
|
let ret = false
|
|
12
|
+
let cbKey = ''
|
|
10
13
|
const resultMessage = result?.resultMessage || ''
|
|
11
14
|
const resultCode = result.resultCode
|
|
12
15
|
switch (resultCode) {
|
|
13
16
|
case RESULT_CODE.SUCCESS:
|
|
14
17
|
if (!noSuccessIip) {
|
|
15
|
-
|
|
18
|
+
cbKey = 'success'
|
|
16
19
|
}
|
|
17
20
|
ret = true
|
|
18
21
|
break;
|
|
19
22
|
case RESULT_CODE.INFO:
|
|
20
23
|
if (messageInstance.info && typeof messageInstance.info === 'function') {
|
|
21
|
-
|
|
24
|
+
cbKey = 'info'
|
|
22
25
|
} else if (messageInstance.text && typeof messageInstance.text === 'function') {
|
|
23
26
|
// 移动端兼容写法
|
|
24
|
-
|
|
27
|
+
cbKey = 'text'
|
|
25
28
|
}
|
|
26
29
|
break;
|
|
27
30
|
case RESULT_CODE.WARNING:
|
|
28
|
-
|
|
31
|
+
cbKey = 'warning'
|
|
29
32
|
break;
|
|
30
33
|
case RESULT_CODE.ERROR:
|
|
31
|
-
|
|
34
|
+
cbKey = 'error'
|
|
32
35
|
break;
|
|
33
36
|
case RESULT_CODE.OTHER:
|
|
34
|
-
|
|
37
|
+
cbKey = 'error'
|
|
35
38
|
break;
|
|
36
39
|
default:
|
|
37
|
-
|
|
40
|
+
cbKey = 'error'
|
|
38
41
|
break;
|
|
39
42
|
}
|
|
43
|
+
|
|
44
|
+
if (messageCb) {
|
|
45
|
+
if (isPromise(messageCb)) {
|
|
46
|
+
messageCb({resultMessage, result, resultCode, service, compConfig}).then(res => {
|
|
47
|
+
if (res === true) {
|
|
48
|
+
messageInstance?.[cbKey]?.(resultMessage)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
} else {
|
|
52
|
+
if (messageCb({resultMessage, result, resultCode, service, compConfig}) === true) {
|
|
53
|
+
messageInstance?.[cbKey]?.(resultMessage)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
messageInstance?.[cbKey]?.(resultMessage)
|
|
58
|
+
}
|
|
40
59
|
return ret
|
|
41
60
|
}
|