From 4e3b0ffb433f6e331cd2eae93bcd874d41b8de84 Mon Sep 17 00:00:00 2001 From: value <z1292839451@163.com> Date: 星期四, 23 五月 2024 17:37:07 +0800 Subject: [PATCH] 解决标准库bug --- src/components/do/b1-inspect-order-plan/Inspection.vue | 69 ++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue index 7f56a52..49302c5 100644 --- a/src/components/do/b1-inspect-order-plan/Inspection.vue +++ b/src/components/do/b1-inspect-order-plan/Inspection.vue @@ -241,9 +241,10 @@ <el-input v-else-if="getInspectionValueType(n.i) == 2" class="table_input" type="textarea" v-model="n.v.v" :disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')" - @change="saveInsContext()" /> + @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)" /> <el-select v-else-if="getInspectionValueType(n.i) == 5" class="table_input" v-model="n.v.v" - :disabled="state>1" @visible-change="e=>getDic(e,n.i)" @change="saveInsContext()"> + :disabled="state>1" @visible-change="e=>getDic(e,n.i)" + @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`)"> <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option> </el-select> <span :style="`font-family:${n.v.ff} !important;`" @@ -272,14 +273,14 @@ <span :style="`font-family:${n.v.ff} !important;`">{{getTell(n.i)}}</span> </template> <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='鏈�缁堝��' && state==1"> - <el-input class="table_input" type="textarea" + <!-- <el-input class="table_input" type="textarea" :disabled="getInspectionItemType(n.i) == 1 || (n.u != userId && n.u != undefined && n.u != '')" v-model="n.v.v" @change="saveInsContext()" v-if="getInspectionValueType(n.i) == 2"></el-input> <el-select v-else-if="getInspectionValueType(n.i) == 5" class="table_input" v-model="n.v.v" :disabled="state>1" @visible-change="e=>getDic(e,n.i)" @change="saveInsContext()"> <el-option v-for="(e, i) in enumList" :key="i" :label="e.label" :value="e.value"></el-option> - </el-select> - <span v-else :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span> + </el-select> --> + <span :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span> </template> <span v-else :style="`font-family:${n.v.ff} !important;`">{{n.v.v}}</span> </div> @@ -843,15 +844,19 @@ if (b[0].r == a.r) { b.forEach(c => { if (c.c == a.c) { - if (!isNaN(parseFloat(c.v.v))) { - var tableCode = '' - for (var d in this.comparisonList) { - if (c.c == this.comparisonList[d].value) { - tableCode = this.comparisonList[d].label - break - } + var tableCode = '' + for (var d in this.comparisonList) { + if (c.c == this.comparisonList[d].value) { + tableCode = this.comparisonList[d].label + break } - comValue[(tableCode + (c.r + 1))] = parseFloat(c.v.v) + } + if(this.getInspectionValueType(item.i)==1){ + if (!isNaN(parseFloat(c.v.v))) { + comValue[(tableCode + (c.r + 1))] = parseFloat(c.v.v) + } + }else{ + comValue[(tableCode + (c.r + 1))] = c.v.v } } }) @@ -865,24 +870,22 @@ let comp = ask.map((m, i) => { if (m.includes('=')) { return res == m.split('=')[1] - } - if (m.includes('鈮�')) { + } else if (m.includes('鈮�')) { return res >= m.split('鈮�')[1] - } - if (m.includes('鈮�')) { + }else if (m.includes('鈮�')) { return res <= m.split('鈮�')[1] - } - if (m.includes('<')) { + }else if (m.includes('<')) { return res < m.split('<')[1] - } - if (m.includes('>')) { + }else if (m.includes('>')) { return res > m.split('>')[1] } }) - if (comp.every(m => m)) { - item.v.v = 1 - } else { - item.v.v = 0 + if(this.getInspectionValueType(item.i)==1){ + if (comp.every(m => m)) { + item.v.v = 1 + } else { + item.v.v = 0 + } } this.saveInsContext() } @@ -922,14 +925,18 @@ valueList.forEach(b => { str = str.replace(b.name, b.value) }) - if (item.v.f.includes('/') > -1) { + if (item.v.f.includes('/')) { if (Object.getOwnPropertyNames(comValue).length == valueList.length) { comResult = eval(str) } else { comResult = '' } } else { - comResult = eval(str) + if(this.getInspectionValueType(item.i)==1){ + comResult = eval(str) + }else{ + comResult = str + } } break; } @@ -937,8 +944,12 @@ if (a[0].r == item.r && comResult != '') { for (var b in a) { if (a[b].c == item.c) { - let val = parseFloat(comResult.toFixed(3)) - a[b].v.v = isNaN(val) ? '' : val + try{ + let val = parseFloat(comResult.toFixed(3)) + a[b].v.v = isNaN(val) ? '' : val + }catch(e){ + a[b].v.v = comResult + } break } } -- Gitblit v1.9.3