浏览代码

预托书第二版

fenghaifu 2 年之前
父节点
当前提交
e76ee83ddd
共有 2 个文件被更改,包括 130 次插入67 次删除
  1. 124 61
      src/views/pre-book/addPreBookDrawer.vue
  2. 6 6
      src/views/pre-book/advancePackingListModal.vue

+ 124 - 61
src/views/pre-book/addPreBookDrawer.vue

@@ -13,7 +13,7 @@
       <a-card :bordered="true">
         <div class="table-page-search-wrapper">
           <!-- :rules="validatorRules" -->
-          <a-form-model layout="inline" ref="form" :model="addPreBook">
+          <a-form-model layout="inline" ref="form" :model="addPreBook" :rules="validatorRules">
             <a-row :gutter="24">
               
 
@@ -33,7 +33,7 @@
                 </a-form-model-item>
               </a-col>
 
-              <a-col :md="6" :sm="8">
+              <a-col :md="12" :sm="16">
                 <a-form-model-item label="外销发票号码" prop="exportInvoiceNo">
                   <a-input placeholder="请输入外销发票号码" v-model="addPreBook.exportInvoiceNo"></a-input>
                 </a-form-model-item>
@@ -69,8 +69,13 @@
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="收货人" prop="theFinalShippingDate">
-                  <a-input placeholder="请输入收货人" v-model="addPreBook.theFinalShippingDate"></a-input>
+                <a-form-model-item label="收货人" prop="consignee">
+                  <j-search-select-tag
+                    placeholder="请选择收货人"
+                    v-model="addPreBook.consigneeAll"
+                    @change="consigneeSelectChange"
+                    dict="receiving_goods_info">
+                  </j-search-select-tag>
                 </a-form-model-item>
               </a-col>
 
@@ -133,17 +138,6 @@
                 </a-form-model-item>
               </a-col>
 
-              <a-col :md="6" :sm="8">
-                <a-form-model-item label="人民币" prop="cny">
-                  <a-input placeholder="请输入人民币" v-model="addPreBook.cny"></a-input>
-                </a-form-model-item>
-              </a-col>
-
-              <a-col :md="6" :sm="8">
-                <a-form-model-item label="美元" prop="usd">
-                  <a-input placeholder="请输入美元" v-model="addPreBook.usd"></a-input>
-                </a-form-model-item>
-              </a-col>
             </a-row>
           </a-form-model>
         </div>
@@ -178,9 +172,7 @@
             </template>
 
             <template v-slot:action="props">
-              <a @click="handleCK(props)">查看</a>
-              <a-divider type="vertical"/>
-              <a-popconfirm title="确定删除吗?" @confirm="handleDL(props)">
+              <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
                 <a>删除</a>
               </a-popconfirm>
             </template>
@@ -207,8 +199,11 @@
         <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
           <a-button :style="{ marginRight: '8px' }">取消</a-button>
         </a-popconfirm>
-        <a-button type="primary" @click="submitAdd">
-          提交
+        <a-button type="primary" @click="myHandSave">
+          保存
+        </a-button>
+        <a-button type="primary" @click="myHandSubmit" style="margin-left: 8px">
+          保存并提交
         </a-button>
       </div>
     </a-drawer>
@@ -223,6 +218,7 @@ import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
 import AdvancePackingListModal from '@views/pre-book/advancePackingListModal.vue'
 import { JVXETypes } from '@/components/jeecg/JVxeTable'
