From d7fceb14f6fab12f62114ff36a2ec00bd6c7c1c2 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 30 七月 2024 14:46:54 +0800 Subject: [PATCH] 优化检验任务计算值最终值小数位数保留 --- static/js/worker.js | 5 +++++ static/js/worker0.js | 22 ++++++---------------- src/components/do/b1-inspect-order-plan/Inspection.vue | 1 - 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index 8438b07..fb42e85 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -2349,7 +2349,6 @@ if (!isTrue) { n.v.v = n.v.v.replace('/', '') } - let num = 0 } try { // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫 diff --git a/static/js/worker.js b/static/js/worker.js index 60c3ac5..28c9c74 100644 --- a/static/js/worker.js +++ b/static/js/worker.js @@ -339,6 +339,11 @@ try{ if(comResult==0){ a[b].v.v = 0 + }else if(a[b].v.ct&&a[b].v.ct.fa&&typeof a[b].v.ct.fa == 'string'&&a[b].v.ct.fa.includes('.')){ + let num = 0 + let str = n.v.ct.fa.split('.')[1] + num = str.length + a[b].v.v = comResult?Number(comResult).toFixed(num):0 }else{ let val = parseFloat(Number(comResult).toFixed(3)) a[b].v.v = isNaN(val) ? '' : val diff --git a/static/js/worker0.js b/static/js/worker0.js index b725961..e2481ba 100644 --- a/static/js/worker0.js +++ b/static/js/worker0.js @@ -46,8 +46,10 @@ if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ let str = n.v.ct.fa.split('.')[1] num = str.length + n.v.v = dataAcquisitionInfo[str]?dataAcquisitionInfo[str].toFixed(num):0 + }else{ + n.v.v = dataAcquisitionInfo[str] } - n.v.v = dataAcquisitionInfo[str]?dataAcquisitionInfo[str].toFixed(num):0 result = { method:'changeInput', value:{ @@ -64,8 +66,10 @@ if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ let str = n.v.ct.fa.split('.')[1] num = str.length + n.v.v = dataAcquisitionInfo[str]?Number(dataAcquisitionInfo[str]).toFixed(num):0 + }else{ + n.v.v = dataAcquisitionInfo[str] } - n.v.v = dataAcquisitionInfo[str]?Number(dataAcquisitionInfo[str]).toFixed(num):0 result = { method:'changeInput', value:{ @@ -75,20 +79,6 @@ } self.postMessage(JSON.stringify(result)) },2000) - // n.v.v = dataAcquisitionInfo[str] - // result = { - // method:'changeInput', - // value:{ - // list:list, - // n:n - // } - // } - // self.postMessage(JSON.stringify(result)) - // setTimeout(()=>{ - // this.$delete(n.v,'v') - // this.$set(n.v,'v',this.dataAcquisitionInfo[str]) - // this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) - // },1000) } } } -- Gitblit v1.9.3