Bläddra i källkod

更新 添加船东逻辑

wzh 3 år sedan
förälder
incheckning
2697924776
1 ändrade filer med 20 tillägg och 3 borttagningar
  1. 20 3
      src/views/shipOwnerManage/shipOwnerList.vue

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

@@ -18,7 +18,7 @@
         title="添加船东"
         v-model="dialogFormVisible"
         @closed="resetForm"
-        distory
+        destroy-on-close
       >
         <template v-slot:default>
           <el-form
@@ -32,12 +32,14 @@
               <el-input
                 style="width: 280px"
                 v-model="ruleForm.userPhone"
+                :disabled="!!ruleForm.userId"
               ></el-input>
             </el-form-item>
             <el-form-item prop="userName" label="船东姓名">
               <el-input
                 style="width: 280px"
                 v-model="ruleForm.userName"
+                :disabled="!!ruleForm.userId"
               ></el-input>
             </el-form-item>
             <el-form-item prop="shipMmsi" label="MMSI">
@@ -144,7 +146,6 @@ let ruleForm = ref({
   shipMmsi: "",
 });
 async function resetForm() {
-  dialogFormVisible.value = false;
   form.value.resetFields();
   ruleForm.value = {};
 }
@@ -157,7 +158,22 @@ const checkShipOwnerPhone = async (rule, value, callback) => {
     userPhone: value,
   });
   if (res.data.status == 0) {
-    callback(new Error("此手机号已绑定船东!"));
+    ElMessageBox.confirm("已查询到船东信息,是否匹配?", "提示", {
+      confirmButtonText: "匹配",
+      cancelButtonText: "更换手机号",
+      type: "info",
+    })
+      .then(() => {
+        ruleForm.value = {
+          ...ruleForm.value,
+          ...res.data.result,
+        };
+      })
+      .catch(() => {
+        ruleForm.value.userPhone = "";
+        ruleForm.value.userId = "";
+        ruleForm.value.userName = "";
+      });
   } else {
     callback();
   }
@@ -214,6 +230,7 @@ async function addShipOwner() {
           type: "success",
         });
         resetForm();
+        dialogFormVisible.value = false;
         getShipOwnerList();
       } else {
         ElNotification.error({