resolver-egretimp-plus 0.0.279 → 0.0.281

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.279",
3
+ "version": "0.0.281",
4
4
  "description": "交付体验渲染",
5
5
  "main": "./dist/web/index.js",
6
6
  "module": "./dist/web/index.js",
@@ -11,6 +11,11 @@
11
11
  "./const": "./dist/const/index.js",
12
12
  "./*": "./*"
13
13
  },
14
+ "scripts": {
15
+ "build:package": "webpack --config scripts/webpack.config.js",
16
+ "build:theme": "gulp -f scripts/gulpfile.mjs",
17
+ "build": "npm run build:package && npm run build:theme"
18
+ },
14
19
  "author": "caowb",
15
20
  "license": "ISC",
16
21
  "devDependencies": {
@@ -49,10 +54,5 @@
49
54
  "vue3-sfc-loader": "^0.9.5",
50
55
  "webpack": "^5.90.0",
51
56
  "webpack-cli": "^5.1.4"
52
- },
53
- "scripts": {
54
- "build:package": "webpack --config scripts/webpack.config.js",
55
- "build:theme": "gulp -f scripts/gulpfile.mjs",
56
- "build": "npm run build:package && npm run build:theme"
57
57
  }
58
- }
58
+ }
@@ -15,7 +15,7 @@ function getPathVal(obj = {}, path) {
15
15
  return ret[key]
16
16
  }
17
17
  return null
18
- }, obj) || ''
18
+ }, obj) ?? ''
19
19
  }
20
20
  function assignmentPathVal(obj = {}, path, val) {
21
21
  let paths = path
@@ -91,9 +91,13 @@ export default {
91
91
  return normalColumnConfig(config)
92
92
  })
93
93
  })
94
+ let pageSize = 5
95
+ if (props.config?.pageSize) {
96
+ pageSize = parseInt(props.config.pageSize) || 5
97
+ }
94
98
  const page = reactive({
95
99
  pageNum: 1,
96
- pageSize: 5,
100
+ pageSize,
97
101
  total: 0,
98
102
  })
