wzg 2 rokov pred
rodič
commit
d78ce0fbf3
8 zmenil súbory, kde vykonal 137 pridanie a 138 odobranie
  1. 1 1
      .env.dev
  2. 1 1
      .env.release
  3. 4 23
      src/App.vue
  4. 1 1
      src/apis/config.js
  5. 6 6
      src/apis/fetch.js
  6. 40 37
      src/main.js
  7. 83 68
      src/views/voyage/voyageDetail.vue
  8. 1 1
      vite.config.js

+ 1 - 1
.env.dev

@@ -1,2 +1,2 @@
 VITE_PROJECT_ENV = 'dev'
-VITE_BASEURL = 'https://interface.huihenduo.com.cn/hhd-cargo-dev/'
+VITE_BASEURL = 'https://interface.huihenduo.com.cn/hhd-api/'

+ 1 - 1
.env.release

@@ -1,2 +1,2 @@
 VITE_PROJECT_ENV = 'release'
-VITE_BASEURL = 'https://interface.huihenduo.cc/hhd-cargo/'
+VITE_BASEURL = 'https://interface.huihenduo.cc/hhd-api/'

+ 4 - 23
src/App.vue

@@ -1,29 +1,10 @@
 <template>
-  <div v-if="store.state.isLogin" class="main-container">
-    <HeaderVue class="header"></HeaderVue>
-    <div class="main-app">
-      <div class="aside"><AsideVue></AsideVue></div>
-      <div class="section">
-        <div class="first-title" v-if="store.state.firstTitle != '主页'">
-          {{ store.state.firstTitle }}
-        </div>
-        <div
-          class="main-section"
-          :style="{
-            margin: store.state.firstTitle == '主页' ? 0 : '24px 0 0 24px',
-            height:
-              store.state.firstTitle == '主页'
-                ? 'calc(100vh - 60px)'
-                : 'calc(100vh - 136px)',
-          }"
-        >
-          <router-view></router-view>
-        </div>
-      </div>
+  <div style="overflow-y: auto; height: 100vh; padding: 20px 30px">
+    <div v-if="store.state.isLogin" class="main-container">
+      <router-view></router-view>
     </div>
-    <!-- <FooterVue></FooterVue> -->
+    <router-view v-else></router-view>
   </div>
-  <router-view v-else></router-view>
 </template>
 
 <script>

+ 1 - 1
src/apis/config.js

@@ -18,7 +18,7 @@ export const $http = function (url, data) {
     url: baseurl + url,
     data: {
       ...data,
-      loginAccountId: localStorage.loginAccountId,
+      token: localStorage.token,
     },
     withCredentials: true,
   });

+ 6 - 6
src/apis/fetch.js

