Mr.Zhang
2023-08-30 05143990efdcad0e57341913480ab1fb112993bc
minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
@@ -5,7 +5,8 @@
         <div class="tl_title_left">
            <div class="tl_title_left_x"></div>
            <span>投料信息</span>
            <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span>
            <!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
            <!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
         </div>
         <div class="tl_title_right" @click="add">
            <image src="../../static/gongdan_ic_shoudong@2x.png" class="add-img" mode=""></image>
@@ -19,7 +20,7 @@
               <div class="tl_list_item" @click="open1(index)">
                  <div class="tl_list_item_label">选择物料</div>
                  <div class="tl_list_item_go" v-if="!item.materialName">
                     <span>点击跳转到物料列表</span>
                     <span>点击跳转到物料列表</span>
                     <u-icon name="arrow-right"></u-icon>
                  </div>
                  <div class="tl_list_item_wl" v-else>
@@ -46,24 +47,48 @@
               </div>
            </div>
         </u-swipe-action-item>
      </u-swipe-action>
      </u-swipe-action>
      <SelectMaterial ref="selectMaterial" />
   </view>
</template>
<script>
   import workOrderInfo from '@/components/workOrderInfo.vue'
   import workOrderInfo from '@/components/workOrderInfo.vue'
   import SelectMaterial from '@/components/selectMaterial.vue'
   import {
      positiveInteger,
      number
   } from '@/common/config'
   export default {
      components: {
         workOrderInfo
         workOrderInfo,
         SelectMaterial
      },
      data() {
         return {
            total: 3,
            formList: [{
               dw: 'dasda'
            }],
            // formList: [{
            //    id: Date.now(),
            //    toolingTypeId: '', // 工装类型
            //    toolingTypeName: '', // 工装类型名称
            //    workClothesId: '', // 工装
            //    workClothesName: '', // 工装名称
            //    num: '', // 数量
            //    attribute: '', // 工装属性
            //    attributeType: '', // 工装属性类型
            //    dw: '', // 物料单位
            //    unitAttribute: ''
            // }],
            materialList: [{
               id: '',
               materialName: '',
               materialCode: '',
               qualityType: '',
               procedureName: '',
               locationName: '',
               batch: '',
               num: '',
               unitAttribute: ''
            }],
            options: [{
               text: '删除',
@@ -72,14 +97,54 @@
               }
            }],
         };
      },
      },
      methods: {
         open1(index) {
            this.$refs.selectMaterial.open({})
         },
         deleItem(index) {
            if (this.materialList.length === 1) {
               uni.$u.toast('至少保留一条投料信息')
               return
            }
            this.materialList.splice(index, 1)
         },
         add() {
            this.total += 1
            this.materialList.unshift({
               id: '',
               materialName: '',
               materialCode: '',
               qualityType: '',
               procedureName: '',
               locationName: '',
               batch: '',
               num: '',
               unitAttribute: ''
            })
         },
         changeNumber(num, index, unitAttribute) {
            if (unitAttribute === 0 && num !== '') {
               if (!positiveInteger.test(num)) {
                  uni.$u.toast({
                     message: '只能输入正整数'
                  })
                  this.materialList[index].num = ''
               }
            } else if (unitAttribute === 1 && num !== '') {
               if (!number.test(num)) {
                  uni.$u.toast({
                     message: '只能输入正整数或小数(最多四位)'
                  })
                  this.materialList[index].num = ''
               }
            }
            if (num <= 0) {
               uni.$u.toast({
                  message: '投料数量不能小于等于0'
               })
               this.materialList[index].num = ''
            }
         }
      }
   }