Browse Source

预装箱单详情

fenghaifu 2 years ago
parent
commit
06aec20ed5

+ 30 - 3
src/views/advance-packingList/adPaList-clothes.vue

@@ -465,9 +465,36 @@ export default {
     },
     //  详情
     details(record) {
-      this.$refs.detailsAdpackingDrawer.visible = true
-      this.$refs.detailsAdpackingDrawer.record = record //接口参数
-      this.$refs.detailsAdpackingDrawer.getDetailsById()
+      itemByMainId({id:record.id}).then(res => {
+        if (res.success) {
+          
+          this.$refs.detailsAdpackingDrawer.visible = true;
+          this.$refs.detailsAdpackingDrawer.addAdpacking = res.result; //接口参数
+          this.$refs.detailsAdpackingDrawer.loadSizeTables(res.result.syPreAssembledPackingListItemList[0].sizeTables);
+          var totalNetWeight = 0;
+          var totalGrossWeight = 0;
+          var totalVolume = 0;
+          var totalPrice = 0;
+          for (var i=0; i<res.result.syPreAssembledPackingListItemList.length;i++){
+            var row = res.result.syPreAssembledPackingListItemList[i];
+            var sizeTables = row.sizeTables;
+            for (var j=0; j<sizeTables.length;j++){
+              row['size-'+sizeTables[j].size] = sizeTables[j].proportion;
+            }
+            totalNetWeight += row.totalNetWeight*1;
+            totalGrossWeight += row.totalGrossWeight*1;
+            totalVolume += row.totalVolume*1;
+            totalPrice += row.totalPrice*1;
+          }
+          res.result.totalNetWeight = totalNetWeight;
+          res.result.totalGrossWeight = totalGrossWeight;
+          res.result.totalVolume = totalVolume;
+          res.result.totalPrice = totalPrice;
+          
+        }else{
+          this.$message.error(res.message);
+        }
+      });
     },
 
     // 新增

+ 292 - 218
src/views/advance-packingList/detailsAdpackingDrawer.vue

@@ -1,83 +1,159 @@
 <template>
