resolver-egretimp-plus 0.0.58 → 0.0.59

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
  {
2
2
  "name": "resolver-egretimp-plus",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -48,6 +48,7 @@ export default {
48
48
  delete ret.onClick
49
49
  return ret
50
50
  })
51
+ const buttonActions = inject('buttonActions', {})
51
52
  const route = useRoute()
52
53
  const routeQuery= route?.query
53
54
  const hireRelatMapRules = inject('hireRelatMapRules')
@@ -188,6 +189,7 @@ export default {
188
189
  openChildDialog: openChildDialogInstance?.value,
189
190
  messageInstance: messageInstance?.value,
190
191
  messageCb,
192
+ buttonActions,
191
193
  lang: lang?.value,
192
194
  appContext
193
195
  })
@@ -12,9 +12,14 @@ const props = defineProps({
12
12
  },
13
13
  // 请求方法的实列
14
14
  axiosInstance: {
15
- type: [Object, Function],
16
- default: () => null
17
- },
15
+ type: [Object, Function],
16
+ default: () => null
17
+ },
18
+ // 按钮的工作集合
19
+ buttonActions: {
20
+ type: Object,
21
+ default: () => ({})
22
+ },
18
23
  // config的额外属性配置
19
24
  polyfillConfigs: {
20
25
  type: Object,
@@ -76,6 +81,7 @@ defineExpose({
76
81
  v-model="formData"
77
82
  :busiIdentityId="busiIdentityId"
78
83
  :lang="props.lang"
84
+ :buttonActions="props.buttonActions"
79
85
  :loadEvnetsReq="props.loadEvnetsReq"
80
86
  :polyfillConfigs="props.polyfillConfigs"
81
87
  :axiosInstance="props.axiosInstance"
@@ -1,6 +1,8 @@
1
+ import { isArray } from "../../utils/is"
1
2
  import { DATA_VALID_RULE_EXECUTE } from "../../api/builtIn"
2
3
  import { getRelateConfigKeys } from "../../rules/ruleUtils"
3
4
  import { RESULT_CODE, resultToast } from "../../utils/respone"
5
+ import { unionWith } from "../../utils/index"
4
6
 
5
7
  export async function dispatchClickEvents ({serviceList = [], axiosInstance, dynamicMapComp, rootValue, dynamicHireRelat, messageCb, compConfig, messageInstance}) {
6
8
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
@@ -77,7 +79,7 @@ function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys
77
79
 
78
80
  function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult = {} }) {
79
81
  outParamMappingList.forEach(params => {
80
- const { orignParam = '', destParam = '' } = params
82
+ const { orignParam = '', destParam = '', isList = false, primaryKeys = [] } = params
81
83
  const configCodes = getRelateConfigKeys(dynamicMapCompKeys, destParam, dynamicHireRelat)
82
84
  if (configCodes.length > 1) {
83
85
  console.error('search arg muti', params, configCodes)
@@ -87,10 +89,19 @@ function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMap
87
89
 
88
90
  if (compConfig) {
89
91
  const orignParamArr = orignParam ? orignParam?.split('.') : []
90
- const val = orignParamArr.reduce((ret, item) => {
92
+ let val = orignParamArr.reduce((ret, item) => {
91
93
  if (!ret) return
92
94
  return ret[item]
93
95
  }, outResult)
96
+ if (isList) {
97
+ if (!isArray(val)) {
98
+ val = isArray(compConfig.refValue) ? compConfig.refValue : []
99
+ } else if (isArray(compConfig.refValue) && isArray(val)) {
100
+ val = unionWith(compConfig.refValue, val, (arrVal, othVal) => {
101
+ return (primaryKeys && primaryKeys.length) ? primaryKeys.map(key => arrVal[key] == othVal[key])?.every(item => item) : false
102
+ })
103
+ }
104
+ }
94
105
  compConfig.refValue = val
95
106
  }
96
107
  })
@@ -120,20 +131,47 @@ export function openDailg({
120
131
  dynamicMapComp,
121
132
  dynamicHireRelat,
122
133
  lang,
134
+ buttonActions,
123
135
  openChildDialog,
124
136
  appContext,
125
137
  }) {
126
138
  const busiIdentityId = pagePopupMap.popupBusiIdentityId
127
139
  const dynamicMapCompKeys = Object.keys(dynamicMapComp)
128
140
  const reqData = getReqData(pagePopupMap.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
141
+
142
+ let mapList = {}
143
+ let outParamMappingList = []
144
+ // 是表格还是list
145
+ const isList = pagePopupMap?.objOrList == '1'
146
+ if (isList ) {
147
+ const primaryKeys = []
148
+ mapList = pagePopupMap?.outParamMappingList?.reduce((ret, item) => {
149
+ const { orignParam, destParam, primaryKeyFlag = '' } = item
150
+ ret[destParam] = orignParam
151
+ if (primaryKeyFlag == '1') {
152
+ primaryKeys.push(destParam)
153
+ }
154
+ return ret
155
+ }, {})
156
+
157
+ outParamMappingList = [
158
+ {
159
+ orignParam: '',
160
+ destParam: pagePopupMap.parentTable || '',
161
+ primaryKeys,
162
+ isList: true
163
+ }
164
+ ]
165
+ } else {
166
+ outParamMappingList = pagePopupMap?.outParamMappingList?.map(item => {
167
+ const orignParamArr = item.orignParam ? item.orignParam.split('->') : []
168
+ return {
169
+ ...item,
170
+ orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
171
+ }
172
+ }) || []
173
+ }
129
174
 
130
- const outParamMappingList = pagePopupMap?.outParamMappingList?.map(item => {
131
- const orignParamArr = item.orignParam ? item.orignParam.split('->') : []
132
- return {
133
- ...item,
134
- orignParam: item.orignParam ? orignParamArr[orignParamArr.length - 1] : ''
135
- }
136
- }) || []
137
175
 
138
176
  let rootStore = {}
139
177
  let dialogClose = null
@@ -142,7 +180,16 @@ export function openDailg({
142
180
  polyfillConfigs[pagePopupMap.outDisplayTrigger] = (config) => {
143
181
  return {
144
182
  onClick() {
145
- initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: rootStore.tableSelectedInfo})
183
+ const outResult = rootStore.tableSelectedInfo?.map(item => {
184
+ const retItem = {
185
+ ...item
186
+ }
187
+ Object.keys(mapList).forEach(key => {
188
+ retItem[key] = item[mapList[key]]
189
+ })
190
+ return retItem
191
+ })
192
+ initOutParamData(outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult})
146
193
  dialogClose?.()
147
194
  }
148
195
  }
@@ -158,6 +205,7 @@ export function openDailg({
158
205
  }
159
206
  }
160
207
  dialogClose = openChildDialog({
208
+ buttonActions,
161
209
  busiIdentityId,
162
210
  axiosInstance: axiosInstance,
163
211
  lang,
@@ -232,17 +280,20 @@ export async function executeDataValid(validConfig, { dynamicMapComp, mixinServi
232
280
  })
233
281
  }
234
282
 
235
- function closePage() {
236
- // window?.close()
237
- // window?.history?.back()
283
+ function closePage(lcpPageClosedMapVO) {
284
+ if (lcpPageClosedMapVO?.closedType == '1') {
285
+ const top = window.top
286
+ top?.close()
287
+ } else {
288
+ window?.history?.back()
289
+ }
238
290
  }
239
291
 
240
- export async function executeEventOrchestration({props, axiosInstance, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
292
+ export async function executeEventOrchestration({props, axiosInstance, buttonActions, rootValue, confirmInstance, dynamicMapComp, messageInstance, openChildDialog, messageCb, lang, appContext } = {}) {
241
293
  const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
242
294
  const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
243
295
  const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
244
296
  if (lcpPageRuleVOLis?.length && mixinServiceConfig) {
245
- // for(let i = 0; i < lcpPageRuleVOLis.length; i++) {
246
297
  // 数据校验服务
247
298
  const validConfig = lcpPageRuleVOLis[0]
248
299
  const valid = await executeDataValid(validConfig, {
@@ -255,8 +306,8 @@ export async function executeEventOrchestration({props, axiosInstance, rootValue
255
306
  if (!valid) {
256
307
  return
257
308
  }
258
- // }
259
309
  }
310
+
260
311
  if (PageServiceMapVOList?.length) {
261
312
  const dynamicHireRelat = props.config?.dynamicHireRelat
262
313
  dispatchClickEvents({
@@ -281,7 +332,12 @@ export async function executeEventOrchestration({props, axiosInstance, rootValue
281
332
  appContext,
282
333
  lang,
283
334
  messageCb,
335
+ buttonActions,
284
336
  openChildDialog
285
337
  })
286
338
  }
339
+ const lcpPageClosedMapVO = props.config.lcpPageClosedMapVO
340
+ if (lcpPageClosedMapVO) {
341
+ closePage(lcpPageClosedMapVO)
342
+ }
287
343
  }
@@ -2,7 +2,8 @@
2
2
  import { intersectionWith, isEqual, mergeWith, unionWith, isArray, cloneDeep } from 'lodash-es'
3
3
 
4
4
  export {
5
- cloneDeep
5
+ cloneDeep,
6
+ unionWith
6
7
  }
7
8
 
8
9
  function cached(fn) {