wzg vor 1 Jahr
Ursprung
Commit
3e29dc6597
1 geänderte Dateien mit 20 neuen und 12 gelöschten Zeilen
  1. 20 12
      src/views/agencyManage/agencyCompanyList.vue

+ 20 - 12
src/views/agencyManage/agencyCompanyList.vue

@@ -245,26 +245,34 @@ let ruleFormRef = ref(null);
 async function addAgency() {
   ruleFormRef.value.validate(async (valid) => {
     if (valid) {
-      let res = await api.addAgency({
+      let { data } = await api.addAgency({
         ...ruleForm.value,
         loginAccountId: loginAccountId.value,
       });
-      console.log(res);
-      let status = res.data.status == 0;
-      ElNotification({
-        title: status ? "成功" : "失败",
-        duration: 1500,
-        message: res.data.msg,
-        type: status ? "success" : "error",
-      });
-      resetForm();
-      getAgencyList();
+
+      if (data.status === 0) {
+        ElNotification({
+          title: "成功",
+          duration: 1500,
+          message: data.msg,
+          type: "success",
+        });
+        resetForm();
+        getAgencyList();
+      } else {
+        ElNotification({
+          title: "失败",
+          duration: 1500,
+          message: data.msg,
+          type: "error",
+        });
+      }
     }
   });
 }
 function resetForm() {
   visable.value = false;
-  form.value.resetFields();
+  ruleFormRef.value.resetFields();
 }
 
 function closeModal() {