resolver-egretimp-plus 0.1.2 → 0.1.3

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.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -71,11 +71,13 @@ export default {
71
71
  const builtPolyfillReq = inject('_builtPolyfillReq')
72
72
  const rootValue = inject('rootValue')
73
73
  const validate = inject('_validate')
74
+ const lang = inject('lang')
74
75
 
75
76
  const selects = inject('selects')
76
77
  const _parentRootValue = inject('_parentRootValue')
77
78
  const _parentDynamicMapComp = inject('_parentDynamicMapComp')
78
79
 
80
+ definePrivatelyProp(props.config, '_lang', lang)
79
81
  definePrivatelyProp(props.config, '_rootValue', rootValue)
80
82
  definePrivatelyProp(props.config, 'router', router)
81
83
  definePrivatelyProp(props.config, 'route', route)
@@ -234,7 +236,6 @@ export default {
234
236
  provide('parent', props.config)
235
237
 
236
238
  const _isH5 = inject('_isH5')
237
- const lang = inject('lang')
238
239
  const onClick = (e, params) => {
239
240
  const context = {
240
241
  props,
@@ -25,7 +25,7 @@ function assignmentPathVal(obj = {}, path, val) {
25
25
  let currentObj = obj
26
26
  paths.forEach((item, idx) => {
27
27
  if (idx + 1 === paths.length) {
28
- currentObj[item] = val
28
+ currentObj[item] = val ?? ''
29
29
  } else {
30
30
  if (!currentObj[item]) {
31
31
  currentObj[item] = {}
@@ -85,7 +85,7 @@ export async function dispatchClickEvent(service, {
85
85
  }
86
86
 
87
87
  if (service.transactionType == '1') {
88
- reqData = getReqData(service.inParamMappingList || [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
88
+ reqData = getReqData(service.inParamMappingList || [], {emptyUpdate: true, dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat})
89
89
  tableConfig = getTableConfig(service.outParamMappingList, { dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat })
90
90
  if (tableConfig?.vm) {
91
91
  if (!isUndefined(tableConfig.vm.page?.pageNum) && !isNull(tableConfig.vm.page?.pageNum) ) {
@@ -102,7 +102,8 @@ export async function dispatchClickEvent(service, {
102
102
  }
103
103
  const url = service.serviceCode
104
104
  const httpMethod = service.httpMethod || "post"
105
- const reqResult = {
105
+
106
+ let reqResult = {
106
107
  aid_language: lang,
107
108
  requestTraceId,
108
109
  pmHandleBusinessIdentity: {
@@ -111,6 +112,15 @@ export async function dispatchClickEvent(service, {
111
112
  tenantId: service.tenantId,
112
113
  mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
113
114
  },
115
+
116
+ }
117
+ const notDefaultParmas = serviceCustomProps?.notDefaultParmas
118
+ if (notDefaultParmas) {
119
+ reqResult = {
120
+ }
121
+ }
122
+ reqResult = {
123
+ ...reqResult,
114
124
  ...reqData
115
125
  }
116
126
 
@@ -177,7 +187,7 @@ export async function dispatchClickEvent(service, {
177
187
  }
178
188
  }
179
189
 
180
- function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat}) {
190
+ function getReqData(inParamMappingList = [], {emptyUpdate, dynamicMapComp, dynamicMapCompKeys, dynamicHireRelat}) {
181
191
  return inParamMappingList.reduce((ret, params) => {
182
192
  const { orignParam = '', destParam = '' } = params
183
193
  const configCodes = getRelateConfigKeys(dynamicMapCompKeys, orignParam, dynamicHireRelat)
@@ -187,8 +197,18 @@ function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys
187
197
  const configCode = configCodes[0]
188
198
  if (
189
199
  configCode &&
190
- !isUndefined(dynamicMapComp[configCode]?.refValue) &&
191
- !isNull(dynamicMapComp[configCode]?.refValue)
200
+ (
201
+ (
202
+ (
203
+ isUndefined(dynamicMapComp[configCode]?.refValue) ||
204
+ isNull(dynamicMapComp[configCode]?.refValue)
205
+ ) && emptyUpdate
206
+ ) ||
207
+ (
208
+ !isUndefined(dynamicMapComp[configCode]?.refValue) &&
209
+ !isNull(dynamicMapComp[configCode]?.refValue)
210
+ )
211
+ )
192
212
  ) {
193
213
  let destParamArr
194
214
  if (destParam?.indexOf('->') !== -1) {
@@ -196,7 +216,7 @@ function getReqData(inParamMappingList = [], {dynamicMapComp, dynamicMapCompKeys
196
216
  } else {
197
217
  destParamArr = destParam?.split('.') || []
198
218
  }
199
- assignmentPathVal(ret, destParamArr, dynamicMapComp[configCode]?.refValue)
219
+ assignmentPathVal(ret, destParamArr, dynamicMapComp?.[configCode]?.refValue)
200
220
  }
201
221
  return ret
202
222
  }, {})
@@ -48,6 +48,7 @@ const reserveBottomMargin = computed(() => {
48
48
  </script>
49
49
  <style lang="scss">
50
50
  .custom-component-row {
51
+ max-width: 100%;
51
52
  .el-col {
52
53
  & > .el-form-item {
53
54
  }
@@ -1,6 +1,6 @@
1
1
  import { ElSelect, ElOption } from 'element-plus'
2
- import { computed, inject} from 'vue'
3
- import { commonPropsType } from '../../utils/index.js'
2
+ import { computed, inject, onMounted, watch} from 'vue'
3
+ import { commonPropsType, isString } from '../../utils/index.js'
4
4
 
5
5
  export default {
6
6
  inheritAttrs: false,
@@ -28,7 +28,26 @@ export default {
28
28
  // 这个是真实的值
29
29
  const modelValue = computed({
30
30
  get() {
31
- return props.modelValue
31
+ let val = props.modelValue
32
+ if (isStrVal.value || !isMutiple.value) {
33
+ if (!isString(val)) {
34
+ try {
35
+ val = Object.values(val).join(props.separator)
36
+ emit('update:modelValue', val)
37
+ } catch (error) {
38
+ val = val
39
+ }
40
+ }
41
+ } else {
42
+ if (val && isString(val)) {
43
+ val = val?.split(props.separator)
44
+ if (isObject.value) {
45
+ val = val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {})
46
+ }
47
+ emit('update:modelValue', val)
48
+ }
49
+ }
50
+ return val
32
51
  },
33
52
  set(val) {
34
53
  emit('update:modelValue', val)
@@ -150,7 +169,6 @@ export default {
150
169
  })
151
170
  }
152
171
  }
153
-
154
172
  return () => {
155
173
  return (
156
174
  <ElSelect class="custom-self-select" { ...{...attrs, ...selectProps.value }} v-model={value.value} onClear={clear}>
@@ -50,11 +50,48 @@ const eventsMap = {
50
50
  14: 'setNoDisableNotEffect',
51
51
  16: 'setProps'
52
52
  }
53
+ function replaceDefValue(str, {config, dynamicMapComp}) {
54
+ return str?.replace(/\$\{([^}]+)\}/g, (a, val, c) => {
55
+ let routeMatchs = null
56
+ const _absoluteTarget = /^_absoluteTarget:(.+)$/
57
+ const matchs = val?.match?.(_absoluteTarget)
58
+ if (val === ARG_FLAGS.REF_VAL) {
59
+ val = config?.bindValue ?? ''
60
+ } else if(val === ARG_FLAGS.CURRENT_DATE) {
61
+ val = formatDate(new Date(), 'yyyy-MM-dd')
62
+ } else if (routeMatchs = val.match(/^_route:(.*)$/)) {
63
+ const queryKey = routeMatchs[1]
64
+ const routeQuery = config?.route?.query
65
+ val = routeQuery?.[queryKey]
66
+ } else if ( typeof val === 'string' && (/^_lang$/.test(val))) {
67
+ val = config?._lang
68
+ } else if (matchs?.[1]) {
69
+ const targetConfig = dynamicMapComp?.[matchs[1]]
70
+ val = targetConfig?.bindValue || ''
71
+ } else {
72
+ const _assginKey = /^_assgin:(.*)$/
73
+ const matchs = val?.match?.(_assginKey)
74
+ if (matchs) {
75
+ val = matchs?.[1]
76
+ } else {
77
+ val = ''
78
+ }
79
+ }
80
+ return val
81
+ })
82
+ }
53
83
  const allInitEvents = {
54
84
  setDefaultValue(event, isInit, tabpanelCode) {
55
- const { targetObj: target, targetObjVal } = event
85
+ let { targetObj: target, targetObjVal } = event
56
86
  if (!target) return
87
+ const { config } = this
88
+ const { dynamicMapComp } = this
57
89
  const targetObj = `${tabpanelCode ? tabpanelCode + '->' : ''}${target}`
90
+ const isReplace = /^_replace:/.test(targetObjVal)
91
+ if (isReplace) {
92
+ targetObjVal = replaceDefValue(targetObjVal?.replace(/^_replace:/, ''), {config, dynamicMapComp})
93
+
94
+ }
58
95
  let val = ''
59
96
  try {
60
97
  val = JSON.parse(targetObjVal)
@@ -64,8 +101,10 @@ const allInitEvents = {
64
101
  if (typeof val === 'number') {
65
102
  val = `${val}`
66
103
  }
67
- if (val === ARG_FLAGS.REF_VAL) {
68
- const { config } = this
104
+
105
+ if (isReplace) {
106
+ val = val
107
+ } else if (val === ARG_FLAGS.REF_VAL) {
69
108
  val = config?.bindValue ?? ''
70
109
  } else if(val === ARG_FLAGS.CURRENT_DATE) {
71
110
  val = formatDate(new Date(), 'yyyy-MM-dd')
@@ -74,12 +113,12 @@ const allInitEvents = {
74
113
  const _absoluteTarget = /^_absoluteTarget:(.+)$/
75
114
  const matchs = val?.match?.(_absoluteTarget)
76
115
  if ( typeof val === 'string' && (routeMatchs = val.match(/^_route:(.*)$/))) {
77
- const { config } = this
78
116
  const queryKey = routeMatchs[1]
79
117
  const routeQuery = config?.route?.query
80
118
  val = routeQuery?.[queryKey]
119
+ } else if ( typeof val === 'string' && (/^_lang$/.test(val))) {
120
+ val = config?._lang
81
121
  } else if (typeof val === 'string' && matchs?.[1]) {
82
- const { dynamicMapComp } = this
83
122
  const targetConfig = dynamicMapComp?.[matchs[1]]
84
123
  val = targetConfig?.bindValue || ''
85
124
  } else {
@@ -87,7 +126,7 @@ const allInitEvents = {
87
126
  const matchs = val?.match?.(_assginKey)
88
127
  if (matchs) {
89
128
  val = matchs?.[1]
90
- } else {
129
+ } else {
91
130
  const curVal = getConfigValue.call(this, targetObj, true)
92
131
  if (curVal || curVal == '0') {
93
132
  val = curVal
@@ -95,6 +134,7 @@ const allInitEvents = {
95
134
  }
96
135
  }
97
136
  }
137
+
98
138
  setFormVal.call(this, targetObj, val)
99
139
  },
100
140
  setClear(event, isInit, tabpanelCode) {
@@ -11,6 +11,8 @@ export default function defaultVal(config) {
11
11
  const queryKey = routeMatchs[1]
12
12
  const routeQuery = config?.route?.query
13
13
  defaultVal = routeQuery?.[queryKey]
14
+ } else if ( typeof configDefaultVal === 'string' && (/^_lang$/.test(configDefaultVal))) {
15
+ defaultVal = config?._lang
14
16
  } else if (/^{[\w\W]*}$/.test(configDefaultVal) || /^\[[\w\W]*\]$/.test(configDefaultVal)) {
15
17
  defaultVal = JSON.parse(configDefaultVal)
16
18
  } else {