瀏覽代碼

托书基本功能

jbb 2 年之前
父節點
當前提交
07d242baf8

+ 22 - 1
src/api/document/book.js

@@ -4,5 +4,26 @@ import { getAction,deleteAction,postAction} from '@/api/manage'
 //分页查询
 const bookList = params => getAction('/syShippingOrder/syShippingOrder/list', params)
 
-export {bookList}
+//参照数据分页查询
+const PackingList =params => getAction('/syShippingOrder/syShippingOrder/queryTailoring', params)
+
+//新增
+const addPackingList =params => postAction('/syShippingOrder/syShippingOrder/add', params)
+
+//编辑
+const editPackingList =params => postAction('/syShippingOrder/syShippingOrder/edit', params)
+
+//通过id删除
+const deletePackingList =params => deleteAction('/syShippingOrder/syShippingOrder/delete', params)
+
+//通过id查询
+const bookListId = params => getAction('/syShippingOrder/syShippingOrder/queryById', params)
+
+//提交,取消提交
+const submitPackingList =params => postAction('/syShippingOrder/syShippingOrder/syShippingDetailsSubmit', params)
+
+
+
+
+export {bookList,PackingList,addPackingList,editPackingList,deletePackingList,bookListId,submitPackingList}
 

+ 235 - 100
src/views/book/addBookDrawer.vue

@@ -14,19 +14,19 @@
           <a-form-model layout="inline" ref="form" :model="addBook" :rules="validatorRules">
             <a-row :gutter="24">
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="托书日期" prop="bookDate">
+                <a-form-model-item label="托书日期" prop="shippingOrderDate">
                   <a-date-picker
                     placeholder="请选择托书日期"
                     style="width:100%;"
                     :format="dateFormat"
-                    v-model="addBook.bookDate"
+                    v-model="addBook.shippingOrderDate"
                   />
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="托书号" prop="bookNum">
-                  <a-input placeholder="请输入托书号" v-model="addBook.bookNum"></a-input>
+                <a-form-model-item label="托书号" prop="shippingOrderNumber">
+                  <a-input placeholder="请输入托书号" v-model="addBook.shippingOrderNumber"></a-input>
                 </a-form-model-item>
               </a-col>
 
@@ -38,17 +38,17 @@
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="经营单位" prop="businessUnit">
-                  <a-input placeholder="请输入经营单位" v-model="addBook.businessUnit"></a-input>
+                  <a-input placeholder="请输入经营单位" v-model="addBook.unitInOperation"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="经营单位地址" prop="businessUnitAdd">
-                  <a-select placeholder="请选择经营单位地址" v-model="addBook.businessUnitAdd">
+                  <a-select placeholder="请选择经营单位地址" v-model="addBook.unitInOperationAddress">
                     <a-select-option value="">请选择</a-select-option>
-                    <a-select-option :value="0">客户1</a-select-option>
-                    <a-select-option :value="1">客户2</a-select-option>
-                    <a-select-option :value="2">客户3</a-select-option>
+                    <a-select-option value="0">客户1</a-select-option>
+                    <a-select-option value="1">客户2</a-select-option>
+                    <a-select-option value="2">客户3</a-select-option>
                   </a-select>
                 </a-form-model-item>
               </a-col>
@@ -59,43 +59,47 @@
                     placeholder="请选择装运期限"
                     style="width:100%;"
                     :format="dateFormat"
-                    v-model="addBook.latestShipmentDate"
+                    v-model="addBook.latestDateOfShipment"
                   />
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="最终船期" prop="finalShipDate">
-                  <a-input placeholder="请输入最终船期" v-model="addBook.finalShipDate"></a-input>
+                  <a-input placeholder="请输入最终船期" v-model="addBook.theFinalShippingDate"></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="consignee">
-                  <a-input placeholder="请输入收货人" v-model="addBook.consignee"></a-input>
+                  <!-- <j-dict-select-tag 
+                   style="width:100%;margin-bottom: 10px;"  v-model="addBook.consignee" 
+                  dictCode="sys_dict_item,item_text,description,dict_id in(select id from sys_dict where dict_code='receiving_goods_info')"
+                  @change="consigneeSelectChange"/> -->
+                  <j-search-select-tag
+                    placeholder="请选择收货人"
+                    v-model="addBook.consignee"
+                    @change="consigneeSelectChange"
+                    dict="receiving_goods_info">
+                  </j-search-select-tag>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="收货人地址" prop="consigneeAdd">
-                  <a-select placeholder="请选择收货人地址" v-model="addBook.consigneeAdd">
-                    <a-select-option value="">请选择</a-select-option>
-                    <a-select-option value="0">收货人1</a-select-option>
-                    <a-select-option value="1">收货人2</a-select-option>
-                    <a-select-option value="2">收货人3</a-select-option>
-                  </a-select>
+                <a-form-model-item label="收货人地址" prop="consigneeAddress">
+                  <a-input placeholder="根据收货人自动带出" v-model="addBook.consigneeAddress" ></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="通知方" prop="notifying">
-                  <a-input placeholder="请输入通知方" v-model="addBook.notifying"></a-input>
+                <a-form-model-item label="通知方" prop="notifyParty">
+                  <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyParty" ></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="通知方地址" prop="notifyingAdd">
-                  <a-input placeholder="请输入通知方地址" v-model="addBook.notifyingAdd"></a-input>
+                <a-form-model-item label="通知方地址" prop="notifyPartyAddress">
+                  <a-input placeholder="根据收货人自动带出" v-model="addBook.notifyPartyAddress" ></a-input>
                 </a-form-model-item>
               </a-col>
 
@@ -107,7 +111,7 @@
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="运抵国别" prop="arriveCountry">
-                  <a-input placeholder="请输入运抵国别" v-model="addBook.arriveCountry"></a-input>
+                  <a-input placeholder="请输入运抵国别" v-model="addBook.arriveInCountry"></a-input>
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="8">
@@ -118,19 +122,19 @@
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="目的港" prop="destinationport">
-                  <a-input placeholder="请输入目的港" v-model="addBook.destinationport"></a-input>
+                  <a-input placeholder="请输入目的港" v-model="addBook.destinationPort"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="收汇方式" prop="collectionMethod">
-                  <a-input placeholder="请输入收汇方式" v-model="addBook.collectionMethod"></a-input>
+                  <a-input placeholder="请输入收汇方式" v-model="addBook.exchangeEarningsValue"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="成交方式" prop="soldType">
-                  <a-input placeholder="请输入成交方式" v-model="addBook.soldType"></a-input>
+                  <a-input placeholder="请输入成交方式" v-model="addBook.termsOfDeliveryvalue"></a-input>
                 </a-form-model-item>
               </a-col>
 
@@ -142,13 +146,13 @@
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="人民币" prop="RMB">
-                  <a-input placeholder="请输入人民币" v-model="addBook.RMB"></a-input>
+                  <a-input placeholder="请输入人民币" v-model="addBook.cny"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="美元" prop="dollar">
-                  <a-input placeholder="请输入美元" v-model="addBook.dollar"></a-input>
+                  <a-input placeholder="请输入美元" v-model="addBook.usd"></a-input>
                 </a-form-model-item>
               </a-col>
             </a-row>
@@ -159,8 +163,9 @@
       <!--操作按钮区域 参照装箱单  増行-->
       <a-card :bordered="true" style="margin:10px 0  40px 0;">
         <div class="table-operator">
-          <a-button type="primary" @click="referPackingList" icon="ordered-list">参照装箱单</a-button>
-          <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
+          <a-button type="primary" @click="referPackingList('0')" icon="ordered-list">参照装箱单-成衣</a-button>
+          <a-button type="primary" @click="referPackingList('1')" icon="ordered-list">参照装箱单-面料</a-button>
+          <!-- <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button> -->
         </div>
 
         <!-- 子表-->
