Browse Source

装箱单面辅料新增页面字段调整

jbb 2 years ago
parent
commit
c846665d54
1 changed files with 160 additions and 50 deletions
  1. 160 50
      src/views/packing-list/packinglist-fabrics/addFabricDrawer.vue

+ 160 - 50
src/views/packing-list/packinglist-fabrics/addFabricDrawer.vue

@@ -9,7 +9,8 @@
             <a-row :gutter="24">
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="单号" prop="oddNum">
-                  <a-input placeholder="自动生成" v-model="addFabric.documentNo"></a-input>
+                  {{addFabric.documentNo}}
+                  <!-- <a-input placeholder="自动生成" v-model="addFabric.documentNo"></a-input> -->
                 </a-form-model-item>
               </a-col>
 
@@ -20,13 +21,19 @@
               </a-col> -->
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="集装箱号" prop="styleNum">
+                <a-form-model-item label="集装箱号" prop="containerNumber">
                   <a-input placeholder="请输入集装箱号" v-model="addFabric.containerNumber"></a-input>
                 </a-form-model-item>
               </a-col>
 
+                 <a-col :md="6" :sm="8">
+                <a-form-model-item label="铅分号" prop="plumbumNo">
+                  <a-input placeholder="请输入铅分号" v-model="addFabric.plumbumNo"></a-input>
+                </a-form-model-item>
+              </a-col>
+
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="装柜日期" prop="loadingDate">
+                <a-form-model-item label="装柜日期" prop="latestDateOfShipment">
                   <a-date-picker
                     placeholder="请选择装柜日期"
                     :format="dateFormat"
@@ -37,24 +44,24 @@
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="成衣工厂" prop="clothesFactory">
+                <a-form-model-item label="成衣工厂" prop="garmentFactory">
                   <a-input placeholder="勾选数据自动生成" v-model="addFabric.garmentFactory"></a-input>
                 </a-form-model-item>
               </a-col>
 
-              <a-col :md="6" :sm="8">
+              <!-- <a-col :md="6" :sm="8">
                 <a-form-model-item label="发票号" prop="invoiceNum">
                   <a-input placeholder="请输入发票号" v-model="addFabric.invoiceNo"></a-input>
                 </a-form-model-item>
-              </a-col>
+              </a-col> -->
 
-              <a-col :md="6" :sm="8">
+              <!-- <a-col :md="6" :sm="8">
                 <a-form-model-item label="制单人" prop="preparedBy">
                   <a-input placeholder="请输入制单人" v-model="addFabric.preparedBy"></a-input>
                 </a-form-model-item>
-              </a-col>
+              </a-col> -->
 
-              <a-col :md="6" :sm="8">
+              <!-- <a-col :md="6" :sm="8">
                 <a-form-model-item label="制单日期" prop="preparedDate">
                   <a-date-picker
                     placeholder="请选择制单日期"
@@ -63,7 +70,7 @@
                     v-model="addFabric.preparedDate"
                   />
                 </a-form-model-item>
-              </a-col>
+              </a-col> -->
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="外销发票号" prop="exportInvoiceNo">
@@ -72,16 +79,12 @@
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="托书号" prop="bookNum">
+                <a-form-model-item label="托书号" prop="shippingOrderNumber">
                   <a-input placeholder="请输入托书号" v-model="addFabric.shippingOrderNumber"></a-input>
                 </a-form-model-item>
               </a-col>
 
-              <a-col :md="6" :sm="8">
-                <a-form-model-item label="备注" prop="note">
-                  <a-input placeholder="请输入备注" v-model="addFabric.remarks"></a-input>
-                </a-form-model-item>
-              </a-col>
+           
             </a-row>
           </a-form-model>
         </div>
@@ -121,6 +124,15 @@
                 </a-form-model-item>
               </template>
 
+              
+              <!-- 成分 -->
+              <template slot="composition" slot-scope="text, record, index">
+                <a-form-model-item prop="composition">
+                  <a-input style="width:100%" type="text" v-model="record.composition" />
+                </a-form-model-item>
+              </template>
+
+
               <!-- 门幅 -->
               <template slot="width" slot-scope="text, record, index">
                 <a-form-model-item prop="width">
