bug修改
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
"name" : "宁波富佳",
|
||||
"appid" : "__UNI__F00F4C3",
|
||||
"description" : "宁波富佳手持系统",
|
||||
"versionName" : "1.0.2",
|
||||
"versionCode" : 102,
|
||||
"versionName" : "1.0.3",
|
||||
"versionCode" : 103,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
@@ -41,7 +41,16 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<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><button class="mini-btn" type="primary" size="mini" style="display: block" @tap="delItem(i)">{{$t('button.Delete')}}</button></td>
|
||||
</tr>
|
||||
@@ -75,7 +84,8 @@
|
||||
totalQty: null,
|
||||
currentData: {},
|
||||
disabled: false,
|
||||
dataList: []
|
||||
dataList: [],
|
||||
errorIndex: -1 // 新增:记录错误行的索引
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -101,8 +111,14 @@
|
||||
})
|
||||
},
|
||||
addmater () {
|
||||
this.validateMaterFrames()
|
||||
this.dataList.push({mater_frame: null, qty: 0.000})
|
||||
if(this.validateMaterFrames()){
|
||||
this.dataList.push({mater_frame: null, qty: 0.000})
|
||||
}else {
|
||||
uni.showToast({
|
||||
title: '请先填写当前料框号',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
delItem (i) {
|
||||
this.dataList.splice(i, 1)
|
||||
@@ -141,8 +157,8 @@
|
||||
}
|
||||
},
|
||||
clearError(index) {
|
||||
if (this.dataList[index].mater_frame) {
|
||||
this.$refs.materFrameInputs[index].$el.style.borderColor = ''
|
||||
if (this.dataList[index].mater_frame && this.errorIndex === index) {
|
||||
this.errorIndex = -1
|
||||
}
|
||||
},
|
||||
updateTotalQty() {
|
||||
@@ -150,13 +166,12 @@
|
||||
},
|
||||
validateMaterFrames () {
|
||||
let isValid = true
|
||||
this.errorIndex = -1 // 重置错误索引
|
||||
for (let i = 0; i < this.dataList.length; i++) {
|
||||
if (!this.dataList[i].mater_frame) {
|
||||
this.$refs.materFrameInputs[i].$el.style.borderColor = 'red'
|
||||
this.scrollToView(this.$refs.materFrameInputs[i])
|
||||
this.errorIndex = i // 设置第一个错误的索引
|
||||
isValid = false
|
||||
} else {
|
||||
this.$refs.materFrameInputs[i].$el.style.borderColor = ''
|
||||
break // 找到第一个错误就停止
|
||||
}
|
||||
}
|
||||
return isValid
|
||||
|
||||
Reference in New Issue
Block a user