@@ -179,7 +184,7 @@
             >
               <!-- 集装箱代号 输入框 -->
               <template slot="containerCode" slot-scope="text, record, index">
-                <a-form-model-item prop="containerCode" :rules="rules.containerCode" required>
+                <a-form-model-item prop="containerCode" :rules="rules.containerCode" >
                   <a-input style="width:100%" type="text" v-model="record.containerCode" />
                 </a-form-model-item>
               </template>
@@ -187,13 +192,13 @@
               <!-- 集装箱号 输入框-->
               <template slot="containerNo" slot-scope="text, record, index">
                 <a-form-model-item prop="containerNo" :rules="rules.containerNo">
-                  <a-input style="width:100%" type="text" v-model="record.containerNo" />
+                  <a-input style="width:100%" type="text" v-model="record.containerNumber" />
                 </a-form-model-item>
               </template>
 
               <!-- 操作 -->
-              <span slot="operationSlot" slot-scope="text, record">
-                <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
+              <span slot="operationSlot" slot-scope="text, record,index">
+                <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(index)">
                   <a href="javascript:void(0);" style="color:red;">删除</a>
                 </a-popconfirm>
               </span>
@@ -208,16 +213,27 @@
                 :row-key="record => record.id"
                 :loading="loading"
                 :columns="CNYColumns"
-                :data-source="CNYData"
+                :data-source="rmbList"
+                :scroll="{ y: 200 }"
                 bordered
                 :pagination="false"
               >
+              <template slot="CNYfreighForward" slot-scope="text, record, index">
+                <a-form-model-item prop="CNYfreighForward" :rules="rules.CNYfreighForward" >
+                  <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
+                </a-form-model-item>
+              </template>
+              <template slot="CNYmoney" slot-scope="text, record, index">
+                <a-form-model-item prop="CNYmoney" :rules="rules.CNYmoney" >
+                  <a-input placeholder="请输入金额" v-model="record.amount" />
+                </a-form-model-item>
+              </template>
                 <!-- CNY项目列 -->
                 <template slot="CNYProjectList" slot-scope="text, record, index">
                   <a-form-model-item prop="CNYProjectList" :rules="rules.CNYProjectList">
-                    <a-select v-model="record.CNYProjectList" style="width:100%">
-                      <a-select-option :value="1">项目列1</a-select-option>
-                      <a-select-option :value="2">项目列2</a-select-option>
+                    <a-select v-model="record.itemColumn" style="width:100%" placeholder="请输入项目列">
+                      <a-select-option value="1">项目列1</a-select-option>
+                      <a-select-option value="2">项目列2</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </template>
@@ -230,16 +246,27 @@
                 :row-key="record => record.id"
                 :loading="loading"
                 :columns="USDColumns"
-                :data-source="USDData"
+                :data-source="usdList"
+                :scroll="{ y: 200 }"
                 bordered
                 :pagination="false"
               >
+               <template slot="USDfreighForward" slot-scope="text, record, index">
+                <a-form-model-item prop="USDfreighForward" :rules="rules.USDfreighForward" >
+                  <a-input placeholder="请输入货代" v-model="record.freightForwarder" />
+                </a-form-model-item>
+              </template>
+              <template slot="USDmoney" slot-scope="text, record, index">
+                <a-form-model-item prop="USDmoney" :rules="rules.USDmoney" >
+                  <a-input placeholder="请输入金额" v-model="record.amount" />
+                </a-form-model-item>
+              </template>
                 <!-- USD项目列 -->
                 <template slot="USDProjectList" slot-scope="text, record, index">
                   <a-form-model-item prop="USDProjectList" :rules="rules.USDProjectList">
-                    <a-select v-model="record.USDProjectList" style="width:100%">
-                      <a-select-option :value="1">项目列1</a-select-option>
-                      <a-select-option :value="2">项目列2</a-select-option>
+                    <a-select v-model="record.itemColumn" style="width:100%">
+                      <a-select-option value="1">项目列1</a-select-option>
+                      <a-select-option value="2">项目列2</a-select-option>
                     </a-select>
                   </a-form-model-item>
                 </template>
@@ -272,7 +299,8 @@
       </div>
     </a-drawer>
     <!-- 参照装箱单 -->
-    <packingList-modal ref="packingListModal" :father="aa" @ok="modalFormOk"></packingList-modal>
+    <packingList-modal ref="packingListModal" :father="aa" @ok="modalFormOk" @callback="referCallback"></packingList-modal>
+    <packing-list-modal-fabrics  ref="packingListModalFabrics" :father="aa" @ok="modalFormOk" @callback="referCallback"></packing-list-modal-fabrics>
   </div>
 </template>
 
@@ -280,13 +308,14 @@
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
-
+import {addPackingList,editPackingList} from '@api/document/book.js'
 import packingListModal from '@views/book/packingListModal.vue'
