resolver-egretimp-plus 0.0.47 → 0.0.49

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.47",
3
+ "version": "0.0.49",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -6,8 +6,14 @@ const props = defineProps({
6
6
  type: [Object, Function],
7
7
  default: () => null
8
8
  },
9
- config: [Object, Array],
10
- lang: String,
9
+ config: {
10
+ type: Object,
11
+ default: () => ({})
12
+ },
13
+ lang: {
14
+ type: String,
15
+ default: 'zh'
16
+ },
11
17
  labelWidth: [String, Number]
12
18
  })
13
19
  const attrs = useAttrs()
@@ -1,6 +1,6 @@
1
1
  export async function executeLoadServices(services = [], { axiosInstance, messageInstance, reqData, respCb }) {
2
2
  const loadServices = services.filter(ser => ser.eventType == '1')
3
- // const mixinServiceConfig = services.find(service => service.serviceType === '1')
3
+ const mixinServiceConfig = services.find(service => service.serviceType === '1')
4
4
 
5
5
  for (let i = 0; i < loadServices.length; i++) {
6
6
  const service = loadServices[i]
@@ -13,7 +13,7 @@ export async function executeLoadServices(services = [], { axiosInstance, messag
13
13
  busiIdentityId: service.busiIdentityId,
14
14
  pageMetaId: service.pageMetaId,
15
15
  tenantId: service.tenantId,
16
- // mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
16
+ mainServiceCode: mixinServiceConfig?.mainServiceCode, // 提交按钮绑定上绑定的融合服务编码
17
17
  },
18
18
  ...(reqData || {})
19
19
  }
@@ -47,9 +47,9 @@ const selects = inject('selects')
47
47
  const rootValue = inject('rootValue')
48
48
  const dataLoad = inject('dataLoad')
49
49
  const rootForm = inject('rootForm')
50
+ const validate = inject('_validate', () => {})
50
51
  const routeQuery= route?.query
51
52
 
52
-
53
53
  const buttonAction = (...arg) => {
54
54
  attrs?.onClick?.(...arg) // 如果配置中有点击事件
55
55
  const actionKey = props.config?.clickActionKey || props.config?.buttonActionKey || props.config?.hireRelat
@@ -62,7 +62,8 @@ const buttonAction = (...arg) => {
62
62
  rootValue,
63
63
  dataLoad,
64
64
  rootForm,
65
- routeQuery
65
+ routeQuery,
66
+ validate
66
67
  }, appContext)
67
68
  }
68
69
  </script>
@@ -5,8 +5,7 @@
5
5
  </template>
6
6
  <script setup>
7
7
  import Renderer from '../../renderer.jsx'
8
- import { computed, inject } from "vue"
9
-
8
+ import { computed, inject, onMounted, reactive, ref, watch } from "vue"
10
9
 
11
10
  const emits = defineEmits(['update:modelValue'])
12
11
  const props = defineProps({
@@ -21,13 +20,21 @@ const props = defineProps({
21
20
  },
22
21
  })
23
22
 
23
+ const val = computed({
24
+ get() {
25
+ return props.modelValue
26
+ },
27
+ set(val) {
28
+ emits('update:modelValue', val)
29
+ }
30
+ })
24
31
  const rootForm = inject('rootForm')
25
32
  const refFn = e => {
26
33
  if (props.config?.rootForm) {
27
34
  rootForm.value = e
35
+ rootForm?.value?.setModel?.(val);
28
36
  }
29
37
  }
30
-
31
38
  const formProps = computed(() => {
32
39
  return {
33
40
  validatefirst: props.config?.validatefirst == '1' ? true : false,
@@ -41,14 +48,6 @@ const formProps = computed(() => {
41
48
 
42
49
  const pmPageMetaList = computed(() => props.config.pmPageMetaList)
43
50
 
44
- const val = computed({
45
- get() {
46
- return props.modelValue
47
- },
48
- set(val) {
49
- emits('update:modelValue', val)
50
- }
51
- })
52
51
  defineExpose({
53
52
  val
54
53
  })
@@ -69,6 +69,7 @@ const selects = inject('selects')
69
69
  const rootValue = inject('rootValue')
70
70
  const dataLoad = inject('dataLoad')
71
71
  const rootForm = inject('rootForm')
72
+ const validate = inject('_validate', () => {})
72
73
 
73
74
  const routeQuery= route?.query
74
75
 
@@ -85,7 +86,8 @@ const buttonAction = async (...arg) => {
85
86
  rootValue: rootValue?.value,
86
87
  dataLoad,
87
88
  rootForm,
88
- routeQuery
89
+ routeQuery,
90
+ validate
89
91
  }, appContext)
90
92
  }
91
93
  </script>
@@ -1,7 +1,6 @@
1
1
  <template>
2
- <ElCheckboxGroup v-model="modeValue" v-if="props.options && props.options.length" v-bind="{...checkboxGroupProps, ...attrs}">
2
+ <ElCheckboxGroup v-if="isMutiple" v-bind="{...checkboxGroupProps, ...attrs}" v-model="proxyValue" >
3
3
  <ElCheckbox
4
- v-bind="{...checkboxProps }"
5
4
  v-for="option in props.options"
6
5
  :key="option.columnValue"
7
6
  :value="option.columnValue"
@@ -9,13 +8,13 @@
9
8
  {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
10
9
  </ElCheckbox>
11
10
  </ElCheckboxGroup>
12
- <ElCheckbox v-else v-bind="{...checkboxProps, ...attrs}" v-model="modeValue">
11
+ <ElCheckbox v-else v-bind="{...checkboxProps, ...attrs}" v-model="proxyValue">
13
12
  {{ label }}
14
13
  </ElCheckbox>
15
14
  </template>
16
15
  <script setup>
17
16
  import { ElCheckbox, ElCheckboxGroup } from 'element-plus'
18
- import { useAttrs, computed, inject } from 'vue'
17
+ import { useAttrs, computed, inject, ref } from 'vue'
19
18
  import { commonPropsType, hasOwn } from '../../utils/index.js'
20
19
 
21
20
  const props = defineProps({
@@ -51,5 +50,27 @@ const checkboxProps = computed(() => {
51
50
  return ret
52
51
  })
53
52
  const attrs = useAttrs()
54
- const modeValue = defineModel()
53
+ // 是否为多选
54
+ const isMutiple = computed(() => {
55
+ return props.options && props.options.length
56
+ })
57
+ const modelValue = defineModel()
58
+
59
+ const proxyValue = computed({
60
+ get() {
61
+ if (isMutiple.value) {
62
+ const val = modelValue.value || ''
63
+ return val ? val.split(',') : []
64
+ } else {
65
+ return modelValue.value
66
+ }
67
+ },
68
+ set(val) {
69
+ if (isMutiple.value) {
70
+ modelValue.value = val.join(',')
71
+ } else {
72
+ modelValue.value = val
73
+ }
74
+ }
75
+ })
55
76
  </script>
package/src/index.jsx CHANGED
@@ -178,7 +178,6 @@ export default {
178
178
  }
179
179
  )
180
180
  })
181
-
182
181
  provide('_messageCb', props.messageCb)
183
182
  provide('_rootStore', rootStore)
184
183
  provide('_openChildDialogInstance', toRef(props, 'openChildDialogInstance'))
@@ -208,6 +207,7 @@ export default {
208
207
  const validate = (cb) => {
209
208
  toValidate(rootForm, cb, dynamicMapComp)
210
209
  }
210
+ provide('_validate', validate)
211
211
  expose({
212
212
  dynamicMapComp,
213
213
  validate,
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import getNativeComps from './components/patchComponents-H5.js'
3
- import { useAttrs } from 'vue';
3
+ import { computed, ref, 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"
@@ -36,9 +36,31 @@ defineOptions({
36
36
  })
37
37
  const attrs = useAttrs()
38
38
 
39
+ const resolverRef = ref(null)
40
+ defineExpose({
41
+ dynamicMapComp: computed({
42
+ get() {
43
+ return resolverRef.value?.dynamicMapComp
44
+ }
45
+ }),
46
+ validate(...arg) {
47
+ return resolverRef.value?.validate(...arg)
48
+ },
49
+ pageConfig: computed({
50
+ get() {
51
+ return resolverRef.value?.pageConfig
52
+ }
53
+ }),
54
+ rootForm: computed({
55
+ get() {
56
+ return resolverRef.value?.rootForm
57
+ }
58
+ }),
59
+ })
39
60
  </script>
40
61
  <template>
41
62
  <Resolver
63
+ ref="resolverRef"
42
64
  v-bind="attrs"
43
65
  :isH5="true" :getNativeComps="getNativeComps"
44
66
  :messageInstance="props.messageInstance"
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { computed, useAttrs } from 'vue';
2
+ import { computed, ref, useAttrs } from 'vue';
3
3
  import Resolver from './index.jsx'
4
4
  import { useBuildInData } from './hooks/pageConfig';
5
5
  import { initInterceptors } from './utils/request.js';
@@ -43,7 +43,29 @@ const allSelects = computed(() => {
43
43
  ...selects.value
44
44
  }
45
45
  })
46
+
47
+ const resolverRef = ref(null)
48
+ defineExpose({
49
+ dynamicMapComp: computed({
50
+ get() {
51
+ return resolverRef.value?.dynamicMapComp
52
+ }
53
+ }),
54
+ validate(...arg) {
55
+ return resolverRef.value?.validate(...arg)
56
+ },
57
+ pageConfig: computed({
58
+ get() {
59
+ return resolverRef.value?.pageConfig
60
+ }
61
+ }),
62
+ rootForm: computed({
63
+ get() {
64
+ return resolverRef.value?.rootForm
65
+ }
66
+ }),
67
+ })
46
68
  </script>
47
69
  <template>
48
- <Resolver v-bind="attrs" :loadingInstance="props.loadingInstance" :messageInstance="props.messageInstance" :getNativeComps="props.getNativeComps" :config="pageConfig || null" :selects="allSelects"></Resolver>
70
+ <Resolver ref="resolverRef" v-bind="attrs" :loadingInstance="props.loadingInstance" :messageInstance="props.messageInstance" :getNativeComps="props.getNativeComps" :config="pageConfig || null" :selects="allSelects"></Resolver>
49
71
  </template>
@@ -2,7 +2,7 @@
2
2
  import getNativeComps from './components/patchComponents-web'
3
3
  import { ElMessage, ElMessageBox } from "element-plus"
4
4
  import { loadingInstance } from './components/loading'
5
- import { useAttrs } from 'vue';
5
+ import { computed, ref, useAttrs } from 'vue';
6
6
  import Resolver from './resolver-common.vue'
7
7
  import { openChildDialog } from './components/childDialog';
8
8
 
@@ -35,9 +35,31 @@ defineOptions({
35
35
  })
36
36
  const attrs = useAttrs()
37
37
 
38
+ const resolverRef = ref(null)
39
+ defineExpose({
40
+ dynamicMapComp: computed({
41
+ get() {
42
+ return resolverRef.value?.dynamicMapComp
43
+ }
44
+ }),
45
+ validate(...arg) {
46
+ return resolverRef.value?.validate(...arg)
47
+ },
48
+ pageConfig: computed({
49
+ get() {
50
+ return resolverRef.value?.pageConfig
51
+ }
52
+ }),
53
+ rootForm: computed({
54
+ get() {
55
+ return resolverRef.value?.rootForm
56
+ }
57
+ }),
58
+ })
38
59
  </script>
39
60
  <template>
40
61
  <Resolver
62
+ ref="resolverRef"
41
63
  v-bind="attrs"
42
64
  :getNativeComps="getNativeComps"
43
65
  :messageInstance="props.messageInstance"
@@ -337,7 +337,12 @@ export function getComponentForConfig({config, disabled, getNativeComps}) {
337
337
  if (renderby && typeof renderby === 'string') {
338
338
  let renderbyComp = resolveAssetComponents(allComps, renderby) //则通过传入的获取组件
339
339
  if (!renderbyComp) {
340
- renderbyComp = resolveComponent(renderby) // 实例上绑定的组件
340
+ try {
341
+ renderbyComp = resolveComponent(renderby) // 实例上绑定的组件
342
+ } catch (error) {
343
+ console.log('resolveComponent fail, config:', config)
344
+ renderbyComp = <div>not component</div>
345
+ }
341
346
  }
342
347
  component = renderbyComp || component
343
348
  }
@@ -614,8 +619,10 @@ export function generateFormItemPolyfill(config, lang, compProps, _isH5, params)
614
619
  }
615
620
 
616
621
  function getFormItemExtendProps(config, lang, params) {
622
+ const propAttr = config.dynamicHireRelat ? config.dynamicHireRelat?.split('->') : []
623
+ const prop = propAttr.join('.')
617
624
  return {
618
- prop: config.dynamicHireRelat,
625
+ prop,
619
626
  rules: getFormItemRule(config, lang, params),
620
627
  class: {
621
628
  'content-right': config.contentRight,