@@ -198,6 +210,35 @@
                   <a-input style="width:100%" type="text" v-model="record.mannerOfPacking" />
                 </a-form-model-item>
               </template>
+             <!-- 处理方式 -->
+              <template slot="treatmentMethod" slot-scope="text, record, index">
+                <a-form-model-item prop="treatmentMethod">
+                  <a-input style="width:100%" type="text" v-model="record.treatmentMethod" />
+                </a-form-model-item>
+              </template>
+               <!-- 手册纱 -->
+                <template slot="manualYarnFlag" slot-scope="text, record, index">
+                <a-form-model-item prop="manualYarnFlag">
+                  <a-select v-model="record.manualYarnFlag" @change='changeManualYarnFlag'>
+                    <a-select-option :value="1">是</a-select-option>
+                    <a-select-option :value="0">否</a-select-option>
+                  </a-select>
+                </a-form-model-item>
+              </template>
+
+                <!--手册纱单价 -->
+              <template slot="manualYarnUnitPrice" slot-scope="text, record, index">
+                <a-form-model-item prop="manualYarnUnitPrice">
+                  <a-input style="width:100%" type="text" v-model="record.manualYarnUnitPrice" :disabled='manualYarnDisabled' @change="changeManualYarn('Price',record.manualYarnUnitPrice)" />
+                </a-form-model-item>
+              </template>
+
+              <!--手册纱占比 -->
+              <template slot="manualYarnProportion" slot-scope="text, record, index">
+                <a-form-model-item prop="manualYarnProportion">
+                  <a-input style="width:100%" type="text" v-model="record.manualYarnProportion"  :disabled='manualYarnDisabled' @change="changeManualYarn('Proportion',record.manualYarnProportion)" />
+                </a-form-model-item>
+              </template>
 
               <!-- 柜号 -->
               <template slot="containerNumber" slot-scope="text, record, index">
@@ -256,13 +297,14 @@
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import { getShippingDetailId,addFabricList,editFabricList} from '@api/document/packing-list/packinglist-fabrics'
 import JEllipsis from '@/components/jeecg/JEllipsis'
