Ver Fonte

更新 基础数据/数据提交

wzh há 4 anos atrás
pai
commit
ea4baae78b
1 ficheiros alterados com 43 adições e 21 exclusões
  1. 43 21
      src/store/index.js

+ 43 - 21
src/store/index.js

@@ -1,58 +1,57 @@
 import { createStore } from "vuex";
 import api from "apis/fetch.js";
+import _ from "lodash";
 
 const store = createStore({
   state: {
     isLogin: false,
     currentTabText: "运输安全管理中心",
     cargoOwnerInfo: {
-      cargoOwnerName: "货主王",
-      cargo: "石油焦",
-      tons: "30000",
-      shipRoute: "秦皇岛-上海",
+      cargoOwnerName: "",
       contractId: 1,
       data: [
         {
           title: "货种",
-          text: "煤炭",
+          text: "",
           icon: "cargo",
         },
         {
           title: "吨位",
-          text: "30",
+          text: "",
           unit: "吨",
           icon: "ship",
         },
         {
           title: "航线",
-          text: "秦皇岛-上海",
+          text: "",
           icon: "hangxian",
         },
       ],
     },
     shipInfo: {
-      shipOwnerName: "船东王",
-      shipOwnerId: "898980000000000909",
-      shipName: "航海家998",
+      shipOwnerName: "",
+      shipOwnerId: "",
+      shipName: "",
       icon: "china",
-      mmsi: "410999888",
-      length: 100,
-      width: 30,
+      mmsi: "",
+      length: 0,
+      width: 0,
+      imgs: [],
       data: [
         {
           title: "MMSI",
-          text: "410998998",
+          text: "",
           icon: "ship-fill",
         },
         {
           title: "船长",
-          text: "30",
+          text: "",
           unit: "米",
           icon: "ship-length",
         },
         {
           title: "船宽",
-          text: "18",
+          text: "",
           unit: "米",
           icon: "ship-width",
         },
@@ -81,11 +80,11 @@ const store = createStore({
       ],
     },
     capacity: {
-      status: 0,
-      shipOwner: "王船东",
-      company: "船王公司",
-      cargoOwner: "货主王",
-      cargoStatus: 0,
+      id: 1,
+      shipownerName: "",
+      shipownerCompany: "",
+      cargoowner: "",
+      shipStatus: 0,
     },
     numbers: [],
   },
@@ -97,6 +96,8 @@ const store = createStore({
       state.currentTabText = text;
     },
     setCargoOwner(state, info) {
+      console.log(info);
+      return;
       state.cargoOwnerInfo = info;
     },
     setShipInfo(state, info) {
@@ -110,6 +111,22 @@ const store = createStore({
       state.damInfo.data[1].text = nums.waitingShipNum;
       state.damInfo.data[2].text = nums.estimatedWaitingTime;
     },
+    setManageShipDetail(state, data) {
+      let { cargoownerDetail, capacityDetail, shipDetail } = data;
+      state.cargoOwnerInfo.cargoOwnerName = cargoownerDetail.cargoowner;
+      state.cargoOwnerInfo.data[0].text = cargoownerDetail.cargo;
+      state.cargoOwnerInfo.data[1].text = cargoownerDetail.tons;
+      state.cargoOwnerInfo.data[2].text =
+        cargoownerDetail.loadPort + " - " + cargoownerDetail.dischargePort;
+      state.shipInfo.shipName = shipDetail.shipName;
+      state.shipInfo.imgs = shipDetail.exhibitImgs;
+      state.shipInfo.shipOwnerName = shipDetail.shipownerName;
+      state.shipInfo.shipOwnerId = shipDetail.shipownerIdcard;
+      state.shipInfo.data[0].text = shipDetail.shipMmsi;
+      state.shipInfo.data[1].text = shipDetail.shipLength;
+      state.shipInfo.data[2].text = shipDetail.shipBreadth;
+      state.capacity = capacityDetail;
+    },
   },
   actions: {
     Login({ commit }, userInfo) {
@@ -145,6 +162,11 @@ const store = createStore({
         resolve(type ? arr1 : arr2);
       });
     },
+    GetManageShipDetail({ commit }, shipId) {
+      api.getManageShipDetail({ shipId }).then((e) => {
+        commit("setManageShipDetail", e.data.result);
+      });
+    },
   },
 });