bug修改

This commit is contained in:
2025-10-16 16:31:17 +08:00
parent 01f7b2074d
commit 6d1a8d7378
2 changed files with 27 additions and 12 deletions

View File

@@ -2,8 +2,8 @@
"name" : "宁波富佳", "name" : "宁波富佳",
"appid" : "__UNI__F00F4C3", "appid" : "__UNI__F00F4C3",
"description" : "宁波富佳手持系统", "description" : "宁波富佳手持系统",
"versionName" : "1.0.2", "versionName" : "1.0.3",
"versionCode" : 102, "versionCode" : 103,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

@@ -41,7 +41,16 @@
</thead> </thead>
<tbody> <tbody>
<tr v-for="(e, i) in dataList" :key="i"> <tr v-for="(e, i) in dataList" :key="i">
<td><input class="sin_input" :class="{ 'input-error': e.mater_frame === '' }" type="text" v-model="e.mater_frame" @blur="checkMaterFrame(i)" @input="clearError(i)" ref="materFrameInputs"></td> <td>
<input
class="sin_input"
:class="{ 'input-error': errorIndex === i }"
type="text"
v-model="e.mater_frame"
@blur="checkMaterFrame(i)"
@input="clearError(i)"
ref="materFrameInputs">
</td>
<td><input class="sin_input" type="number" v-model="e.qty" @blur="checkQty(i)"></td> <td><input class="sin_input" type="number" v-model="e.qty" @blur="checkQty(i)"></td>
<td><button class="mini-btn" type="primary" size="mini" style="display: block" @tap="delItem(i)">{{$t('button.Delete')}}</button></td> <td><button class="mini-btn" type="primary" size="mini" style="display: block" @tap="delItem(i)">{{$t('button.Delete')}}</button></td>
</tr> </tr>
@@ -75,7 +84,8 @@
totalQty: null, totalQty: null,
currentData: {}, currentData: {},
disabled: false, disabled: false,
dataList: [] dataList: [],
errorIndex: -1 // 新增:记录错误行的索引
}; };
}, },
watch: { watch: {
@@ -101,8 +111,14 @@
}) })
}, },
addmater () { addmater () {
this.validateMaterFrames() if(this.validateMaterFrames()){
this.dataList.push({mater_frame: null, qty: 0.000}) this.dataList.push({mater_frame: null, qty: 0.000})
}else {
uni.showToast({
title: '请先填写当前料框号',
icon: 'none'
})
}
}, },
delItem (i) { delItem (i) {
this.dataList.splice(i, 1) this.dataList.splice(i, 1)
@@ -141,8 +157,8 @@
} }
}, },
clearError(index) { clearError(index) {
if (this.dataList[index].mater_frame) { if (this.dataList[index].mater_frame && this.errorIndex === index) {
this.$refs.materFrameInputs[index].$el.style.borderColor = '' this.errorIndex = -1
} }
}, },
updateTotalQty() { updateTotalQty() {
@@ -150,13 +166,12 @@
}, },
validateMaterFrames () { validateMaterFrames () {
let isValid = true let isValid = true
this.errorIndex = -1 // 重置错误索引
for (let i = 0; i < this.dataList.length; i++) { for (let i = 0; i < this.dataList.length; i++) {
if (!this.dataList[i].mater_frame) { if (!this.dataList[i].mater_frame) {
this.$refs.materFrameInputs[i].$el.style.borderColor = 'red' this.errorIndex = i // 设置第一个错误的索引
this.scrollToView(this.$refs.materFrameInputs[i])
isValid = false isValid = false
} else { break // 找到第一个错误就停止
this.$refs.materFrameInputs[i].$el.style.borderColor = ''
} }
} }
return isValid return isValid