From 771699a2a85aecde95a4393ef6016b28f73a551e Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 28 六月 2024 14:11:46 +0800
Subject: [PATCH] 检验任务bug修复
---
src/components/do/b1-inspect-order-plan/Inspection.vue | 80 ++++++++++---------
src/util/excelFountion.js | 121 +++++++++++++++++------------
2 files changed, 112 insertions(+), 89 deletions(-)
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index 09e8c64..fbf847c 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -253,7 +253,7 @@
</el-form>
</div>
<div class="center">
- <div class="search">
+ <div class="search" style="text-align: left;">
<el-radio-group v-model="currentTable" size="small">
<el-radio-button :label="item.templateId" v-for="(item,index) in tableLists" :key="index"
size="small">{{ item.templateName }}</el-radio-button>
@@ -272,7 +272,7 @@
<template v-if="n.v.ps!=undefined && n.v.ps.value==='妫�楠屽��' && state==1">
<el-input v-if="getInspectionValueType(n.i) == 1" class="table_input" v-model="n.v.v"
:disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')"
- @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" type="number" @mousewheel.native.prevent>
+ @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" type="number" @mousewheel.native.prevent :key="'abc-'+'000'+index+'000'+i+'000'+j">
<el-button slot="append" type="primary" icon="el-icon-edit" size="mini"
v-if="getInspectionItemType(n.i) == 1" @click="getSystemValue(n)"></el-button>
</el-input>
@@ -1204,43 +1204,47 @@
let ask = this.currentSample.insProduct.find(m => m.id == item.i).ask?this.currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null;
let res = Object.values(comValue)[0]
let comp = []
- if(ask){
- comp = ask.map((m, i) => {
- if (m.includes('=')) {
- let str = m.split('=')[1]
- if(typeof res == 'string'&&typeof str == 'string'){
- return res.trim() == str.trim()
- }else{
- return res == str
- }
- } else if (m.includes('鈮�')) {
- return res >= m.split('鈮�')[1]
- }else if (m.includes('鈮�')) {
- return res <= m.split('鈮�')[1]
- }else if (m.includes('<')) {
- return res < m.split('<')[1]
- }else if (m.includes('>')) {
- return res > m.split('>')[1]
- }else if (m.includes('~')) {
- let k = m.split('~')
- return res >= k[0] && res <= k[1]
- }else if(m.includes('-')){
- let k = m.split('-')
- return res >= k[0] && res <= k[1]
- }else if(m.includes('卤')){
- let k = m.split('卤')
- return res >= (k[0] - k[1]) && res <= (k[0] + k[1])
- }else if(m.includes('锛�')){
- return res > m.split('锛�')[1]
- }else if(m.includes('锛�')){
- return res < m.split('锛�')[1]
+ if(res==''||res==null||res==undefined||res=='Infinity'){
+ item.v.v = ''
+ }else{
+ if(ask){
+ comp = ask.map((m, i) => {
+ if (m.includes('=')) {
+ let str = m.split('=')[1]
+ if(typeof res == 'string'&&typeof str == 'string'){
+ return res.trim() == str.trim()
+ }else{
+ return res == str
+ }
+ } else if (m.includes('鈮�')) {
+ return res >= m.split('鈮�')[1]
+ }else if (m.includes('鈮�')) {
+ return res <= m.split('鈮�')[1]
+ }else if (m.includes('<')) {
+ return res < m.split('<')[1]
+ }else if (m.includes('>')) {
+ return res > m.split('>')[1]
+ }else if (m.includes('~')) {
+ let k = m.split('~')
+ return res >= k[0] && res <= k[1]
+ }else if(m.includes('-')){
+ let k = m.split('-')
+ return res >= k[0] && res <= k[1]
+ }else if(m.includes('卤')){
+ let k = m.split('卤')
+ return res >= (k[0] - k[1]) && res <= (k[0] + k[1])
+ }else if(m.includes('锛�')){
+ return res > m.split('锛�')[1]
+ }else if(m.includes('锛�')){
+ return res < m.split('锛�')[1]
+ }
+ })
}
- })
- }
- if (comp.every(m => m)) {
- item.v.v = 1
- } else {
- item.v.v = 0
+ if (comp.every(m => m)) {
+ item.v.v = 1
+ } else {
+ item.v.v = 0
+ }
}
this.saveInsContext()
}
diff --git a/src/util/excelFountion.js b/src/util/excelFountion.js
index d879f8f..de10531 100644
--- a/src/util/excelFountion.js
+++ b/src/util/excelFountion.js
@@ -1,7 +1,7 @@
function SUM(...val){
- let num = 0;
+ let num = null;
if(val&&val.length>0){
val.forEach(item=>{
num+=item;
@@ -10,33 +10,44 @@
return num;
}
function MAX(...val){
- let max = 0;
+ let max = null;
if(val&&val.length>0){
val = val.filter(item=>item!=null&&item!=='')
- max = Math.max(...val)
+ if(val.length>0){
+ max = Math.max(...val)
+ }else{
+ max = null;
+ }
}
return max;
}
function MIN(...val){
- let min = 0;
+ let min = null;
if(val&&val.length>0){
val = val.filter(item=>item!=null&&item!=='')
- min = Math.min(...val)
+ console.log(val)
+ if(val.length>0){
+ min = Math.min(...val)
+ }
}
return min;
}
function AVERAGE(...val){
- let num = 0;
+ let num = null;
let arr = [];
if(val&&val.length>0){
arr = val.filter(item=>item!=null&&item!=='')
arr.forEach(item=>{
num+=item;
})
- return num/arr.length;
+ if(arr.length>0){
+ return num/arr.length;
+ }else{
+ return null;
+ }
}else{
- return 0;
+ return null;
}
}
@@ -51,19 +62,23 @@
* @param {Object} cellId
*/
function getColumnNameFromId(cellId){
- if (! Array.isArray(cellId)) {
- cellId = cellId.split('-');
- }
- var i = cellId[0];
- var letter = '';
- if (i > 701) {
- letter += String.fromCharCode(64 + parseInt(i / 676));
- letter += String.fromCharCode(64 + parseInt((i % 676) / 26));
- } else if (i > 25) {
- letter += String.fromCharCode(64 + parseInt(i / 26));
- }
- letter += String.fromCharCode(65 + (i % 26));
- return letter + (parseInt(cellId[1]) + 1);
+ try{
+ if (! Array.isArray(cellId)) {
+ cellId = cellId.split('-');
+ }
+ var i = cellId[0];
+ var letter = '';
+ if (i > 701) {
+ letter += String.fromCharCode(64 + parseInt(i / 676));
+ letter += String.fromCharCode(64 + parseInt((i % 676) / 26));
+ } else if (i > 25) {
+ letter += String.fromCharCode(64 + parseInt(i / 26));
+ }
+ letter += String.fromCharCode(65 + (i % 26));
+ return letter + (parseInt(cellId[1]) + 1);
+ }catch(e){
+ console.log('error',cellId)
+ }
}
/**
* 鏍规嵁鍒楀悕鑾峰彇鍧愭爣
@@ -71,37 +86,41 @@
* @param {Object} arr
*/
function getIdFromColumnName(id, arr) {
- // Get the letters
- var t = /^[a-zA-Z]+/.exec(id);
- if (t) {
- // Base 26 calculation
- var code = 0;
- for (var i = 0; i < t[0].length; i++) {
- code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
- }
- code--;
- // Make sure jexcel starts on zero
- if (code < 0) {
- code = 0;
- }
-
- // Number
- var number = parseInt(/[0-9]+$/.exec(id));
- if (number > 0) {
- number--;
- }
-
- if (arr == true) {
- id = [ code, number ];
- } else {
- // id = code + '-' + number;
- id = {
- c:code,
- r:number
+ try{
+ // Get the letters
+ var t = /^[a-zA-Z]+/.exec(id);
+ if (t) {
+ // Base 26 calculation
+ var code = 0;
+ for (var i = 0; i < t[0].length; i++) {
+ code += parseInt(t[0].charCodeAt(i) - 64) * Math.pow(26, (t[0].length - 1 - i));
}
- }
- }
- return id;
+ code--;
+ // Make sure jexcel starts on zero
+ if (code < 0) {
+ code = 0;
+ }
+
+ // Number
+ var number = parseInt(/[0-9]+$/.exec(id));
+ if (number > 0) {
+ number--;
+ }
+
+ if (arr == true) {
+ id = [ code, number ];
+ } else {
+ // id = code + '-' + number;
+ id = {
+ c:code,
+ r:number
+ }
+ }
+ }
+ return id;
+ }catch(e){
+ console.log('error',id)
+ }
}
// 鑾峰彇鍙傛暟鍒楄〃
--
Gitblit v1.9.3