99
103
  const isFrontPage = computed(() => {
@@ -38,6 +38,11 @@ export default {
38
38
  type: Number,
39
39
  default: 2
40
40
  },
41
+ // 保留小数点0后缀
42
+ decimalSuffix: {
43
+ type: [Number, String],
44
+ default: '0'
45
+ },
41
46
  // 在显示金额的时候,可以显示的符号
42
47
  canShowFlag: {
43
48
  type: Array,
@@ -102,18 +107,10 @@ export default {
102
107
  emit('update:modelValue', val)
103
108
  }
104
109
  })
105
- // 如果开启了金额显示的话,需要有currentVal进行中间值展示
106
- const currentVal = ref('')
107
- watch(modelValue, (val) => {
108
- const value = formatValue(val)
109
- if (currentVal.value != value) {
110
- currentVal.value = value
111
- }
112
- }, {
113
- immediate: true
114
- })
110
+ // 开启金额展示的时候需要isFocus来控制格式的转换
111
+ const isFocus = ref(false)
115
112
  const displayValue = computed(() => {
116
- return props.showMoney == '1' ? currentVal.value : modelValue.value
113
+ return props.showMoney == '1' ? (isFocus.value ? modelValue.value : formatValue(modelValue.value)) : modelValue.value
117
114
  })
118
115
  const isPagePopup = computed(() => {
119
116
  return props.config?.lcpPagePopupMapVO
@@ -132,19 +129,15 @@ export default {
132
129
  }
133
130
  if (!(isPagePopup.value && !isPagePopupAlwayEdit.value)) {
134
131
  ret['onUpdate:modelValue'] = (val) => {
135
- if (props.showMoney == '1') {
136
- currentVal.value = val
137
- } else {
138
- modelValue.value = val
139
- }
132
+ modelValue.value = val
140
133
  }
141
134
  if (props.showMoney == '1') {
142
135
  ret['onFocus'] = () => {
143
- currentVal.value = parseValue(currentVal.value)
136
+ isFocus.value = true
144
137
  }
145
138
  ret['onBlur'] = () => {
146
- currentVal.value = formatValue(currentVal.value)
147
- modelValue.value = parseValue(currentVal.value)
139
+ isFocus.value = false
140
+ modelValue.value = parseValue(formatValue(modelValue.value))
148
141
  }
149
142
  }
150
143
  } else {
@@ -265,7 +258,7 @@ export default {
265
258
  if (props.canShowFlag?.includes(String(value).toLowerCase())) {
266
259
  return value
267
260
  }
268
- if (value === null || isNaN(value)) return ''
261
+ if (value === null || value === undefined) return ''
269
262
  let val = parseFloat(value)
270
263
  if (isNaN(val)) {
271
264
  return ''
@@ -275,7 +268,11 @@ export default {
275
268
  val = Math.max(props.min, Math.min(props.max, val))
276
269
 
277
270
  // 处理千分位
278
- const parts = val.toFixed(props.decimal).split('.')
271
+ val = val.toFixed(props.decimal)
272
+ if (props.decimalSuffix != '1') {
273
+ val = parseFloat(val)
274
+ }
275
+ const parts = `${val}`.split('.')
279
276
  parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, props.moneySeg)
280
277
 
281
278
  // 添加货币符号
@@ -296,7 +293,16 @@ export default {
296
293
  return ''
297
294
  }
298
295
  // 移除所有非数字字符(保留负号和小数点)
299
- const parsed = Number(value.replace(/[^\d.-]/g, ''))
296
+ let pointCount = 0
297
+ const repVal = `${value}`.replace(/[^\d.-]/g, '').replace(/(\.\d*)/g, (a) => {
298
+ const count = pointCount
299
+ pointCount ++
300
+ if (!count) {
301
+ return a
302
+ }
303
+ return ''
304
+ })
305
+ const parsed = Number(repVal)
300
306
  return isNaN(parsed) ? '' : parsed
301
307
  }
302
308
 
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
3
+ <ElOption v-for="option in options"
4
+ :key="option.columnValue"
5
+ :label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
6
+ :value="option.columnValue"
7
+ :disabled="option.columnStatus == '0' || option.columnStatus == '2'"
8
+ >
9
+ <template v-for="(_, key) in optionsSlots" :key="key" v-slot:[key]="scope">
10
+ <slot :name="key" v-bind="scope"></slot>
11
+ </template>
12
+ </ElOption>
13
+ <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
14
+ <slot :name="key" v-bind="scope"></slot>
15
+ </template>
16
+ </ElSelect>
17
+ </template>
18
+ <script setup>
19
+ import { ElSelect, ElOption } from 'element-plus'
20
+ import { computed, defineProps, inject, useAttrs, useSlots } from 'vue'
21
+ import { commonPropsType, getComponentSolt } from '../../utils/index.js'
22
+
23
+ const VALUE_TYPES = {
24
+ LIST: 'list',
25
+ OBJECT: 'object',
26
+ STRING: 'string',
27
+ }
28
+ const slots = useSlots()
29
+ const optionsSlots = computed(() => {
30
+ return getComponentSolt({
31
+ config: props.config,
32
+ slotKey: 'optionsSlots'
33
+ }) || {}
34
+ })
35
+ const modelValue = defineModel()
36
+ const props = defineProps({
37
+ ...ElSelect.props,
38
+ ...commonPropsType,
39
+ multiple: [String, Boolean],
40
+ filterable: [String, Boolean],
41
+ multipleLimit: [String, Number],
42
+ rangeOptions: Array,
43
+ excludeOptions: Array,
44
+ // 多选的分割符号
45
+ separator: {
46
+ type: [String],
47
+ default: ','
48
+ }
49
+ })
50
+ const attrs = useAttrs()
51
+ const separator = computed(() => {
52
+ return props.separator
53
+ })
54
+ const valueTypes = computed(() => {
55
+ return props.config?.valueType
56
+ })
57
+ // 值是list 还是,连起来的string
58
+ const isStrVal = computed(() => {
59
+ // valueType 值为 list 或者 string
60
+ return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
61
+ })
62
+ const isObject = computed(() => {
63
+ return valueTypes.value === VALUE_TYPES.OBJECT
64
+ })
65
+
66
+ // 是否为多选
67
+ const isMutiple = computed(() => {
68
+ return props.multiple == '1'
69
+ })
70
+
71
+ const options = computed(() => {
72
+ let list = props.options
73
+ if (props.rangeOptions && props.rangeOptions.length) {
74
+ list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
75
+ }
76
+ if (props.excludeOptions && props.excludeOptions.length) {
77
+ list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
78
+ }
79
+ return list
80
+ })
81
+
82
+ const value = computed({
83
+ get() {
84
+ if (isMutiple.value) {
85
+ const val = modelValue.value || ''
86
+ return val ?
87
+ (
88
+ isStrVal.value ?
89
+ val.split(separator.value) :
90
+ (
91
+ isObject.value ?
92
+ Object.values(val || {}) :
93
+ val
94
+ )
95
+ ) :
96
+ []
97
+ } else {
98
+ if (modelValue.value !== null && modelValue.value !== undefined) {
99
+ if (options.value?.some(item => item.columnValue == modelValue.value)) {
100
+ props.config.isMatch = true
101
+ return `${modelValue.value}`
102
+ } else {
103
+ props.config.isMatch = false
104
+ return ''
105
+ }
106
+ } else {
107
+ return ''
108
+ }
109
+ }
110
+ },
111
+ set(val) {
112
+ if (isMutiple.value) {
113
+ modelValue.value = isStrVal.value ?
114
+ val.join(separator.value) :
115
+ (
116
+ isObject.value ?
117
+ val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
118
+ val
119
+ )
120
+ } else {
121
+ modelValue.value = val
122
+ }
123
+ }
124
+ })
125
+
126
+ const selectProps = computed(() => {
127
+ const attrs = Object.keys(ElSelect.props).reduce((ret, key) => {
128
+ ret[key] = props[key]
129
+ return ret
130
+ }, {})
131
+ if (attrs.placeholder === null || attrs.placeholder === undefined) {
132
+ attrs.placeholder = ''
133
+ }
134
+ if (typeof attrs.filterable === 'string') {
135
+ attrs.filterable = attrs.filterable == '1'
136
+ }
137
+ if (typeof attrs.multiple === 'string') {
138
+ attrs.multiple = attrs.multiple == '1'
139
+ }
140
+ if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
141
+ delete attrs.suffixIcon
142
+ delete attrs['suffix-icon']
143
+ }
144
+ attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
145
+ return attrs
146
+ })
147
+ const lang = inject('lang')
148
+ const clear = () => {
149
+ modelValue.value = ''
150
+ }
151
+ </script>
152
+ <style lang="scss">
153
+ .custom-self-select {
154
+ }
155
+ </style>
@@ -787,7 +787,7 @@ function getFormItemExtendProps(config, lang, params) {
787
787
  class: {
788
788
  [`vertical-${config['label-vertical'] || config['labelVertical'] || 'center'}`]: true,
789
789
  'content-right': config.contentRight,
790
- 'hidden-label': config.labelWidth == 0 || config.labelWidth === '0px' || config.labelHidden == '1',
790
+ 'hidden-label': (config.labelWidth == 0 || config.labelWidth === '0px' || config.labelHidden == '1') && !config.showLabel,
791
791
  [`label-position-${config['label-position'] || config['labelPosition'] || 'right'}`]: true // label-position 支持三个值,right、left、top
792
792
  },
793
793
  style,