| src/views/business/inspectionTask/components/InspectionWord.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/business/inspectionTask/inspection.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/views/business/inspectionView/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/workers/DataWorker.worker.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/workers/InspectionWorker.worker.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/views/business/inspectionTask/components/InspectionWord.vue
@@ -115,9 +115,9 @@ </el-select> </template> <template v-else-if="n.v.ps != undefined && n.v.ps.value === '计算值' && state == 1"><span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) }}</span></template> :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span></template> <template v-else-if="n.v.ps != undefined && n.v.ps.value === '最终值' && state == 1"> <span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) }}</span> <span :style="`font-family:${n.v.ff} !important;`">{{ n.v.v }}</span> </template> <template v-else-if="n.v.ps != undefined && n.v.ps.value === '样品编号'"> <div :title="currentSample.sampleCode" @@ -1242,13 +1242,6 @@ getValue(v) { // 对页面展示数据进行处理,@,代表换行 let str = v.v ? v.v : (v.v === 0 ? v.v : (v.ct && v.ct.s ? v.ct.s.length > 0 && v.ct.s[0].v.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp('@', 'g'), '<br/>') : '')) // 对数据保留小数点进行处理 if (v.ct && v.ct.fa && v.ct.fa.includes('.') && str) { let num = 0 let str0 = v.ct.fa.split('.')[1] num = str0.length str = Number(str).toFixed(num) } if (v.v && typeof v.v == 'string' && v.v.includes('@')) { str = v.v.replace(new RegExp('@', 'g'), '<br/>') } @@ -1739,26 +1732,6 @@ }).catch(error => { }) }, /** * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。 * * @param v 要格式化的数值 * @param ct 包含格式化配置的对象 * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数 * @returns 格式化后的字符串或原始数值(若配置不符合要求) */ toFixed(v, ct) { if (v && ct && ct.fa) { if (ct.fa.includes('.')) { let num = ct.fa.slice(4).length return Number(v).toFixed(num) } else { return v } } else { return v } } } } src/views/business/inspectionTask/inspection.vue
@@ -298,7 +298,7 @@ n.v.ps.value === '计算值' && state == 1 "><span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) n.v.v }}</span></template> <template v-else-if=" n.v.ps != undefined && @@ -306,7 +306,7 @@ state == 1 "> <span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) n.v.v }}</span> </template> <template v-else-if=" @@ -2166,13 +2166,6 @@ .replace(new RegExp("\n", "g"), "<br/>") .replace(new RegExp("@", "g"), "<br/>") : ""; // 对数据保留小数点进行处理 if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) { let num = 0; let str0 = v.ct.fa.split(".")[1]; num = str0.length; str = Number(str).toFixed(num); } if (v.v && typeof v.v == "string" && v.v.includes("@")) { str = v.v.replace(new RegExp("@", "g"), "<br/>"); } @@ -2716,26 +2709,6 @@ this.$download.saveAs(res.data.fileUrl, row.fileName) }) .catch((error) => { }); }, /** * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。 * * @param v 要格式化的数值 * @param ct 包含格式化配置的对象 * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数 * @returns 格式化后的字符串或原始数值(若配置不符合要求) */ toFixed(v, ct) { if (v && ct && ct.fa) { if (ct.fa.includes(".")) { let num = ct.fa.slice(4).length; return Number(v).toFixed(num); } else { return v; } } else { return v; } }, async goback() { await this.waitForPendingSaves(); src/views/business/inspectionView/index.vue
@@ -257,7 +257,7 @@ n.v.ps.value === '计算值' && state == 1 "><span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) n.v.v }}</span></template> <template v-else-if=" n.v.ps != undefined && @@ -265,7 +265,7 @@ state == 1 "> <span :style="`font-family:${n.v.ff} !important;`">{{ toFixed(n.v.v, n.v.ct) n.v.v }}</span> </template> <template v-else-if=" @@ -1949,13 +1949,6 @@ .replace(new RegExp("\n", "g"), "<br/>") .replace(new RegExp("@", "g"), "<br/>") : ""; // 对数据保留小数点进行处理 if (v.ct && v.ct.fa && v.ct.fa.includes(".") && str) { let num = 0; let str0 = v.ct.fa.split(".")[1]; num = str0.length; str = Number(str).toFixed(num); } if (v.v && typeof v.v == "string" && v.v.includes("@")) { str = v.v.replace(new RegExp("@", "g"), "<br/>"); } @@ -2476,26 +2469,6 @@ this.$download.saveAs(res.data.fileUrl, row.fileName) }) .catch((error) => { }); }, /** * 将数值v保留ct.fa中'##'后的指定小数位数,并返回格式化后的字符串。 * * @param v 要格式化的数值 * @param ct 包含格式化配置的对象 * @param ct.fa 格式化配置字符串,若包含'##'则按照其后的内容确定小数位数 * @returns 格式化后的字符串或原始数值(若配置不符合要求) */ toFixed(v, ct) { if (v && ct && ct.fa) { if (ct.fa.includes(".")) { let num = ct.fa.slice(4).length; return Number(v).toFixed(num); } else { return v; } } else { return v; } }, goback() { this.$router.go(-1) src/workers/DataWorker.worker.js
@@ -65,16 +65,8 @@ if(i+1==arr[1]){ // 赋值数采优化检验项列表 arrSpecial.push(n.i) let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value[i]?Number(dataAcquisitionInfo[str].value[i]).toFixed(num0):dataAcquisitionInfo[str].value[i] }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value[i] } // 传递给主线程 result = { method:'changeInput', @@ -92,16 +84,8 @@ // 如果数采次数等于检验值序号,则赋值给当前检验值 arrSpecial.push(n.i) setTimeout(()=>{ let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value } // 传递给主线程 result = { method:'changeInput', @@ -117,16 +101,8 @@ if(n.v.ps.value.includes(num)){ arrSpecial.push(n.i) setTimeout(()=>{ let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value } // 传递给主线程 result = { method:'changeInput', src/workers/InspectionWorker.worker.js
@@ -227,8 +227,6 @@ break; } } let isToExponential = ""; //是否为科学计数法 let list2 = []; //一个数组,里面保存有当前检验项的所有参数值 let isPoint = ""; //是否为小数点 let inputType = null; let currentInsItemId = ""; @@ -262,7 +260,6 @@ break; } } list2.push(c.v.v); // 组装参数的对象集合并赋值,列如{A3:12,B4:15} if ( (getInspectionValueType(item.i) == 1 || @@ -341,22 +338,7 @@ } // 根据输入的数值,进行计算 comResult = compute(item.v.f.replace(/=/g, " "), comValue, isPoint); // 检验项为密度时,根据要求值的小数位改变最终值的小数位 if (inspectionItem == "密度") { const str = "" + tell; const indexOfDecimal = str.indexOf("."); if (indexOfDecimal > -1) { const length = str.length - indexOfDecimal - 1; comResult = comResult.toFixed(length); } } else if ( inspectionItemClass == "外护套机械物理性能" && inspectionItem == "在IRM 902矿物油中浸泡后" && (inspectionItemSubclass == "断裂伸长率变化率" || inspectionItemSubclass == "抗张强度变化率") ) { comResult = Math.round(comResult).toFixed(0); } else if ( if ( typeof comResult == "string" && (comResult.includes("断裂") || comResult.includes("脆化")) ) { @@ -384,15 +366,6 @@ } if (isHaveSymbol) { comResult = symbol + comResult; } let list3 = list2.map((item) => item + ""); // 判断填的检验值是否为科学计数法,如果为科学计数法,则进行转化 isToExponential = list3.some( (val) => val.includes("e+") || val.includes("e-") ); if (isToExponential) { let num2 = new Big(comResult); comResult = num2.toExponential(1); } } else { // 如果检验值类型是文本输入框、下拉框 @@ -432,45 +405,7 @@ // 判断当前行是否为当前检验项所在行,如果为当前行,则给表格数据赋值 for (var b in a) { if (a[b].c == item.c) { try { if (comResult == 0) { // 判断计算结果是否为0,如果为0,则给表格数据赋值为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 = a[b].v.ct.fa.split(".")[1]; num = str.length; a[b].v.v = comResult ? Number(comResult).toFixed(num) : comResult; } else if ( typeof comResult == "string" && (comResult.includes("e+") || comResult.includes("e-")) ) { // 判断计算结果是否为科学计数法,如果为科学计数法,则给表格数据赋值为科学计数法 a[b].v.v = comResult; } else { const inspectionItem = findInsItem(item.i).inspectionItem; // 判断计算结果是否为数字,如果为数字,则给表格数据赋值为数字 if (inspectionItem == "铜线电阻率ρ20最大值") { let val = parseFloat(Number(comResult).toFixed(5)); a[b].v.v = isNaN(val) ? comResult : val; } else { let val = parseFloat(Number(comResult).toFixed(3)); a[b].v.v = isNaN(val) ? comResult : val; } } } catch (error) { // 如果以上判断都不支持,则直接赋值 a[b].v.v = comResult; console.log("error---", error); } hasComputedWrite = true; break; }