+import moment from 'moment'
 import referShipDetailsModal from '@views/packing-list/packinglist-fabrics/referShipDetailsModal.vue'
 
 export default {
   name: 'AddFabricDrawer', //  新增 装箱单 -面料
   mixins: [JeecgListMixin],
   computed: {},
-  components: { JEllipsis, referShipDetailsModal }, // 参照发运明细 弹框
+  components: { JEllipsis, referShipDetailsModal,moment }, // 参照发运明细 弹框
   props: {
     fatherList: {
       type: Function,
@@ -331,6 +373,7 @@ export default {
         {
           title: '成分/Composition',
           dataIndex: 'composition',
+          scopedSlots: { customRender: 'composition' },
           width: 150,
           className: 'replacecolor'
         },
@@ -338,7 +381,7 @@ export default {
         {
           title: '门幅/Width',
           dataIndex: 'width',
-          scopedSlots: { customRender: 'width' },
+          // scopedSlots: { customRender: 'width' },
           width: 140,
           className: 'replacecolor'
         },
@@ -384,12 +427,12 @@ export default {
           width: 130,
           className: 'replacecolor'
         },
-        {
-          title: '价格',
-          dataIndex: 'price',
-          width: 120,
-          className: 'replacecolor'
-        },
+        // {
+        //   title: '价格',
+        //   dataIndex: 'price',
+        //   width: 120,
+        //   className: 'replacecolor'
+        // },
         {
           title: '克重/G',
           dataIndex: 'gramWeight',
@@ -399,20 +442,20 @@ export default {
         {
           title: '供应商编码(染厂)',
           dataIndex: 'supplierCodeDyeingPlant',
-          scopedSlots: { customRender: 'supplierCodeDyeingPlant' },
+          // scopedSlots: { customRender: 'supplierCodeDyeingPlant' },
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '供应商(染厂)',
           dataIndex: 'supplierDyeingPlant',
-          scopedSlots: { customRender: 'supplierDyeingPlant' },
+          // scopedSlots: { customRender: 'supplierDyeingPlant' },
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '供应商编码(印厂)',
-          scopedSlots: { customRender: 'supplierCodePrintingPlant' },
+          // scopedSlots: { customRender: 'supplierCodePrintingPlant' },
           dataIndex: 'supplierCodePrintingPlant',
           width: 120,
           className: 'replacecolor'
@@ -420,7 +463,7 @@ export default {
         {
           title: '供应商(印厂)',
           dataIndex: 'supplierPrintingPlant',
-          scopedSlots: { customRender: 'supplierPrintingPlant' },
+          // scopedSlots: { customRender: 'supplierPrintingPlant' },
           width: 120,
           className: 'replacecolor'
         },
@@ -433,6 +476,7 @@ export default {
         },
         {
           title: '处理方式',
+          scopedSlots: { customRender: 'treatmentMethod' },
           dataIndex: 'treatmentMethod',
           width: 120,
           className: 'replacecolor'
@@ -440,18 +484,21 @@ export default {
         {
           title: '是否手册纱',
           dataIndex: 'manualYarnFlag',
+          scopedSlots: { customRender: 'manualYarnFlag' },
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '手册纱单价',
           dataIndex: 'manualYarnUnitPrice',
+          scopedSlots: { customRender: 'manualYarnUnitPrice' },
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '手册纱占比%',
           dataIndex: 'manualYarnProportion',
+          scopedSlots: { customRender: 'manualYarnProportion' },
           width: 120,
           className: 'replacecolor'
         },
@@ -463,20 +510,20 @@ export default {
           className: 'replacecolor'
         },
 
-        {
-          title: '备注',
-          dataIndex: 'memo',
-          width: 160,
-          customRender: t => ellipsis(t),
-          className: 'replacecolor'
-        },
-        {
-          title: '入库数量',
-          dataIndex: 'inventoryQuantity',
-          scopedSlots: { customRender: 'inventoryQuantity' },
-          width: 120,
-          className: 'replacecolor'
-        },
+        // {
+        //   title: '备注',
+        //   dataIndex: 'memo',
+        //   width: 160,
+        //   customRender: t => ellipsis(t),
+        //   className: 'replacecolor'
+        // },
+        // {
+        //   title: '入库数量',
+        //   dataIndex: 'inventoryQuantity',
+        //   scopedSlots: { customRender: 'inventoryQuantity' },
+        //   width: 120,
+        //   className: 'replacecolor'
+        // },
         {
           title: '规格型号',
           dataIndex: 'specificationAndModel',
@@ -524,11 +571,15 @@ export default {
       loading: false, // 表格加载
       addFabric: {},
       visible: false,
+      judge : 0,
       confirmLoading: false,
       defaultMethod:'add',
       validatorRules: {
-        // oddNum: [{ required: true, message: '单号不能为空', trigger: 'blur' }],
-        // containerNo: [{ required: true, message: '款号不能为空', trigger: 'blur' }]
+        plumbumNo: [{ required: true, message: '铅分号不能为空'}],
+        containerNumber: [{ required: true, message: '集装箱号不能为空'}],
+        exportInvoiceNo: [{ required: true, message: '外销发票号不能为空'}],
+        latestDateOfShipment: [{ required: true, message: '装柜日期不能为空'}],
+        garmentFactory: [{ required: true, message: '成衣工厂不能为空'}],
         // 待确定还有哪些必填信息
       },
       dateFormat: 'YYYY-MM-DD'
@@ -537,6 +588,7 @@ export default {
   created() {},
   mounted() {},
   methods: {
+    moment,
     // 参照发运明细 弹框
     referadvancePackingList() {
       console.log('打开参照发运明细 弹框')
@@ -562,11 +614,11 @@ export default {
               latestDateOfShipment : data.latestDateOfShipment,
               garmentFactory : data.garmentFactory,
               invoiceNo : data.invoiceNo,
-              preparedBy : data.preparedBy,
-              preparedDate : data.preparedDate,
+              // preparedBy : data.preparedBy,
+              preparedDate :  moment(new Date()).format('YYYY-MM-DD'),
               exportInvoiceNo : data.exportInvoiceNo,
               shippingOrderNumber : data.shippingOrderNumber,
-              remarks : data.remarks,
+              plumbumNo : data.plumbumNo,
               customer : data.customer,
               customerAbbreviation : data.customerAbbreviation
             }
@@ -574,6 +626,12 @@ export default {
             this.addFabricData.map(item =>{
               item.inventoryQuantity = 0
               item.meter = 0
+              // item.planLotNumber = item.orderNumber()
+              if(item.manualYarnFlag == 0){
+                 this.manualYarnDisabled = true
+              }else {
+                 this.manualYarnDisabled = false
+              }
             })
           }else {
             this.$message.error(res.message);
@@ -633,6 +691,30 @@ export default {
     handleDelete(record,index) {
       this.addFabricData.splice(index, 1);
     },
+      //修改是否为手册纱时触发
+    changeManualYarnFlag(val) {
+      this.addFabricData.map(item =>{
+      item.manualYarnFlag = null
+      item.manualYarnFlag = val
+      //是手工纱时
+      if(val === 0){
+        item.manualYarnUnitPrice = ""
+        item.manualYarnProportion = ""
+        this.manualYarnDisabled = true
+      }else {
+        this.manualYarnDisabled = false
+      }
+      })
+      this.$forceUpdate()
+   },
+   //输入手册纱单价或者手册纱占比时触发
+   changeManualYarn(data,val){
+     this.addFabricData.map(item => {
+       if(data === 'Price'){item.manualYarnUnitPrice = val}
+       else{item.manualYarnProportion = val}
+     })
+     this.$forceUpdate()
+   },
 
     //操作 复制
     copy(record){
@@ -652,7 +734,7 @@ export default {
       console.log('保存新增、刷新装箱单-面料')
       const that = this
       // 触发表单验证
-      this.$refs.form.validate(valid => {
+      this.$refs.form.validate(async valid => {
         if (valid) {
           // that.confirmLoading = true
           var newObj = {
@@ -671,7 +753,9 @@ export default {
             customerAbbreviation : this.addFabric.customerAbbreviation,
             syPackingListFabricItem:this.addFabricData
           }
-          if(this.defaultMethod === 'add'){
+         await this.JudgeVluabled(newObj)
+         if(this.judge == 0){
+           if(this.defaultMethod === 'add'){
             addFabricList(newObj).then(res => {
              if (res.success) {
               this.$message.success('新增成功')
@@ -681,6 +765,7 @@ export default {
              that.fatherList() // 调用父组件 查询方法
             }else{
               this.$message.error(res.message)
+              this.close()
             }
            })
           }else {
@@ -694,16 +779,41 @@ export default {
               that.fatherList() // 调用父组件 查询方法
             }else{
               this.$message.error(res.message)
+              this.close()
             }
            })
           }
+         }
+          
           
         }
       })
-      this.close()
+      // this.close()
       // this.getShipmentList() // 刷新 装箱单-面料
     },
 
+     JudgeVluabled(data){
+          this.judge = 0
+           for (var i=0; i<data.syPackingListFabricItem.length;i++){
+             var tableRow = data.syPackingListFabricItem[i];
+            //是否未填
+            var required = [
+           {key:'dyelotNumber',value:'缸号'},
+           {key:'grossWeight',value:'毛重/GW/kg'},
+           {key:'netWeight',value:'净重/NW/kg'},
+           {key:'actualDeclaredQuantity',value:'实际报关数量'},
+              ]
+             for(var j=0 ; j<required.length;j++){
+                if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
+                  this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
+                  this.judge+=1
+                  return
+                }
+             }
+           }
+      
+    },
+
     // -------------------------------------
     close() {
       this.$emit('close')