+import packingListModalFabrics from '@views/book/packingListModalFabrics.vue'
 
 export default {
   name: 'AddBookDrawer', // 新增 托书
   mixins: [JeecgListMixin],
-  components: { packingListModal, JEllipsis, moment }, // 参照装箱单 弹框
+  components: { packingListModal, JEllipsis, moment,packingListModalFabrics }, // 参照装箱单 弹框
   data() {
     let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
     return {
@@ -301,39 +330,39 @@ export default {
         },
         {
           title: '款号',
-          dataIndex: 'styleNum',
+          dataIndex: 'styleNumber',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
         },
         {
           title: '小po号',
-          dataIndex: 'smallPoNum',
+          dataIndex: 'smailPo',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '数量',
-          dataIndex: 'quantity',
+          dataIndex: 'number',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '箱数',
-          dataIndex: 'boxedNum',
+          dataIndex: 'boxNumber',
           width: 90,
           className: 'replacecolor'
         },
 
         {
           title: '毛重',
-          dataIndex: 'roughWeigh',
+          dataIndex: 'grossWeight',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '净重',
-          dataIndex: 'suttle',
+          dataIndex: 'netWeight',
           width: 120,
           className: 'replacecolor'
         },
@@ -360,14 +389,14 @@ export default {
 
         {
           title: '集装箱号',
-          dataIndex: 'containerNo',
+          dataIndex: 'containerNumber',
           width: 120,
           scopedSlots: { customRender: 'containerNo' },
           className: 'replacecolor'
         },
         {
           title: '单价',
-          dataIndex: 'price',
+          dataIndex: 'unitPrice',
           width: 120,
           className: 'replacecolor'
         },
@@ -382,7 +411,7 @@ export default {
         // },
         {
           title: '预发货日期',
-          dataIndex: 'scheduledShipDate',
+          dataIndex: 'preShipmentDate',
           width: 120,
           className: 'replacecolor'
         },
@@ -401,14 +430,14 @@ export default {
         },
         {
           title: '采购/委外订单号',
-          dataIndex: 'purchaseAboardOrderNum',
+          dataIndex: 'purchaseOutsourcingOrderNo',
           width: 160,
           className: 'replacecolor'
         },
 
         {
           title: '采购/委外工厂',
-          dataIndex: 'purchaseAboardFactory',
+          dataIndex: 'outsourcingFactoryForProcurement',
           width: 160,
           className: 'replacecolor'
         },
@@ -422,96 +451,172 @@ export default {
           className: 'replacecolor'
         }
       ],
-      addBookData: [{ englishName: 'morningFresh', styleNum: 'MWBBW2068', quantity: '1200', boxedNum: '588' }, {}],
+      addBookData: [],
       CNYColumns: [
         {
           title: '货代',
-          dataIndex: 'CNYfreighForward',
+          dataIndex: 'freightForwarder',
+          scopedSlots: { customRender: 'CNYfreighForward' },
           width: 60,
           className: 'replacecolor'
         },
         {
           title: '金额',
-          dataIndex: 'CNYmoney',
+          dataIndex: 'amount',
+          scopedSlots: { customRender: 'CNYmoney' },
           width: 60,
           className: 'replacecolor'
         },
         {
           title: '项目列',
-          dataIndex: 'CNYProjectList',
+          dataIndex: 'itemColumn',
           width: 60,
           scopedSlots: { customRender: 'CNYProjectList' },
           className: 'replacecolor'
         }
       ],
-      CNYData: [{ CNYmoney: '487576,87' }],
+      rmbList: [{}],
       USDColumns: [
         {
           title: '货代',
-          dataIndex: 'USDfreighForward',
+          dataIndex: 'freightForwarder',
+          scopedSlots: { customRender: 'USDfreighForward' },
           width: 20,
           className: 'replacecolor'
         },
         {
           title: '金额',
-          dataIndex: 'USDmoney',
+          dataIndex: 'amount',
+          scopedSlots: { customRender: 'USDmoney' },
           width: 20,
           className: 'replacecolor'
         },
         {
           title: '项目列',
-          dataIndex: 'USDProjectList',
+          dataIndex: 'itemColumn',
           width: 90,
           scopedSlots: { customRender: 'USDProjectList' },
           className: 'replacecolor'
         }
       ],
-      USDData: [{}],
+      usdList: [{}],
       loading: false, // 表格加载
       addBook: {},
+      defaultMethod : 'add',
       confirmLoading: false,
       visible: false,
       dateFormat: 'YYYY-MM-DD',
       validatorRules: {
-        bookDate: [{ required: true, message: '托书日期不能为空', trigger: 'blur' }]
-        // 确定必填项
+          shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
+          consignee:[{required: true, message: '收货人不能为空!'}],
+          shippingOrderNumber:[{required: true, message: '预托书号不能为空!'}],
       }
     }
   },
   created() {},
   methods: {
     // 参照装箱单
-    referPackingList() {
+    referPackingList(data) {
       console.log('打开参照装箱单')
-      this.$refs.packingListModal.packingListModVis = true
-    },
-    // 増行
-    handleAddColumn() {
-      console.log('増行')
-
-      const addrow = {
-        englishName: '',
-        styleNum: '',
-        smallPoNum: '',
-        quantity: '',
-        boxedNum: '',
-        roughWeigh: '',
-        suttle: '',
-        volume: '',
-        distributionPoint: '',
-        containerCode: '',
-        containerNo: '',
-        price: '',
-        scheduledShipDate: '',
-        salesman: '',
-        operatingDepartment: '',
-        purchaseAboardOrderNum: '',
-        purchaseAboardFactory: '',
-        operation: ''
+      if(data === '0'){
+         this.$refs.packingListModal.packingListModVis = true
+         this.$refs.packingListModal.queryParam.tailoringOrFabric = data
+         this.$refs.packingListModal.getPackingList()
+         if(this.addBookData.length !== 0){
+         this.$refs.packingListModal.fatherList = this.addBookData
+         }
+      }else {
+        this.$refs.packingListModalFabrics.packingListModalFabrics = true
+        this.$refs.packingListModalFabrics.queryParam.tailoringOrFabric = data
+        this.$refs.packingListModalFabrics.getPackingList()
+        if(this.addBookData.length !== 0){
+         this.$refs.packingListModal.fatherList = this.addBookData
+         }
       }
+    },
+    referCallback(data){
+        var subList = this.convertReferToSub(data);
+        this.addBookData = this.addBookData.concat(subList);
+    },
 
-      this.addBookData.push(addrow)
+    // 参照数据转换成子表
+    convertReferToSub(dataList){
+      var ret = [];
+      for (var i=0; i<dataList.length; i++){
+        var data = dataList[i];
+        var sub = {
+         customer: data.customer,
+         readyFabric:data.readyFabric,
+         tailoringFabricItemId:data.itemId,
+         tailoringFabricId:data.id,
+         englishName:'',
+         styleNumber:data.itemNumber,
+         smailPo:data.smallPo,
+         number : data.inventoryQuantity,
+         boxNumber:'',
+         grossWeight:'',
+         netWeight:'',
+         volume:'',
+         distributionPoint:data.distributionPoint,
+         containerCode:'',
+         containerNumber:'',
+         unitPrice:'',
+         preShipmentDate:data.preDeliveryDate,
+         salesman:'',
+         operatingDepartment:'',
+         purchaseOutsourcingOrderNo:data.purchase,
+         outsourcingFactoryForProcurement:'',
+        };
+        ret.push(sub);
+      }
+      return ret;
     },
+    // 増行
+    // handleAddColumn() {
+    //   console.log('増行')
+
+    //   const addrow = {
+    //     englishName: '',
+    //     styleNum: '',
+    //     smallPoNum: '',
+    //     quantity: '',
+    //     boxedNum: '',
+    //     roughWeigh: '',
+    //     suttle: '',
+    //     volume: '',
+    //     distributionPoint: '',
+    //     containerCode: '',
+    //     containerNo: '',
+    //     price: '',
+    //     preShipmentDate: '',
+    //     salesman: '',
+    //     operatingDepartment: '',
+    //     purchaseAboardOrderNum: '',
+    //     purchaseAboardFactory: '',
+    //     operation: ''
+    //   }
+
+    //   this.addBookData.push(addrow)
+    // },
+
+     // 收货人下拉框
+    consigneeSelectChange(value){
+        if(value !=null && value !='' &&value != 'undefined'){
+        var valueArr = value.split("+")
+        this.addBook.consignee = valueArr[0];
+        if (valueArr.length == 4){
+          this.addBook.consigneeAddress = valueArr[1];
+          this.addBook.notifyParty = valueArr[2];
+          this.addBook.notifyPartyAddress = valueArr[3];
+        }else{
+           this.$message.error('收货信息维护有问题,请检查!')
+        }
+        }else{
+          this.addBook.consigneeAddress = '';
+          this.addBook.notifyParty = '';
+          this.addBook.notifyPartyAddress = '';
+        }
+      },
 
     // 新增托书 子表合计
     addBookFooterShow(data) {
@@ -530,8 +635,8 @@ export default {
     },
 
     // 操作 删除
-    handleDelete(id) {
-      console.log('id:', id)
+    handleDelete(index) {
+      this.addBookData.splice(index, 1);
     },
     // 抽屉 取消
     handleCancel() {
@@ -545,15 +650,45 @@ export default {
       // 触发表单验证
       this.$refs.form.validate(valid => {
         if (valid) {
-          that.confirmLoading = true
+          // that.confirmLoading = true
+          var newObj = this.addBook
+          newObj.rmbList = this.rmbList
+          newObj.usdList = this.usdList
+          newObj.syShippingOrderItemList = this.addBookData
+          if(this.defaultMethod === 'add'){
+           addPackingList(newObj).then(res => {
+            if (res.success) {
+              this.$message.success('添加成功')
+              this.$emit('back')
+              this.close()
+            }else {
+             this.$message.error(res.message);
+            }
+           })
+        }else {
+          editPackingList(newObj).then(res => {
+            if (res.success) {
+              this.$message.success('添加成功')
+              this.$emit('back')
+              this.close()
+            }else {
+             this.$message.error(res.message);
+            }
+           })
+        }
+        
         }
       })
-      this.close()
       // this.getShipmentList() // 刷新托书列表
     },
     close() {
       this.$emit('close')
+      this.addBook ={}
+      this.addBookData =[]
+      this.rmbList = [{}]
+      this.usdList = [{}]
       this.visible = false
+      this.defaultMethod = 'add'
       this.$refs.form.resetFields()
     },
 

+ 84 - 15
src/views/book/book-list.vue

@@ -70,7 +70,7 @@
         :columns="bookListColumns"
         :data-source="bookListData"
         :loading="loading"
-        :pagination="ipagination"
+        :pagination="pagination"
         :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
         @change="handleTableChange"
         :scroll="{ x: 1500 }"
@@ -83,8 +83,9 @@
         </template> -->
 
         <!-- 单据状态 -->
-        <span slot="documentStateSlot">
-          <a-tag color="#2db7f5">保存</a-tag>
+        <span slot="documentStateSlot" slot-scope="text, record">
+          <a-tag color="orange" v-if="record.theDocumentsState == '0'">仅保存</a-tag>
+          <a-tag color="green" v-if="record.theDocumentsState == '1'">已提交</a-tag>
         </span>
         <!-- if  已提交 -->
         <!-- <span slot="documentStateSlot">
@@ -98,10 +99,10 @@
 
           <a-dropdown>
             <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
-            <a-menu slot="overlay">
+            <a-menu slot="overlay" v-if="record.theDocumentsState == '0'">
               <a-menu-item><a @click="submit(record)">提交</a></a-menu-item>
-              <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
-              <a-menu-item><a @click="edit(record)">编辑</a></a-menu-item>
+              <a-menu-item><a @click="edit(record,'2')">详情</a></a-menu-item>
+              <a-menu-item><a @click="edit(record,'1')">编辑</a></a-menu-item>
               <a-menu-item><a @click="print(record)">打印</a></a-menu-item>
               <a-menu-item>
                 <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
@@ -109,13 +110,17 @@
                 </a-popconfirm></a-menu-item
               >
             </a-menu>
+             <a-menu slot="overlay" v-if="record.theDocumentsState == '1'">
+              <a-menu-item><a @click="canaleSubmit(record)">取消提交</a></a-menu-item>
+              <a-menu-item><a @click="details(record)">详情</a></a-menu-item>
+            </a-menu>
           </a-dropdown>
         </span>
       </a-table>
     </a-card>
 
     <!-- 抽屉 -->
-    <addBook-drawer ref="addBookDrawer" :father="aa" @ok="modalFormOk"></addBook-drawer>
+    <addBook-drawer ref="addBookDrawer" :father="aa" @ok="modalFormOk" @back="getBookList"></addBook-drawer>
     <detailsBook-drawer ref="detailsBookDrawer" :father="bb" @ok="modalFormOk"></detailsBook-drawer>
     <editBook-drawer ref="editBookDrawer" :father="cc" @ok="modalFormOk"></editBook-drawer>
   </div>
@@ -129,7 +134,7 @@ import moment from 'moment'
 import addBookDrawer from '@views/book/addBookDrawer.vue'
 import detailsBookDrawer from '@views/book/detailsBookDrawer.vue'
 import editBookDrawer from '@views/book/editBookDrawer.vue'
-import {bookList} from '@api/document/book.js'
+import {bookList,bookListId,submitPackingList,deletePackingList} from '@api/document/book.js'
 
 export default {
   name: 'BookList', // 托书列表
@@ -233,7 +238,7 @@ export default {
       bookListData: [],
       id: '',
       loading: false, // 表格加载
-
+      pagination:{},
       // 查询条件
       queryParam: {
         pageNo:''
@@ -250,8 +255,12 @@ export default {
       this.$nextTick(() => {
         bookList(this.queryParam).then(res => {
           if (res.success) {
-            debugger
            this.bookListData = res.result.records
+           this.pagination = {
+              total: res.result.total,
+              current: res.result.current,
+              pageSize: res.result.size
+            }
           }else {
              this.$message.error(res.message);
           }
@@ -284,21 +293,81 @@ export default {
     // 上传附件
     accessoryUpload() {},
     // 操作 提交
-    submit(record) {},
+    submit(record) {
+      this.$nextTick(() => {
+        submitPackingList({ id: record.id, type: '1' }).then(res => {
+          if (res.success) {
+           record.theDocumentsState = '1'
+           this.getBookList()
+           this.$message.success('提交成功')
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+      })
+    },
+    //取消提交
+    canaleSubmit(record) {
+      this.$nextTick(() => {
+        submitPackingList({ id: record.id, type: '2' }).then(res => {
+          if (res.success) {
+           this.$message.success('取消提交成功')
+           record.theDocumentsState = '0'
+           this.getBookList()
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+      })
+    },
     // 操作 详情
     details(record) {
       this.$refs.detailsBookDrawer.visible = true
     },
     // 操作 编辑
-    edit(record) {
-      console.log('edit')
-      this.$refs.editBookDrawer.visible = true
+    edit(record,pattern) {
+      this.$nextTick(() => {
+        bookListId({id:record.id}).then(res => {
+          if (res.success) {
+            var data =res.result
+            if(pattern == '1'){
+              this.$refs.addBookDrawer.visible = true
+              this.$refs.addBookDrawer.defaultMethod = 'edit'
+              this.$refs.addBookDrawer.addBook = data
+              this.$refs.addBookDrawer.addBookData = data.syShippingOrderItemList
+              this.$refs.addBookDrawer.rmbList = data.rmbList
+              this.$refs.addBookDrawer.usdList = data.usdList
+            }else {
+              this.$refs.detailsBookDrawer.visible = true
+              this.$refs.detailsBookDrawer.addBook = data
+              this.$refs.detailsBookDrawer.addBookData = data.syShippingOrderItemList
+              this.$refs.detailsBookDrawer.rmbList = data.rmbList
+              this.$refs.detailsBookDrawer.usdList = data.usdList
+            }
+             
+          //  this.bookListData = res.result.records
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+      })
     },
     // 操作 打印
     print(record) {},
     // 操作 删除
     handleDelete(id) {
-      console.log('id:', id)
+        this.$nextTick(() => {
+          if(this.queryParam.pageNo > 1 && this.bookListData.length === 1){
+          this.queryParam.pageNo = this.queryParam.pageNo -1
+        }
+        deletePackingList({id:id}).then(res => {
+          if (res.success) {
+            this.getBookList()
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+      })
     },
 
     // // 分页、排序、筛选变化时触发

+ 151 - 127
src/views/book/detailsBookDrawer.vue

@@ -1,155 +1,139 @@
 <template>
-  <!-- 详情 回显全部 -->
-  <div id="detailsBookDrawer">
+  <!-- 新增托书  -->
+  <div id="addBookDrawer">
     <a-drawer
-      title="详情"
+      title="新增托书"
       width="89%"
       placement="right"
       :closable="true"
       :visible="visible"
       @close="handleCancel">
-      <!-- 主表信息  -->
+      <!-- 主表信息 填写 为什么原先图部分回显??-->
       <a-card :bordered="true">
         <div class="table-page-search-wrapper">
-          <a-form-model layout="inline" ref="form" :model="editBook">
+          <a-form-model layout="inline" ref="form" :model="addBook" :rules="validatorRules">
             <a-row :gutter="24">
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="托书日期" prop="bookDate">
-                  2022-04-30
-                  <!-- <a-date-picker
-                    placeholder="请选择托书日期"
-                    style="width:100%;"
-                    :format="dateFormat"
-                    v-model="editBook.bookDate"
-                  /> -->
+                <a-form-model-item label="托书日期" prop="shippingOrderDate">
+                  {{addBook.shippingOrderDate}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="托书号" prop="bookNum">
-                  <!-- <a-input placeholder="请输入托书号" v-model="editBook.bookNum"></a-input> -->
+                <a-form-model-item label="托书号" prop="shippingOrderNumber">
+                  {{addBook.shippingOrderNumber}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="12" :sm="12">
                 <a-form-model-item label="外销发票号码" prop="exportInvoiceNo">
-                  <!-- <a-input placeholder="请输入外销发票号码" v-model="editBook.exportInvoiceNo"></a-input> -->
+                  {{addBook.exportInvoiceNo}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="经营单位" prop="businessUnit">
-                  <!-- <a-input placeholder="请输入经营单位" v-model="editBook.businessUnit"></a-input> -->
+                  {{addBook.unitInOperation}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="经营单位地址" prop="businessUnitAdd">
-                  <!-- <a-select placeholder="请选择经营单位地址" v-model="editBook.businessUnitAdd"> -->
-                  <!-- <a-select-option value="">请选择</a-select-option>
-                    <a-select-option :value="0">客户1</a-select-option>
-                    <a-select-option :value="1">客户2</a-select-option>
-                    <a-select-option :value="2">客户3</a-select-option>
-                  </a-select> -->
+                  <a-select placeholder="请选择经营单位地址" v-model="addBook.unitInOperationAddress" disabled="true">
+                    <a-select-option value="">请选择</a-select-option>
+                    <a-select-option value="0">客户1</a-select-option>
+                    <a-select-option value="1">客户2</a-select-option>
+                    <a-select-option value="2">客户3</a-select-option>
+                  </a-select>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="装运期限" prop="latestShipmentDate">
-                  <!-- <a-date-picker
-                    placeholder="请选择装运期限"
-                    style="width:100%;"
-                    :format="dateFormat"
-                    v-model="editBook.latestShipmentDate"
-                  /> -->
+                  {{addBook.latestDateOfShipment}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="最终船期" prop="finalShipDate">
-                  <!-- <a-input placeholder="请输入最终船期" v-model="editBook.finalShipDate"></a-input> -->
+                  {{addBook.theFinalShippingDate}}
                 </a-form-model-item>
               </a-col>
 
-              <a-col :md="6" :sm="8">
+               <a-col :md="6" :sm="8">
                 <a-form-model-item label="收货人" prop="consignee">
-                  <!-- <a-input placeholder="请输入收货人" v-model="editBook.consignee"></a-input> -->
+                  {{addBook.consignee}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="收货人地址" prop="consigneeAdd">
-                  <!-- <a-select placeholder="请选择收货人地址" v-model="editBook.consigneeAdd">
-                    <a-select-option value="">请选择</a-select-option>
-                    <a-select-option value="0">收货人1</a-select-option>
-                    <a-select-option value="1">收货人2</a-select-option>
-                    <a-select-option value="2">收货人3</a-select-option>
-                  </a-select> -->
+                <a-form-model-item label="收货人地址" prop="consigneeAddress">
+                  {{addBook.consigneeAddress}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="通知方" prop="notifying">
-                  <!-- <a-input placeholder="请输入通知方" v-model="editBook.notifying"></a-input> -->
+                <a-form-model-item label="通知方" prop="notifyParty">
+                  {{addBook.notifyParty}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="通知方地址" prop="notifyingAdd">
-                  <!-- <a-input placeholder="请输入通知方地址" v-model="editBook.notifyingAdd"></a-input> -->
+                <a-form-model-item label="通知方地址" prop="notifyPartyAddress">
+                  {{addBook.notifyPartyAddress}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="贸易国别" prop="tradeCountry">
-                  <!-- <a-input placeholder="请输入贸易国别" v-model="editBook.tradeCountry"></a-input> -->
+                  {{addBook.tradeCountry}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="运抵国别" prop="arriveCountry">
-                  <!-- <a-input placeholder="请输入运抵国别" v-model="editBook.arriveCountry"></a-input> -->
+                  {{addBook.arriveInCountry}}
                 </a-form-model-item>
               </a-col>
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="出口口岸" prop="exportPort">
-                  <!-- <a-input placeholder="请输入出口口岸" v-model="editBook.exportPort"></a-input> -->
+                  {{addBook.exportPort}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="目的港" prop="destinationport">
-                  <!-- <a-input placeholder="请输入目的港" v-model="editBook.destinationport"></a-input> -->
+                  {{addBook.destinationPort}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="收汇方式" prop="collectionMethod">
-                  <!-- <a-input placeholder="请输入收汇方式" v-model="editBook.collectionMethod"></a-input> -->
+                  {{addBook.exchangeEarningsValue}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="成交方式" prop="soldType">
-                  <!-- <a-input placeholder="请输入成交方式" v-model="editBook.soldType"></a-input> -->
+                  {{addBook.termsOfDeliveryvalue}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="金额" prop="money">
-                  <!-- <a-input placeholder="请输入金额" v-model="editBook.money"></a-input> -->
+                  {{addBook.money}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="人民币" prop="RMB">
-                  <!-- <a-input placeholder="请输入人民币" v-model="editBook.RMB"></a-input> -->
+                  {{addBook.cny}}
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="美元" prop="dollar">
-                  <!-- <a-input placeholder="请输入美元" v-model="editBook.dollar"></a-input> -->
+                  {{addBook.usd}}
                 </a-form-model-item>
               </a-col>
             </a-row>
@@ -157,20 +141,21 @@
         </div>
       </a-card>
 
-      <!-- 子表-->
-      <a-card :bordered="true" style="margin:10px 0 10px 0;">
+      <!--操作按钮区域 参照装箱单  増行-->
+      <a-card :bordered="true" style="margin:10px 0  40px 0;">
+        <!-- 子表-->
         <a-spin :spinning="confirmLoading">
-          <a-form-model ref="formRef">
+          <a-form-model ref="formRef" :rules="validatorRules">
             <a-table
               bordered
               :row-key="record => record.id"
-              :columns="bookColumns"
-              :data-source="bookData"
+              :columns="addBookColumns"
+              :data-source="addBookData"
               :loading="loading"
               :pagination="ipagination"
               :scroll="{ x: 1500 }"
               @change="handleTableChange"
-              :footer="detailsBookFooterShow"
+              :footer="addBookFooterShow"
             >
             </a-table>
           </a-form-model>
@@ -183,10 +168,30 @@
                 :row-key="record => record.id"
                 :loading="loading"
                 :columns="CNYColumns"
-                :data-source="CNYData"
+                :scroll="{ y: 200 }"
+                :data-source="rmbList"
                 bordered
                 :pagination="false"
               >
+              <template slot="CNYfreighForward" slot-scope="text, record, index">
+                <a-form-model-item prop="CNYfreighForward" :rules="rules.CNYfreighForward" >
+                  {{record.freightForwarder}}
+                </a-form-model-item>
+              </template>
+              <template slot="CNYmoney" slot-scope="text, record, index">
+                <a-form-model-item prop="CNYmoney" :rules="rules.CNYmoney" >
+                  {{record.amount}}
+                </a-form-model-item>
+              </template>
+                <!-- CNY项目列 -->
+                <template slot="CNYProjectList" slot-scope="text, record, index">
+                  <a-form-model-item prop="CNYProjectList" :rules="rules.CNYProjectList">
+                    <a-select v-model="record.itemColumn" style="width:100%" placeholder="请输入项目列" disabled="true">
+                      <a-select-option value="1">项目列1</a-select-option>
+                      <a-select-option value="2">项目列2</a-select-option>
+                    </a-select>
+                  </a-form-model-item>
+                </template>
               </a-table>
             </div>
 
@@ -196,15 +201,54 @@
                 :row-key="record => record.id"
                 :loading="loading"
                 :columns="USDColumns"
-                :data-source="USDData"
+                :data-source="usdList"
+                :scroll="{ y: 200 }"
                 bordered
                 :pagination="false"
               >
+               <template slot="USDfreighForward" slot-scope="text, record, index">
+                <a-form-model-item prop="USDfreighForward" :rules="rules.USDfreighForward" >
+                  {{record.freightForwarder}}
+                </a-form-model-item>
+              </template>
+              <template slot="USDmoney" slot-scope="text, record, index">
+                <a-form-model-item prop="USDmoney" :rules="rules.USDmoney" >
+                  {{record.amount}}
+                </a-form-model-item>
+              </template>
+                <!-- USD项目列 -->
+                <template slot="USDProjectList" slot-scope="text, record, index">
+                  <a-form-model-item prop="USDProjectList" :rules="rules.USDProjectList">
+                    <a-select v-model="record.itemColumn" style="width:100%" disabled="true">
+                      <a-select-option value="1">项目列1</a-select-option>
+                      <a-select-option value="2">项目列2</a-select-option>
+                    </a-select>
+                  </a-form-model-item>
+                </template>
               </a-table>
             </div>
           </a-row>
         </a-spin>
       </a-card>
+
+      <!-- 页面底部保存取消 -->
+      <div
+        :style="{
+          position: 'absolute',
+          right: 0,
+          bottom: 0,
+          width: '100%',
+          borderTop: '1px solid #e9e9e9',
+          padding: '10px 16px',
+          background: '#fff',
+          textAlign: 'right',
+          zIndex: 1
+        }"
+      >
+        <a-popconfirm title="确定放弃新增?" @confirm="handleCancel" okText="确定" cancelText="取消">
+          <a-button :style="{ marginRight: '8px' }">关闭</a-button>
+        </a-popconfirm>
+      </div>
     </a-drawer>
   </div>
 </template>
@@ -215,15 +259,14 @@ import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
 
 export default {
-  name: 'AddBookDrawer', // 详情 托书
-
+  name: 'AddBookDrawer', // 新增 托书
   mixins: [JeecgListMixin],
-  components: { JEllipsis, moment },
+  components: {  JEllipsis, moment }, // 参照装箱单 弹框
   data() {
     let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
     return {
       // 表头
-      bookColumns: [
+      addBookColumns: [
         {
           title: '英文名称',
           dataIndex: 'englishName',
@@ -233,39 +276,39 @@ export default {
         },
         {
           title: '款号',
-          dataIndex: 'styleNum',
+          dataIndex: 'styleNumber',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
         },
         {
           title: '小po号',
-          dataIndex: 'smallPoNum',
+          dataIndex: 'smailPo',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '数量',
-          dataIndex: 'quantity',
+          dataIndex: 'number',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '箱数',
-          dataIndex: 'boxedNum',
+          dataIndex: 'boxNumber',
           width: 90,
           className: 'replacecolor'
         },
 
         {
           title: '毛重',
-          dataIndex: 'roughWeigh',
+          dataIndex: 'grossWeight',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '净重',
-          dataIndex: 'suttle',
+          dataIndex: 'netWeight',
           width: 120,
           className: 'replacecolor'
         },
@@ -286,20 +329,18 @@ export default {
           title: '集装箱代号',
           dataIndex: 'containerCode',
           width: 120,
-          scopedSlots: { customRender: 'containerCode' },
           className: 'replacecolor'
         },
 
         {
           title: '集装箱号',
-          dataIndex: 'containerNo',
+          dataIndex: 'containerNumber',
           width: 120,
-          scopedSlots: { customRender: 'containerNo' },
           className: 'replacecolor'
         },
         {
           title: '单价',
-          dataIndex: 'price',
+          dataIndex: 'unitPrice',
           width: 120,
           className: 'replacecolor'
         },
@@ -314,7 +355,7 @@ export default {
         // },
         {
           title: '预发货日期',
-          dataIndex: 'scheduledShipDate',
+          dataIndex: 'preShipmentDate',
           width: 120,
           className: 'replacecolor'
         },
@@ -333,120 +374,103 @@ export default {
         },
         {
           title: '采购/委外订单号',
-          dataIndex: 'purchaseAboardOrderNum',
+          dataIndex: 'purchaseOutsourcingOrderNo',
           width: 160,
           className: 'replacecolor'
         },
 
         {
           title: '采购/委外工厂',
-          dataIndex: 'purchaseAboardFactory',
+          dataIndex: 'outsourcingFactoryForProcurement',
+          width: 160,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '操作',
+          dataIndex: 'operation',
           width: 160,
+          fixed: 'right',
           className: 'replacecolor'
         }
       ],
-      bookData: [{ englishName: 'morningFresh', styleNum: 'MWBBW2068', quantity: '1200', boxedNum: '588' }, { englishName: 'DHC', styleNum: 'AWBW2068', quantity: '9800', boxedNum: '188' }, {}],
+      addBookData: [],
       CNYColumns: [
         {
           title: '货代',
-          dataIndex: 'CNYfreighForward',
+          dataIndex: 'freightForwarder',
           width: 60,
           className: 'replacecolor'
         },
         {
           title: '金额',
-          dataIndex: 'CNYmoney',
+          dataIndex: 'amount',
           width: 60,
           className: 'replacecolor'
         },
         {
           title: '项目列',
-          dataIndex: 'CNYProjectList',
-          width: 60,
+          dataIndex: 'itemColumn',
           scopedSlots: { customRender: 'CNYProjectList' },
+          width: 60,
           className: 'replacecolor'
         }
       ],
-      CNYData: [{ CNYmoney: '487576,87' }],
-
+      rmbList: [{}],
       USDColumns: [
         {
           title: '货代',
-          dataIndex: 'USDfreighForward',
+          dataIndex: 'freightForwarder',
+          scopedSlots: { customRender: 'USDfreighForward' },
           width: 20,
           className: 'replacecolor'
         },
         {
           title: '金额',
-          dataIndex: 'USDmoney',
+          dataIndex: 'amount',
+          scopedSlots: { customRender: 'USDmoney' },
           width: 20,
           className: 'replacecolor'
         },
         {
           title: '项目列',
-          dataIndex: 'USDProjectList',
+          dataIndex: 'itemColumn',
           width: 90,
           scopedSlots: { customRender: 'USDProjectList' },
           className: 'replacecolor'
         }
       ],
-      USDData: [{ USDmoney: '627576,87' }],
-
+      usdList: [{}],
       loading: false, // 表格加载
-      editBook: {},
+      addBook: {},
       confirmLoading: false,
       visible: false,
-      dateFormat: 'YYYY-MM-DD'
+      dateFormat: 'YYYY-MM-DD',
+      validatorRules: {
+          shippingOrderDate:[{required: true, message: '托书日期不能为空!'}],
+          consignee:[{required: true, message: '收货人不能为空!'}],
+          shippingOrderNumber:[{required: true, message: '预托书号不能为空!'}],
+      }
     }
   },
   created() {},
   methods: {
-    detailsBookFooterShow(data) {
-      console.log(' 详情托书 子表 ----合计行')
-      console.log('data', data)
-      return (
-        <a-table
-          rowKey={Math.random}
-          bordered={false}
-          pagination={false}
-          columns={this.bookColumns}
-          dataSource={this.bookdataSource || []}
-          showHeader={false}
-        ></a-table>
-      )
-    },
     // 抽屉 取消
     handleCancel() {
       console.log('点击抽屉取消')
       this.close()
     },
+
     close() {
       this.$emit('close')
+      this.addBook ={}
+      this.addBookData =[]
+      this.rmbList = []
+      this.usdList = []
       this.visible = false
-      this.$refs.form.resetFields()
     },
 
-    // ------------------------------------------
-    modalFormOk() {},
-    aa() {}
-    // // 分页、排序、筛选变化时触发
-    // handleTableChange(pagination, filters, sorter) {
-    //   // console.log('当前页信息>>>>',pagination)
-    //   this.queryParam.pageNo = pagination.current
-    //   this.getAnnList()
-    // }
-  },
-  // TODO:合计行 有滚动待解决
-  computed: {
-    bookdataSource() {
-      // 详情托书  子表 合计
-      const total = Object.assign({}, this.bookData[0])
-      for (const attr in total) {
-        total[attr] = '合计'
-        break
-      }
-      return [total]
-    }
+  
   },
   mounted() {}
 }

+ 77 - 17
src/views/book/packingListModal.vue

@@ -16,7 +16,7 @@
           <a-row :gutter="24">
             <a-col :md="6" :sm="8">
               <a-form-item label="订单号">
-                <a-input placeholder="请输入订单号" v-model="queryParam.orderNum"></a-input>
+                <a-input placeholder="请输入订单号" v-model="queryParam.purchase"></a-input>
               </a-form-item>
             </a-col>
 
@@ -28,7 +28,7 @@
 
             <a-col :md="6" :sm="8">
               <a-form-item label="款号">
-                <a-input placeholder="请输入款号" v-model="queryParam.styleNum"></a-input>
+                <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
               </a-form-item>
             </a-col>
 
@@ -71,6 +71,7 @@
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
+import {PackingList} from '@api/document/book.js'
 
 export default {
   name: 'PackingListModal', // 参照装箱单 弹框
@@ -80,9 +81,7 @@ export default {
     return {
       // 查询条件
       queryParam: {
-        orderNum: '',
-        name: '', // 品名
-        styleNum: ''
+        pageNo:''
       },
       selectedRowKeys: [], // 勾选航
       loading: false, // 表格加载
@@ -90,14 +89,14 @@ export default {
       packingListColumns: [
         {
           title: '款号',
-          dataIndex: 'styleNum',
+          dataIndex: 'itemNumber',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
         },
         {
           title: '客户简称',
-          dataIndex: 'customerShortName',
+          dataIndex: 'customerAbbreviation',
           width: 120,
           fixed: 'left',
           className: 'replacecolor'
@@ -113,7 +112,7 @@ export default {
         // },
         {
           title: '预发货日期',
-          dataIndex: 'scheduledShipDate',
+          dataIndex: 'preDeliveryDate',
           width: 120,
           className: 'replacecolor'
         },
@@ -132,7 +131,7 @@ export default {
 
         {
           title: '备注',
-          dataIndex: 'note',
+          dataIndex: 'memo',
           width: 120,
           className: 'replacecolor'
         },
@@ -163,13 +162,13 @@ export default {
 
         {
           title: '颜色',
-          dataIndex: 'color',
+          dataIndex: 'colour',
           width: 120,
           className: 'replacecolor'
         },
         {
           title: '采购/委外订单号',
-          dataIndex: 'purchaseAboardOrderNum',
+          dataIndex: 'purchase',
           width: 140,
           className: 'replacecolor'
         },
@@ -182,7 +181,7 @@ export default {
 
         {
           title: '工厂单价',
-          dataIndex: 'factoryPeice',
+          dataIndex: 'theFactoryPrice',
           width: 120,
           className: 'replacecolor'
         },
@@ -245,11 +244,15 @@ export default {
           className: 'replacecolor'
         }
       ],
-      packingListData: [{}, {}, {}],
+      packingListData: [],
+      selectedRows:[],
+      error:[],//两条以上数据,不同字段名
 
       // orderDataform: this.$form.createForm(this),
       confirmLoading: false,
-      packingListModVis: false
+      packingListModVis: false,
+      fatherList: [],
+      errorFather:[]
     }
   },
   // 接收父组件 方法
@@ -261,19 +264,76 @@ export default {
   },
   created() {},
   methods: {
+    getPackingList(){
+      this.$nextTick(() => {
+      PackingList(this.queryParam).then(res => {
+          if (res.success) {
+           this.packingListData = res.result.records
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+        
+      })
+    },
     // 弹框查询按钮
-    searchQuery() {},
+    searchQuery() {
+      this.getPackingList()
+    },
     // 重置
     searchReset() {
       this.queryParam = {}
-      // this.getShipmentList()
+      this.getPackingList()
     },
     // 弹框确定
-    onSubmit() {},
+    onSubmit() {
+      console.log(this.selectedRows)
+      this.dataSet()
+      var selectedRow = this.selectedRows[0]
+      if(this.fatherList.length !== 0){
+        this.fatherDataSet(this.fatherList,selectedRow)
+      }
+      if(this.selectedRows.length === 0){
+        this.$message.error('请选择数据!');
+      }else if(this.selectedRows.length !==1 && this.error.length !==0){
+        var cc =this.error.toString()
+        this.$message.error(cc+'必须相同!');
+        this.error = []
+      }else if(this.fatherList.length !== 0 && this.errorFather.length !==0){
+        var fatherCc = this.errorFather.toString()
+        this.$message.error(fatherCc+'必须相同!');
+        this.errorFather = []
+      }else{
+        this.$emit('callback',this.selectedRows)
+        this.close()
+      }
+    },
+      //勾选两条以上数据进行校验
+    dataSet(){
+       var distributionPointTest = [],
+            customerTest = []
+       this.selectedRows.map(item=>{
+         distributionPointTest.push(item.distributionPoint)
+         customerTest.push(item.customer)
+      })
+      if([...new Set(distributionPointTest)].length !== 1){this.error.push('分销点')}
+      if([...new Set(customerTest)].length !== 1){this.error.push('客户')}
+    },
+    
+    //父组件列表有值时,进行判断
+    fatherDataSet(fathers,sons){
+      var father = fathers[0]
+      if(father.distributionPoint !== sons.distributionPoint){this.errorFather.push('分销点')}
+      if(father.customer !== sons.customer){this.errorFather.push('客户')}
+    },
 
     close() {
       this.$emit('close')
       this.packingListModVis = false
+      this.queryParam = {}
+      this.packingListData =[]
+      this.selectedRowKeys = []
+      this.selectedRows = []
     },
     handleCancel() {
       this.close()

+ 387 - 0
src/views/book/packingListModalFabrics.vue

@@ -0,0 +1,387 @@
+<template>
+  <a-modal
+    title="参照装箱单"
+    v-model="packingListModalFabrics"
+    :confirmLoading="confirmLoading"
+    @ok="onSubmit"
+    @cancel="handleCancel"
+    width="86%"
+    style="top:330px;left:100px;"
+  >
+    <!-- tabel 加载 -->
+    <a-spin :spinning="confirmLoading">
+      <!-- 查询  -->
+      <div class="table-page-search-wrapper">
+        <a-form layout="inline" @keyup.enter.native="searchQuery">
+          <a-row :gutter="24">
+            <a-col :md="6" :sm="8">
+              <a-form-item label="订单号">
+                <a-input placeholder="请输入订单号" v-model="queryParam.purchase"></a-input>
+              </a-form-item>
+            </a-col>
+
+            <a-col :md="6" :sm="8">
+              <a-form-item label="品名">
+                <a-input placeholder="请输入品名" v-model="queryParam.name"></a-input>
+              </a-form-item>
+            </a-col>
+
+            <a-col :md="6" :sm="8">
+              <a-form-item label="款号">
+                <a-input placeholder="请输入款号" v-model="queryParam.itemNumber"></a-input>
+              </a-form-item>
+            </a-col>
+
+            <a-col :md="6" :sm="8">
+              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+                <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
+                <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
+                <a @click="handleToggleSearch" style="margin-left: 8px">
+                  {{ toggleSearchStatus ? '收起' : '展开' }}
+                  <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
+                </a>
+              </span>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+
+
+      <!-- table , y: 300 -->
+      <div class="anotherTable">
+        <a-table
+          v-if="packingListData"
+          :columns="packingListColumns"
+          :data-source="packingListData"
+          :loading="loading"
+          :pagination="ipagination"
+          :row-key="record => record.id"
+          :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
+          @change="handleTableChange"
+          bordered
+          :scroll="{ x: 1500 }"
+          size="small"
+        >
+        </a-table>
+      </div>
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import JEllipsis from '@/components/jeecg/JEllipsis'
+import moment from 'moment'
+import {PackingList} from '@api/document/book.js'
+
+export default {
+  name: 'PackingListModal', // 参照装箱单 弹框
+  mixins: [JeecgListMixin],
+  components: { JEllipsis, moment },
+  data() {
+    return {
+      // 查询条件
+      queryParam: {
+        pageNo:''
+      },
+      packingListModalFabrics:false,
+      selectedRowKeys: [], // 勾选航
+      selectedRows:[],
+      loading: false, // 表格加载
+      fatherList:[],
+      // 表头
+      packingListColumns: [
+         {
+          title: '款号',
+          dataIndex: 'itemNumber',
+          width: 120,
+          fixed: 'left',
+          className: 'replacecolor'
+        },
+        {
+          title: '客户简称',
+          dataIndex: 'customerAbbreviation',
+          width: 120,
+          fixed: 'left',
+          className: 'replacecolor'
+        },
+        //  {
+        //   title: '创建时间',
+        //   dataIndex: 'createTime',
+        //   align: 'center',
+        //   sorter: true,
+        //   customRender: text => {
+        //     return moment(text).format('YYYY-MM-DD')
+        //   }
+        // },
+        {
+          title: '预发货日期',
+          dataIndex: 'preDeliveryDate',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '小PO',
+          dataIndex: 'smallPo',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '分销点',
+          dataIndex: 'distributionPoint',
+          width: 120,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '备注',
+          dataIndex: 'memo',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '发货日期',
+          dataIndex: 'shipDate',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '业务员',
+          dataIndex: 'salesman',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '客户',
+          dataIndex: 'customer',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '存货名称',
+          dataIndex: 'inventoryName',
+          width: 120,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '颜色',
+          dataIndex: 'colour',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '采购/委外订单号',
+          dataIndex: 'purchase',
+          width: 140,
+          className: 'replacecolor'
+        },
+        {
+          title: '订单类型',
+          dataIndex: 'orderType',
+          width: 120,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '工厂单价',
+          dataIndex: 'theFactoryPrice',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '数量(按合并规则累计)',
+          dataIndex: 'quantity',
+          width: 180,
+          className: 'replacecolor'
+        },
+        {
+          title: '箱数',
+          dataIndex: 'boxesNum',
+          width: 90,
+          className: 'replacecolor'
+        },
+        {
+          title: '总净重',
+          dataIndex: 'totalSuttle',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '总毛重',
+          dataIndex: 'totalRoughWeigh',
+          width: 120,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '总体积',
+          dataIndex: 'totalVolume',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '总价',
+          dataIndex: 'totalPrices',
+          width: 120,
+          className: 'replacecolor'
+        },
+        {
+          title: '集装箱代号',
+          dataIndex: 'containerCode',
+          width: 120,
+          className: 'replacecolor'
+        },
+
+        {
+          title: '集装箱号',
+          dataIndex: 'containerNo',
+          width: 120,
+          fixed: 'right',
+          className: 'replacecolor'
+        },
+        {
+          title: '预托书号',
+          dataIndex: 'preBookNum',
+          width: 120,
+          fixed: 'right',
+          className: 'replacecolor'
+        }
+      ],
+      packingListData: [],
+      error:[],
+      fatherList:[],
+      errorFather:[],
+      // orderDataform: this.$form.createForm(this),
+      confirmLoading: false,
+      packingListModalFabrics: false
+    }
+  },
+  // 接收父组件 方法
+  props: {
+    father: {
+      type: Function,
+      default: null
+    }
+  },
+  created() {},
+  methods: {
+    getPackingList(){
+      this.$nextTick(() => {
+      PackingList(this.queryParam).then(res => {
+          if (res.success) {
+           this.packingListData = res.result.records
+          }else {
+             this.$message.error(res.message);
+          }
+        })
+        
+      })
+    },
+    // 弹框查询按钮
+    searchQuery() {
+      this.getPackingList
+    },
+    // 重置
+    searchReset() {
+      this.queryParam = {}
+      this.getPackingList()
+      // this.getShipmentList()
+    },
+    // 弹框确定
+    onSubmit() {
+      console.log(this.selectedRows)
+      this.dataSet()
+      var selectedRow = this.selectedRows[0]
+      if(this.fatherList.length !== 0){
+        this.fatherDataSet(this.fatherList,selectedRow)
+      }
+      if(this.selectedRows.length === 0){
+        this.$message.error('请选择数据!');
+      }else if(this.selectedRows.length !==1 && this.error.length !==0){
+        var cc =this.error.toString()
+        this.$message.error(cc+'必须相同!');
+        this.error = []
+      }else if(this.fatherList.length !== 0 && this.errorFather.length !==0){
+        var fatherCc = this.errorFather.toString()
+        this.$message.error(fatherCc+'必须相同!');
+        this.errorFather = []
+      }else{
+        this.$emit('callback',this.selectedRows)
+        this.close()
+      }
+    },
+
+     //勾选两条以上数据进行校验
+    dataSet(){
+       var distributionPointTest = [],
+            customerTest = []
+       this.selectedRows.map(item=>{
+         distributionPointTest.push(item.distributionPoint)
+         customerTest.push(item.customer)
+      })
+      if([...new Set(distributionPointTest)].length !== 1){this.error.push('分销点')}
+      if([...new Set(customerTest)].length !== 1){this.error.push('客户')}
+    },
+
+    
+    //父组件列表有值时,进行判断
+    fatherDataSet(fathers,sons){
+      var father = fathers[0]
+      if(father.distributionPoint !== sons.distributionPoint){this.errorFather.push('分销点')}
+      if(father.customer !== sons.customer){this.errorFather.push('客户')}
+    },
+
+    close() {
+      this.$emit('close')
+      this.packingListModalFabrics = false
+      this.queryParam = {}
+      this.packingListData =[]
+      this.selectedRowKeys = []
+      this.selectedRows = []
+    },
+    handleCancel() {
+      this.close()
+    },
+    handleTableChange() {},
+    // 选中行
+    onSelectChange(keys, rows) {
+      this.selectedRowKeys = keys
+      this.selectedRows = rows
+    }
+  },
+  computed: {
+    // 选中项
+    rowSelection() {
+      return {
+        onChange: (selectedRowKeys, selectedRows) => {
+          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
+        },
+        getCheckboxProps: record => ({
+          props: {
+            disabled: record.title === 'Disabled User',
+            // Column configuration not to be checked
+            title: record.title
+          }
+        })
+      }
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+@import '~@assets/less/common.less';
+@import '~@assets/less/overwriter.less';
+/deep/ .ant-table-thead > tr > th {
+  text-align: center;
+  // font-weight: 700;
+}
+
+/deep/ .ant-table-tbody {
+  text-align: center;
+}
+
+// /deep/ th.replacecolor {
+//   background-color: #ccc;
+// }
+</style>