pjb
15 小时以前 d9afd0924fc3bb5b495d4f879fc8b82b0be7c708
pages/order/orderComb.vue
@@ -62,6 +62,12 @@
                     </view>
                  </view>
                  <view class="info-row">
                     <view class="info-label">工单号:</view>
                     <view class="info-value">
                        <text class="tag tag-primary">{{item.standby1 || '-'}}</text>
                     </view>
                  </view>
                  <view class="info-row">
                     <view class="info-label">批号:</view>
                     <view class="info-value">
                        <text class="tag tag-warning">{{item.batch || '-'}}</text>
@@ -109,9 +115,15 @@
                  </view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">重量:</view>
                  <view class="popup-item-left">工单号:</view>
                  <view class="popup-item-right">
                     <input type="text" v-model="weight" class="popup-input" placeholder="请输入重量">
                     <input type="text" v-model="standby1" class="popup-input" placeholder="请输入工单号">
                  </view>
               </view>
               <view class="popup-item">
                  <view class="popup-item-left">批号:</view>
                  <view class="popup-item-right">
                     <input type="text" v-model="batch" class="popup-input" placeholder="请输入批号">
                  </view>
               </view>
               <view class="popup-item">
@@ -180,6 +192,7 @@
            msgType1: 'success',
            msgType: 'success',
            messageText: '',
            standby1: '',
            title: '',
            content: '',
            barcodeFocus: true,
@@ -459,11 +472,12 @@
         },
         resetClose() {},
         revise(item, i) {
            this.standby1 = this.dataList[i].standby1 || ''  //添加工单号赋值
            this.matnr1 = this.dataList[i].matnr
            this.count = this.dataList[i].anfme
            this.batch = this.dataList[i].batch
            this.batch = this.dataList[i].batch
            this.weight = this.dataList[i].weight
            this.maxCount = this.dataList[i].maxCount
            this.maxCount = this.dataList[i].maxCount|| this.dataList[i].anfme || 0  // 添加默认值
            this.rowNum = i
            this.eject()
         },
@@ -483,18 +497,64 @@
            this.dataList.splice(this.removeNum, 1)
         },
         reviseConfirm() {
            this.dataList[this.rowNum].anfme = this.count
            this.dataList[this.rowNum].batch = this.batch
            this.dataList[this.rowNum].weight = this.weight
            uni.showToast({ title:"修改成功", icon: "success", position: 'center' })
            this.$refs.revise.close()
            this.$forceUpdate()
             // 再次校验数量是否超过最大值
             if (this.count > this.maxCount) {
                 uni.showToast({
                     title: `数量不能超过最大值 ${this.maxCount}`,
                     icon: "none",
                     position: 'center'
                 })
                 // 恢复成最大值
                 this.count = this.maxCount
                 return  // 阻止保存
             }
             // 校验数量是否小于1
             if (this.count < 1) {
                 uni.showToast({
                     title: "数量至少为 1",
                     icon: "none",
                     position: 'center'
                 })
                 this.count = 1
                 return  // 阻止保存
             }
             // 校验通过,保存数据
             this.dataList[this.rowNum].standby1 = this.standby1
             this.dataList[this.rowNum].anfme = this.count
             this.dataList[this.rowNum].batch = this.batch
             this.dataList[this.rowNum].weight = this.weight
             uni.showToast({ title:"修改成功", icon: "success", position: 'center' })
             this.$refs.revise.close()
             this.$forceUpdate()
         },
         reviseClose() {
            this.$refs.revise.close()
         },
         changeValue(value) {
            this.count = value
             // 限制数量不能超过 maxCount
             if (value > this.maxCount) {
                 uni.showToast({
                     title: `数量不能超过最大值 ${this.maxCount}`,
                     icon: "none",
                     position: 'center'
                 })
                 this.count = this.maxCount
                 // 将值设置为最大值
                 return
             }
             // 限制数量不能小于 1
             if (value < 1) {
                 uni.showToast({
                     title: "数量至少为 1",
                     icon: "none",
                     position: 'center'
                 })
                 this.count = 1
                 return
             }
             this.count = value
         },
         resst() {
            this.dataList = []