|
|
@@ -57,7 +57,7 @@
|
|
|
<el-form
|
|
|
:model="ruleForm"
|
|
|
:rules="rules"
|
|
|
- ref="form"
|
|
|
+ ref="ruleFormRef"
|
|
|
label-width="110px"
|
|
|
label-position="left"
|
|
|
>
|
|
|
@@ -241,22 +241,26 @@ function pageChange(e) {
|
|
|
getAgencyList();
|
|
|
}
|
|
|
let visable = ref(false);
|
|
|
-let form = ref(null);
|
|
|
+let ruleFormRef = ref(null);
|
|
|
async function addAgency() {
|
|
|
- let res = 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",
|
|
|
+ ruleFormRef.value.validate(async (valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let res = 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();
|
|
|
+ }
|
|
|
});
|
|
|
- resetForm();
|
|
|
- getAgencyList();
|
|
|
}
|
|
|
function resetForm() {
|
|
|
visable.value = false;
|