Selaa lähdekoodia

更新 接口参数

wzg 2 vuotta sitten
vanhempi
commit
ede5b520d4

+ 1 - 0
src/apis/config.js

@@ -19,6 +19,7 @@ export const $http = async function (url, data) {
     data: {
       ...data,
       loginAccountId: store.state.loginAccountId,
+      choiceCompanyId: store.state.currentCompany.key,
     },
     withCredentials: true,
   });

+ 0 - 2
src/layout/Header.vue

@@ -208,8 +208,6 @@ async function getAbledVersions() {
 const size = 20;
 
 function selectCompany(e) {
-  localStorage.loginAccountId = e.key;
-  store.state.loginAccountId = e.key;
   localStorage.currentCompany = JSON.stringify(e);
   router.go(0);
 }

+ 3 - 6
src/store/index.js

@@ -21,6 +21,7 @@ const store = createStore({
     versions: [],
     keepAliveList: ["shipList", "shipOwnerList"],
     loginAccountId: localStorage.loginAccountId,
+    shippingId: localStorage.shippingId,
     companySelect: [],
     isSuperuser: localStorage.isSuperuser,
     currentCompany: JSON.parse(localStorage.currentCompany || "{}"),
@@ -57,18 +58,14 @@ const store = createStore({
     },
     login(state, data) {
       Object.keys(data).forEach((key) => {
-        if (data.isSuperuser == 1 && key == "loginAccountId") {
-        } else {
-          localStorage.setItem(key, data[key]);
-        }
+        localStorage.setItem(key, data[key]);
       });
       if (data.isSuperuser == 1) {
         state.manageId = data.loginAccountId;
         localStorage.manageId = data.loginAccountId;
         state.isSuperuser = 1;
-      } else {
-        state.loginAccountId = data.loginAccountId;
       }
+      state.loginAccountId = data.loginAccountId;
       state.isLogin = true;
 
       router.replace({ path: "/index" });

+ 3 - 1
src/views/index/Index.vue

@@ -71,6 +71,7 @@
                 path: '/shipManage/shipDetail',
                 query: {
                   shipCode: ship.code,
+                  shippingId: ship.shippingId,
                 },
               })
             "
@@ -184,7 +185,7 @@ const map = ref({});
 function initMap() {
   map.value = new AMap.Map("map-container", {
     zoom: 9, //级别
-    zooms: [4, 9],
+    zooms: [4, 10],
     center: [indexData.value.lng, indexData.value.lat], //中心点坐标
     mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
     zoomEnable: true,
@@ -267,6 +268,7 @@ async function getIndexShipDetail(shipItem) {
   map.value.remove(polyline.value);
   let { data } = await api.getIndexShipDetail({
     shipCode: shipItem.code,
+    shippingId: shipItem.shippingId,
   });
   if (data.status == 0) {
     ship.value = { ...data.result, ...shipItem };

+ 1 - 3
src/views/index/Login.vue

@@ -121,7 +121,6 @@ async function login() {
           message: data.msg,
           type: "success",
         });
-
         if (data.result.isSuperuser == 1) {
           cache.value = data.result;
           await store.dispatch(
@@ -147,9 +146,8 @@ async function login() {
 }
 
 function selectCompany(e) {
-  localStorage.loginAccountId = e.key;
+  console.log(e);
   localStorage.currentCompany = JSON.stringify(e);
-  store.state.loginAccountId = e.key;
   store.state.currentCompany = e;
   store.commit("login", cache.value);
 }

+ 4 - 1
src/views/shipManage/shipDetail.vue

@@ -82,7 +82,10 @@ let shipCoors = ref([]);
 let shipCoorsPolyline = ref([]);
 let mediaCoorsPolyline = ref([]);
 async function getShipDetail(shipCode) {
-  let { data } = await api.getShipDetail({ shipCode });
+  let { data } = await api.getShipDetail({
+    shipCode,
+    shippingId: route.query.shippingId,
+  });
   for (const i of data.result.shipCerts) {
     i.date = [i.startValidTime, i.endValidTime];
     for (let j of i.certs) {

+ 3 - 2
src/views/shipManage/shipList.vue

@@ -118,7 +118,7 @@
               删除
             </el-button>
             <el-button
-              @click="shipDetail(scope.row.code)"
+              @click="shipDetail(scope.row)"
               type="primary"
               text
               size="small"
@@ -169,12 +169,13 @@ async function getShipList(page) {
   }
 }
 
-async function shipDetail(shipCode) {
+async function shipDetail({ code: shipCode, shippingId }) {
   store.commit("addAlive", "shipList");
   router.push({
     path: "/shipManage/shipDetail",
     query: {
       shipCode,
+      shippingId,
     },
   });
 }

+ 1 - 0
src/views/shipOwnerManage/shipOwnerDetail.vue

@@ -236,6 +236,7 @@ let shipCertsRef = ref(null);
 async function getShipOwnerDetail(shipOwnerId) {
   let { data } = await api.getShipOwnerDetail({
     shipOwnerId,
+    shippingId: route.query.shippingId,
   });
   data.result.shipOwnerId = data.result.id;
   shipOwnerDetail.value = data.result;

+ 3 - 2
src/views/shipOwnerManage/shipOwnerList.vue

@@ -94,7 +94,7 @@
         <el-table-column label="操作" min-width="80" align="center">
           <template v-slot="scope">
             <el-button
-              @click="shipOwnerDetail(scope.row.id)"
+              @click="shipOwnerDetail(scope.row)"
               type="primary"
               text
               size="small"
@@ -198,12 +198,13 @@ async function getShipOwnerList(page) {
   }
 }
 
-async function shipOwnerDetail(shipOwnerId) {
+async function shipOwnerDetail({ id: shipOwnerId, shippingId }) {
   store.commit("addAlive", "shipOwnerList");
   router.push({
     path: "/shipOwnerManage/shipOwnerDetail",
     query: {
       shipOwnerId,
+      shippingId,
     },
   });
 }