resolver-egretimp-plus 0.0.280 → 0.0.282
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
|
@@ -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
|
-
//
|
|
106
|
-
const
|
|
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' ?
|
|
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
|
-
|
|
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
|
-
|
|
136
|
+
isFocus.value = true
|
|
144
137
|
}
|
|
145
138
|
ret['onBlur'] = () => {
|
|
146
|
-
|
|
147
|
-
modelValue.value = parseValue(
|
|
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 ||
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
package/src/utils/render.jsx
CHANGED
|
@@ -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,
|