+import { addPreBook, editById } from '@api/document/pre-book.js'
 
 export default {
   name: 'AddPreBookDrawer', // 新增预托书
@@ -235,33 +231,33 @@ export default {
       addPerBookColumns: [
         {
           title: '英文名称',
-          dataIndex: 'englishName',
+          key: 'englishName',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
         },
         {
           title: '款号',
-          dataIndex: 'itemNumber',
+          key: 'itemNumber',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
         },
         {
           title: '小po',
-          dataIndex: 'poNo',
+          key: 'poNo',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '数量',
-          dataIndex: 'total',
+          key: 'total',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '箱数',
-          dataIndex: 'boxNumber',
+          key: 'boxNumber',
           width: 90,
 
           className: 'replacecolor'
@@ -269,35 +265,35 @@ export default {
 
         {
           title: '毛重',
-          dataIndex: 'totalGrossWeight',
+          key: 'totalGrossWeight',
           width: 120,
 
           className: 'replacecolor'
         },
         {
           title: '净重',
-          dataIndex: 'totalNetWeight',
+          key: 'totalNetWeight',
           width: 120,
 
           className: 'replacecolor'
         },
         {
           title: '体积',
-          dataIndex: 'totalVolume',
+          key: 'totalVolume',
           width: 160,
 
           className: 'replacecolor'
         },
         {
           title: '分销点',
-          dataIndex: 'distributionPoint',
+          key: 'distributionPoint',
           width: 120,
 
           className: 'replacecolor'
         },
         {
           title: '集装箱代号',
-          dataIndex: 'containerCode',
+          key: 'containerCode',
           width: 120,
           type:JVXETypes.inputNumber,
           className: 'replacecolor'
@@ -305,14 +301,21 @@ export default {
 
         {
           title: '集装箱号',
-          dataIndex: 'containerNumber',
+          key: 'containerNumber',
           width: 120,
           type:JVXETypes.inputNumber,
           className: 'replacecolor'
         },
         {
           title: '单价',
-          dataIndex: 'unitPrice',
+          key: 'unitPrice',
+          width: 120,
+
+          className: 'replacecolor'
+        },
+        {
+          title: '金额',
+          key: 'totalPrice',
           width: 120,
 
           className: 'replacecolor'
@@ -328,14 +331,14 @@ export default {
         // },
         {
           title: '预发货日期',
-          dataIndex: 'scheduledShipDate',
+          key: 'scheduledShipDate',
           width: 120,
 
           className: 'replacecolor'
         },
         {
           title: '业务员',
-          dataIndex: 'salesman',
+          key: 'salesman',
           width: 120,
 
           className: 'replacecolor'
@@ -343,14 +346,14 @@ export default {
 
         {
           title: '业务部门',
-          dataIndex: 'operatingDepartment',
+          key: 'operatingDepartment',
           width: 120,
 
           className: 'replacecolor'
         },
         {
           title: '采购/委外订单号',
-          dataIndex: 'purchaseAboardOrderNum',
+          key: 'purchaseAboardOrderNum',
           width: 160,
 
           className: 'replacecolor'
@@ -358,7 +361,7 @@ export default {
 
         {
           title: '采购/委外工厂',
-          dataIndex: 'purchaseAboardFactory',
+          key: 'purchaseAboardFactory',
           width: 160,
 
           className: 'replacecolor'
@@ -366,12 +369,12 @@ export default {
 
         {
           title: '操作',
-          dataIndex: 'operation',
-          scopedSlots: { customRender: 'operationSlot' },
-          width: 160,
-
+          key: 'action',
+          type: JVXETypes.slot,
+          width: 100,
+          align: 'center',
           fixed: 'right',
-          className: 'replacecolor'
+          slotName: 'action',
         }
       ],
       addPerBookData: [],
@@ -386,11 +389,10 @@ export default {
       toolbarConfig: {
           btn: []
       },
-       
-      // validatorRules: {
-      //   shippingOrderDate: [{ required: true, message: '托书日期不能为空', trigger: 'blur' }]
-      //   // 确定必填项
-      // }
+      validatorRules:{
+          shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
+          consignee:[{required: true, message: '收货人不能为空!'}],
+      },
     }
   },
   created() {},
@@ -431,25 +433,66 @@ export default {
 
     // ------------------------------------------
     // 操作 删除
-    handleDelete(id) {
-      console.log('id:', id)
+    handleDelete(index) {
+      var ret = this.addPreBook.syLetterDepositItemList.splice(index, 1);
+      this.setHeadCalField();
+      return ret;
+      
     },
     // 抽屉 取消
     handleCancel() {
       console.log('点击抽屉取消')
       this.close()
     },
+    myHandSave(){
+      this.addPreBook.theDocumentsState=0;
+      this.saveAdd();
+
+    },
+    myHandSubmit(){
+      this.addPreBook.theDocumentsState=1;
+      this.saveAdd();
+    },
     // 抽屉 提交
-    submitAdd() {
-      console.log('保存新增、刷新预托书')
-      const that = this
+    saveAdd() {
+      const that = this;
+      var newObj = this.addPreBook;
+      if (newObj.syLetterDepositItemList.length == 0){
+        this.$message.error('当前记录没有子表记录,无法保存');
+        return;
+      }
       // 触发表单验证
       this.$refs.form.validate(valid => {
         if (valid) {
-          that.confirmLoading = true
+          that.confirmLoading = true;
+          if (newObj.id == undefined || newObj.id == "" || newObj.id == null){
+            addPreBook(newObj).then(res => {
+              that.confirmLoading = false;
+              if (res.success) {
+                this.$message.success('新增成功')
+                this.close()
+                //清空信息
+                this.fatherList(); // 调用父组件 查询方法
+                // this.msgFormSon = {}  清空子表信息
+              }else{
+                this.$message.error(res.message)
+              }
+            })
+          }else{
+            editById(newObj).then(res => {
+              that.confirmLoading = false;
+              if (res.success) {
+                this.$message.success('修改成功')
+                this.close();
+                this.fatherList() // 调用父组件 查询方法
+                // this.msgFormSon = {}  清空子表信息
+              }else{
+                this.$message.error(res.message)
+              }
+            })
+          }
         }
       })
-      this.close()
       // this.getShipmentList() // 刷新发运明细列表
     },
     close() {
@@ -470,6 +513,8 @@ export default {
           }).length == 0;
         });
         this.addPreBook.syLetterDepositItemList = this.addPreBook.syLetterDepositItemList.concat(filterList);
+        this.setHeadCalField();
+        
     },
     // 参照数据转换成子表
     convertReferToSub(dataList){
@@ -481,20 +526,20 @@ export default {
           syLetterDepositId:"",
           syPreAssembledPackingListId:data.id,
           syPreAssembledPackingListItemId:data.itemId,
-          acSetNo:"",
+          acSetNo:data.acSetNo,
           garmentFactory:"",
           hod:"",
           styleNo:"",
-          poNo:data.poNo,
+          poNo:data.smallPo,
           itemCode:"",
           distributionPoint:data.distributionPoint,
-          size:"",
+          size:data.size,
           startingBoxNumber:"",
           endCaseNumber:"",
           colour:data.colour,
-          piecesBox:"",
+          piecesBox:data.piecesBox,
           boxNumber:data.boxNumber,
-          total:0,
+          total:data.piecesBox*data.boxNumber,
           netWeight:data.totalNetWeight/data.boxNumber,
           totalNetWeight:data.totalNetWeight,
           grossWeight:data.totalGrossWeight/data.boxNumber,
@@ -502,9 +547,9 @@ export default {
           outerBoxLength:0,
           outerBoxWidth:0,
           outerBoxHeight:0,
-          totalVolume:0,
+          totalVolume:data.totalVolume,
           netWeightToo:0,
-          unitPrice:0,
+          unitPrice:data.unitPrice,
           totalPrice:data.totalPrice,
           containerCode:data.containerCode,
           containerNumber:data.containerNumber,
@@ -517,6 +562,24 @@ export default {
     },
      handleValueChange(event) {
       },
+      // 收货人下拉框
+      consigneeSelectChange(value){
+        var arr = value.split("-");
+        this.addPreBook.consignee = arr[0];
+        if (arr.length >= 4){
+          this.addPreBook.consigneeAddress = arr[1];
+          this.addPreBook.notifyParty = arr[2];
+          this.addPreBook.notifyPartyAddress = arr[3];
+        }
+      },
+      // 设置表头计算字段
+      setHeadCalField(){
+        var money = 0
+        for (var i=0; i<this.addPreBook.syLetterDepositItemList.length; i++){
+          money += this.addPreBook.syLetterDepositItemList[i].totalPrice;
+        }
+        this.addPreBook.money = money;
+      }
     
   },
 

+ 6 - 6
src/views/pre-book/advancePackingListModal.vue

@@ -72,7 +72,7 @@
           :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
           @change="handleTableChange"
           bordered
-          :scroll="{ x: 2000 }"
+          :scroll="{ x: 2800 }"
           size="small"
         >
         </a-table>
@@ -168,7 +168,7 @@ export default {
         {
           title: '存货名称',
           dataIndex: 'inventoryName',
-          width: 150,
+          width: 200,
           customRender: t => ellipsis(t),
           className: 'replacecolor'
         },
@@ -229,26 +229,26 @@ export default {
         {
           title: '总净重',
           dataIndex: 'totalNetWeight',
-          width: 90,
+          width: 120,
           className: 'replacecolor'
         },
         {
           title: '总毛重',
           dataIndex: 'totalGrossWeight',
-          width: 90,
+          width: 120,
           className: 'replacecolor'
         },
 
         {
           title: '总体积',
           dataIndex: 'totalVolume',
-          width: 90,
+          width: 120,
           className: 'replacecolor'
         },
         {
           title: '总价',
           dataIndex: 'totalPrice',
-          width: 90,
+          width: 120,
           className: 'replacecolor'
         },
       ],