Ver Fonte

更新 卸货天气,提单信息

wzh há 3 anos atrás
pai
commit
6c70b8731c
1 ficheiros alterados com 243 adições e 74 exclusões
  1. 243 74
      src/views/voyage/voyageDetail.vue

+ 243 - 74
src/views/voyage/voyageDetail.vue

@@ -13,9 +13,10 @@
     <div class="df aic">
       <div class="mr30">航次信息</div>
       <el-tooltip
+        v-if="blockchainInfo"
         class="box-item"
         effect="light"
-        :content="blockchainInfo"
+        :content="blockchainInfo.hash"
         placement="top"
       >
         <div class="pointer" style="font-size: 14px; font-weight: normal">
@@ -380,14 +381,9 @@
   <div class="container-title">卸货信息</div>
   <div class="line-container-p24">
     <div class="container-second-title df aic jcsb">
-      <div>天气信息</div>
+      <div>{{ voyage.dischargeProt }} - 天气信息</div>
     </div>
-    <el-table
-      style="width: 800px"
-      :data="dischargeList"
-      stripe
-      :disabled="disabledStatus"
-    >
+    <el-table style="width: 800px" :data="weatherTableData" stripe>
       <el-table-column
         type="index"
         label="序号"
@@ -395,70 +391,55 @@
         align="center"
       ></el-table-column>
       <el-table-column
-        prop="dischargeTime"
-        label="卸货时间"
+        prop="weather"
+        label="天气"
         min-width="120"
         align="center"
       ></el-table-column>
       <el-table-column
-        prop="dischargeTons"
-        label="卸货吨位"
+        prop="temperature"
+        label="温度"
         min-width="100"
         align="center"
       ></el-table-column>
       <el-table-column
-        prop="dischargePieces"
-        label="卸货件数"
+        prop="winddirection"
+        label="风向"
+        min-width="100"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        prop="windpower"
+        label="风力"
+        min-width="100"
+        align="center"
+      ></el-table-column>
+      <el-table-column
+        prop="reporttime"
+        label="记录时间"
         min-width="100"
         align="center"
       ></el-table-column>
-      <el-table-column label="磅单" min-width="150" align="center">
-        <template v-slot="scope">
-          <el-button
-            @click="showUpdateDischarge(scope.row, scope.$index)"
-            type="primary"
-            size="small"
-          >
-            {{ scope.row.files ? "查看" : "上传" }}
-          </el-button>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" min-width="150" align="center">
-        <template v-slot="scope">
-          <el-button
-            @click="showUpdateDischarge(scope.row, scope.$index)"
-            type="primary"
-            size="small"
-          >
-            修改
-          </el-button>
-          <el-button
-            @click="deleteDischarge(scope.row.id, scope.$index)"
-            type="danger"
-            size="small"
-          >
-            删除
-          </el-button>
-        </template>
-      </el-table-column>
     </el-table>
     <div style="width: 800px; text-align: right; margin-top: 43px">
       <el-pagination
         background
         layout="prev, pager, next"
-        :total="total"
-        @current-change="pageChange"
+        :total="weatherTotal"
+        @current-change="weatherPageChange"
       ></el-pagination>
     </div>
-    <div class="container-second-title df aic jcsb">
+    <div class="hr mt20"></div>
+
+    <div class="container-second-title df aic jcsb mt40">
       <div>提单信息</div>
+      <div>
+        <el-button type="primary" @click="showAddLab()">
+          新增提单记录
+        </el-button>
+      </div>
     </div>
-    <el-table
-      style="width: 800px"
-      :data="dischargeList"
-      stripe
-      :disabled="disabledStatus"
-    >
+    <el-table :data="labTableData" stripe style="width: 800px">
       <el-table-column
         type="index"
         label="序号"
@@ -466,45 +447,39 @@
         align="center"
       ></el-table-column>
       <el-table-column
-        prop="dischargeTime"
-        label="卸货时间"
-        min-width="120"
-        align="center"
-      ></el-table-column>
-      <el-table-column
-        prop="dischargeTons"
-        label="卸货吨位"
+        prop="billingNum"
+        label="开单数量"
         min-width="100"
         align="center"
       ></el-table-column>
       <el-table-column
