Bladeren bron

预装箱单第一版

fenghaifu 3 jaren geleden
bovenliggende
commit
8671936c91

BIN
dist.zip


+ 4 - 1
src/api/document/advance-packingList.js

@@ -19,4 +19,7 @@ const editById = params => postAction('/spapl/syPreAssembledPackingList/edit', p
 //  删除
 const deleteAdPaList = params => deleteAction('/spapl/syPreAssembledPackingList/delete', params)
 
-export { getadPaList, deleteAdPaList, itemByMainId, editById, addAdvPac, shipList }
+// 发运明细详情
+const queryShippingDetails = params =>getAction('/spapl/syPreAssembledPackingList/queryShippingDetails', params)
+
+export { getadPaList, deleteAdPaList, itemByMainId, editById, addAdvPac, shipList, queryShippingDetails }

+ 25 - 7
src/views/advance-packingList/adPaList-clothes.vue

@@ -23,6 +23,20 @@
                 <a-input placeholder="请输入品名" v-model="queryParam.productName"></a-input>
               </a-form-item>
             </a-col>
+            <template v-if="toggleSearchStatus">
+              <a-col :md="6" :sm="8">
+              <a-form-item label="单据日期">
+                <a-range-picker
+                  style="width: 100%"
+                  v-model="timeRange"
+                  format="YYYY-MM-DD"
+                  :placeholder="['开始日期', '结束日期']"
+                  @change="onDateChange"
+                  @ok="onDateOk"
+                />
+              </a-form-item>
+            </a-col>
+            </template>
 
             <a-col :md="6" :sm="8">
               <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
@@ -208,6 +222,7 @@ export default {
     return {
       loading: false, // 表格加载
       id: '',
+      timeRange:'',
       // 表头
       adPaListClothesColumns: [
         {
@@ -405,8 +420,10 @@ export default {
       this.$nextTick(() => {
         getadPaList(this.queryParam).then(res => {
           if (res.success) {
-            this.adPaListClothesData = res.result.records
-            console.log('预装箱单-成衣', this.adPaListClothesData)
+            this.adPaListClothesData = [];
+            if (res.result.records != null){
+              this.adPaListClothesData = res.result.records;
+            }
             this.pagination = {
               total: res.result.total,
               current: res.result.current,
@@ -419,7 +436,6 @@ export default {
 
     //  编辑
     edit(record) {
-      console.log('编辑', record)
       this.$refs.editAdpackingDrawer.visible = true
       // this.$refs.detailsAdpackingDrawer.visible = true
       this.$refs.editAdpackingDrawer.record = record //接口参数
@@ -427,7 +443,6 @@ export default {
     },
     //  详情
     details(record) {
-      console.log('点击的record', record)
       this.$refs.detailsAdpackingDrawer.visible = true
       this.$refs.detailsAdpackingDrawer.record = record //接口参数
       this.$refs.detailsAdpackingDrawer.getDetailsById()
@@ -435,8 +450,7 @@ export default {
 
     // 新增
     addAdpacking() {
-      console.log('新增预装箱单')
-      this.$refs.addAdpackingDrawer.visible = true
+      this.$refs.addAdpackingDrawer.visible = true;
     },
 
     // 列表导出
@@ -503,7 +517,11 @@ export default {
       this.queryParam.pageNo = pagination.current
       this.getadPaListClothes()
     },
-    aa() {}
+    aa() {},
+    onDateChange(value, dateString) {
+      this.queryParam.startTime = dateString[0]
+      this.queryParam.endTime = dateString[1]
+    },
   },
 
   computed: {

+ 394 - 286
src/views/advance-packingList/addAdpackingDrawer.vue

@@ -16,56 +16,86 @@
           <a-form-model layout="inline" ref="form" :model="addAdpacking">
             <a-row :gutter="24">
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="订单号" prop="orderNumber">
-                  <a-input placeholder="请输入订单号" v-model="addAdpacking.orderNumber"></a-input>
+                <a-form-model-item label="单据号" prop="orderNumber">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.orderNumber" readOnly></a-input>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="集装箱代号" prop="containerCode">
+                  <a-input placeholder="请输入集装箱代号" v-model="addAdpacking.containerCode"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="款号" prop="styleNum">
-                  <a-input placeholder="请输入款号" v-model="addAdpacking.styleNum"></a-input>
+                <a-form-model-item label="集装箱号" prop="containerNumber">
+                  <a-input placeholder="请输入集装箱号" v-model="addAdpacking.containerNumber"></a-input>
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="预发货日期" prop="u8Remarks">
+                  <j-date placeholder="请选择预发货日期" v-model="addAdpacking.preDeliveryDate" style="width:100%"></j-date>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="u8备注" prop="u8Remarks">
+                  <a-input placeholder="请输入u8备注" v-model="addAdpacking.u8Remarks"></a-input>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="款号" prop="itemNumber">
+                  <a-input placeholder="选择子表自动生成" v-model="addAdpacking.itemNumber"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="品名" prop="productName">
-                  <a-input placeholder="请输入品名" v-model="addAdpacking.productName"></a-input>
+                  <a-input placeholder="选择子表自动生成" v-model="addAdpacking.productName"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="尺码范围" prop="sizeRange">
-                  <a-input placeholder="请输入尺码范围" v-model="addAdpacking.sizeRange"></a-input>
+                  <a-input placeholder="选择子表自动生成" v-model="addAdpacking.sizeRange"></a-input>
                 </a-form-model-item>
               </a-col>
 
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="客户" prop="customer">
-                  <a-input placeholder="请输入客户" v-model="addAdpacking.customer"></a-input>
+                  <a-input placeholder="选择子表自动生成" v-model="addAdpacking.customer"></a-input>
                 </a-form-model-item>
               </a-col>
 
+              
+
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="集装箱代号" prop="containerCode">
-                  <a-input placeholder="请输入集装箱代号" v-model="addAdpacking.containerCode"></a-input>
+                <a-form-model-item label="成衣工厂" prop="garmentFactory">
+                  <a-input placeholder="选择子表自动生成" v-model="addAdpacking.garmentFactory"></a-input>
                 </a-form-model-item>
               </a-col>
-
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="集装箱号" prop="containerNumber">
-                  <a-input placeholder="请输入集装箱号" v-model="addAdpacking.containerNumber"></a-input>
+                <a-form-model-item label="总箱数" prop="totalBoxes">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.totalBoxes" readOnly></a-input>
                 </a-form-model-item>
               </a-col>
-
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="备注" prop="memo">
-                  <a-input placeholder="请输入备注" v-model="addAdpacking.memo"></a-input>
+                <a-form-model-item label="总净重" prop="totalNetWeight">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.totalNetWeight" readOnly></a-input>
                 </a-form-model-item>
               </a-col>
-
               <a-col :md="6" :sm="8">
-                <a-form-model-item label="成衣工厂" prop="garmentFactory">
-                  <a-input placeholder="请输入成衣工厂" v-model="addAdpacking.garmentFactory"></a-input>
+                <a-form-model-item label="总毛重" prop="totalGrossWeight">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.totalGrossWeight" readOnly></a-input>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总体积" prop="totalVolume">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.totalVolume" readOnly></a-input>
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总价" prop="totalPrice">
+                  <a-input placeholder="自动生成" v-model="addAdpacking.totalPrice" readOnly></a-input>
                 </a-form-model-item>
               </a-col>
             </a-row>
@@ -75,103 +105,39 @@
 
       <!-- 参照发运明细 増行-->
       <a-card :bordered="false" style="margin:10px 0 60px 0;">
-        <div class="table-operator">
-          <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照发运明细</a-button>
-          <a-button type="primary" @click="handleAddColumn" icon="plus" style="margin-left: 20px">増行</a-button>
-        </div>
 
         <!-- 子表 ipagination :rules="validatorRules"-->
         <a-spin :spinning="confirmLoading">
           <a-form-model ref="formRef">
-            <a-table
-              bordered
-              rowKey="id"
-              :columns="columns"
-              :data-source="data"
+            <j-vxe-table
+              ref="vTable"
+              toolbar
+              row-number
+              row-selection
+              drag-sort
+              keep-source
+              :height="300"
               :loading="loading"
-              :pagination="false"
+              :dataSource="addAdpacking.syPreAssembledPackingListItemList"
+              :columns="columns"
+              :alwaysEdit=true
+              :bordered=true
               :scroll="{ x: 1500 }"
-              @change="handleTableChange"
+              style="margin-top: 5px;"
+              :toolbarConfig="toolbarConfig"
+              @valueChange="handleValueChange"
             >
-              <!-- 结束箱号 输入框-->
-              <template slot="endCaseNumberSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="endCaseNumber">
-                  <a-input style="width:100%" type="text" v-model="record.endCaseNumber" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 颜色(中英文) -->
-              <template slot="colourSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="colour">
-                  <a-input style="width:100%" type="text" v-model="record.colour" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 箱数  -->
-              <template slot="boxNumberSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="boxNumber">
-                  <a-input style="width:100%" type="text" v-model="record.boxNumber" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 总件数 -->
-              <template slot="totalSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="total">
-                  <a-input style="width:100%" type="text" v-model="record.total" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 总净重 -->
-              <template slot="totalNetWeightSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="totalNetWeight">
-                  <a-input style="width:100%" type="text" v-model="record.totalNetWeight" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 总毛重 -->
-              <template slot="totalGrossWeightSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="totalGrossWeight">
-                  <a-input style="width:100%" type="text" v-model="record.totalGrossWeight" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 外箱宽度 -->
-              <template slot="outerBoxWidthSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="outerBoxWidth">
-                  <a-input style="width:100%" type="text" v-model="record.outerBoxWidth" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 外箱高度 -->
-              <template slot="outerBoxHeightSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="outerBoxHeight">
-                  <a-input style="width:100%" type="text" v-model="record.outerBoxHeight" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 总体积 -->
-              <template slot="totalVolumeSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="totalVolume">
-                  <a-input style="width:100%" type="text" v-model="record.totalVolume" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 总价 -->
-              <template slot="totalPriceSlot" slot-scope="text, record, index">
-                <a-form-model-item prop="totalPrice">
-                  <a-input style="width:100%" type="text" v-model="record.totalPrice" />
-                </a-form-model-item>
-              </template>
-
-              <!-- 操作 -->
-              <span slot="operationSlot" slot-scope="text, record">
-                <a-popconfirm title="确定删除吗?" ok-text="是" cancel-text="否" @confirm="handleDelete(record.id)">
-                  <a href="javascript:void(0);" style="color:red;">删除</a>
-                </a-popconfirm>
-                <a-divider type="vertical" />
-                <a @click="copy(record)">复制</a>
-              </span>
-            </a-table>
+            <template v-slot:action="props">
+              <a @click="copy(props)">复制</a>
+              <a-divider type="vertical"/>
+              <a-popconfirm title="确定删除吗?" @confirm="handleDelete(props)">
+                <a>删除</a>
+              </a-popconfirm>
+            </template>
+            <template v-slot:toolbarSuffix>
+              <a-button type="primary" @click="referShipmentDetails" icon="ordered-list">参照发运明细</a-button>
+            </template>
+            </j-vxe-table>
           </a-form-model>
         </a-spin>
       </a-card>
@@ -216,6 +182,9 @@ import moment from 'moment'
 import ReferShipmentDetailsModal from '@views/advance-packingList/referShipmentDetailsModal.vue'
 
 import { addAdvPac } from '@api/document/advance-packingList.js'
+import { queryShippingDetails } from '@api/document/advance-packingList.js'
+import { JVXETypes } from '@/components/jeecg/JVxeTable'
+import { pushIfNotExist, randomNumber, randomUUID } from '@/utils/util'
 
 export default {
   name: 'AddAdvancePacking', // 新增预装箱单
@@ -225,249 +194,208 @@ export default {
     let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
 
     return {
+      toolbarConfig: {
+          // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
+          btn: []
+        },
       // 表头
       columns: [
         {
           title: '账套',
-          dataIndex: 'acSetNo',
+          key: 'acSetNo',
           width: 120,
           fixed: 'left',
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '成衣工厂',
-          dataIndex: 'garmentFactory',
+          key: 'garmentFactory',
           width: 120,
           fixed: 'left',
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: 'HOD',
-          dataIndex: 'hod',
+          key: 'hod',
           width: 120,
           fixed: 'left',
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: 'STYLE NO.',
-          dataIndex: 'styleNo',
+          key: 'styleNo',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: 'PO NO.',
-          dataIndex: 'poNo',
+          key: 'poNo',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
 
         {
           title: 'ITEM NO./SKU NO./UPC NO./PACKS CODE',
-          dataIndex: 'itemCode',
+          key: 'itemCode',
           width: 340,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '分销点/DC/LABEL',
-          dataIndex: 'distributionPoint',
+          key: 'distributionPoint',
           width: 180,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
 
         {
           title: 'PREPACK SKU',
-          dataIndex: 'prepackSku',
+          key: 'prepackSku',
           width: 140,
-          className: 'replacecolor'
-        },
+          type: JVXETypes.normal,
+          insertAfter:true,
 
-        {
-          title: 'S',
-          dataIndex: 's',
-          width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: 'M',
-          dataIndex: 'm',
-          width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: 'L',
-          dataIndex: 'l',
-          width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: 'XL',
-          dataIndex: 'xl',
-          width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: 'XXL',
-          dataIndex: 'xxl',
-          width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: '3XL',
-          dataIndex: 'xxxl',
-          width: 120,
-          className: 'replacecolor'
         },
+
         {
           title: '起始箱号',
-          dataIndex: ' startingBoxNumber.',
+          key: 'startingBoxNumber',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.input ,
         },
 
         {
           title: '结束箱号',
-          dataIndex: 'endCaseNumber',
-          scopedSlots: { customRender: 'endCaseNumberSlot' },
+          key: 'endCaseNumber',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.input ,
         },
 
         {
           title: '颜色(中英文)',
-          dataIndex: 'colour',
-          scopedSlots: { customRender: 'colourSlot' },
+          key: 'colour',
           width: 140,
-          // customRender: t => ellipsis(t),
-          className: 'replacecolor'
+          type: JVXETypes.input ,
         },
         {
           title: '配码--根据U8订单来显示',
-          dataIndex: 'withCode',
+          key: 'withCode',
           width: 240,
-          className: 'replacecolor'
+          type: JVXETypes.input ,
         },
         {
           title: '件数/箱',
-          dataIndex: 'piecesBox',
+          key: 'piecesBox',
           width: 90,
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
         {
           title: '箱数',
-          dataIndex: 'boxNumber',
-          scopedSlots: { customRender: 'boxNumberSlot' },
+          key: 'boxNumber',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
 
         {
           title: '总件数',
-          dataIndex: 'total',
-          scopedSlots: { customRender: 'totalSlot' },
+          key: 'total',          
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '净重/箱',
-          dataIndex: 'netWeight',
+          key: 'netWeight',
           width: 90,
-          className: 'replacecolor'
+          type: JVXETypes.inputNumber,
+          validateRules: [{ required: true, message: '${title}不能为空' }]
         },
         {
           title: '总净重',
-          dataIndex: 'totalNetWeight',
-          scopedSlots: { customRender: 'totalNetWeightSlot' },
+          key: 'totalNetWeight',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
 
         {
           title: '毛重/箱',
-          dataIndex: 'grossWeight',
+          key: 'grossWeight',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.inputNumber,
+          validateRules: [{ required: true, message: '${title}不能为空' }]
         },
         {
           title: '总毛重',
-          dataIndex: 'totalGrossWeight',
-          scopedSlots: { customRender: 'totalGrossWeightSlot' },
+          key: 'totalGrossWeight',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '外箱长度',
-          dataIndex: 'outerBoxLength',
+          key: 'outerBoxLength',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.inputNumber,
+          validateRules: [{ required: true, message: '${title}不能为空' }]
         },
 
         {
           title: '外箱宽度',
-          dataIndex: 'outerBoxWidth',
-          scopedSlots: { customRender: 'outerBoxWidthSlot' },
+          key: 'outerBoxWidth',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.inputNumber,
+          validateRules: [{ required: true, message: '${title}不能为空' }]
         },
         {
           title: '外箱高度',
-          dataIndex: 'outerBoxHeight',
-          scopedSlots: { customRender: 'outerBoxHeightSlot' },
+          key: 'outerBoxHeight',
+          type: JVXETypes.inputNumber ,
+          validateRules: [{ required: true, message: '${title}不能为空' }],
           width: 140,
-          className: 'replacecolor'
         },
 
         {
           title: '总体积',
-          dataIndex: 'totalVolume',
-          scopedSlots: { customRender: 'totalVolumeSlot' },
+          key: 'totalVolume',
+          type: JVXETypes.normal ,
           width: 140,
-          className: 'replacecolor'
+          
         },
         {
           title: '净净重',
-          dataIndex: 'netWeightToo',
+          key: 'netWeightToo',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '单价',
-          dataIndex: 'unitPrice',
+          key: 'unitPrice',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '总价',
-          dataIndex: 'totalPrice',
-          scopedSlots: { customRender: 'totalPriceSlot' },
+          key: 'totalPrice',          
           width: 120,
-          className: 'replacecolor'
-        },
-        {
-          title: '备注(U8)',
-          dataIndex: 'u8Remarks',
-          width: 140,
-          fixed: 'right',
-          customRender: t => ellipsis(t),
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '操作',
-          dataIndex: 'operation',
-          scopedSlots: { customRender: 'operationSlot' },
-          width: 160,
+          key: 'action',
+          type: JVXETypes.slot,
           fixed: 'right',
-          className: 'replacecolor'
+          width: 160,
+          align: 'center',
+            slotName: 'action',
         }
       ],
 
-      data: [], //子表数据
       loading: false, // 表格加载
       visible: false,
       dateFormat: 'YYYY-MM-DD',
 
-      addAdpacking: {}, //主表信息
+      addAdpacking: {
+        syPreAssembledPackingListItemList:[]
+      }, //主表信息
       confirmLoading: false,
-      msgFormSon: 'test' // 子组件传来数据的变量
+      msgFormSon: 'test', // 子组件传来数据的变量
       // state: '0', // 单据状态初始未【仅保存】
       // pushState: '0' // 推送状态初始未【仅保存】
 
@@ -477,6 +405,7 @@ export default {
       //   styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
       //   name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
       // },
+      sizeFields:[], // 尺码字段
     }
   },
   // 接收父组件查询方法
@@ -497,9 +426,48 @@ export default {
       //   val[i]['customerOrder'] = val[i].customerOrderNumber
       //   val[i]['shipmentQuantity'] = val[i].surplusNum //订单剩余数量 赋值给发货数量
       // }
-      this.msgFormSon = val
-      this.data = this.msgFormSon
-      console.log('新增页 子表信息', this.data)
+      this.addAdpacking.syPreAssembledPackingListItemList = [];
+      this.setHeadCalField();
+      var selectData = val[0];
+      
+      queryShippingDetails({id:selectData.id}).then(res => {
+          if (res.success) {
+            var newColums = this.columns.filter(item=>{
+              return item.isSize != true;
+            });
+            this.sizeFields = [];
+            var sizeTable = res.result.sizeTables;
+            if (sizeTable != null){
+              var i=0;
+              // 找到插入位置点
+              for (; i<newColums.length;i++){
+                if (newColums[i].insertAfter){
+                  break;
+                }
+              }
+              // 插入数据
+              for (var j=0;j<sizeTable.length;j++){
+                this.sizeFields.push('size-'+sizeTable[j].size);
+                newColums.splice(i+1+j,0,{
+                    title: sizeTable[j].size,
+                    key: 'size-'+sizeTable[j].size,
+                    type: JVXETypes.inputNumber ,
+                    width: 80,
+                    isSize:true
+                });
+              }
+            }
+            
+            this.columns = newColums;
+            
+            this.setHeadData(val[0], res.result);
+            var changedData = this.changeData(val[0], res.result);
+            this.addAdpacking.syPreAssembledPackingListItemList.push(changedData);
+
+          }else{
+            this.$message.success("请求发运明细详情失败");
+          }
+        })
     },
 
     // 参照发运明细
@@ -510,38 +478,87 @@ export default {
 
     //  保存
     saveAdd() {
-      var newObj = {} // 新增对象
-      newObj.orderNumber = this.addAdpacking.orderNumber
-      newObj.styleNum = this.addAdpacking.styleNum
-      newObj.productName = this.addAdpacking.productName
-      newObj.sizeRange = this.addAdpacking.sizeRange
-      newObj.customer = this.addAdpacking.customer
-
-      newObj.containerCode = this.addAdpacking.containerCode
-      newObj.containerNumber = this.addAdpacking.containerNumber
-      newObj.memo = this.addAdpacking.memo
-      newObj.garmentFactory = this.addAdpacking.garmentFactory
-
-      newObj.data = this.data // 子表信息赋值F
-       newObj.outerBoxWidth = this.data.outerBoxWidth
-
-      // 必须选择子表 --- 参照订单数据
-      if (newObj.data.length == 0) {
-        this.$message.error('请选择参照发运明细')
-      } else {
-        addAdvPac(newObj).then(res => {
-          if (res.success) {
-            this.$message.success('新增成功')
-            console.log('新增的对象', newObj)
-            this.close()
-            //清空信息
-            newObj = {}
-            newObj.data = []
-            this.fatherList() // 调用父组件 查询方法
-            // this.msgFormSon = {}  清空子表信息
+      var newObj = JSON.parse(JSON.stringify(this.addAdpacking));
+      if (this.sizeFields.length == 0){
+        this.$message.error('当前记录没有尺码字段,无法保存');
+        return;
+      }
+      if (newObj.totalBoxes == 0){
+        this.$message.error('总箱数为0,无法保存');
+        return;
+      }
+      // 尺码二维表分成多条记录
+      var subList = [];
+      var sort = 0;
+      for (var i=0; i<newObj.syPreAssembledPackingListItemList.length;i++){
+        var tableRow = newObj.syPreAssembledPackingListItemList[i];
+        var allSizeSum = this.getAllSizeSum(tableRow);
+        if (allSizeSum == 0){
+          this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
+          return;
+        }
+        if (tableRow.startingBoxNumber == ""){
+          this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
+          return;
+        }
+        if (tableRow.endCaseNumber == ""){
+          this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
+          return;
+        }
+        if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
+          this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
+          return;
+        }
+        if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
+          this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
+          return;
+        }
+        if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
+          this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
+          return;
+        }
+        if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
+          this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
+          return;
+        }
+        if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
+          this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
+          return;
+        }
+        if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
+          this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
+          return;
+        }
+
+        for (var j=0; j<this.sizeFields.length;j++){
+          var sizeField = this.sizeFields[j];
+          var rowData = JSON.parse(JSON.stringify(tableRow));
+          rowData.size = sizeField.substr(5);    // 'size-'+
+          if (rowData[sizeField] == undefined || rowData[sizeField] == null || rowData[sizeField] == ""){
+            continue;
           }
-        })
+          rowData.boxNumber = rowData[sizeField]; // 箱数
+          rowData.total = rowData.boxNumber*rowData.piecesBox;  //件数
+          rowData.totalNetWeight = rowData.boxNumber*rowData.netWeight;  // 总净重
+          rowData.totalGrossWeight = rowData.boxNumber*rowData.grossWeight;  // 总毛重
+          rowData.totalVolume = rowData.boxNumber*rowData.outerBoxLength*rowData.outerBoxWidth*rowData.outerBoxHeight;  // 总体积
+          rowData.totalPrice = rowData.total*rowData.unitPrice; // 总价
+          rowData.sort = ++sort;
+          subList.push(rowData);
+        }
       }
+      newObj.syPreAssembledPackingListItemList = subList;
+      addAdvPac(newObj).then(res => {
+        if (res.success) {
+          this.$message.success('新增成功')
+          this.close()
+          //清空信息
+          newObj = {syPreAssembledPackingListItemList:[]};
+          this.fatherList() // 调用父组件 查询方法
+          // this.msgFormSon = {}  清空子表信息
+        }
+      })
+      
 
       // const that = this
       // // 触发表单验证
@@ -552,55 +569,83 @@ export default {
       // })
     },
 
-    // 増行
-    handleAddColumn() {
-      console.log('増行')
-      const addrow = {
-        acSetNo: '',
-        garmentFactory: '',
-        hod: '',
-        styleNo: '',
-        poNo: '',
-        itemCode: '',
-        distributionPoint: '',
+    // 设置表头信息
+    setHeadData(referData, mData){
+      var itemData = {};
+      if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.size>0){
+        itemData = mData.syPreAssembledPackingListItemList[0];
+      }
+
+      this.addAdpacking.syDeclarationElementsId = mData.syDeclarationElementsId;      
+      this.addAdpacking.itemNumber = referData.itemNumber;
+      this.addAdpacking.productName = referData.chineseName;
+      this.addAdpacking.sizeRange = "";
+      if (mData.sizeTables != null){
+        if (mData.sizeTables.length == 1){
+            this.addAdpacking.sizeRange = mData.sizeTables[0].size;
+        }else if (mData.sizeTables.length>1){
+            this.addAdpacking.sizeRange = mData.sizeTables[0].size + " ~ " + mData.sizeTables[mData.sizeTables.length-1].size;
+        }
+      }
+      this.addAdpacking.customer = mData.customer;
+      this.addAdpacking.garmentFactory = mData.garmentFactory;
+    },
+    // 发运明细详情成预装箱记录:mData-主表记录,itemData-子表记录
+    changeData(referData, mData) {      
+      var itemData = {};
+      if (mData.syPreAssembledPackingListItemList != null && mData.syPreAssembledPackingListItemList.length>0){
+        itemData = mData.syPreAssembledPackingListItemList[0];
+      }
+      var addrow = {
+        syDeclarationElementsId:itemData.syDeclarationElementsId,
+        syDeclarationElementsItemId:itemData.syDeclarationElementsItemId,
+        acSetNo: itemData.acSetNo,
+        garmentFactory: mData.garmentFactory,
+        hod: itemData.hod,
+        styleNo:itemData.styleNo,
+        poNo:itemData.smallPo,
+        itemCode:referData.packId,
+        distributionPoint:referData.distributionPoint,
         prepackSku: '',
-        s: '',
-        m: '',
-        l: '',
-        xl: '',
-        xxl: '',
-        xxxl: '',
+        size:"",
         startingBoxNumber: '',
         endCaseNumber: '',
-        colour: '',
-        withCode: '',
-        piecesBox: '',
+        colour: itemData.colour,
+        withCode: itemData.withCode,
+        piecesBox: itemData.piecesBox,
         boxNumber: '',
         total: '',
         netWeight: '',
         totalNetWeight: '',
-        roughWeight: '',
+        grossWeight: '',
         totalGrossWeight: '',
         outerBoxLength: '',
         outerBoxWidth: '',
         outerBoxHeight: '',
         totalVolume: '',
         netWeightToo: '',
-        unitPrice: '',
+        unitPrice: itemData.unitPrice,
         totalPrice: '',
-        u8Remarks: '',
-        operation: ''
+        smallPo: referData.smallPo,
+        inventoryName:referData.inventoryName,
+        spurOrSubOrder:referData.purOrSubOrder,
+        factoryUnitPrice:referData.factoryUnitPrice,
+        customerAbbreviation:referData.customerAbbreviation,
       }
-      this.data.push(addrow)
+      return addrow;
     },
 
     //  操作按钮 删除
     handleDelete(index) {
-      return this.data.splice(index, 1)
+      var ret = this.addAdpacking.syPreAssembledPackingListItemList.splice(index, 1);
+      this.setHeadCalField();
+      return ret;
     },
     // 复制
     copy(record) {
-      this.data.push(record)
+      var newRow = JSON.parse(JSON.stringify(record.row));
+      this.addAdpacking.syPreAssembledPackingListItemList.push(newRow);
+      this.setHeadCalField();
     },
 
     // 抽屉 取消
@@ -610,14 +655,77 @@ export default {
 
     close() {
       this.$emit('close')
-      this.visible = false
-      this.addAdpacking = {}
-      this.data = []
+      this.visible = false;
+      this.addAdpacking = {syPreAssembledPackingListItemList:[]};
     },
     aa() {},
     modalFormOk() {
       this.$refs.referShipmentDetailsModal.referShipmentDetailsModVis = true
-    }
+    },
+    // 表格字段值变动时触发
+    handleValueChange(event) {
+      var allSizeSum = this.getAllSizeSum(event.row);
+      event.row.boxNumber = allSizeSum;
+      event.row.total = allSizeSum*event.row.piecesBox;
+      if (event.row.unitPrice != undefined && event.row.unitPrice != ""){
+        event.row.totalPrice = event.row.unitPrice*event.row.total;
+      }
+      if (event.row.netWeight != "" && event.row.netWeight != undefined){
+        event.row.totalNetWeight = event.row.netWeight * allSizeSum;
+      }
+      if (event.row.grossWeight != "" && event.row.grossWeight != undefined){
+        event.row.totalGrossWeight = event.row.grossWeight * allSizeSum;
+      }
+      if (event.row.outerBoxLength != "" && event.row.outerBoxLength != undefined &&
+      event.row.outerBoxWidth != "" && event.row.outerBoxWidth != undefined &&
+      event.row.outerBoxHeight != "" && event.row.outerBoxHeight != undefined){
+        event.row.totalVolume = event.row.outerBoxLength * event.row.outerBoxWidth * event.row.outerBoxHeight * allSizeSum;
+      }
+      this.setHeadCalField();
+      },
+    // 获取不同尺码数量之和
+    getAllSizeSum(record){
+      var ret = 0;
+      for (var i=0; i<this.sizeFields.length; i++){
+        if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
+          ret += record[this.sizeFields[i]]*1;
+        }
+      }
+      return ret;
+    },
+    // 设置表头计算值,直接设置表头值对象不能刷新,把表头对象换了就可以了
+    setHeadCalField(){
+      var headData = JSON.parse(JSON.stringify(this.addAdpacking));
+      var totalBoxes = 0;
+      var totalNetWeight = 0;
+      var totalGrossWeight = 0;
+      var totalVolume = 0;
+      var totalPrice = 0;
+
+      for (var i=0; i<headData.syPreAssembledPackingListItemList.length; i++){
+        var rowData = headData.syPreAssembledPackingListItemList[i];
+        var allSizeSum = this.getAllSizeSum(rowData);
+        totalBoxes += allSizeSum;
+        if (rowData.totalNetWeight != undefined && rowData.totalNetWeight != ""){
+          totalNetWeight += rowData.totalNetWeight;
+        }
+        if (rowData.totalGrossWeight != undefined && rowData.totalGrossWeight != ""){
+          totalGrossWeight += rowData.totalGrossWeight;
+        }
+        if (rowData.totalVolume != undefined && rowData.totalVolume != ""){
+          totalVolume += rowData.totalVolume;
+        }
+        if (rowData.totalPrice != undefined && rowData.totalPrice != ""){
+          totalPrice += rowData.totalPrice;
+        }
+      }
+      headData.totalBoxes = totalBoxes;
+      headData.totalNetWeight = totalNetWeight;
+      headData.totalGrossWeight = totalGrossWeight;
+      headData.totalVolume = totalVolume;
+      headData.totalPrice = totalPrice; 
+      this.addAdpacking = headData;
+    },
   },
   computed: {},
   mounted() {}

+ 6 - 3
src/views/advance-packingList/detailsAdpackingDrawer.vue

@@ -334,10 +334,13 @@ export default {
     getDetailsById() {
       this.$nextTick(() => {
         itemByMainId({ id: this.record.id }).then(res => {
-          if (res.code == 0) {
+          if (res.success) {
             console.log('点击的对象', res.result)
-            this.detailsAdpacking = res.result //主表信息
-            this.data = res.result.syPreAssembledPackingListItemList //子表信息
+            this.detailsAdpacking = res.result; //主表信息
+            this.data = [];
+            if (res.result.syPreAssembledPackingListItemList != null){
+              this.data = res.result.syPreAssembledPackingListItemList; //子表信息
+            }
           }
         })
       })

+ 16 - 4
src/views/advance-packingList/referShipmentDetailsModal.vue

@@ -14,14 +14,18 @@
         <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.documentNo"></a-input>
+              <a-form-item label="发运明细单号">
+                <a-input placeholder="请输入发运明细单号" v-model="queryParam.documentNo"></a-input>
               </a-form-item>
             </a-col>
 
             <a-col :md="6" :sm="8">
               <a-form-item label="客户">
-                <a-input placeholder="请输入客户" v-model="queryParam.customer"></a-input>
+                <j-search-select-tag
+                  placeholder="请选择客户"
+                  v-model="queryParam.customer"
+                  dict="view_customer,customername,customername">
+                </j-search-select-tag>
               </a-form-item>
             </a-col>
 
@@ -286,7 +290,10 @@ export default {
         shipList(this.queryParam).then(res => {
           // console.log('参照订单数据res', res)
           if (res.success) {
-            this.data = res.result.records
+            this.data = [];
+            if (res.result.records != null){
+              this.data = res.result.records;
+            }
             this.pagination = {
               total: res.result.total,
               current: res.result.current,
@@ -304,6 +311,11 @@ export default {
       } else {
         // console.log('需要传给父组件的数据', this.selectedRows)
         // bao父组件指定的传数据绑定的函数 || this.selectedRows子组件给父组件传递的数据
+        var msg = "选中记录后,会清除编辑的内容。";
+        if (this.selectedRowKeys.length>1){
+          msg = '当前勾选了多行,只有第一行会被选中。'+msg;
+        }
+        this.$message.info(msg);
         this.$emit('bao', this.selectedRows)
         this.referShipDetModVis = false
         this.selectedRowKeys = []