resolver-egretimp-plus 0.0.39 → 0.0.42

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.39",
3
+ "version": "0.0.42",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -1,9 +1,11 @@
1
1
  import { computed, defineAsyncComponent, getCurrentInstance, inject, onBeforeMount, provide, ref } from 'vue'
2
- import { getComponentPropsKeys, hasOwn } from './utils/index.js'
2
+ import { commonPropsType, getComponentPropsKeys, hasOwn } from './utils/index.js'
3
3
  import { useVmodels } from './hooks/index.js'
4
4
  import { getRenderComponentProps, generateFormItemPolyfill } from './utils/index.js'
5
5
  import rulesDriver from './rules/rulesDriver'
6
6
  import { penddingRules } from './rules/ruleUtils.js'
7
+ import { useRoute } from 'vue-router'
8
+ import { executeEventOrchestration } from './components/helper/eventOrchestration.js'
7
9
 
8
10
  export default {
9
11
  name: 'AnalysisComponent',
@@ -39,9 +41,29 @@ export default {
39
41
  },
40
42
  emits: ['update:modelValue'],
41
43
  setup(props, { emit, attrs }) {
44
+ const currentAttrs = computed(() => {
45
+ const ret = {
46
+ ...attrs
47
+ }
48
+ delete ret.onClick
49
+ return ret
50
+ })
51
+ const route = useRoute()
52
+ const routeQuery= route?.query
53
+ const hireRelatMapRules = inject('hireRelatMapRules')
54
+ const components = inject('components')
55
+ const dataLoad = inject('dataLoad')
56
+ const rootForm = inject('rootForm')
57
+ const _axiosInstance = inject('_axiosInstance')
58
+ const confirmInstance = inject('_confirmInstance')
59
+ const openChildDialogInstance = inject('_openChildDialogInstance')
60
+ const messageCb = inject('_messageCb')
61
+ const messageInstance = inject('_messageInstance')
62
+
42
63
  const selects = inject('selects')
43
64
  // 当前组件的实例
44
65
  const instance = getCurrentInstance()
66
+ const appContext = instance?.appContext
45
67
  props.config.wrapVm = instance
46
68
  const refFn = e => {
47
69
  // 具体渲染的组件
@@ -142,8 +164,39 @@ export default {
142
164
  const _isH5 = inject('_isH5')
143
165
  const lang = inject('lang')
144
166
  const rootValue = inject('rootValue')
167
+ const onClick = (e) => {
168
+ e.stopPropagation()
169
+ const context = {
170
+ props,
171
+ dynamicMapComp,
172
+ hireRelatMapRules,
173
+ components,
174
+ selects,
175
+ rootValue: rootValue?.value,
176
+ dataLoad,
177
+ rootForm,
178
+ routeQuery,
179
+ appContext
180
+ }
181
+ attrs?.onClick?.call(context, e) // 如果配置中有点击事件
182
+
183
+ executeEventOrchestration({
184
+ props,
185
+ axiosInstance: _axiosInstance?.value,
186
+ rootValue: rootValue?.value,
187
+ confirmInstance: confirmInstance?.value,
188
+ dynamicMapComp,
189
+ openChildDialog: openChildDialogInstance?.value,
190
+ messageInstance: messageInstance?.value,
191
+ messageCb,
192
+ lang: lang?.value,
193
+ appContext
194
+ })
195
+ }
145
196
  return () => {
146
197
  const compProps = getRenderComponentProps({config: props.config, props, component: props.component, modelValue, selects})
198
+ const compPropsOnClick = compProps?.onClick
199
+ delete compProps.onClick
147
200
  const formItemPolyfill = generateFormItemPolyfill(props.config, lang.value, compProps, _isH5?.value, {
148
201
  lang,
149
202
  rootValue,
@@ -152,14 +205,15 @@ export default {
152
205
  }) // 生成formItem()的辅助函数
153
206
  return formItemPolyfill(
154
207
  <currentComponent.value
155
- ref={refFn}
156
- onVnodeMounted={onVnodeMounted}
157
- onVnodeUnmounted={onVnodeUnmounted}
158
- {...attrs}
159
- {...componentProps.value}
160
- {...compProps}
161
- {...vModelObjs}
162
- ></currentComponent.value>
208
+ ref={refFn}
209
+ onVnodeMounted={onVnodeMounted}
210
+ onVnodeUnmounted={onVnodeUnmounted}
211
+ {...currentAttrs.value}
212
+ onClick={(e) => {onClick(e);compPropsOnClick?.(e)}}
213
+ {...componentProps.value}
214
+ {...compProps}
215
+ {...vModelObjs}
216
+ ></currentComponent.value>
163
217
  )
164
218
  }
165
219
  }
@@ -2,3 +2,4 @@ export const QUERY_PAGE_CONFIG_DATA = '/sa-lcp/api/v1/pageConfig/queryPageConfig
2
2
  export const LCP_LOGIN = '/sa-lcp/login'
3
3
  export const GET_SYS_PARAM_CACHE = '/sa-lcp/api/v1/sysparam/getSysParamCache'
4
4
  export const REFRESH_TOKEN = '/sa-lcp/changePwd/refreshToken'
5
+ export const DATA_VALID_RULE_EXECUTE = '/sa-lcp/api/v1/validate/dataValidRuleExecute'
@@ -49,7 +49,7 @@ function loadedConfigCompeted(pageConfig) {
49
49
  rootOptionComp.value = pageConfig.rootOptionComp
50
50
  }
51
51
  function rootStoreChange(rootStore) {
52
- props.rootStoreChange(rootStore)
52
+ props.rootStoreChange && props.rootStoreChange(rootStore)
53
53
  }
54
54
 
55
55
 
@@ -1,3 +1,4 @@
1
+ import { DATA_VALID_RULE_EXECUTE } from "../../api/builtIn"
1
2
  import { getRelateConfigKeys } from "../../rules/ruleUtils"
2
3
  import { RESULT_CODE, resultToast } from "../../utils/respone"
3
4
 
@@ -76,7 +77,8 @@ function initOutParamData(outParamMappingList = [], { dynamicMapComp, dynamicMap
76
77
  const compConfig = dynamicMapComp[configCode]
77
78
 
78
79
  if (compConfig) {
79
- const orignParamArr = orignParam?.split('.') || []
80
+ debugger
81
+ const orignParamArr = orignParam ? orignParam?.split('.') : []
80
82
  const val = orignParamArr.reduce((ret, item) => {
81
83
  if (!ret) return
82
84
  return ret[item]
@@ -159,28 +161,40 @@ export function openDailg({
159
161
  }
160
162
 
161
163
  // 数据校验服务
162
- export async function executeDataValid(validConfig, { dynamicMapComp, rootValue, axiosInstance, lang}) {
163
- let reqData = rootValue
164
- const url = service.serviceCode
164
+ export async function executeDataValid(validConfig, { dynamicMapComp, mixinServiceConfig, rootValue, axiosInstance, lang}) {
165
+ let reqData = rootValue || {}
166
+ const url = DATA_VALID_RULE_EXECUTE
165
167
  const ret = await (axiosInstance && axiosInstance({
166
168
  url,
167
169
  method: "post",
168
- data: reqData
170
+ data: {
171
+ pmHandleBusinessIdentity: {
172
+ busiIdentityId: validConfig.busiIdentityId,
173
+ pageMetaId: validConfig.pageMetaId,
174
+ tenantId: validConfig.tenantId,
175
+ mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
176
+ },
177
+ ...reqData
178
+ }
169
179
  }))
170
180
  const result = ret.data || {}
171
181
  const resultCode = result.resultCode
172
182
  const resultMessage = result?.resultMessage || ''
173
183
  let type = ''
184
+ let weakFlag = false
185
+
174
186
  if (RESULT_CODE.SUCCESS !== resultCode) {
175
187
  switch (resultCode) {
176
- case RESULT_CODE.INFO:
177
- type = 'info'
178
- break;
179
188
  case RESULT_CODE.WARNING:
180
189
  type = 'warning'
190
+ weakFlag = true
181
191
  break;
182
192
  case RESULT_CODE.ERROR:
183
193
  type = 'error'
194
+ weakFlag = false
195
+ break;
196
+ case RESULT_CODE.INFO:
197
+ type = 'info'
184
198
  break;
185
199
  case RESULT_CODE.OTHER:
186
200
  type = 'error'
@@ -190,10 +204,9 @@ export async function executeDataValid(validConfig, { dynamicMapComp, rootValue,
190
204
  break;
191
205
  }
192
206
  }
193
- let weakFlag = false
194
- if (validConfig?.validationType === '2') {
195
- weakFlag = true
196
- }
207
+ // if (validConfig?.validationType === '2') {
208
+ // weakFlag = true
209
+ // }
197
210
  return new Promise((resolver, inject) => {
198
211
  confirmInstance(resultMessage, lang?.indexOf('zh') > -1 ? '提示' : 'Hint', {
199
212
  type,
@@ -211,18 +224,25 @@ export async function executeDataValid(validConfig, { dynamicMapComp, rootValue,
211
224
  }
212
225
 
213
226
  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
227
+ const lcpPageRuleVOLis = props.config?.lcpPageRuleVOList || []
228
+ const PageServiceMapVOList = props.config.lcpPageServiceMapVOList || []
229
+ const mixinServiceConfig = PageServiceMapVOList.find(service => service.serviceType === '1')
230
+ if (lcpPageRuleVOLis?.length && mixinServiceConfig) {
231
+ // for(let i = 0; i < lcpPageRuleVOLis.length; i++) {
232
+ // 数据校验服务
233
+ const validConfig = lcpPageRuleVOLis[0]
234
+ const valid = await executeDataValid(validConfig, {
235
+ dynamicMapComp,
236
+ rootValue,
237
+ axiosInstance,
238
+ mixinServiceConfig,
239
+ lang
240
+ })
241
+ if (!valid) {
242
+ return
243
+ }
244
+ // }
223
245
  }
224
-
225
- const PageServiceMapVOList = props.config.lcpPageServiceMapVOList
226
246
  if (PageServiceMapVOList?.length) {
227
247
  const dynamicHireRelat = props.config?.dynamicHireRelat
228
248
  dispatchClickEvents({
@@ -20,6 +20,7 @@ const checkboxGroupProps = computed(() => {
20
20
 
21
21
  const checkboxProps = computed(() => {
22
22
  return {
23
+ label: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
23
24
  size: props?.config?.size,
24
25
  disabled: props.disabled,
25
26
  block: props?.config?.block === '1',
@@ -50,6 +51,7 @@ const onSigleChange = ({ detail }) => {
50
51
  <template>
51
52
  <cmi-checkbox-group :value="modeValue" @change="onChange" v-if="props.options && props.options.length" v-bind="{...checkboxGroupProps, ...attrs}">
52
53
  <cmi-checkbox
54
+ class="mr-20"
53
55
  v-for="option in props.options" :key="option.columnValue"
54
56
  :disabled="option.columnStatus == '0' || option.columnStatus == '2'"
55
57
  :name="option.columnValue" :label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
@@ -57,7 +59,12 @@ const onSigleChange = ({ detail }) => {
57
59
  {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
58
60
  </cmi-checkbox>
59
61
  </cmi-checkbox-group>
60
- <cmi-checkbox v-else v-bind="{...checkboxProps, ...attrs}" :checked="modeValue === '1'" :value="modeValue" @change="onSigleChange">
62
+ <cmi-checkbox v-else v-bind="{...attrs, ...checkboxProps}" :checked="modeValue === '1'" :value="modeValue" @change="onSigleChange">
61
63
  {{ label }}
62
64
  </cmi-checkbox>
63
- </template>
65
+ </template>
66
+ <style lang="scss" scoped>
67
+ .mr-20 {
68
+ margin-right: 20px;
69
+ }
70
+ </style>
@@ -0,0 +1,30 @@
1
+ <script setup>
2
+ import { computed, defineProps, inject } from 'vue'
3
+ import { commonPropsType } from '../../utils/index.js'
4
+
5
+ const lang = inject('lang')
6
+ const props = defineProps({
7
+ ...commonPropsType,
8
+ })
9
+ const dividerProps = computed(() => {
10
+ return {
11
+ direction: props.config?.direction,
12
+ borderStyle: props.config?.borderStyle,
13
+ borderwidth: props.config?.borderwidth,
14
+ position: props.config?.position,
15
+ }
16
+ })
17
+ const modelValue = defineModel()
18
+
19
+ const label = computed(() => {
20
+ return modelValue.value || (lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn)
21
+ })
22
+ </script>
23
+
24
+ <template>
25
+ <cmi-divider
26
+ v-bind="{...dividerProps}"
27
+ >
28
+ {{ label }}
29
+ </cmi-divider>
30
+ </template>
@@ -5,7 +5,7 @@ import { commonPropsType } from '../../utils/index.js'
5
5
  const modelValue = defineModel()
6
6
  const props = defineProps({
7
7
  ...commonPropsType,
8
- isMutiple: [String, Boolean]
8
+ multiple: [String, Boolean]
9
9
  })
10
10
  const attrs = useAttrs()
11
11
  const lang = inject('lang')
@@ -47,7 +47,7 @@ const value = computed({
47
47
 
48
48
  const selectProps = computed(() => {
49
49
  return {
50
- label: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
50
+ // label: lang?.value?.indexOf('zh') > -1 ? props.config?.metaNameZh : props.config?.metaNameEn,
51
51
  value: value.value,
52
52
  disabled: props.disabled,
53
53
  clearable: props.clearable,
@@ -8,8 +8,6 @@ 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 { executeEventOrchestration } from '../helper/eventOrchestration.js';
12
- import { getRelateConfigKeys } from '../../rules/ruleUtils.js';
13
11
 
14
12
  defineOptions({
15
13
  inheritAttrs: false
@@ -63,9 +61,7 @@ const label = computed(() => {
63
61
  })
64
62
  const route = useRoute()
65
63
  const buttonActions = inject('buttonActions', {})
66
- const messageCb = inject('_messageCb')
67
64
 
68
- const messageInstance = inject('_messageInstance')
69
65
  const dynamicMapComp = inject('dynamicMapComp')
70
66
  const hireRelatMapRules = inject('hireRelatMapRules')
71
67
  const components = inject('components')
@@ -73,14 +69,12 @@ const selects = inject('selects')
73
69
  const rootValue = inject('rootValue')
74
70
  const dataLoad = inject('dataLoad')
75
71
  const rootForm = inject('rootForm')
76
- const _axiosInstance = inject('_axiosInstance')
77
- const confirmInstance = inject('_confirmInstance')
78
- const openChildDialogInstance = inject('_openChildDialogInstance')
79
72
 
80
73
  const routeQuery= route?.query
81
74
 
82
75
  const buttonAction = async (...arg) => {
83
- attrs?.onClick?.(...arg) // 如果配置中有点击事件
76
+ attrs?.onClick?.(...arg)
77
+
84
78
  const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
85
79
  const actionFn = buttonActions[actionKey]
86
80
  actionFn && actionFn(props, {
@@ -93,14 +87,5 @@ const buttonAction = async (...arg) => {
93
87
  rootForm,
94
88
  routeQuery
95
89
  }, appContext)
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
- })
105
90
  }
106
91
  </script>
@@ -55,6 +55,12 @@ export function useBuildInData(messageTipInstance, loadingInstance) {
55
55
  cb(pageConfig.value)
56
56
  getSelects(ret.data.result?.pmBusinessIdentityVO?.tenantId)
57
57
  return
58
+ } else {
59
+ if (loadingInstance.finish && typeof loadingInstance.finish === 'function') {
60
+ loadingInstance.finish()
61
+ } else if (loadingInstance.hide && typeof loadingInstance.hide === 'function') {
62
+ loadingInstance.hide()
63
+ }
58
64
  }
59
65
  }).catch(() => {
60
66
  if (loadingInstance.finish && typeof loadingInstance.finish === 'function') {
@@ -72,6 +78,12 @@ export function useBuildInData(messageTipInstance, loadingInstance) {
72
78
  if (resultToast(ret.data, messageTipInstance, { noSuccessIip: true })) {
73
79
  selects.value = JSON.parse(ret.data.result || '{}')
74
80
  return
81
+ } else {
82
+ if (loadingInstance.finish && typeof loadingInstance.finish === 'function') {
83
+ loadingInstance.finish()
84
+ } else if (loadingInstance.hide && typeof loadingInstance.hide === 'function') {
85
+ loadingInstance.hide()
86
+ }
75
87
  }
76
88
  }).finally(() => {
77
89
  if (loadingInstance.finish && typeof loadingInstance.finish === 'function') {
package/src/index.jsx CHANGED
@@ -116,9 +116,9 @@ export default {
116
116
  }, {
117
117
  immediate: true
118
118
  })
119
- watch(rootStore, () => {
119
+ watch(() => rootStore, () => {
120
120
  emit('rootStoreChange', rootStore)
121
- }, { immediate: true })
121
+ }, { immediate: true, deep: true })
122
122
 
123
123
  const dataLoad = computed(() => {
124
124
  return props.dataLoad || nativeDataLoad.value
@@ -22,7 +22,18 @@ export const NOT_NEED_FORM_ITEM_META_TYPE = [
22
22
  'ElButton',
23
23
  'CustomComponentTable',
24
24
  'CustomComponentRow',
25
- 'CustomComponentCol'
25
+ 'CustomComponentCol',
26
+
27
+ 'CustomComponentCardH5',
28
+ 'CustomComponentCollapseH5',
29
+ 'CustomComponentTabsH5',
30
+ 'CustomComponentTabPaneH5',
31
+ 'CustomComponentTableH5',
32
+ 'cmi-cell',
33
+ 'cmi-button',
34
+ 'cmi-link',
35
+ 'cmi-dropdown-menu',
36
+ 'cmi-divider'
26
37
  ]
27
38
  export const NOT_NEED_COL_ITEM_META_TYPE = ['CustomComponentTabPane', 'CustomComponentDialog', 'CustomComponentCol', 'CustomComponentTabPaneH5']
28
39
  export const MULTI_PAGE_META_LIST_TYPES = ['CustomComponentTable']
@@ -134,7 +145,19 @@ export const commonPropsType = {
134
145
  getValue(config, props, modelValue, selects) {
135
146
  const referenceOptions = config.referenceOptions
136
147
  const selectKey = config.selectKey
137
- const options = (selects?.value && selects?.value?.[selectKey]) || (selects?.value && selects?.value?.[`${config.metaCode}ListValue`]) || (selects?.value && selects?.value?.[referenceOptions]) || []
148
+ let optionItemsList = []
149
+ try {
150
+ optionItemsList = JSON.parse(config?.optionItems || '[]').map(item => {
151
+ return {
152
+ columnValue: item.value,
153
+ columnDesc_zh: item.label,
154
+ columnDesc: item.label_en || item.label,
155
+ }
156
+ })
157
+ } catch (error) {
158
+ optionItemsList = []
159
+ }
160
+ const options = (selects?.value && selects?.value?.[selectKey]) || (selects?.value && selects?.value?.[`${config.metaCode}ListValue`]) || (selects?.value && selects?.value?.[referenceOptions]) || optionItemsList || []
138
161
  return options
139
162
  }
140
163
  }
@@ -5,6 +5,7 @@ import CustomComponentColH5 from '../components/packages-H5/CustomComponentColH5
5
5
  import {
6
6
  commonPropsType,
7
7
  FORM_META_TYPE,
8
+ FORM_META_TYPE_H5,
8
9
  NOT_NEED_FORM_ITEM_META_TYPE,
9
10
  SPECIAL_SET_FULL_WIDTH_ITEM_META_TYPE,
10
11
  NOT_NEED_COL_ITEM_META_TYPE,
@@ -19,7 +20,6 @@ import {
19
20
  META_TYPE_MAP,
20
21
  H5_REPLACE_PREFIX_FLAG,
21
22
  H5_PREFIX_FLAG,
22
- FORM_META_TYPE_H5
23
23
  } from './const.js'
24
24
  import { preserveCheck } from './preserveFunc.js'
25
25
  import { isArray, isFunction, isString } from './is.js'
@@ -166,9 +166,12 @@ export function normalConfig({
166
166
  }
167
167
 
168
168
  let extendAttrObj = parseExtendAttr(config)
169
+ if (metaType == 'cmi-card') {
170
+ debugger
171
+ }
169
172
  let extendObj = {
170
173
  removeCol: findComponent(NOT_NEED_COL_ITEM_META_TYPE, extendAttrObj.renderby) !== -1 || findComponent(NOT_NEED_COL_ITEM_META_TYPE, metaType) !== -1,
171
- needformItem: (findComponent(NOT_NEED_FORM_ITEM_META_TYPE, extendAttrObj.renderby) !== -1 || findComponent(NOT_NEED_FORM_ITEM_META_TYPE, metaType) !== -1) ? false : needformItem, // 表示这个配置项对应的渲染组件是否需要formItem进行包装
174
+ needformItem: (findComponent(NOT_NEED_FORM_ITEM_META_TYPE, extendAttrObj.renderby) !== -1 || findComponent(NOT_NEED_FORM_ITEM_META_TYPE, metaType) !== -1) ? false : needformItem, // 表示这个配置项对应的渲染组件是否需要formItem进行包装 移动端是cmi-form-item
172
175
  }
173
176
  if (config.defStyle) {
174
177
  extendObj.style = parseDefStyle(config.defStyle)
@@ -188,7 +191,7 @@ export function normalConfig({
188
191
  axiosInstance,
189
192
  messageInstance ,
190
193
  messageCb
191
- }, metaItem, hireRelat, mapComp, needformItem || [FORM_META_TYPE].includes(metaType))
194
+ }, metaItem, hireRelat, mapComp, needformItem || [FORM_META_TYPE, FORM_META_TYPE_H5].includes(metaType))
192
195
  return pageConfig
193
196
  })?.sort((a, b) => a.seqNo - b.seqNo)
194
197
  }
@@ -465,7 +468,9 @@ export function generateLayoutPolyfill(config, disabled, isH5) {
465
468
  if (config.removeCol) {
466
469
  return node
467
470
  }
468
- let ret = <colComp {...props}>{node}</colComp>
471
+ let ret = <colComp {...props}>
472
+ {node}
473
+ </colComp>
469
474
  if (config.isAllRow) {
470
475
  ret = <colComp span={24}>{ret}</colComp>
471
476
  }