企业添加与修改
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
<template>
|
||||
<el-button @click="check">验证</el-button>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="modelValue"
|
||||
@ -220,40 +219,40 @@
|
||||
|
||||
<!-- <FieldOptions v-model="value" :labelWidth="labelWidth" ref="fieldForm" /> -->
|
||||
|
||||
<!-- <InputBoxAdd
|
||||
<InputBoxAdd
|
||||
:labelWidth="labelWidth"
|
||||
v-model="value"
|
||||
v-model="modelValue"
|
||||
title="关键词"
|
||||
placeholder="应用场景关键词+技术产品关键词"
|
||||
fieldKey="keywords"
|
||||
ref="keywordsForm"
|
||||
ref="keywordsFormRef"
|
||||
/>
|
||||
|
||||
<InputBoxAdd
|
||||
v-if="formType != 2"
|
||||
:labelWidth="labelWidth"
|
||||
v-model="value"
|
||||
v-model="modelValue"
|
||||
title="研究方向"
|
||||
placeholder="请输入研究方向"
|
||||
fieldKey="researchs"
|
||||
ref="researchsForm"
|
||||
ref="researchsFormRef"
|
||||
/>
|
||||
|
||||
<InputBoxAdd
|
||||
v-if="formType == 2"
|
||||
:labelWidth="labelWidth"
|
||||
v-model="value"
|
||||
v-model="modelValue"
|
||||
title="生产方向"
|
||||
placeholder="请输入生产方向"
|
||||
fieldKey="directions"
|
||||
ref="directionsForm"
|
||||
/> -->
|
||||
ref="directionsFormRef"
|
||||
/>
|
||||
|
||||
<el-row v-if="formType == 2">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="邀请码:">
|
||||
<el-input
|
||||
v-model="modelValue.inviter_code"
|
||||
v-model="modelValue.inviterCode"
|
||||
:disabled="!isAdd"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
@ -285,7 +284,7 @@
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 2, maxRows: 6 }"
|
||||
/>
|
||||
<WangEditor v-model="modelValue.introduce" minHeight="150px" />
|
||||
<WangEditor v-else v-model="modelValue.introduce" minHeight="150px" />
|
||||
<!-- <Editor
|
||||
v-else
|
||||
v-model="modelValue.introduce"
|
||||
@ -301,7 +300,7 @@
|
||||
<script setup name="ExpertForm">
|
||||
import CityOptions from "@/views/components/CityOptions";
|
||||
// import FieldOptions from "@/views/components/FieldOptions";
|
||||
// import InputBoxAdd from "@/views/components/InputBoxAdd";
|
||||
import InputBoxAdd from "@/views/components/InputBoxAdd";
|
||||
import { researchSelect } from "@/api/dataList/research";
|
||||
import { laboratorySelect } from "@/api/dataList/laboratory";
|
||||
import { tenantSelect } from "@/api/subPlatform/tenant";
|
||||
@ -328,8 +327,12 @@ const props = defineProps({
|
||||
default: 120,
|
||||
},
|
||||
});
|
||||
const { formType, modelValue } = toRefs(props);
|
||||
const { formType, modelValue, labelWidth, showTitle, isAdd } = toRefs(props);
|
||||
const cityFormRef = ref(null);
|
||||
const formRef = ref(null);
|
||||
const keywordsFormRef = ref(null);
|
||||
const researchsFormRef = ref(null);
|
||||
const directionsFormRef = ref([]);
|
||||
const researchOptions = ref([]);
|
||||
const options = ref([]);
|
||||
const siteList = ref([]);
|
||||
@ -413,40 +416,77 @@ const getSiteList = async () => {
|
||||
const check = async () => {
|
||||
// console.log(cityFormRef.value);
|
||||
// console.log(cityFormRef.value.formRef.value.validate());
|
||||
cityFormRef.value
|
||||
.validateForm()
|
||||
.then((re) => {
|
||||
console.log(re);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
// cityFormRef.value
|
||||
// .validateForm()
|
||||
// .then((re) => {
|
||||
// console.log(re);
|
||||
// })
|
||||
// .catch((error) => {
|
||||
// console.log(error);
|
||||
// });
|
||||
// console.log(await keywordsFormRef.value.validateForm());
|
||||
const res = await validateForm();
|
||||
console.log(res);
|
||||
};
|
||||
const submitForm = () => {
|
||||
let flag = false;
|
||||
if (this.formType == 1) {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
const cityForm = this.$refs.cityForm.submitForm(); // 城市
|
||||
const fieldForm = this.$refs.fieldForm.submitForm(); // 所属领域
|
||||
const keywordsForm = this.$refs.keywordsForm.submitForm(); // 关键词
|
||||
const researchsForm = this.$refs.researchsForm.submitForm(); // 研究方向
|
||||
if (valid && cityForm && fieldForm && keywordsForm && researchsForm) {
|
||||
flag = !flag;
|
||||
}
|
||||
});
|
||||
} else if (this.formType == 2) {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
const cityForm = this.$refs.cityForm.submitForm();
|
||||
const fieldForm = this.$refs.fieldForm.submitForm();
|
||||
const keywordsForm = this.$refs.keywordsForm.submitForm();
|
||||
const directionsForm = this.$refs.directionsForm.submitForm();
|
||||
if (valid && cityForm && fieldForm && keywordsForm && directionsForm) {
|
||||
flag = !flag;
|
||||
}
|
||||
});
|
||||
const validate1 = async () => {
|
||||
try {
|
||||
return await formRef.value.validate();
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
return flag;
|
||||
};
|
||||
const validateForm = async () => {
|
||||
let formValid;
|
||||
try {
|
||||
formValid = await formRef.value.validate();
|
||||
} catch (error) {
|
||||
formValid = false;
|
||||
}
|
||||
const cityFormValid = await cityFormRef.value.validateForm();
|
||||
|
||||
const keywordsFormValid = await keywordsFormRef.value.validateForm();
|
||||
if (formType.value == 1) {
|
||||
const researchsFormValid = await researchsFormRef.value.validateForm();
|
||||
return (
|
||||
formValid && cityFormValid && keywordsFormValid && researchsFormValid
|
||||
);
|
||||
} else if (formType.value == 2) {
|
||||
const directionsFormValid = await directionsFormRef.value.validateForm();
|
||||
return (
|
||||
formValid && cityFormValid && keywordsFormValid && directionsFormValid
|
||||
);
|
||||
} else {
|
||||
throw "未知的formType";
|
||||
}
|
||||
};
|
||||
defineExpose({
|
||||
validateForm,
|
||||
});
|
||||
// const submitForm = () => {
|
||||
// let flag = false;
|
||||
// if (this.formType == 1) {
|
||||
// this.$refs["form"].validate((valid) => {
|
||||
// const cityForm = this.$refs.cityForm.submitForm(); // 城市
|
||||
// const fieldForm = this.$refs.fieldForm.submitForm(); // 所属领域
|
||||
// const keywordsForm = this.$refs.keywordsForm.submitForm(); // 关键词
|
||||
// const researchsForm = this.$refs.researchsForm.submitForm(); // 研究方向
|
||||
// if (valid && cityForm && fieldForm && keywordsForm && researchsForm) {
|
||||
// flag = !flag;
|
||||
// }
|
||||
// });
|
||||
// } else if (this.formType == 2) {
|
||||
// this.$refs["form"].validate((valid) => {
|
||||
// const cityForm = this.$refs.cityForm.submitForm();
|
||||
// const fieldForm = this.$refs.fieldForm.submitForm();
|
||||
// const keywordsForm = this.$refs.keywordsForm.submitForm();
|
||||
// const directionsForm = this.$refs.directionsForm.submitForm();
|
||||
// if (valid && cityForm && fieldForm && keywordsForm && directionsForm) {
|
||||
// flag = !flag;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// return flag;
|
||||
// };
|
||||
getSiteList();
|
||||
</script>
|
||||
|
||||
@ -494,7 +534,7 @@ export default {
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</script> -->
|
||||
<style lang="scss" scoped>
|
||||
.form_title {
|
||||
font-weight: 700;
|
||||
@ -506,9 +546,9 @@ export default {
|
||||
// height: 120px;
|
||||
// line-height: 120px;
|
||||
// }
|
||||
.el-select,
|
||||
.el-date-editor {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
</style> -->
|
||||
// .el-select,
|
||||
// .el-date-editor {
|
||||
// display: block;
|
||||
// width: 100%;
|
||||
// }
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user