doway-coms 2.11.66 → 2.11.68
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
|
@@ -219,10 +219,9 @@
|
|
|
219
219
|
size="small"
|
|
220
220
|
@change="cellValueChange(scope)"
|
|
221
221
|
v-model="scope.row[scope.column.property]"
|
|
222
|
-
:
|
|
223
|
-
:
|
|
224
|
-
:
|
|
225
|
-
:max="scope.column.numberMax"
|
|
222
|
+
:max="scope.column.params.max"
|
|
223
|
+
:min="scope.column.params.min"
|
|
224
|
+
:precision="scope.column.params.precision"
|
|
226
225
|
:disabled="editDisabled(scope)"
|
|
227
226
|
:step="scope.column.params.step"
|
|
228
227
|
/>
|
|
@@ -2182,6 +2181,16 @@ export default {
|
|
|
2182
2181
|
if (originCol.rules) {
|
|
2183
2182
|
this.validRules[colInfo.field] = originCol.rules
|
|
2184
2183
|
}
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
// if (XEUtils.isNumber(originCol.min)) {
|
|
2187
|
+
// colParams['min'] =(XEUtils.isNumber(originCol.min)?originCol.min:'Infinity'
|
|
2188
|
+
// }
|
|
2189
|
+
// if (XEUtils.isNumber(originCol.max)) {
|
|
2190
|
+
// colParams['max'] = originCol.max
|
|
2191
|
+
// }
|
|
2192
|
+
colParams['max'] =XEUtils.isNumber(originCol.max)?originCol.max:'Infinity'
|
|
2193
|
+
colParams['min'] =XEUtils.isNumber(originCol.min)?originCol.min:'-Infinity'
|
|
2185
2194
|
if (originCol.precision) {
|
|
2186
2195
|
colParams['precision'] = originCol.precision
|
|
2187
2196
|
//加入验证逻辑
|
|
@@ -2192,12 +2201,8 @@ export default {
|
|
|
2192
2201
|
// validator: this.validPrecision
|
|
2193
2202
|
// })
|
|
2194
2203
|
}
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
}
|
|
2198
|
-
if (XEUtils.isInteger(originCol.max)) {
|
|
2199
|
-
colParams['max'] = originCol.max
|
|
2200
|
-
}
|
|
2204
|
+
|
|
2205
|
+
|
|
2201
2206
|
// else{
|
|
2202
2207
|
// colParams['precision'] = 10 //默认十位小数
|
|
2203
2208
|
// }
|
|
@@ -4025,17 +4030,18 @@ export default {
|
|
|
4025
4030
|
)
|
|
4026
4031
|
if (!reg.test(value)) {
|
|
4027
4032
|
//小数点验证不通过
|
|
4028
|
-
|
|
4033
|
+
console.debug('验证不通过',value)
|
|
4029
4034
|
returnValue = XEUtils.floor(value, tempPrecision)
|
|
4030
4035
|
}
|
|
4036
|
+
console.debug('returnValue',returnValue, XEUtils.toNumber(returnValue))
|
|
4031
4037
|
if (
|
|
4032
|
-
XEUtils.
|
|
4038
|
+
XEUtils.isNumber(scope.column.params.max) &&
|
|
4033
4039
|
XEUtils.toNumber(returnValue) > scope.column.params.max
|
|
4034
4040
|
) {
|
|
4035
4041
|
returnValue = scope.column.params.max
|
|
4036
4042
|
}
|
|
4037
4043
|
if (
|
|
4038
|
-
XEUtils.
|
|
4044
|
+
XEUtils.isNumber(scope.column.params.min) &&
|
|
4039
4045
|
XEUtils.toNumber(returnValue) < scope.column.params.min
|
|
4040
4046
|
) {
|
|
4041
4047
|
returnValue = scope.column.params.min
|
|
@@ -33,6 +33,9 @@
|
|
|
33
33
|
:placeholder="placeholder"
|
|
34
34
|
:formatter="numberFormatter"
|
|
35
35
|
:parser="numberParse"
|
|
36
|
+
:max="max"
|
|
37
|
+
:min="min"
|
|
38
|
+
:precision="precision"
|
|
36
39
|
style="width: 100%"
|
|
37
40
|
:class="{ 'd-error-input': v.errors.length > 0 }"
|
|
38
41
|
/>
|
|
@@ -46,6 +49,9 @@
|
|
|
46
49
|
:placeholder="placeholder"
|
|
47
50
|
:formatter="numberFormatter"
|
|
48
51
|
:parser="numberParse"
|
|
52
|
+
:max="max"
|
|
53
|
+
:min="min"
|
|
54
|
+
:precision="precision"
|
|
49
55
|
style="width: 100%"
|
|
50
56
|
:class="{ 'd-error-input': v.errors.length > 0 }"
|
|
51
57
|
/>
|
|
@@ -220,11 +226,12 @@ export default {
|
|
|
220
226
|
numberFormatter(value) {
|
|
221
227
|
// 百分比格式化
|
|
222
228
|
if (this.percent) {
|
|
223
|
-
if (this.precision) {
|
|
224
|
-
return XEUtils.round(value, this.precision) + "%";
|
|
225
|
-
} else {
|
|
226
229
|
return value + "%";
|
|
227
|
-
|
|
230
|
+
// if (this.precision) {
|
|
231
|
+
// return XEUtils.round(value, this.precision) + "%";
|
|
232
|
+
// } else {
|
|
233
|
+
// return value + "%";
|
|
234
|
+
// }
|
|
228
235
|
}
|
|
229
236
|
return value;
|
|
230
237
|
},
|
|
@@ -233,35 +240,36 @@ export default {
|
|
|
233
240
|
if (this.percent) {
|
|
234
241
|
value.replace("%", "");
|
|
235
242
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
let
|
|
241
|
-
let
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
243
|
+
return value
|
|
244
|
+
// if (value === null || value === "") {
|
|
245
|
+
// return value;
|
|
246
|
+
// }
|
|
247
|
+
// let returnValue = value;
|
|
248
|
+
// let tempPrecision = XEUtils.toNumber(this.precision);
|
|
249
|
+
// let reg = new RegExp(
|
|
250
|
+
// "^((-?)|(-?([1-9]{1}\\d*)|-?([0]{1})))(\\.(\\d){0," +
|
|
251
|
+
// tempPrecision +
|
|
252
|
+
// "})?$"
|
|
253
|
+
// );
|
|
254
|
+
// if (!reg.test(value)) {
|
|
255
|
+
// //小数点验证不通过
|
|
256
|
+
// returnValue = XEUtils.floor(value, tempPrecision);
|
|
257
|
+
// }
|
|
258
|
+
// if (
|
|
259
|
+
// this.max !== null &&
|
|
260
|
+
// this.max !== undefined &&
|
|
261
|
+
// XEUtils.toNumber(returnValue) > this.max
|
|
262
|
+
// ) {
|
|
263
|
+
// returnValue = this.max;
|
|
264
|
+
// }
|
|
265
|
+
// if (
|
|
266
|
+
// this.min !== null &&
|
|
267
|
+
// this.min !== undefined &&
|
|
268
|
+
// XEUtils.toNumber(returnValue) < this.min
|
|
269
|
+
// ) {
|
|
270
|
+
// returnValue = this.min;
|
|
271
|
+
// }
|
|
272
|
+
// return returnValue;
|
|
265
273
|
},
|
|
266
274
|
getFormatValue(value) {
|
|
267
275
|
if (this.percent) {
|
|
@@ -442,6 +442,14 @@ export function secondDisplayTime(value) {
|
|
|
442
442
|
* @param {*} colInfo
|
|
443
443
|
*/
|
|
444
444
|
export function gridDefaultValueDisplay(rowInfo,colInfo){
|
|
445
|
+
|
|
446
|
+
//获取全局配置,数字是否显示小数点补零
|
|
447
|
+
let girdNumberPointZero = 2
|
|
448
|
+
if(store.getters.baseSetting && store.getters.baseSetting.pointZero){
|
|
449
|
+
girdNumberPointZero = XEUtils.toInteger(store.getters.baseSetting.pointZero)
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
|
|
445
453
|
let colControlType = colInfo.params.controlType
|
|
446
454
|
let displayValue = rowInfo[colInfo.field]
|
|
447
455
|
if(displayValue===null){
|
|
@@ -475,11 +483,23 @@ export function gridDefaultValueDisplay(rowInfo,colInfo){
|
|
|
475
483
|
if(colInfo.params.thousandDigit===true){
|
|
476
484
|
displayValue = displayValue.toLocaleString('en-US',{ maximumFractionDigits: 10 })
|
|
477
485
|
}
|
|
486
|
+
//查看是否小数点补零位数
|
|
487
|
+
if(girdNumberPointZero>0){
|
|
488
|
+
girdNumberPointZero = girdNumberPointZero>XEUtils.toInteger(colInfo.params.precision)?
|
|
489
|
+
girdNumberPointZero:XEUtils.toInteger(colInfo.params.precision)
|
|
490
|
+
displayValue = setNumberZero(displayValue,girdNumberPointZero)
|
|
491
|
+
}
|
|
478
492
|
displayValue = displayValue+'%'
|
|
479
493
|
}else{
|
|
480
494
|
if(colInfo.params.thousandDigit===true){
|
|
481
495
|
displayValue = displayValue.toLocaleString('en-US',{ maximumFractionDigits: 10 })
|
|
482
496
|
}
|
|
497
|
+
//查看是否小数点补零位数
|
|
498
|
+
if(girdNumberPointZero>0){
|
|
499
|
+
girdNumberPointZero = girdNumberPointZero>XEUtils.toInteger(colInfo.params.precision)?
|
|
500
|
+
girdNumberPointZero:XEUtils.toInteger(colInfo.params.precision)
|
|
501
|
+
displayValue = setNumberZero(displayValue,girdNumberPointZero)
|
|
502
|
+
}
|
|
483
503
|
}
|
|
484
504
|
}
|
|
485
505
|
|
|
@@ -493,4 +513,31 @@ export function gridDefaultValueDisplay(rowInfo,colInfo){
|
|
|
493
513
|
break
|
|
494
514
|
}
|
|
495
515
|
return displayValue
|
|
516
|
+
}
|
|
517
|
+
export function setNumberZero(value,numberPointZero){
|
|
518
|
+
//转成字符串,防止是数字
|
|
519
|
+
// 转成字符串,防止是数字
|
|
520
|
+
//判断是否存在小数点,如果不存在就直接补小数点和对应的0,如果存在就判断小数点后面存在几个字符,如果小于设定的字符数就补零
|
|
521
|
+
let strValue = value + '';
|
|
522
|
+
|
|
523
|
+
// 判断是否存在小数点
|
|
524
|
+
const decimalIndex = strValue.indexOf('.');
|
|
525
|
+
|
|
526
|
+
if (decimalIndex === -1) {
|
|
527
|
+
// 不存在小数点,直接补小数点和对应的0
|
|
528
|
+
if (numberPointZero > 0) {
|
|
529
|
+
strValue += '.' + '0'.repeat(numberPointZero);
|
|
530
|
+
}
|
|
531
|
+
} else {
|
|
532
|
+
// 存在小数点,判断小数点后的位数
|
|
533
|
+
const decimalPart = strValue.substring(decimalIndex + 1);
|
|
534
|
+
const decimalLength = decimalPart.length;
|
|
535
|
+
|
|
536
|
+
if (decimalLength < numberPointZero) {
|
|
537
|
+
// 不足位数则补零
|
|
538
|
+
strValue += '0'.repeat(numberPointZero - decimalLength);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
return strValue;
|
|
542
|
+
|
|
496
543
|
}
|