-        prop="dischargePieces"
-        label="卸货件数"
-        min-width="100"
+        prop="billingDate"
+        label="开单日期"
+        min-width="120"
         align="center"
       ></el-table-column>
-      <el-table-column label="单" min-width="150" align="center">
+      <el-table-column label="单" min-width="150" align="center">
         <template v-slot="scope">
           <el-button
-            @click="showUpdateDischarge(scope.row, scope.$index)"
+            @click="showLab(scope.row, scope.$index, '查看提单')"
             type="primary"
             size="small"
           >
-            {{ scope.row.files ? "查看" : "上传" }}
+            {{ scope.row.file ? "查看" : "上传" }}
           </el-button>
         </template>
       </el-table-column>
       <el-table-column label="操作" min-width="150" align="center">
         <template v-slot="scope">
           <el-button
-            @click="showUpdateDischarge(scope.row, scope.$index)"
+            @click="showLab(scope.row, scope.$index, '修改提单')"
             type="primary"
             size="small"
           >
             修改
           </el-button>
           <el-button
-            @click="deleteDischarge(scope.row.id, scope.$index)"
+            @click="deleteLab(scope.row.id, scope.$index)"
             type="danger"
             size="small"
           >
@@ -513,14 +488,66 @@
         </template>
       </el-table-column>
     </el-table>
-    <div style="width: 800px; text-align: right; margin-top: 43px">
+    <div style="text-align: right; margin-top: 43px">
       <el-pagination
         background
         layout="prev, pager, next"
-        :total="total"
-        @current-change="pageChange"
+        :total="labTotal"
+        @current-change="labPageChange"
       ></el-pagination>
     </div>
+    <el-dialog
+      v-model="isAddLabVisable"
+      :title="labModalType"
+      width="780px"
+      center
+      @close="cancelUploadLab"
+    >
+      <el-form
+        :model="labForm"
+        inline
+        style="margin-bottom: 20px"
+        label-width="100px"
+      >
+        <el-form-item label="开单日期">
+          <el-date-picker
+            class="info-line-text"
+            v-model="labForm.billingDate"
+            type="date"
+            format="YYYY/MM/DD"
+            value-format="YYYY/MM/DD"
+            placeholder="开单日期"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item label="开单数量">
+          <el-input
+            style="width: 240px"
+            v-model="labForm.billingNum"
+            placeholder="开单数量"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="提单">
+          <Uploader
+            :actionUrl="store.state.wayBillUrl"
+            :uploaderId="'labLoad'"
+            :params="labParams"
+            @onSendFileList="getLabBillList"
+            :fileList="labBillList"
+            uploadText="上传提单"
+            :limit="1"
+          ></Uploader>
+        </el-form-item>
+      </el-form>
+
+      <template #footer>
+        <el-button @click="cancelUploadLab">取消</el-button>
+        <el-button style="margin-left: 30px" type="primary" @click="addLab">
+          提交
+        </el-button>
+      </template>
+    </el-dialog>
+    <div class="hr mt20"></div>
+
     <div class="container-second-title df aic jcsb">
       <div>卸货记录</div>
       <div>
@@ -679,7 +706,6 @@
         <el-form-item label="上传磅单">
           <Uploader
             :actionUrl="store.state.wayBillUrl"
-            isVisiable
             :uploaderId="'updatePound'"
             :params="updatePoundParams"
             @onSendFileList="getupdatePoundBillList"
@@ -944,7 +970,6 @@
         <el-form-item label="汽车装货单">
           <Uploader
             :actionUrl="store.state.wayBillUrl"
-            isVisiable
             :uploaderId="'truckLoad'"
             :params="truckLoadParams"
             @onSendFileList="getTruckLoadBillList"
@@ -1467,7 +1492,7 @@ async function getVoyageDetail() {
       type: "success",
       title: res.data.msg,
     });
-
+    blockchainInfo.value = res.data.result.blockChain;
     coordinates.value = res.data.result.coordinates;
     voyage.value = res.data.result.voyage;
     medias.value = res.data.result.medias;
