Mr.Zhang
2023-09-06 a89fe32c353040bbb95d7519cf7bafc4b5934f10
minipro_standard/pages_adjust/pages/addReceipt/addReceipt.vue
@@ -3,16 +3,16 @@
      <view class="rework_list">
         <view class="rework_list_item">
            <text><b>*</b>单据类型</text>
            <view class="rework_list_item_right">
            <view class="rework_list_item_right" @click="typeShow = true">
               <text :class="form.typeName ? 'black' : ''">{{form.typeName ? form.typeName : '请选择'}}</text>
               <van-icon name="arrow" size="20" color="#999999" />
               <u-icon name="arrow-right"></u-icon>
            </view>
         </view>
         <view class="rework_list_item">
            <text><b>*</b>入库仓库</text>
            <view class="rework_list_item_right">
            <view class="rework_list_item_right" @click="warehouseShow = true">
               <text :class="form.warehouseName ? 'black' : ''">{{form.warehouseName ? form.warehouseName : '请选择'}}</text>
               <van-icon name="arrow" size="20" color="#999999" />
               <u-icon name="arrow-right"></u-icon>
            </view>
         </view>
      </view>
@@ -29,46 +29,46 @@
         </view>
         <van-swipe-cell v-for="(item, index) in list" :key="index">
            <view class="rework_qd_list">
               <view class="rework_qd_item">
               <view class="rework_qd_item" @click="locationShow = true">
                  <text><b>*</b>入库货位</text>
                  <view class="rework_qd_item_right">
                     <text :class="item.locationName ? 'black' : ''">{{item.locationName ? item.locationName : '请选择'}}</text>
                     <van-icon name="arrow" size="20" color="#999999" />
                     <u-icon name="arrow-right"></u-icon>
                  </view>
               </view>
               <view class="rework_qd_item">
               <view class="rework_qd_item" @click="materialsShow = true">
                  <text><b>*</b>入库物料</text>
                  <view class="rework_qd_item_right">
                     <text :class="item.materialName ? 'black' : ''">{{item.materialName ? item.materialName : '请选择'}}</text>
                     <van-icon name="arrow" size="20" color="#999999" />
                     <u-icon name="arrow-right"></u-icon>
                  </view>
               </view>
               <template v-if="form.type !== 25">
                  <view class="rework_qd_item">
                  <view class="rework_qd_item" @click="productionShow = true">
                     <text>生产工序</text>
                     <view class="rework_qd_item_right">
                        <text :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '请选择'}}</text>
                        <van-icon name="arrow" size="20" color="#999999" />
                        <u-icon name="arrow-right"></u-icon>
                     </view>
                  </view>
               </template>
               <view class="rework_qd_item">
               <view class="rework_qd_item" @click="qualityShow = true">
                  <text><b>*</b>质量属性</text>
                  <view class="rework_qd_item_right">
                     <text :class="item.qualityTypeName ? 'black' : ''">{{item.qualityTypeName ? item.qualityTypeName : '请选择'}}</text>
                     <van-icon name="arrow" size="20" color="#999999" />
                     <u-icon name="arrow-right"></u-icon>
                  </view>
               </view>
               <view class="rework_qd_item">
                  <text>批次号</text>
                  <view class="rework_qd_item_right">
                     <input type="text" v-model="item.batch" placeholder="请输入" />
                     <u--input placeholder="请输入" inputAlign="right" :customStyle="{width: '230rpx'}" border="surround" v-model="item.batch"></u--input>
                  </view>
               </view>
               <view class="rework_qd_item">
                  <text><b>*</b>入库数量<template v-if="item.unitName">({{ item.unitName }})</template></text>
                  <view class="rework_qd_item_right">
                     <input type="text" v-model="item.num" placeholder="0" />
                     <u--input placeholder="0" inputAlign="right" :customStyle="{width: '230rpx'}" border="surround" v-model="item.num"></u--input>
                  </view>
               </view>
            </view>
@@ -78,27 +78,156 @@
         </van-swipe-cell>
      </view>
      <view class="rework_zw"></view>
      <!-- 底部操作按钮 -->
      <view class="rework_footer">
         <button class="rework_footer_submit">提交</button>
      </view>
      <u-toast ref="uToast"></u-toast>
      <!-- 仓库 -->
      <Warehouse :show="warehouseShow" @close="close" @value="getValue" />
      <!-- 物料 -->
      <Material :show="materialsShow" @close="close1" @value="getValue1" />
      <!-- 货位 -->
      <location :show="locationShow" :list="locationList" @close="close3" @value="getValue3" />
      <!-- 工序 -->
      <ProductionProcess :show="productionShow" :list="productionList" @close="close4" @value="getValue4" />
      <!-- 单据类型 -->
      <u-picker :show="typeShow" keyName="name" :columns="typeList" @confirm="confirm" @cancel="typeClose"></u-picker>
      <!-- 质量属性 -->
      <u-picker :show="qualityShow" :columns="columns" @cancel="qualityShow = false" keyName="name" @confirm="onConfirm1"></u-picker>
   </view>