-  <!-- 详情 预装箱单-成衣 单证-->
-  <a-drawer title="详情" width="89%" placement="right" :closable="true" :visible="visible" @close="onClose">
-    <!-- 主表信息 展示 -->
-    <a-card :bordered="true">
-      <div class="table-page-search-wrapper">
-        <a-form-model layout="inline" ref="form">
-          <a-row :gutter="24">
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="订单号" prop="orderNumber">
-                {{ detailsAdpacking.orderNumber }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="款号" prop="styleNum">
-                {{ detailsAdpacking.itemNumber }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="品名" prop="productName">
-                {{ detailsAdpacking.productName }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="尺码范围" prop="sizeRange">
-                {{ detailsAdpacking.sizeRange }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="客户" prop="customer">
-                {{ detailsAdpacking.customer }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="集装箱代号" prop="containerCode">
-                {{ detailsAdpacking.containerCode }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="集装箱号" prop="containerNumber">
-                {{ detailsAdpacking.containerNumber }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="备注" prop="memo">
-                {{ detailsAdpacking.memo }}
-              </a-form-model-item>
-            </a-col>
-
-            <a-col :md="6" :sm="8">
-              <a-form-model-item label="成衣工厂" prop="garmentFactory">
-                {{ detailsAdpacking.garmentFactory }}
-              </a-form-model-item>
-            </a-col>
-          </a-row>
-        </a-form-model>
-      </div>
-    </a-card>
-    <!-- 子表 ipagination-->
-    <a-card :bordered="true" style="margin:10px 0">
-      <a-table
-        bordered
-        rowKey="id"
-        :columns="columns"
-        :data-source="data"
-        :loading="loading"
-        :pagination="false"
-        :scroll="{ x: 1500 }"
-        @change="handleTableChange"
+  <!-- 新增 预装箱单-成衣-->
+  <div id="addAdvancePacking">
+    <a-drawer
+      title="新增预装箱单-成衣"
+      width="89%"
+      placement="right"
+      :closable="true"
+      :visible="visible"
+      @close="handleCancel"
+    >
+      <!-- 主表信息 填写 -->
+      <a-card :bordered="false">
+        <div class="table-page-search-wrapper">
+          <!-- :rules="validatorRules" -->
+          <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">
+                  {{addAdpacking.orderNumber}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="集装箱代号" prop="containerCode">
+                  {{addAdpacking.containerCode}}
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="集装箱号" prop="containerNumber">
+                  {{addAdpacking.containerNumber}}
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="预发货日期" prop="u8Remarks">
+                  {{addAdpacking.preDeliveryDate}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="u8备注" prop="u8Remarks">
+                  {{addAdpacking.u8Remarks}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="款号" prop="itemNumber">
+                  {{addAdpacking.itemNumber}}
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="品名" prop="productName">
+                  {{addAdpacking.productName}}
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="尺码范围" prop="sizeRange">
+                  {{addAdpacking.sizeRange}}
+                </a-form-model-item>
+              </a-col>
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="客户" prop="customer">
+                  {{addAdpacking.customer}}
+                </a-form-model-item>
+              </a-col>
+
+              
+
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="成衣工厂" prop="garmentFactory">
+                  
+                  {{addAdpacking.garmentFactory}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总箱数" prop="totalBoxes">
+                  {{addAdpacking.totalBoxes}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总净重" prop="totalNetWeight">
+                  {{addAdpacking.totalNetWeight}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总毛重" prop="totalGrossWeight">
+                  {{addAdpacking.totalGrossWeight}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总体积" prop="totalVolume">
+                  {{addAdpacking.totalVolume}}
+                </a-form-model-item>
+              </a-col>
+              <a-col :md="6" :sm="8">
+                <a-form-model-item label="总价" prop="totalPrice">
+                  {{addAdpacking.totalPrice}}
+                </a-form-model-item>
+              </a-col>
+            </a-row>
+          </a-form-model>
+        </div>
+      </a-card>
+
+      <!-- 参照发运明细 増行-->
+      <a-card :bordered="false" style="margin:10px 0 60px 0;">
+
+        <!-- 子表 ipagination :rules="validatorRules"-->
+        <a-spin :spinning="confirmLoading">
+          <a-form-model ref="formRef">
+            <j-vxe-table
+              ref="vTable"
+              toolbar
+              row-number
+              row-selection
+              drag-sort
+              keep-source
+              :height="300"
+              :loading="loading"
+              :dataSource="addAdpacking.syPreAssembledPackingListItemList"
+              :columns="columns"
+              :alwaysEdit=true
+              :bordered=true
+              :scroll="{ x: 1500 }"
+              style="margin-top: 5px;"
+              :toolbarConfig="toolbarConfig"
+              @valueChange="handleValueChange"
+            >
+            </j-vxe-table>
+          </a-form-model>
+        </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-table>
-    </a-card>
-  </a-drawer>
+        <a-button type="primary" @click="handleCancel">
+          关闭
+        </a-button>
+      </div>
+    </a-drawer>
+
+  </div>
 </template>
 
 <script>
@@ -85,276 +161,279 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import moment from 'moment'
 
-import { itemByMainId } from '@api/document/advance-packingList.js'
+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'
+import { getDotConfig, getDotValidExpress } from '@/utils/myutil'
 
 export default {
-  name: 'DetailsAdpackingDrawer', // 详情
+  name: 'AddAdvancePacking', // 新增预装箱单
   mixins: [JeecgListMixin],
-  components: { JEllipsis, moment },
+  components: { JEllipsis, moment }, // 参照发运明细弹框
   data() {
-    let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
+    let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
+
     return {
-      detailsAdpacking: {}, //主表信息
+      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.normal ,
         },
 
         {
           title: '结束箱号',
-          dataIndex: 'endCaseNumber.',
+          key: 'endCaseNumber',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
 
         {
           title: '颜色(中英文)',
-          dataIndex: 'colour',
+          key: 'colour',
           width: 140,
-          customRender: t => ellipsis(t),
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
         {
           title: '配码--根据U8订单来显示',
-          dataIndex: 'withCode',
-          width: 140,
-          className: 'replacecolor'
+          key: 'withCode',
+          width: 240,
+          type: JVXETypes.normal ,
         },
         {
           title: '件数/箱',
-          dataIndex: 'piecesBox',
+          key: 'piecesBox',
           width: 90,
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
         {
           title: '箱数',
-          dataIndex: 'boxNumber',
+          key: 'boxNumber',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal ,
         },
 
         {
           title: '总件数',
-          dataIndex: 'total',
+          key: 'total',          
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '净重/箱',
-          dataIndex: 'netWeight',
+          key: 'netWeight',
           width: 90,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '总净重',
-          dataIndex: 'totalNetWeight',
+          key: 'totalNetWeight',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
 
         {
           title: '毛重/箱',
-          dataIndex: 'grossWeight',
+          key: 'grossWeight',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '总毛重',
-          dataIndex: 'totalGrossWeight',
+          key: 'totalGrossWeight',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '外箱长度',
-          dataIndex: 'outerBoxLength',
+          key: 'outerBoxLength',
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
 
         {
           title: '外箱宽度',
-          dataIndex: 'outerBoxWidth',
+          key: 'outerBoxWidth',
           width: 140,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
         {
           title: '外箱高度',
-          dataIndex: 'outerBoxHeight',
+          key: 'outerBoxHeight',
+          type: JVXETypes.normal ,
           width: 140,
-          className: 'replacecolor'
         },
 
         {
           title: '总体积',
-          dataIndex: 'totalVolume',
+          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',
+          key: 'totalPrice',          
           width: 120,
-          className: 'replacecolor'
+          type: JVXETypes.normal,
         },
-        {
-          title: '备注(U8)',
-          dataIndex: 'u8Remarks',
-          width: 140,
-          fixed: 'right',
-          customRender: t => ellipsis(t),
-          className: 'replacecolor'
-        }
       ],
-      data: [], //子表信息
 
       loading: false, // 表格加载
-      pagination: {
-        pageNo: ''
-        // total: '',
-        // current: '',
-        // pageSize: ''
-      },
-
       visible: false,
       dateFormat: 'YYYY-MM-DD',
-      record: {} //点击的对象
+
+      addAdpacking: {
+        syPreAssembledPackingListItemList:[]
+      }, //主表信息
+      confirmLoading: false,
+      msgFormSon: 'test', // 子组件传来数据的变量
+      // state: '0', // 单据状态初始未【仅保存】
+      // pushState: '0' // 推送状态初始未【仅保存】
+
+      // 待确定还有哪些必填信息 ----------------------------
+      // validatorRules: {
+      //   orderNumber: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
+      //   styleNum: [{ required: true, message: '款号不能为空', trigger: 'blur' }],
+      //   name: [{ required: true, message: '品名不能为空', trigger: 'blur' }]
+      // },
+      sizeFields:[], // 尺码字段
+      dotConfig:{}, // 小数点配置
     }
   },
-  created() {
-    this.getDetailsById()
+  // 接收父组件查询方法
+  props: {
+    fatherList: {
+      type: Function,
+      default: null
+    }
   },
+
   methods: {
-    // 回显数据
-    getDetailsById() {
-      this.$nextTick(() => {
-        itemByMainId({ id: this.record.id }).then(res => {
-          if (res.success) {
-            console.log('点击的对象', res.result)
-            this.detailsAdpacking = res.result; //主表信息
-            this.data = [];
-            if (res.result.syPreAssembledPackingListItemList != null){
-              this.data = res.result.syPreAssembledPackingListItemList; //子表信息
-            }
+
+    loadSizeTables(sizeTable){
+      var newColums = this.columns.filter(item=>{
+        return item.isSize != true;
+      });            
+
+      this.sizeFields = [];
+      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);
+          var validExpress = getDotValidExpress(this.dotConfig.quantity);
+          var field = {
+              title: sizeTable[j].size,
+              key: 'size-'+sizeTable[j].size,
+              type: JVXETypes.normal ,
+              width: 80,
+              isSize:true,
+          };
+          
+          newColums.splice(i+1+j,0,field);
+        }
+      }
+      
+      this.columns = newColums;  
     },
-    handleTableChange(pagination, filters, sorter) {
-      this.pagination.pageNo = pagination.current
-      this.getDetailsById()
+
+
+    // 抽屉 取消
+    handleCancel() {
+      this.close()
     },
-    onClose() {
-      this.visible = false
-    }
-  },
 
-  modalFormOk() {}
+    close() {
+      this.$emit('close')
+      this.visible = false;
+      this.addAdpacking = {syPreAssembledPackingListItemList:[]};
+    },
+    aa() {},
+  },
+  computed: {},
+  mounted() {}
 }
 </script>
 <style lang="less" scoped>
@@ -369,7 +448,6 @@ export default {
 // /deep/ th.replacecolor {
 //   background-color: #ccc;
 // }
-
 // 抽屉里的card样式
 /deep/ .ant-drawer-content {
   background-color: #f0f2f5;
@@ -377,8 +455,4 @@ export default {
 /deep/ .ant-drawer-body {
   padding: 10px;
 }
-// 回显label文字
-/deep/.ant-form-item-label > label {
-  font-weight: 700;
-}
 </style>