resolver-egretimp-plus 0.0.236 → 0.0.238

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.236",
3
+ "version": "0.0.238",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -14,7 +14,15 @@ export default {
14
14
  ...ElTable.props,
15
15
  ...ElPagination.props
16
16
  },
17
- setup(props, { expose, attrs }) {
17
+ setup(props, { expose, attrs, emit }) {
18
+ const modelValue = computed({
19
+ get() {
20
+ return props.modelValue
21
+ },
22
+ set(val) {
23
+ emit('update:modelValue', val)
24
+ }
25
+ })
18
26
  const tableProps = computed(() => {
19
27
  const porpsObj = Object.keys(ElTable.props).reduce((ret, key) => {
20
28
  if (props[key] !== undefined && props[key] !== null) {
@@ -91,13 +99,13 @@ export default {
91
99
  return props.config?.frontPageFlag == '1'
92
100
  })
93
101
  const normalPageTotal = computed(() => {
94
- return !isFrontPage.value ? page.total : ((props.refValue.value || [])?.length || 0)
102
+ return !isFrontPage.value ? page.total : ((modelValue.value || [])?.length || 0)
95
103
  })
96
104
 
97
105
  const normalTableData = computed(() => {
98
106
  return !isFrontPage.value ?
99
- (props.refValue.value || []) :
100
- (props.refValue.value || []).slice((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize)
107
+ (modelValue.value || []) :
108
+ (modelValue.value || []).slice((page.pageNum - 1) * page.pageSize, page.pageNum * page.pageSize)
101
109
  })
102
110
 
103
111
  /** 自定义排序逻辑 ===start==== */
@@ -236,10 +244,10 @@ export default {
236
244
  return tableData.value?.[idx]
237
245
  }
238
246
  const onUpdateModelValue = (val, idx) => {
239
- if (!props.refValue.value) {
240
- props.refValue.value = []
247
+ if (!modelValue.value) {
248
+ modelValue.value = []
241
249
  }
242
- props.refValue.value[idx] = val
250
+ modelValue.value[idx] = val
243
251
  }
244
252
 
245
253
  const multiPmPageMetaList = computed(() => {
@@ -409,10 +417,10 @@ export default {
409
417
  if (ret) {
410
418
  if (isPromise(ret)) {
411
419
  ret.then((res) => {
412
- res && (props.refValue.value = res)
420
+ res && (modelValue.value = res)
413
421
  })
414
422
  } else {
415
- props.refValue.value = ret
423
+ modelValue.value = ret
416
424
  }
417
425
  }
418
426
  })
@@ -423,10 +431,10 @@ export default {
423
431
  if (ret) {
424
432
  if (isPromise(ret)) {
425
433
  ret.then((res) => {
426
- res && (props.refValue.value = res)
434
+ res && (modelValue.value = res)
427
435
  })
428
436
  } else {
429
- props.refValue.value = ret
437
+ modelValue.value = ret
430
438
  }
431
439
  }
432
440
  })
@@ -3,9 +3,11 @@
3
3
  </template>
4
4
  <script setup>
5
5
  import { ElDatePicker } from 'element-plus'
6
- import { useAttrs, computed } from 'vue'
6
+ import { useAttrs, computed, watch, nextTick } from 'vue'
7
7
  import { commonPropsType, formatDate, isDate } from '../../utils/index.js'
8
+ import { useFormItem } from 'element-plus'
8
9
 
10
+ const { formItem: elFormItem } = useFormItem()
9
11
  const props = defineProps({
10
12
  ...ElDatePicker.props,
11
13
  ...commonPropsType,
@@ -47,6 +49,11 @@ const value = computed({
47
49
  modeValue.value = val
48
50
  }
49
51
  })
52
+ watch(value, () => {
53
+ nextTick(() => {
54
+ elFormItem?.validate?.('blur').catch()
55
+ })
56
+ })
50
57
 
51
58
  const disabledDate = (date) => {
52
59
  let dateTime = formatDate(date, 'yyyy-MM-dd')
@@ -13,6 +13,11 @@ import { ElSelect, ElOption } from 'element-plus'
13
13
  import { computed, defineProps, inject, useAttrs } from 'vue'
14
14
  import { commonPropsType } from '../../utils/index.js'
15
15
 
16
+ const VALUE_TYPES = {
17
+ LIST: 'list',
18
+ OBJECT: 'object',
19
+ STRING: 'string',
20
+ }
16
21
  const modelValue = defineModel()
17
22
  const props = defineProps({
18
23
  ...ElSelect.props,
@@ -31,11 +36,18 @@ const attrs = useAttrs()
31
36
  const separator = computed(() => {
32
37
  return props.separator
33
38
  })
39
+ const valueTypes = computed(() => {
40
+ return props.config?.valueType
41
+ })
34
42
  // 值是list 还是,连起来的string
35
43
  const isStrVal = computed(() => {
36
44
  // valueType 值为 list 或者 string
37
- return props.config?.valueType !== 'list'
45
+ return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
38
46
  })
47
+ const isObject = computed(() => {
48
+ return valueTypes.value === VALUE_TYPES.OBJECT
49
+ })
50
+
39
51
  // 是否为多选
40
52
  const isMutiple = computed(() => {
41
53
  return props.multiple == '1'
@@ -52,7 +64,17 @@ const value = computed({
52
64
  get() {
53
65
  if (isMutiple.value) {
54
66
  const val = modelValue.value || ''
55
- return val ? (isStrVal.value ? val.split(separator.value) : val) : []
67
+ return val ?
68
+ (
69
+ isStrVal.value ?
70
+ val.split(separator.value) :
71
+ (
72
+ isObject.value ?
73
+ Object.values(val || {}) :
74
+ val
75
+ )
76
+ ) :
77
+ []
56
78
  } else {
57
79
  if (modelValue.value !== null && modelValue.value !== undefined) {
58
80
  if (options.value?.some(item => item.columnValue == modelValue.value)) {
@@ -69,7 +91,13 @@ const value = computed({
69
91
  },
70
92
  set(val) {
71
93
  if (isMutiple.value) {
72
- modelValue.value = isStrVal.value ? val.join(separator.value) : val
94
+ modelValue.value = isStrVal.value ?
95
+ val.join(separator.value) :
96
+ (
97
+ isObject.value ?
98
+ val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
99
+ val
100
+ )
73
101
  } else {
74
102
  modelValue.value = val
75
103
  }
@@ -90,7 +90,11 @@ export function useVModel(config, props, emit, modelKey = 'update:modelValue') {
90
90
  // 这边的值没有变,就不用出触发下面的其他动作了
91
91
  return
92
92
  }
93
- props.modelValue[metaCode] = val
93
+ try {
94
+ props.modelValue[metaCode] = val
95
+ } catch (error) {
96
+ console.log('config', config, metaCode)
97
+ }
94
98
  }
95
99
  if (config) {
96
100
  setTimeout(() => {
@@ -476,7 +476,10 @@ export function createEmptyCopy(source, cache = new WeakMap()) {
476
476
  copy = {};
477
477
  cache.set(source, copy);
478
478
  for (const key of Object.keys(source)) {
479
- copy[key] = createEmptyCopy(source[key], cache);
479
+ const val = createEmptyCopy(source[key], cache)
480
+ if ( val !== null && val !== undefined) {
481
+ copy[key] = val
482
+ }
480
483
  }
481
484
  }
482
485
 
@@ -107,7 +107,7 @@ export const commonPropsType = {
107
107
  },
108
108
  // 组件是否展示必填标识
109
109
  onlyRequiredFlag: {
110
- type: Boolean,
110
+ type: [Boolean, String, Number],
111
111
  default: false,
112
112
  getValue(config, props, modelValue) {
113
113
  return config.onlyRequiredFlag
@@ -22,9 +22,10 @@ export default function defaultVal(config) {
22
22
  defaultVal = configDefaultVal
23
23
  }
24
24
  }
25
+ console.log(`${config.dynamicHireRelat},${config.hireRelat} to set defaultValue, ${defaultVal}`)
26
+ config.refValue = defaultVal
25
27
  } catch (error) {
26
- console.log('set default val fail, config', config)
28
+ console.log('set default val fail, config', config, error)
27
29
  }
28
- config.refValue = defaultVal
29
30
  }
30
31
  }