Kaynağa Gözat

更新 voyageForm字段

wzh 3 yıl önce
ebeveyn
işleme
189e79facc
1 değiştirilmiş dosya ile 40 ekleme ve 41 silme
  1. 40 41
      src/views/voyage/voyageList.vue

+ 40 - 41
src/views/voyage/voyageList.vue

@@ -460,22 +460,22 @@ function clear(type) {
       case "shipId": {
         let index = ref(-1);
         for (let i in shipsCache.value) {
-          if (voyageForm.voyageForm.shipName == shipsCache.value[i].shipName) {
+          if (voyageForm.value.shipName == shipsCache.value[i].shipName) {
             index.value = i;
             break;
           }
         }
         if (index.value != -1) {
-          voyageForm.voyageForm.shipId = shipsCache.value[index.value].shipId;
+          voyageForm.value.shipId = shipsCache.value[index.value].shipId;
         } else {
           let b = shipsCache.value.some((item) => {
             return (
-              item.shipId == voyageForm.voyageForm.shipId &&
-              item.shipName == voyageForm.voyageForm.shipName
+              item.shipId == voyageForm.value.shipId &&
+              item.shipName == voyageForm.value.shipName
             );
           });
-          voyageForm.voyageForm["shipId"] = "";
-          voyageForm.voyageForm["shipName"] = "";
+          voyageForm.value["shipId"] = "";
+          voyageForm.value["shipName"] = "";
         }
         break;
       }
@@ -483,7 +483,7 @@ function clear(type) {
         let index = ref(-1);
         for (let i in cargoOwnersCache.value) {
           if (
-            voyageForm.voyageForm.cargoOwnerName ==
+            voyageForm.value.cargoOwnerName ==
             cargoOwnersCache.value[i].userName
           ) {
             index.value = i;
@@ -491,18 +491,18 @@ function clear(type) {
           }
         }
         if (index.value != -1) {
-          voyageForm.voyageForm.cargoOwnerId =
+          voyageForm.value.cargoOwnerId =
             cargoOwnersCache.value[index.value].userId;
         } else {
           let b = cargoOwnersCache.value.some((item) => {
             return (
-              item.userId == voyageForm.voyageForm.cargoOwnerId &&
-              item.userName == voyageForm.voyageForm.cargoOwnerName
+              item.userId == voyageForm.value.cargoOwnerId &&
+              item.userName == voyageForm.value.cargoOwnerName
             );
           });
           if (!b) {
-            voyageForm.voyageForm["cargoOwnerId"] = "";
-            voyageForm.voyageForm["cargoOwnerName"] = "";
+            voyageForm.value["cargoOwnerId"] = "";
+            voyageForm.value["cargoOwnerName"] = "";
           }
         }
 
@@ -511,23 +511,23 @@ function clear(type) {
       case "loadPort": {
         let index = ref(-1);
         for (let i in colCache.value) {
-          if (voyageForm.voyageForm.loadPort == colCache.value[i].value) {
+          if (voyageForm.value.loadPort == colCache.value[i].value) {
             index.value = i;
             break;
           }
         }
         if (index.value != -1) {
-          voyageForm.voyageForm.loadPortId = colCache.value[index.value].key;
+          voyageForm.value.loadPortId = colCache.value[index.value].key;
         } else {
           let b = colCache.value.some((item) => {
             return (
-              item.value == voyageForm.voyageForm.loadPort &&
-              item.key == voyageForm.voyageForm.loadPortId
+              item.value == voyageForm.value.loadPort &&
+              item.key == voyageForm.value.loadPortId
             );
           });
           if (!b) {
-            voyageForm.voyageForm["loadPort"] = "";
-            voyageForm.voyageForm["loadPortId"] = "";
+            voyageForm.value["loadPort"] = "";
+            voyageForm.value["loadPortId"] = "";
           }
         }
 
@@ -537,24 +537,23 @@ function clear(type) {
       case "dischargeProt": {
         let index = ref(-1);
         for (let i in colCache.value) {
-          if (voyageForm.voyageForm.dischargeProt == colCache.value[i].value) {
+          if (voyageForm.value.dischargeProt == colCache.value[i].value) {
             index.value = i;
             break;
           }
         }
         if (index.value != -1) {
-          voyageForm.voyageForm.dischargeProtId =
-            colCache.value[index.value].key;
+          voyageForm.value.dischargeProtId = colCache.value[index.value].key;
         } else {
           let b = colCache.value.some((item) => {
             return (
-              item.value == voyageForm.voyageForm.dischargeProt &&
-              item.key == voyageForm.voyageForm.dischargeProtId
+              item.value == voyageForm.value.dischargeProt &&
+              item.key == voyageForm.value.dischargeProtId
             );
           });
           if (!b) {
-            voyageForm.voyageForm["dischargeProt"] = "";
-            voyageForm.voyageForm["dischargeProtId"] = "";
+            voyageForm.value["dischargeProt"] = "";
+            voyageForm.value["dischargeProtId"] = "";
           }
         }
         break;
@@ -567,9 +566,9 @@ let addVoyageForm = ref(null);
 async function addVoyage() {
   addVoyageForm.value.validate(async (valid) => {
     if (valid) {
-      console.log("提交", voyageForm.voyageForm);
+      console.log("提交", voyageForm.value);
       let res = await api.addVoyage({
-        ...voyageForm.voyageForm,
+        ...voyageForm.value,
       });
       if (res.data.status == 0) {
         ElNotification({
@@ -586,7 +585,7 @@ async function addVoyage() {
         });
       }
     } else {
-      console.log("未提交", voyageForm.voyageForm);
+      console.log("未提交", voyageForm.value);
     }
   });
 }
@@ -595,7 +594,7 @@ let shipsCache = ref([]);
 let colCache = ref([]);
 let cargoOwnersCache = ref([]);
 
-const searchShip = _.debounce(
+let searchShip = _.debounce(
   async (queryString, cb) => {
     if (!queryString) return;
     let res = await api.searchShip({
@@ -615,11 +614,11 @@ const searchShip = _.debounce(
   { leading: true }
 );
 
-const selectShip = (item) => {
-  voyageForm.voyageForm.shipId = item.shipId;
+let selectShip = (item) => {
+  voyageForm.value.shipId = item.shipId;
 };
 
-const searchCargoOwner = _.debounce(
+let searchCargoOwner = _.debounce(
   async (queryString, cb) => {
     if (!queryString) return;
     let res = await api.searchUser({
@@ -640,11 +639,11 @@ const searchCargoOwner = _.debounce(
   { leading: true }
 );
 
-const selectCargoOwner = (item) => {
-  voyageForm.voyageForm.cargoOwnerId = item.userId;
+let selectCargoOwner = (item) => {
+  voyageForm.value.cargoOwnerId = item.userId;
 };
 
-const getCol = _.debounce(
+let getCol = _.debounce(
   async (queryString, cb) => {
     if (!queryString) return;
     let res = await api.getCol({
@@ -661,14 +660,14 @@ const getCol = _.debounce(
   { leading: true }
 );
 
-const selectLoadPort = (item) => {
-  voyageForm.voyageForm.loadPortId = item.key;
-  voyageForm.voyageForm.loadPort = item.value;
+let selectLoadPort = (item) => {
+  voyageForm.value.loadPortId = item.key;
+  voyageForm.value.loadPort = item.value;
 };
 
-const selectDischargeProt = (item) => {
-  voyageForm.voyageForm.dischargeProtId = item.key;
-  voyageForm.voyageForm.dischargeProt = item.value;
+let selectDischargeProt = (item) => {
+  voyageForm.value.dischargeProtId = item.key;
+  voyageForm.value.dischargeProt = item.value;
 };
 
 function resetAddVoyageForm() {