Просмотр исходного кода

更新 智能交易中心数据获取

wzh 4 лет назад
Родитель
Сommit
337756fba4
2 измененных файлов с 15 добавлено и 10 удалено
  1. 13 9
      src/store/index.js
  2. 2 1
      src/views/transportationSafetyCenter.vue

+ 13 - 9
src/store/index.js

@@ -95,14 +95,6 @@ const store = createStore({
     changeTab(state, text) {
       state.currentTabText = text;
     },
-    setCargoOwner(state, info) {
-      console.log(info);
-      return;
-      state.cargoOwnerInfo = info;
-    },
-    setShipInfo(state, info) {
-      state.shipInfo = info;
-    },
     setNumbers(state, numbers) {
       state.numbers = numbers;
     },
@@ -127,6 +119,14 @@ const store = createStore({
       state.shipInfo.data[2].text = shipDetail.shipBreadth;
       state.capacity = capacityDetail;
     },
+    setTradeShipDetail(state, data) {
+      state.shipInfo.shipName = data.shipName;
+      state.shipInfo.shipOwnerName = data.shipownerName;
+      state.shipInfo.shipOwnerId = data.shipownerIdcard;
+      state.shipInfo.data[0].text = data.shipMmsi;
+      state.shipInfo.data[1].text = data.shipLength;
+      state.shipInfo.data[2].text = data.shipBreadth;
+    },
   },
   actions: {
     Login({ commit }, userInfo) {
@@ -152,7 +152,6 @@ const store = createStore({
       let t = state.currentTabText == "运输安全管理中心";
       if (t) {
         api.getShipStatusCount().then((e) => {
-          console.log(e);
           let { result } = e.data;
           state.numbers = [
             {
@@ -187,6 +186,11 @@ const store = createStore({
         commit("setManageShipDetail", e.data.result);
       });
     },
+    GetTradeShipDetail({ commit }, shipId) {
+      api.getTradeShipDetail({ shipId }).then((e) => {
+        commit("setTradeShipDetail", e.data.result);
+      });
+    },
   },
 });
 

+ 2 - 1
src/views/transportationSafetyCenter.vue

@@ -72,13 +72,14 @@ export default {
         store.dispatch("GetManageShipDetail", item.key);
       }
       if (store.state.currentTabText == "智能交易中心") {
-        getTradeShipDetail(item.key);
+        store.dispatch("GetTradeShipDetail", item.key);
       }
     }
 
     onMounted(() => {
       // initMap();
       // store.dispatch("GetManageShipDetail", 51710);
+      // store.dispatch("GetTradeShipDetail", 51710);
       store.dispatch("GetNumbers");
     });
     return {