表单提交组件之间的校验
This commit is contained in:
@ -8,3 +8,19 @@ export function expertList(data) {
|
|||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 专家详细信息
|
||||||
|
export function expertDetail(data) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/v1/manage/expert/detail',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 专家信息添加
|
||||||
|
export function expertAdd(data) {
|
||||||
|
return request({
|
||||||
|
url: '/admin/v1/manage/expert/add',
|
||||||
|
method: 'post',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -126,7 +126,11 @@ export default {
|
|||||||
this.districtSelectList = await this.getProvinceByParent(id);
|
this.districtSelectList = await this.getProvinceByParent(id);
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate((valid) => valid);
|
let flag = false;
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
flag = valid;
|
||||||
|
});
|
||||||
|
return flag;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -254,13 +254,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
const flag = false;
|
let flag = false;
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
const cityForm = this.$refs.cityForm.submitForm();
|
const cityForm = this.$refs.cityForm.submitForm();
|
||||||
const fieldForm = this.$refs.fieldForm.submitForm();
|
const fieldForm = this.$refs.fieldForm.submitForm();
|
||||||
const keywordsForm = this.$refs.keywordsForm.submitForm();
|
const keywordsForm = this.$refs.keywordsForm.submitForm();
|
||||||
const researchsForm = this.$refs.researchsForm.submitForm();
|
const researchsForm = this.$refs.researchsForm.submitForm();
|
||||||
if (cityForm && fieldForm && keywordsForm && researchsForm) {
|
if (cityForm && fieldForm && keywordsForm && researchsForm) {
|
||||||
|
console.log(true);
|
||||||
flag = !flag;
|
flag = !flag;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -152,7 +152,11 @@ export default {
|
|||||||
this.value.industrys.splice(index, 1);
|
this.value.industrys.splice(index, 1);
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate((valid) => valid);
|
let flag = false;
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
flag = valid;
|
||||||
|
});
|
||||||
|
return flag;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -6,7 +6,12 @@
|
|||||||
:label="title + ':'"
|
:label="title + ':'"
|
||||||
:prop="fieldKey"
|
:prop="fieldKey"
|
||||||
:rules="[
|
:rules="[
|
||||||
{ required: true, message: '请输入并添加', trigger: 'blur' },
|
{
|
||||||
|
required: true,
|
||||||
|
type: 'array',
|
||||||
|
message: '请输入并添加',
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<el-row type="flex" justify="space-between">
|
<el-row type="flex" justify="space-between">
|
||||||
@ -66,7 +71,11 @@ export default {
|
|||||||
this.value[val].splice(index, 1);
|
this.value[val].splice(index, 1);
|
||||||
},
|
},
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate((valid) => valid);
|
let flag = false;
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
flag = valid;
|
||||||
|
});
|
||||||
|
return flag;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import ExpertForm from "@/views/components/ExpertForm";
|
import ExpertForm from "@/views/components/ExpertForm";
|
||||||
|
import { expertDetail, expertAdd } from "@/api/examine/expert";
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ExpertForm,
|
ExpertForm,
|
||||||
@ -17,8 +18,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
form: {
|
form: {
|
||||||
image: undefined,
|
image: undefined,
|
||||||
name: "1",
|
name: undefined,
|
||||||
mobile: "13911111111",
|
mobile: undefined,
|
||||||
research_id: undefined, // 所属单位
|
research_id: undefined, // 所属单位
|
||||||
laboratory_id: undefined, // 所属实验室
|
laboratory_id: undefined, // 所属实验室
|
||||||
tenant_id: undefined,
|
tenant_id: undefined,
|
||||||
@ -44,6 +45,9 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
if (this.$refs.expertForm.submitForm()) {
|
if (this.$refs.expertForm.submitForm()) {
|
||||||
console.log(this.form);
|
console.log(this.form);
|
||||||
|
// expertAdd(this.form).then((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
console.log("校验未通过");
|
console.log("校验未通过");
|
||||||
}
|
}
|
||||||
@ -73,9 +77,10 @@ export default {
|
|||||||
this.$router.go(-1);
|
this.$router.go(-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(id);
|
expertDetail({ id }).then((res) => {
|
||||||
// this.queryParams.reportedId = id;
|
console.log(res);
|
||||||
// this.getReportDetail();
|
this.form = res.data;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
@ -100,8 +100,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { delUser } from "@/api/system/user";
|
|
||||||
|
|
||||||
import { expertList } from "@/api/examine/expert";
|
import { expertList } from "@/api/examine/expert";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
Reference in New Issue
Block a user