Browse Source

新增 导入卸货记录

wzg 1 năm trước cách đây
mục cha
commit
7fdf12741f
3 tập tin đã thay đổi với 81 bổ sung13 xóa
  1. 10 0
      src/apis/fetch.js
  2. 2 0
      src/store/index.js
  3. 69 13
      src/views/voyage/voyageDetail.vue

+ 10 - 0
src/apis/fetch.js

@@ -560,4 +560,14 @@ export default {
   getOrderList(data) {
     return $http("/order/web/list", data);
   },
+
+  // 上传导入卸货明细
+  uploadDischargeExcel(data) {
+    return $http("/voyage/upload/discharge/excel", data);
+  },
+
+  // 下载卸货导入模板
+  downloadDischargeTemp(data) {
+    return $http("/voyage/download/discharge/temp", data);
+  },
 };

+ 2 - 0
src/store/index.js

@@ -9,6 +9,7 @@ const uploadUrl = `${baseurl}cos/upload`;
 const wayBillUrl = `${baseurl}voyage/uploadVoyageWayBill`;
 const accidentUrl = `${baseurl}voyage/uploadAccidentMedia`;
 const fydi = `${baseurl}fydi/upload`;
+const dischargeExcelUrl = `${baseurl}voyage/upload/discharge/excel`;
 
 const store = createStore({
   state: {
@@ -25,6 +26,7 @@ const store = createStore({
     wayBillUrl,
     accidentUrl,
     fydi,
+    dischargeExcelUrl,
   },
   getters: {},
   mutations: {

+ 69 - 13
src/views/voyage/voyageDetail.vue

@@ -740,10 +740,10 @@
     <div v-auth="'SHIPDISCHARGE'">
       <div class="container-second-title df aic jcsb">
         <div>卸货记录</div>
-        <div>
+        <div class="df aic">
           <el-button
             v-auth="'SHIPDISCHARGEADD'"
-            class="mr20"
+            class="mr10"
             type="primary"
             @click="showAddPoundModal"
           >
@@ -752,7 +752,6 @@
           <el-button
             v-auth="'DOWNLOADDISCHARGE'"
             @click="exportDischargeExcel"
-            style="width: 160px"
             type="primary"
             :loading="isDischargeLoadingExcel"
           >
@@ -803,12 +802,14 @@
         <el-table-column label="磅单" min-width="120" align="center">
           <template v-slot="scope">
             <el-button
+              v-if="scope.row.files"
               @click="showUpdateDischarge(scope.row, scope.$index, '查看记录')"
               type="primary"
               size="small"
             >
-              {{ scope.row.files ? "查看" : "上传" }}
+              查看
             </el-button>
+            <span v-else>暂无</span>
           </template>
         </el-table-column>
         <el-table-column label="提单" min-width="80" align="center">
@@ -962,7 +963,26 @@
     <div v-auth="'CARLOAD'">
       <div class="container-second-title df aic jcsb mt40">
         <div>汽车装货记录详情</div>
-        <div>
+        <div class="df aic">
+          <el-button
+            v-auth="'SHIPDISCHARGEADD'"
+            class="mr20"
+            type="text"
+            @click="downloadDischargeTemp"
+          >
+            下载卸货记录表模板
+          </el-button>
+          <el-upload
+            :action="$store.state.dischargeExcelUrl"
+            :show-file-list="false"
+            :data="dischargeExcelParams"
+            :on-success="dischargeExcelSuccess"
+            :before-upload="beforeDischargeExcel"
+          >
+            <el-button class="mr20" type="primary" :loading="isUpLoading">
+              上传卸货记录表
+            </el-button>
+          </el-upload>
           <el-button
             v-auth="'CARLOADADD'"
             type="primary"
@@ -1513,7 +1533,7 @@
     <Certs ref="certs"></Certs>
   </div> -->
   <div class="container-title df aic jcsb" v-auth="'BILLDISTRIBUTE'">
-    <div @click="getVoyageDetail()">单据图片分配</div>
+    <div>单据图片分配</div>
     <div>
       <el-checkbox
         v-model="isCheckAll"
@@ -1956,13 +1976,10 @@ async function getVoyageDetail(isInit) {
     spinner: "el-icon-loading",
     background: "rgba(0, 0, 0, 0.7)",
   });
-  // let res = await api.getVoyageDetail({
-  //   type: localStorage.userType,
-  //   voyageId: route.query.id,
-  // });
-  let res = {
-    data,
-  };
+  let res = await api.getVoyageDetail({
+    type: localStorage.userType,
+    voyageId: route.query.id,
+  });
   loading.close();
   if (res.data.status == 0) {
     ElNotification({
@@ -3214,6 +3231,45 @@ function deleteAccident(id) {
       });
     });
 }
+
+async function downloadDischargeTemp() {
+  let { data } = await api.downloadDischargeTemp({
+    voyageId: route.query.id,
+  });
+  let url = data.result.downloadUrl;
+  let a = document.createElement("a");
+  a.setAttribute("href", url);
+  a.click();
+}
+
+const dischargeExcelParams = ref({
+  loginAccountId: localStorage.getItem("loginAccountId"),
+  voyageId: route.query.id,
+  portId: currentDiscPortId,
+});
+const isUpLoading = ref(false);
+function dischargeExcelSuccess(e) {
+  if (e.status == 0) {
+    ElNotification.success({
+      title: "成功",
+      duration: 2000,
+      message: e.msg,
+    });
+  } else {
+    ElNotification.error({
+      title: "失败",
+      duration: 2000,
+      message: e.msg,
+    });
+  }
+  getTruckLoadRecord();
+  isUpLoading.value = false;
+}
+
+function beforeDischargeExcel() {
+  isUpLoading.value = true;
+}
+
 onMounted(() => {
   getVoyageDetail(true);
 });