Commit 9725dfbe authored by 高宇's avatar 高宇

精度丢失

parent e343f6c8
...@@ -2320,17 +2320,17 @@ export default { ...@@ -2320,17 +2320,17 @@ export default {
rejectLoading: false, rejectLoading: false,
ThirdFromRules: { ThirdFromRules: {
wgKx: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }], wgKx: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgLlw: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgLlw: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgWlw: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgWlw: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgJbwq: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgJbwq: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgZk: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgZk: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgSh: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgSh: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgBm: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgBm: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgTc: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgTc: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgQg: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgQg: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgCq: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgCq: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgFf: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], wgFf: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
wgTf: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }] wgTf: [{ pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }]
}, },
// 第一部分限制表单账单 // 第一部分限制表单账单
IRMAXLENGTHONE: 11, IRMAXLENGTHONE: 11,
...@@ -2391,39 +2391,39 @@ export default { ...@@ -2391,39 +2391,39 @@ export default {
}], }],
standardOne: [ standardOne: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' } { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }
], ],
standonePlus: [ standonePlus: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }, { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' },
{ validator: this.validateMethod3, trigger: 'blur' } { validator: this.validateMethod3, trigger: 'blur' }
], ],
standoneCy: [ { required: true, message: '请输入差异', trigger: 'blur' }, standoneCy: [ { required: true, message: '请输入差异', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
standtwoCy: [{ required: true, message: '请输入差异', trigger: 'blur' }, standtwoCy: [{ required: true, message: '请输入差异', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }], { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }],
standardTwo: [ standardTwo: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' } { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }
], ],
standtwoPlus: [ standtwoPlus: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }, { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' },
{ validator: this.validateMethod4, trigger: 'blur' } { validator: this.validateMethod4, trigger: 'blur' }
], ],
limitOne: [ limitOne: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }, { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' },
{ validator: this.validateMethod1, trigger: 'blur' } { validator: this.validateMethod1, trigger: 'blur' }
], ],
limitTwo: [ limitTwo: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' }, { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' },
{ validator: this.validateMethod2, trigger: 'blur' } { validator: this.validateMethod2, trigger: 'blur' }
], ],
limitThree: [ limitThree: [
{ required: true, message: '请输入检验标准', trigger: 'blur' }, { required: true, message: '请输入检验标准', trigger: 'blur' },
{ pattern: /^(0|[1-9]\d*)(\.\d{0,6})?$/, message: '请输入有效的数字', trigger: 'change' } { pattern: /^(0|[1-9]\d*)(\.\d{0,4})?$/, message: '请输入有效的数字', trigger: 'change' }
], ],
recordData: [ recordData: [
{ required: true, message: '请输入检验数据', trigger: 'blur' } { required: true, message: '请输入检验数据', trigger: 'blur' }
...@@ -3089,7 +3089,7 @@ export default { ...@@ -3089,7 +3089,7 @@ export default {
const limitOne = parseFloat(this.inspectJbAl2o3List.limitOne) const limitOne = parseFloat(this.inspectJbAl2o3List.limitOne)
const limitTwo = parseFloat(this.inspectJbAl2o3List.limitTwo) const limitTwo = parseFloat(this.inspectJbAl2o3List.limitTwo)
const recordData3 = this.inspectJbAl2o3List.recode3[index].recordData const recordData3 = this.inspectJbAl2o3List.recode3[index].recordData
this.inspectJbAl2o3List.limitThree = Math.abs(limitOne - limitTwo) // this.inspectJbAl2o3List.limitThree = Math.abs(limitOne - limitTwo)
if (recordData3 !== '') { if (recordData3 !== '') {
const num = parseFloat(recordData3) const num = parseFloat(recordData3)
if (num >= limitOne && num <= limitTwo) { if (num >= limitOne && num <= limitTwo) {
...@@ -3099,9 +3099,9 @@ export default { ...@@ -3099,9 +3099,9 @@ export default {
} }
} }
} }
if (this.inspectJbAl2o3List.limitOne === '' || this.inspectJbAl2o3List.limitTwo === '') { // if (this.inspectJbAl2o3List.limitOne === '' || this.inspectJbAl2o3List.limitTwo === '') {
this.inspectJbAl2o3List.limitThree = '' // this.inspectJbAl2o3List.limitThree = ''
} // }
if (this.inspectJbAl2o3List.recode3[index].recordData === '' || this.inspectJbAl2o3List.limitOne === '' || this.inspectJbAl2o3List.limitTwo === '') { if (this.inspectJbAl2o3List.recode3[index].recordData === '' || this.inspectJbAl2o3List.limitOne === '' || this.inspectJbAl2o3List.limitTwo === '') {
this.inspectJbAl2o3List.recode3[index].differenceValue = '' this.inspectJbAl2o3List.recode3[index].differenceValue = ''
} }
...@@ -3119,12 +3119,12 @@ export default { ...@@ -3119,12 +3119,12 @@ export default {
for (let i = 0; i < 15; i++) { for (let i = 0; i < 15; i++) {
this.handleData3Input(i) this.handleData3Input(i)
} }
if (this.inspectJbAl2o3List.limitOne && this.inspectJbAl2o3List.limitOne !== '' && this.inspectJbAl2o3List.limitOne !== undefined && this.inspectJbAl2o3List.limitTwo &&this.inspectJbAl2o3List.limitTwo !== '' &&this.inspectJbAl2o3List.limitTwo !== undefined) { if (this.inspectJbAl2o3List.limitOne && this.inspectJbAl2o3List.limitOne !== '' && this.inspectJbAl2o3List.limitOne !== undefined && this.inspectJbAl2o3List.limitTwo && this.inspectJbAl2o3List.limitTwo !== '' && this.inspectJbAl2o3List.limitTwo !== undefined) {
const limitOne = parseFloat(this.inspectJbAl2o3List.limitOne) const limitOne = Math.floor(Number(this.inspectJbAl2o3List.limitOne) * 10000); // 将浮点数转换为整数并保留整数部分
const limitTwo = parseFloat(this.inspectJbAl2o3List.limitTwo) const limitTwo = Math.floor(Number(this.inspectJbAl2o3List.limitTwo) * 10000);
this.inspectJbAl2o3List.limitThree = Math.abs(limitOne - limitTwo) this.inspectJbAl2o3List.limitThree = Math.abs(limitOne - limitTwo) / 10000; // 将结果转换回浮点数
} else { } else {
this.inspectJbAl2o3List.limitThree = '' this.inspectJbAl2o3List.limitThree = '';
} }
}, },
// 计算标签一的校验标准1 和 检验标准2 之间的差值 // 计算标签一的校验标准1 和 检验标准2 之间的差值
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment