浏览代码

货代配箱10.23

caojunjie 1 年之前
父节点
当前提交
9dbfa75402

+ 23 - 2
src/api/iosBasicData/containers.js

@@ -1,5 +1,6 @@
 import request from '@/router/axios';
 
+// 列表接口
 export const containersList = (current, size, params) => {
   return request({
     url: '/api/blade-los/containers/list',
@@ -21,7 +22,7 @@ export const containersDetail = (id) => {
     }
   })
 }
-
+// 删除
 export const containersRemove = (ids) => {
   return request({
     url: '/api/blade-los/containers/remove',
@@ -31,7 +32,7 @@ export const containersRemove = (ids) => {
     }
   })
 }
-
+// 保存接口
 export const containersSubmit = (row) => {
   return request({
     url: '/api/blade-los/containers/submit',
@@ -40,3 +41,23 @@ export const containersSubmit = (row) => {
   })
 }
 
+// 清除箱号
+export const containersCleanBoxNo = (ids) => {
+  return request({
+    url: '/api/blade-los/containers/cleanBoxNo',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}
+// 撤销接口
+export const containersRevoke = (ids) => {
+  return request({
+    url: '/api/blade-los/containers/revoke',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}

+ 81 - 6
src/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox.vue

@@ -1,11 +1,16 @@
 <template>
     <div>
         <div>
-            <containers :assemblyForm="assemblyForm" :pid="assemblyForm.id" @DistributionBox="DistributionBox"></containers>
+            <containers ref="containers" :assemblyForm="assemblyForm" :pid="assemblyForm.id"
+                        @selectionChange="selectionChange"
+                        @rowSavefun="containersSubmitfun" @billsDetailfun="billsDetailfun"></containers>
         </div>
 
         <div>
-            <PackingBusiness :assemblyForm="assemblyForm"></PackingBusiness>
+            <PackingBusiness ref="PackingBusiness"
+                             :assemblyForm="assemblyForm"
+                             @allocationfun="allocationfun"
+                             @withdrawfun="withdrawfun"></PackingBusiness>
         </div>
     </div>
 </template>
@@ -13,6 +18,7 @@
 <script>
 import containers from "@/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/containers.vue";
 import PackingBusiness from "@/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/PackingBusiness.vue";
+import {containersSubmit} from "@/api/iosBasicData/containers";
     export default {
         components:{
             containers,
@@ -24,14 +30,83 @@ import PackingBusiness from "@/views/iosBasicData/SeafreightExportF/bills/assemb
         },
         data(){
             return {
-
+                // 当前选择的数据
+                selectionList:[],
             }
         },
         methods:{
-            // 配箱
-            DistributionBox(){
-
+            // 详情接口
+            billsDetailfun(){
+                this.$emit('billsDetailfun')
+            },
+            // 选择项
+            selectionChange(list){
+                this.selectionList = list
+                if (list.length > 0) {
+                    this.$refs.PackingBusiness.containersBillsList = this.selectionList[0].containersBillsList
+                    this.$refs.PackingBusiness.containersCommodityList = this.selectionList[0].containersCommodityList
+                }
+            },
+            // 分配
+            allocationfun(row){
+                if (this.selectionList.length > 0) {
+                    this.$set(row,'quantity',Number(row.quantity) - Number(row.editQuantity))
+                    this.$set(row,'grossWeight',Number(row.grossWeight) - Number(row.editGrossWeight))
+                    this.$set(row,'measurement',Number(row.measurement) - Number(row.editMeasurement))
+                    let obj = JSON.parse(JSON.stringify(row))
+                    obj.quantity = obj.editQuantity
+                    obj.grossWeight = obj.editGrossWeight
+                    obj.measurement = obj.editMeasurement
+                    obj.ppId = obj.id
+                    obj.pid = this.selectionList[0].id
+                    delete obj.editQuantity
+                    delete obj.editGrossWeight
+                    delete obj.editMeasurement
+                    delete obj.id
+                    this.selectionList[0].containersBillsList.push(obj)
+                    // 保存接口
+                    this.containersSubmitfun(this.selectionList[0])
+                }else {
+                    this.$message({
+                        type: "warning",
+                        message: "请先勾选要添加的箱!"
+                    })
+                }
             },
+            // 单个撤回
+            withdrawfun(data){
+                this.$confirm("确定将选择数据撤回?", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                }).then(()=>{
+                    // 判断是否是数组
+                    this.selectionList[0].subtractContainersBillsList = this.selectionList[0].subtractContainersBillsList instanceof Array?this.selectionList[0].subtractContainersBillsList:[]
+                    this.selectionList[0].subtractContainersBillsList.push(data.row)
+                    this.selectionList[0].containersBillsList.splice(data.index,1)
+                    for (let item of this.assemblyForm.waitingBoxList) {
+                        if (data.row.ppId == item.id) {
+                            this.$set(item,'quantity',Number(item.quantity) + Number(data.row.quantity))
+                            this.$set(item,'grossWeight',Number(item.grossWeight) + Number(data.row.grossWeight))
+                            this.$set(item,'measurement',Number(item.measurement) + Number(data.row.measurement))
+                        }
+                    }
+                    // 保存接口
+                    this.containersSubmitfun(this.selectionList[0])
+                })
+            },
+            // 保存接口
+            containersSubmitfun(row){
+                containersSubmit(row).then(res=>{
+                    this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                    })
+                    this.billsDetailfun() // 获取详情数据
+                })
+            },
+
+
         }
     }
 </script>

+ 78 - 24
src/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/PackingBusiness.vue

@@ -4,38 +4,38 @@
             <el-table
                 :data="containersBillsList"
                 border
-                height="150px"
+                height="300px"
                 style="width: 100%">
                 <el-table-column
-                    prop="date"
+                    prop="code"
                     label="业务编号">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="hblno"
                     label="HBLNO">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
-                    label="MBLNU">
+                    prop="mblno"
+                    label="MBLNO">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="polCnName"
                     label="目的港">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="quantity"
                     label="件数">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="grossWeight"
                     label="毛重">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="measurement"
                     label="尺码">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="remarks"
                     label="备注">
                 </el-table-column>
                 <el-table-column
@@ -43,7 +43,7 @@
                     label="操作"
                     width="100">
                     <template slot-scope="scope">
-                        <el-button type="text" size="small">撤回</el-button>
+                        <el-button type="text" size="small" @click="withdrawfun(scope.row,scope.$index)">撤回</el-button>
                     </template>
                 </el-table-column>
             </el-table>
@@ -51,45 +51,82 @@
 
         <div class="tbasTop">
             <el-table
-                :data="waitingBoxList"
+                :data="assemblyForm.waitingBoxList"
                 border
-                height="150px"
+                height="300px"
                 style="width: 100%">
                 <el-table-column
-                    prop="date"
+                    prop="billNo"
                     label="BILLNO">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="hblno"
                     label="H B/L NO">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="corpCnName"
                     label="客户">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="polCnName"
                     label="目的港">
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="editQuantity"
                     label="件数">
+                    <template slot-scope="scope">
+                        <el-input v-if="scope.row.edit"
+                                  type="numbers" size="small"
+                                  v-model="scope.row.editQuantity"
+                                  clearable placeholder="请输入件数"
+                        ></el-input>
+                        <span v-else>{{scope.row.editQuantity}}</span>
+                    </template>
                 </el-table-column>
                 <el-table-column
-                    prop="date"
+                    prop="editGrossWeight"
                     label="毛重">
+                    <template slot-scope="scope">
+                        <el-input v-if="scope.row.edit"
+                                  type="numbers" size="small"
+                                  v-model="scope.row.editGrossWeight"
+                                  clearable placeholder="请输入毛重"
+                        ></el-input>
+                        <span v-else>{{scope.row.editGrossWeight}}</span>
+                    </template>
                 </el-table-column>
                 <el-table-column
-                    prop="date"
-                    label="尺码">
+                    prop="editMeasurement"
+                    label="尺码(体积)">
+                    <template slot-scope="scope">
+                        <el-input v-if="scope.row.edit"
+                                  type="numbers" size="small"
+                                  v-model="scope.row.editMeasurement"
+                                  clearable placeholder="请输入尺码(体积)"
+                        ></el-input>
+                        <span v-else>{{scope.row.editMeasurement}}</span>
+                    </template>
+                </el-table-column>
+                <el-table-column
+                    prop="quantity"
+                    label="总件数">
+                </el-table-column>
+                <el-table-column
+                    prop="grossWeight"
+                    label="总毛重">
+                </el-table-column>
+                <el-table-column
+                    prop="measurement"
+                    label="总尺码(体积)">
                 </el-table-column>
                 <el-table-column
                     fixed="right"
                     label="操作"
                     width="100">
                     <template slot-scope="scope">
-                        <el-button type="text" size="small">编辑</el-button>
-                        <el-button type="text" size="small">分配</el-button>
+                        <el-button type="text" size="small" @click="waitingBoxeditfun(scope.row)">编辑</el-button>
+
+                        <el-button type="text" size="small" @click="allocationfun(scope.row)">分配</el-button>
                     </template>
                 </el-table-column>
             </el-table>
@@ -98,6 +135,7 @@
 </template>
 
 <script>
+
     export default {
         props:{
             assemblyForm:{},
@@ -113,9 +151,25 @@
             }
         },
         created() {
-
+        },
+        mounted() {
+            // console.log(this.assemblyForm,153)
         },
         methods:{
+            // 编辑
+            waitingBoxeditfun(row) {
+                console.log(row,160)
+                this.$set(row,'edit',true)
+            },
+            // 分配
+            allocationfun(row){
+                this.$emit('allocationfun',row)
+            },
+            // 撤回
+            withdrawfun(row,index){
+                // 先判断是否有id 有就把数据放到撤的数组里,增的数据清空
+                this.$emit('withdrawfun', {row,index})
+            },
 
         }
     }

+ 119 - 63
src/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/containers.vue

@@ -3,7 +3,6 @@
     <avue-crud :option="option"
                :table-loading="loading"
                :data="assemblyForm.containersList"
-               :page.sync="page"
                :permission="permissionList"
                :before-open="beforeOpen"
                v-model="form"
@@ -16,22 +15,14 @@
                @selection-change="selectionChange"
                @current-change="currentChange"
                @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
+               @refresh-change="refreshChange">
       <template slot="menuLeft">
-        <!-- <el-button type="danger"-->
-        <!--             size="small"-->
-        <!--             icon="el-icon-delete"-->
-        <!--             plain-->
-        <!--             v-if="permission.containers_delete"-->
-        <!--             @click="handleDelete">删 除-->
-        <!--</el-button>-->
         <div style="display: flex;align-items: center;justify-content: space-between">
             <div>
-                <el-button type="primary" size="small" @click="DistributionBox">配箱</el-button>
-                <el-button type="danger" size="small">撤销</el-button>
-                <el-button type="danger" size="small">全部撤销</el-button>
-                <el-button type="warning" size="small">清除箱号</el-button>
+                <!--<el-button type="primary" size="small" @click="DistributionBox">配箱</el-button>-->
+                <el-button type="danger" size="small" @click="revokefun">撤销</el-button>
+                <el-button type="danger" size="small" @click="wholeRevokefun">全部撤销</el-button>
+                <el-button type="warning" size="small" @click="cleanCntrNofun">清除箱号</el-button>
             </div>
             <div>
                 <el-button size="small">Copy</el-button>
@@ -40,21 +31,39 @@
             </div>
         </div>
       </template>
-      <template slot-scope="{type,disabled,row}" slot="polCnNameForm">
-          <search-query ref="SearchQuery" :disabled="extendedDisabled" :selectValue="form.polCnName"
-                        :datalist="polData" title="装货港" :filterable="true" :clearable="true"
-                        :remote="true" :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
-                        @remoteMethod="polListfun"
-                        @corpChange="polCorpChange">
-              <bports></bports>
-          </search-query>
-      </template>
+        <template slot-scope="scope" slot="menu">
+            <el-button v-if="scope.row.edit" :type="scope.type" :size="scope.size" icon="el-icon-edit"
+                       @click.stop="rowSavefun(scope.row, scope.index)">保存
+            </el-button>
+            <el-button v-else :type="scope.type" :size="scope.size" icon="el-icon-edit"
+                       @click.stop="rowCellfun(scope.row, scope.index)">编辑
+            </el-button>
+            <el-button :type="scope.type" :size="scope.size" icon="el-icon-delete"
+                       @click.stop="rowDel(scope.row, scope.index)">删除
+            </el-button>
+        </template>
+        <template slot-scope="scope" slot="cntrNo">
+            <el-input v-if="scope.row.edit" v-model="scope.row.cntrNo"
+                      size="small" clearable placeholder="请输入箱号"></el-input>
+            <span v-else>{{scope.row.cntrNo}}</span>
+        </template>
+        <template slot-scope="scope" slot="sealNo">
+            <el-input v-if="scope.row.edit" v-model="scope.row.sealNo"
+                      size="small" clearable placeholder="请输入封号"></el-input>
+            <span v-else>{{scope.row.sealNo}}</span>
+        </template>
     </avue-crud>
   </basic-container>
 </template>
 
 <script>
-  import {containersList, containersDetail, containersSubmit, containersRemove} from "@/api/iosBasicData/containers";
+import {
+    containersList,
+    containersDetail,
+    containersSubmit,
+    containersRemove,
+    containersCleanBoxNo, containersRevoke
+} from "@/api/iosBasicData/containers";
   import {mapGetters} from "vuex";
   import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
   import bports from "@/views/iosBasicData/bports/index.vue";
@@ -74,12 +83,12 @@
 
         form: {},
         query: {},
-        loading: true,
-        page: {
-          pageSize: 10,
-          currentPage: 1,
-          total: 0
-        },
+        loading: false,
+        // page: {
+        //   pageSize: 10,
+        //   currentPage: 1,
+        //   total: 0
+        // },
         selectionList: [],
         option: {
           height:'250',
@@ -503,30 +512,75 @@
       }
     },
       created() {
-          this.polListfun()
       },
       methods: {
-          // 配箱
-          DistributionBox(){
-              this.$emit('DistributionBox')
+          // 编辑
+          rowCellfun(row,index){
+              this.$delete(row, 'edit')
+              this.$set(row, 'edit', true)
+          },
+          // 保存
+          rowSavefun(row){
+              this.$delete(row, 'edit')
+              this.$set(row,'edit',false)
+              this.$emit('rowSavefun',row)
+          },
+          // 清除箱号
+          cleanCntrNofun(){
+              this.$confirm("确定将数据清除全部箱号?", {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning"
+              }).then(()=>{
+                  let arr =  this.assemblyForm.containersList.map(item=>{
+                      return item.id
+                  })
+                  // 清除箱号接口
+                  containersCleanBoxNo(arr.join(',')).then(res=>{
+                      this.$message({
+                          type: "success",
+                          message: "清除箱号成功!"
+                      });
+                      this.$emit('billsDetailfun')
+                  })
+              })
+          },
+          // 全部撤销
+          wholeRevokefun(){
+              this.$confirm("确定将数据撤销全部?", {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning"
+              }).then(()=>{
+                  let arr =  this.assemblyForm.containersList.map(item=>{
+                      return item.id
+                  })
+                  containersRevoke(arr.join(',')).then(res=>{
+                      this.$message({
+                          type: "success",
+                          message: "全部撤销成功!"
+                      });
+                      this.$emit('billsDetailfun')
+                  })
+              })
+          },
+          // 撤销
+          revokefun(){
+              if (this.selectionList.length > 0) {
+                  containersRevoke(this.selectionList[0].id).then(res=>{
+                      this.$message({
+                          type: "success",
+                          message: "撤销成功!"
+                      });
+                      this.$emit('billsDetailfun')
+                  })
+              }else {
+                  this.$message({
+                      type: "warning",
+                      message: "请选选择要撤销的数据!"
+                  });
+              }
           },
-        // 装货港接口请求数据
-        polListfun(cnName){
-            bportsList(1,2,{cnName}).then(res=>{
-                this.polData = res.data.data.records
-            })
-        },
-        // 装货港回调
-        polCorpChange(value){
-            for(let item of this.polData) {
-                if (item.cnName == value) {
-                    this.$set(this.form, 'polId', item.id)
-                    this.$set(this.form, 'polCode', item.code)
-                    this.$set(this.form, 'polCnName', item.cnName)
-                    this.$set(this.form, 'polEnName', item.enName)
-                }
-            }
-        },
 
       rowSave(row, done, loading) {
         containersSubmit(row).then(() => {
@@ -554,6 +608,7 @@
           console.log(error);
         });
       },
+          // 删除
       rowDel(row) {
         this.$confirm("确定将选择数据删除?", {
           confirmButtonText: "确定",
@@ -621,6 +676,7 @@
               arr = list
           }
           this.selectionList = arr
+          this.$emit('selectionChange',this.selectionList)
       },
       selectionClear() {
         this.selectionList = [];
@@ -633,19 +689,19 @@
         this.page.pageSize = pageSize;
       },
       refreshChange() {
-        this.onLoad(this.page, this.query);
+          console.log('刷新')
+        // this.onLoad(this.page, this.query);
       },
-      onLoad(page, params = {}) {
-        this.loading = true;
-
-        containersList(page.currentPage, page.pageSize, {...Object.assign(params, this.query),pid:this.pid}).then(res => {
-          const data = res.data.data;
-          this.page.total = data.total;
-          this.data = data.records;
-          this.loading = false;
-          this.selectionClear();
-        });
-      }
+      // onLoad(page, params = {}) {
+      //   this.loading = true;
+      //   containersList(page.currentPage, page.pageSize, {...Object.assign(params, this.query),pid:this.pid}).then(res => {
+      //     const data = res.data.data;
+      //     this.page.total = data.total;
+      //       this.data = data.records
+      //     this.loading = false;
+      //     this.selectionClear();
+      //   });
+      // }
     }
   };
 </script>

+ 31 - 12
src/views/iosBasicData/SeafreightExportF/bills/assembly/EntrustmentLnformation/precontainers.vue

@@ -244,18 +244,37 @@
         });
       },
       rowUpdate(row, index, done, loading) {
-          row.pid = this.pid
-        precontainersSubmit(row).then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          done();
-        }, error => {
-          loading();
-          console.log(error);
-        });
+          if (row.id) {
+              this.$confirm("已经存在配箱信息,如果修改预配箱数据 要清除全部配箱信息?", {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning"
+              }).then(()=>{
+                  precontainersSubmit(row).then(()=>{
+                      this.onLoad(this.page);
+                      this.$message({
+                          type: "success",
+                          message: "操作成功!"
+                      });
+                      done();
+                  })
+              }).catch(()=>{
+                  done();
+              })
+          }else {
+              row.pid = this.pid
+              precontainersSubmit(row).then(() => {
+                  this.onLoad(this.page);
+                  this.$message({
+                      type: "success",
+                      message: "操作成功!"
+                  });
+                  done();
+              }, error => {
+                  loading();
+                  console.log(error);
+              });
+          }
       },
       rowDel(row) {
         this.$confirm("确定将选择数据删除?", {

+ 17 - 5
src/views/iosBasicData/SeafreightExportF/bills/billsDetails.vue

@@ -135,7 +135,7 @@
                         <mbinformation :assemblyForm="form" :detailData="detailData"></mbinformation>
                     </el-tab-pane>
                     <el-tab-pane label="配箱" name="third">
-                        <DistributionBox :assemblyForm="form" :detailData="detailData" ></DistributionBox>
+                        <DistributionBox :assemblyForm="form" :detailData="detailData" @billsDetailfun="billsDetailfun(form.id)"></DistributionBox>
                     </el-tab-pane>
                     <el-tab-pane label="单证中心" name="fourth">单证中心</el-tab-pane>
                     <el-tab-pane label="费用" name="fifth">
@@ -821,15 +821,27 @@ import {billsDetail, billsGetBillNo, billsSubmit} from '@/api/iosBasicData/bills
             },
             // 主表保存接口大保存
             billsSubmitfun(){
+                this.form.billNoFormat = 'HYCK'
+                this.form.businessTypeId = '1714186930489712641'
                 billsSubmit(this.form).then(res=>{
                     console.log(res)
                 })
             },
             // 详情接口
-            billsDetailfun(id){
-                billsDetail(id).then(res => {
-                    this.form = res.data.data;
-                });
+            async billsDetailfun(id){
+                const res = await billsDetail(id)
+                this.form = res.data.data;
+                // 配箱最上面可以编辑
+                for(let item of this.form.containersList) {
+                    item.edit = false
+                }
+                // 配箱最下面的
+                for(let item of this.form.waitingBoxList) {
+                    this.$set(item,'editQuantity',1)
+                    this.$set(item,'editGrossWeight',1)
+                    this.$set(item,'editMeasurement',1)
+                    this.$set(item,'edit',false)
+                }
             },
             // tbas切换
             handleClick(tba,event) {