@@ -2272,10 +2297,154 @@ let ocrLoading = ref(false);
 let ocrImageList = ref([]);
 let blockchainInfo = ref("");
 
+let isAddLabVisable = ref(false);
+let labTableData = ref([]);
+let labForm = ref({});
+let labBillList = ref([]);
+let labCurrentPage = ref(1);
+let labTotal = ref(0);
+let labParams = ref({
+  voyageId: route.query.id,
+  type: 5,
+});
+function getLabBillList(list) {
+  labBillList.value = list;
+}
+function cancelUploadLab() {
+  isAddLabVisable.value = false;
+  labForm.value = {};
+  labBillList.value = [];
+  currentLabId.value = -1;
+}
+let currentLabId = ref(-1);
+async function addLab() {
+  let postData = {};
+  if (labBillList.value.length) {
+    if (labBillList.value[0].viewUrl) {
+      let { fileKey, viewUrl, downloadUrl } = labBillList.value[0];
+      postData = {
+        fileKey,
+        viewUrl,
+        downloadUrl,
+      };
+    } else {
+      let { fileKey, viewUrl, downloadUrl } =
+        labBillList.value[0].response.result;
+      postData = {
+        fileKey,
+        viewUrl,
+        downloadUrl,
+      };
+    }
+  } else {
+    postData = {
+      fileKey: "",
+      viewUrl: "",
+      downloadUrl: "",
+    };
+  }
+  if (currentLabId.value != -1) {
+    postData.recordId = currentLabId.value;
+    delete labForm.value.file;
+    delete labForm.value.fileId;
+  }
+  let res = await api[
+    `${labModalType.value == "新增记录" ? "addLab" : "updateTruckLoadRecord"}`
+  ]({
+    voyageId: route.query.id,
+    ...postData,
+    ...labForm.value,
+  });
+  cancelUploadLab();
+  getLabList();
+}
+function showAddLab() {
+  isAddLabVisable.value = true;
+  labModalType.value = "新增记录";
+}
+
+async function getLabList() {
+  let res = await api.getLabList({
+    voyageId: route.query.id,
+    currentPage: labCurrentPage.value,
+    size: 10,
+  });
+  labTableData.value = res.data.result;
+  labTotal.value = res.data.total;
+}
+function labPageChange(e) {
+  labCurrentPage.value = e;
+  getLabList();
+}
+
+let labModalType = ref("");
+function showLab(item, index, text) {
+  isAddLabVisable.value = true;
+  currentLabId.value = item.id;
+  labModalType.value = text;
+  if (item.file) {
+    labBillList.value[0] = {
+      ...item.file,
+      url: item.file.viewUrl,
+    };
+  }
+
+  labForm.value = { ...item };
+}
+async function deleteLab(id, index) {
+  console.log(id);
+  ElMessageBox.confirm("确认删除装货记录?", "Warning", {
+    confirmButtonText: "删除",
+    cancelButtonText: "取消",
+    type: "warning",
+  })
+    .then(async () => {
+      let res = await api.deleteLab({
+        id,
+      });
+      if (res.data.status == 0) {
+        ElMessage({
+          message: "删除成功!",
+          type: "success",
+        });
+      }
+      getLabList();
+    })
+    .catch(() => {
+      ElMessage({
+        type: "info",
+        message: "取消删除",
+      });
+    });
+}
+
+let weatherTableData = ref([]);
+let weatherCurrentPage = ref(1);
+let weatherTotal = ref(0);
+async function getPortWeatherList() {
+  let res = await api.getPortWeatherList({
+    voyageId: route.query.id,
+    size: 10,
+    currentPage: weatherCurrentPage.value,
+  });
+  weatherTableData.value = res.data.result;
+  for (let i of weatherTableData.value) {
+    i.reporttime = i.reporttime.substring(0, 10);
+  }
+  weatherTotal.value = res.data.total;
+}
+
+function weatherPageChange(e) {
+  weatherCurrentPage.value = e;
+  getPortWeatherList();
+}
+
 onMounted(() => {
   getVoyageDetail();
   getDischargeList();
   getTruckLoadRecord();
+  getLabList();
+  getPortWeatherList();
 });
 </script>
 <style scoped>