resolver-egretimp-plus 0.0.111 → 0.0.112

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.111",
3
+ "version": "0.0.112",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -5,7 +5,19 @@ import { RESULT_CODE, resultToast } from "../../utils/respone"
5
5
  import { isPromise, parseExtendAttr, unionWith } from "../../utils/index"
6
6
  import { buildInRequest } from "../../utils/request"
7
7
 
8
- function assignmentPatchVal(obj = {}, path, val) {
8
+ function getPathVal(obj = {}, path) {
9
+ let paths = path
10
+ if (typeof path === 'string') {
11
+ paths = path.split('.')
12
+ }
13
+ return paths.reduce((ret, key) => {
14
+ if (ret) {
15
+ return ret[key]
16
+ }
17
+ return null
18
+ }, obj) || ''
19
+ }
20
+ function assignmentPathVal(obj = {}, path, val) {
9
21
  let paths = path
10
22
  if (typeof path === 'string') {
11
23
  paths = path.split('.')
@@ -39,8 +51,8 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
39
51
  reqData = getReqData(service.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
40
52
  tableConfig = getTableConfig(service.outParamMappingList, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat })
41
53
  if (tableConfig?.vm) {
42
- assignmentPatchVal(reqData, service.pageNum || 'pageNum', tableConfig.vm.page?.pageNum)
43
- assignmentPatchVal(reqData, service.pageSize || 'pageSize', tableConfig.vm.page?.pageSize)
54
+ assignmentPathVal(reqData, service.pageNum || 'pageNum', tableConfig.vm.page?.pageNum)
55
+ assignmentPathVal(reqData, service.pageSize || 'pageSize', tableConfig.vm.page?.pageSize)
44
56
  }
45
57
  reqData = {
46
58
  ...reqData,
@@ -97,7 +109,7 @@ export async function dispatchClickEvent(service, { dynamicMapComp, requestTrace
97
109
  // ret.data = {result: {pageTotalCount: 100, result: [{},{},{},{},{}]}}
98
110
  initOutParamData(service.outParamMappingList, {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat, outResult: ret.data})
99
111
  if (tableConfig?.vm) {
100
- const total = parseInt(ret.data?.result?.[service.pageTotalCount || 'pageCount'])
112
+ const total = parseInt(getPathVal(ret.data?.result || {}, service.pageTotalCount || 'pageCount'))
101
113
  tableConfig.vm.page.total = total
102
114
  // tableConfig.vm?.changePage(total, 'total')
103
115
  }
@@ -113,7 +125,7 @@ function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys
113
125
  const configCode = configCodes[0]
114
126
  if (configCode) {
115
127
  const destParamArr = destParam?.split('.') || []
116
- assignmentPatchVal(ret, destParamArr, dynamicMapComp[configCode]?.refValue)
128
+ assignmentPathVal(ret, destParamArr, dynamicMapComp[configCode]?.refValue)
117
129
 
118
130
  // let currentObj = ret
119
131
  // destParamArr.forEach((item, idx) => {