</template>
<script>
   import Warehouse from '../../components/Warehouse.vue'
   import location from '../../components/location.vue'
   import Material from '../../components/Material.vue'
   import ProductionProcess from '../../components/ProductionProcess.vue'
   export default {
      components: { Warehouse, location, Material, ProductionProcess },
      data() {
         return {
            i: 0,
            form: {
               warehouseName: '',
               warehouseId: '',
               type: '',
               typeName: ''
            },
            list: []
            locationList: [],
            productionList: [],
            columns: [
               [
                  { name: '合格', id: '0' },
                  { name: '不良', id: '1' },
                  { name: '报废', id: '2' }
               ]
            ],
            list: [
               {
                  batch: '',
                  locationId: '',
                  locationIdLabel: '',
                  locationName: '',
                  materialId: '',
                  materialName: '',
                  num: '',
                  hasBom: '',
                  procedureId: '',
                  procedureName: '',
                  qualityType: '',
                  qualityTypeName: '',
                  unitId: '',
                  unitName: ''
               }
            ],
            typeList: [[{name: '采购入库', id: 25}, {name: '库存调整', id: 28}]],
            warehouseShow: false,
            typeShow: false,
            locationShow: false,
            materialsShow: false,
            productionShow: false,
            qualityShow: false
         };
      },
      methods: {
         // 质量属性确认
         onConfirm1(value) {
            this.form.typeName = value.name
            this.form.type = value.id
            if (value.id == 25) {
               this.list.forEach(item => {
                  item.procedureId = ''
                  item.procedureName = ''
               })
            }
            this.typeShow = false
         },
         // 选择物料
         getValue1(item) {
            this.list[this.i].materialName = item.mmodelUnionName
            this.list[this.i].materialId = item.id
            this.list[this.i].unitId = item.unitId
            this.list[this.i].hasBom = item.hasBom
            this.list[this.i].unitName = item.umodelName
            // 获取物料下工序
            getListByMaterialId({
               materialId: item.id
            }).then(res => {
               if (res.code === 200) {
                  productionList.value = res.data
                  this.list[this.i].procedureId = ''
                  this.list[this.i].procedureName = ''
               }
            })
            materialsShow.value = false
         },
         // 关闭仓库选择弹框
         close1() {
            this.materialsShow = false
         },
         // 选择货位
         getValue3(item) {
            this.list[this.i].locationId = item.id
            this.list[this.i].locationName = item.unionName
            this.list[this.i].qualityType = ''
            this.list[this.i].qualityTypeName = ''
            this.list[this.i].locationIdLabel = item.label
            if (item.label === 'APPLIANCE_ONTEST') {
               this.list[this.i].qualityType = '0'
               this.list[this.i].qualityTypeName = '合格'
            } else if (item.label === 'APPLIANCE_OFFTEST') {
               this.list[this.i].qualityType = '1'
               this.list[this.i].qualityTypeName = '不良'
            } else if (item.label === 'APPLIANCE_USELESS') {
               this.list[this.i].qualityType = '2'
               this.list[this.i].qualityTypeName = '报废'
            }
            this.locationShow = false
         },
         // 关闭货位选择弹框
         close3() {
            this.locationShow = false
         },
         // 确认单据类型
         confirm(val) {
            this.form.type = val.value[0].id
            this.form.typeName = val.value[0].name
            this.typeShow = false
         },
         // 仓库确认
         getValue(val) {
            this.form.warehouseName = val.name
            this.form.warehouseId = val.id
            this.warehouseShow = false
         },
         typeClose() {
            this.typeShow = false
         },
         close() {
            this.warehouseShow = false
         },
         // 添加明细
         addItem() {
            if (!this.form.warehouseId) return this.$refs.uToast.show({ type: 'default', message: "请选择入库仓库" })
            this.list.push({
@@ -121,7 +250,7 @@
         // 删除
         dele(index) {
            if (this.list.length === 1) {
               this.$refs.uToast.show({ type: 'default', message: "至少保留一条工装信息" })
               this.$refs.uToast.show({ type: 'default', message: "至少保留一条物流清单信息" })
               return
            }
            this.list.splice(index, 1)
@@ -133,12 +262,12 @@
<style lang="scss" scoped>
   .rework {
      width: 100%;
      height: 100%;
      position: absolute;
      min-height: 100vh;
      background-color: #F7F7F7;
      .rework_list {
         display: flex;
         flex-direction: column;
         background: white;
         background: #ffffff;
         padding: 0 30rpx;
         box-sizing: border-box;
         .rework_list_item {