@@ -11,7 +11,7 @@ export default {
 
   // 获取航次详情
   getVoyageDetail(data) {
-    return $http("/voyage/wx/detail", data);
+    return $http("/voyage/detail", data);
   },
 
   // 更新航次
@@ -40,12 +40,12 @@ export default {
 
   // 获取卸货列表
   getDischargeList(data) {
-    return $http("/voyage/getDischargeList", data);
+    return $http("/voyage/detail/dischargeList", data);
   },
 
   // 获取汽车装货记录
   getTruckLoadRecord(data) {
-    return $http("/voyage/getCarLoadRecordList", data);
+    return $http("/voyage/detail/carLoadRecordList", data);
   },
 
   // 添加职位
@@ -134,12 +134,12 @@ export default {
   },
   // 获取提货单列表
   getLabList(data) {
-    return $http("/voyage/getLabList", data);
+    return $http("/voyage/detail/labList", data);
   },
 
   // 获取港口天气列表
   getPortWeatherList(data) {
-    return $http("/voyage/getPortWeatherList", data);
+    return $http("/voyage/detail/port/weatherList", data);
   },
 
   // 获取超期航次提醒
@@ -238,6 +238,6 @@ export default {
 
   // 获取出险记录列表
   getAccidentList(data) {
-    return $http("/voyage/getAccidentList", data);
+    return $http("/voyage/detail/accidentList", data);
   },
 };

+ 40 - 37
src/main.js

@@ -19,42 +19,45 @@ app.component("RemoteSelect", RemoteSelect);
 app.component("Certs", Certs);
 app.component("Uploader", Uploader);
 
-let userId = localStorage.userId;
-if (userId) {
-  store.dispatch("GetBasePermissionData", localStorage.loginAccountId);
-  store.dispatch("GetUserPermission", localStorage.loginAccountId);
-}
+// let userId = localStorage.userId;
+// if (userId) {
+//   store.dispatch("GetBasePermissionData", localStorage.loginAccountId);
+//   store.dispatch("GetUserPermission", localStorage.loginAccountId);
+// }
 
 router.beforeEach(async (to, from, next) => {
-  if (localStorage.userId) {
+  let { token } = to.query;
+  localStorage.setItem("token", token);
+  if (token) {
     store.commit("changeLogin", true);
-    let rolePermission = localStorage.rolePermission?.split(",") || [];
-    if (store.state.menuData.length) {
-      let path = store.state?.menuData[0]?.items[0].path;
-      if (0 === to.matched.length) {
-        next("/index");
-      } else if (to.path == "/login") {
-        next("/index");
-      } else if (rolePermission?.indexOf(to.meta.code) == -1) {
-        if (to.path == "/index") {
-          next();
-        } else {
-          next("/index");
-        }
-      } else {
-        if (to.path == "/") {
-          next("/index");
-        } else {
-          next();
-        }
-      }
-    } else {
-      if (to.path == "/" || to.path == "/login") {
-        next("/index");
-      } else {
-        next();
-      }
-    }
+    next();
+    // let rolePermission = localStorage.rolePermission?.split(",") || [];
+    // if (store.state.menuData.length) {
+    //   let path = store.state?.menuData[0]?.items[0].path;
+    //   if (0 === to.matched.length) {
+    //     next("/index");
+    //   } else if (to.path == "/login") {
+    //     next("/index");
+    //   } else if (rolePermission?.indexOf(to.meta.code) == -1) {
+    //     if (to.path == "/index") {
+    //       next();
+    //     } else {
+    //       next("/index");
+    //     }
+    //   } else {
+    //     if (to.path == "/") {
+    //       next("/index");
+    //     } else {
+    //       next();
+    //     }
+    //   }
+    // } else {
+    //   if (to.path == "/" || to.path == "/login") {
+    //     next("/index");
+    //   } else {
+    //     next();
+    //   }
+    // }
   } else {
     store.commit("changeLogin", false);
     if (to.path == "/login") {
@@ -73,10 +76,10 @@ router.afterEach((to, from) => {
 
 app.directive("auth", {
   mounted(el, bind) {
-    let permissions = localStorage.rolePermission?.split(",") || [];
-    if (permissions.indexOf(bind.value) == -1) {
-      el.parentNode.removeChild(el);
-    }
+    // let permissions = localStorage.rolePermission?.split(",") || [];
+    // if (permissions.indexOf(bind.value) == -1) {
+    //   el.parentNode.removeChild(el);
+    // }
   },
 });
 

+ 83 - 68
src/views/voyage/voyageDetail.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="line-container-p24">
+  <!-- <div class="line-container-p24">
     <i class="el-icon-arrow-left"></i>
     <div
       class="dib go-back ml8 pointer"
@@ -7,7 +7,7 @@
     >
       返回航次列表
     </div>
-  </div>
+  </div> -->
 
   <div class="container-title df aic jcsb">
     <div class="df aic">
@@ -462,6 +462,7 @@
           background
           layout="prev, pager, next"
           :total="weatherTotal"
+          :current-page="weatherCurrentPage"
           @current-change="weatherPageChange"
         ></el-pagination>
       </div>
@@ -728,6 +729,7 @@
           background
           layout="prev, pager, next"
           :total="truckTotal"
+          :current-page="truckCurrentPage"
           @current-change="truckPageChange"
         ></el-pagination>
       </div>
@@ -1203,10 +1205,10 @@ import url from "../../apis/config";
 import { subTimeStr } from "utils/utils";
 
 const route = useRoute();
-let map = ref();
+let map = ref({});
 let voyage = ref({});
 let medias = ref([]);
-let coordinates = ref();
+let coordinates = ref([]);
 let previewSrcList = ref([]);
 let policyList = ref([]);
 let previewPoundList = ref([]);
@@ -1226,31 +1228,29 @@ async function getVoyageDetail(isInit) {
   voyageBill.value = [];
   previewSrcList.value = [];
   let res = await api.getVoyageDetail({
-    type: localStorage.userType,
-    voyageId: route.query.id,
-    loginAccountId: localStorage.loginAccountId,
+    hhdVoyageCode: route.query.voyageCode,
   });
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
-    blockchainInfo.value = res.data.result.blockChain;
-    coordinates.value = res.data.result.coordinates;
-    voyage.value = res.data.result.voyage;
+    blockchainInfo.value = res.data.data.blockChain;
+    coordinates.value = res.data.data.coordinates;
+    voyage.value = res.data.data.voyage;
     voyage.value.startTime = voyage.value.startTime.substring(0, 16);
     currentPortId.value = voyage.value.voyageDetails[0].portId + "";
     currentDiscPortId.value = voyage.value.voyageDetails[0].portId + "";
-    medias.value = res.data.result.medias;
-    shipAudits.value = res.data.result.shipAudits;
+    medias.value = res.data.data.medias;
+    shipAudits.value = res.data.data.shipAudits;
 
-    for (let i of res.data.result.policys || []) {
+    for (let i of res.data.data.policys || []) {
       policyList.value.push({
         ...i,
         url: i.viewUrl,
       });
     }
-    for (let i of res.data.result.waybills) {
+    for (let i of res.data.data.waybills) {
       voyageBill.value.push({
         ...i,
         url: i.viewUrl,
@@ -1273,7 +1273,7 @@ async function getVoyageDetail(isInit) {
     console.log(res);
     ElNotification({
       type: "error",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   }
 }
@@ -1287,9 +1287,9 @@ async function addDischarge() {
     return;
   let res = await api.addDischarge({
     ...formInline.value,
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
   });
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     getDischargeList(1);
     formInline.value = {};
   } else {
@@ -1300,37 +1300,39 @@ async function deleteDischarge(id, index) {
   let res = await api.deleteDischarge({
     id,
   });
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     dischargeList.value.splice(index, 1);
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   } else {
     console.log(res);
     ElNotification({
       type: "error",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   }
 }
 async function exportExcel() {}
 let dischargeCurrentPage = ref(1);
-let dischargeList = ref();
+let dischargeList = ref([]);
 let formInline = ref({});
 async function getDischargeList(type) {
   let res = await api.getDischargeList({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     portId: currentDiscPortId.value,
     currentPage: dischargeCurrentPage.value,
     size: 10,
     loginAccountId: localStorage.loginAccountId,
   });
-  if (res.data.status == 0) {
-    dischargeList.value = res.data.result;
+  console.log(res);
+  if (res.data.errcode == 0) {
+    dischargeList.value = res.data.data.data;
     total.value = res.data.total;
   } else {
-    console.log(res);
+    dischargeList.value = [];
+    total.value = 0;
   }
 }
 let updateForm = ref({});
@@ -1341,18 +1343,18 @@ async function updateDischarge() {
     ...updateForm.value,
   });
 
-  if (res.data.status == 0) {
-    dischargeList.value[currentUpdateIndex.value] = res.data.result;
+  if (res.data.errcode == 0) {
+    dischargeList.value[currentUpdateIndex.value] = res.data.data.data;
     cancelUpdateDischarge();
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   } else {
     console.log(res);
     ElNotification({
       type: "error",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   }
 }
@@ -1475,16 +1477,16 @@ async function submitVoyageChange() {
     actualDischargeTons,
     remark,
   });
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
     disabledStatus.value = true;
   } else {
     ElNotification({
       type: "error",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
     console.log(res);
   }
@@ -1516,29 +1518,28 @@ let options = ref([
 async function finishVoyage() {
   if (!voyage.value.dischargeEndTime) return;
   let res = await api.finishVoyage({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
   });
 
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     voyage.value.voyageStatus = 2;
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   } else {
     ElNotification({
       type: "error",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   }
 }
 let currentUrl = ref("");
 let mediaModal = ref(false);
 let modalType = ref(1);
-let modalTitle = ref();
+let modalTitle = ref("");
 let modalPreview = ref([]);
 function openMediaModal(url, type, title) {
-  console.log(url, type, title);
   modalPreview.value = [url];
   modalTitle.value = title;
   modalType.value = type;
@@ -1547,22 +1548,21 @@ function openMediaModal(url, type, title) {
 }
 
 async function auditMedia(mediaId, a, index, mediaType) {
-  console.log(mediaId, a, index, mediaType);
   let res = await api.auditMedia({
     mediaId,
     audit: a,
   });
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     medias.value[index].audit = a;
     ElNotification({
       type: "success",
-      title: res.data.msg,
+      title: res.data.errmsg,
     });
   } else {
     console.log(res);
   }
 }
-let dialogImageUrl = ref();
+let dialogImageUrl = ref("");
 let dialogVisible = ref(false);
 function handlePictureCardPreview(file) {
   dialogVisible.value = true;
@@ -1582,7 +1582,7 @@ async function handleRemoveBill(file, list) {
       let res = await api.deleteWaybill({
         id,
       });
-      if (res.data.status == 0) {
+      if (res.data.errcode == 0) {
         ElMessage({
           message: "删除成功!",
           type: "success",
@@ -1610,16 +1610,16 @@ function billUploadSuccess(response, file, list) {
 }
 
 let billParams = ref({
-  voyageId: route.query.id,
+  voyageId: voyage.value.id,
 });
 
 async function calExpectedArrivalTime() {
   let res = await api.calExpectedArrivalTime({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     setSailTime: voyage.value.setSailTime,
   });
-  if (res.data.status == 0) {
-    voyage.value.expectedArrivalTime = res.data.result;
+  if (res.data.errcode == 0) {
+    voyage.value.expectedArrivalTime = res.data.data.data;
   }
 }
 let isLoadingExcel = ref(false);
@@ -1627,7 +1627,7 @@ async function downloadExcel() {
   isLoadingExcel.value = true;
   let res = await downloadBlobFile(
     `${url.baseurl}/voyage/exportExcel`,
-    { voyageId: route.query.id },
+    { voyageId: voyage.value.id },
     `${voyage.value.voyageName}-船舶跟踪表`,
     "post",
     "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
@@ -1641,7 +1641,7 @@ async function exportDischargeExcel() {
   isDischargeLoadingExcel.value = true;
   let res = await downloadBlobFile(
     `${url.baseurl}/voyage/exportDischargeExcel`,
-    { voyageId: route.query.id },
+    { voyageId: voyage.value.id },
     `${voyage.value.voyageName}-卸货记录表`,
     "post",
     "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
@@ -1659,14 +1659,19 @@ let truckCurrentPage = ref(1);
 let truckTotal = ref(0);
 async function getTruckLoadRecord() {
   let res = await api.getTruckLoadRecord({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     portId: currentDiscPortId.value,
     currentPage: truckCurrentPage.value,
     size: 10,
     loginAccountId: localStorage.loginAccountId,
   });
-  truckTableData.value = res.data.result;
-  truckTotal.value = res.data.total;
+  if (res.data.errcode == 0) {
+    truckTableData.value = res.data.data.data;
+    truckTotal.value = res.data.total;
+  } else {
+    truckTableData.value = [];
+    truckTotal.value = 0;
+  }
 }
 function truckPageChange(e) {
   truckCurrentPage.value = e;
@@ -1696,7 +1701,7 @@ async function downloadBillZip() {
   billZipLoading.value = true;
   let res = await downloadBlobFile(
     `${url.baseurl}/voyage/exportBillZip`,
-    { voyageId: route.query.id },
+    { voyageId: voyage.value.id },
     `${voyage.value.voyageName}-单据文件`,
     "post",
     "application/zip"
@@ -1710,13 +1715,18 @@ let weatherCurrentPage = ref(1);
 let weatherTotal = ref(0);
 async function getPortWeatherList() {
   let res = await api.getPortWeatherList({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     portId: currentDiscPortId.value,
     size: 10,
     currentPage: weatherCurrentPage.value,
   });
-  weatherTableData.value = res.data.result;
-  weatherTotal.value = res.data.total;
+  if (res.data.errcode == 0) {
+    weatherTableData.value = res.data.data.data;
+    weatherTotal.value = res.data.total;
+  } else {
+    weatherTableData.value = [];
+    weatherTotal.value = 0;
+  }
 }
 
 function weatherPageChange(e) {
@@ -1730,14 +1740,19 @@ let labCurrentPage = ref(1);
 
 async function getLabList() {
   let res = await api.getLabList({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     portId: currentDiscPortId.value,
     currentPage: labCurrentPage.value,
     size: 10,
     loginAccountId: localStorage.loginAccountId,
   });
-  labTableData.value = res.data.result;
-  labTotal.value = res.data.total;
+  if (res.data.errcode == 0) {
+    labTableData.value = res.data.data.data;
+    labTotal.value = res.data.total;
+  } else {
+    labTableData.value = [];
+    labTotal.value = 0;
+  }
 }
 function labPageChange(e) {
   labCurrentPage.value = e;
@@ -1790,18 +1805,18 @@ let accidentForm = ref({
   files: [],
 });
 let accidentParams = ref({
-  voyageId: route.query.id,
+  voyageId: voyage.value.id,
 });
 let accidentCurrentPage = ref(1);
 let accidentTotal = ref(0);
 async function getAccidentList() {
   let res = await api.getAccidentList({
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     currentPage: accidentCurrentPage.value,
     size: 10,
   });
-  if (res.data.status == 0) {
-    accidentList.value = res.data.result;
+  if (res.data.errcode == 0) {
+    accidentList.value = res.data.data.data;
     accidentTotal.value = res.data.total;
   } else {
     accidentList.value = [];
@@ -1819,7 +1834,7 @@ async function addUpdateAccident() {
   }
   let postData = {
     loginAccountId: localStorage.loginAccountId,
-    voyageId: route.query.id,
+    voyageId: voyage.value.id,
     accidentTime,
     remark,
     voyageFileIds: arr.join(","),
@@ -1827,7 +1842,7 @@ async function addUpdateAccident() {
   };
   // console.log("postData", postData);
   let res = await api[id ? "updateAccident" : "addAccident"](postData);
-  if (res.data.status == 0) {
+  if (res.data.errcode == 0) {
     resetAccidentForm();
     isAccidentVisable.value = false;
   }
@@ -1878,7 +1893,7 @@ function deleteAccident(id) {
       let res = await api.deleteAccident({
         id,
       });
-      if (res.data.status == 0) {
+      if (res.data.errcode == 0) {
         ElMessage({
           type: "success",
           message: "删除成功!",

+ 1 - 1
vite.config.js

@@ -18,6 +18,6 @@ export default defineConfig({
     },
   },
   server: {
-    port: 8888,
+    port: 2888,
   },
 });