This commit is contained in:
2023-06-19 17:25:50 +08:00
parent ef579def81
commit eb19778bd0
41 changed files with 2788 additions and 186 deletions

View File

@ -1,20 +1,20 @@
<template>
<el-form
ref="form"
ref="formRef"
:label-width="labelWidth + 'px'"
:model="modelValue"
:rules="rules"
:label-width="labelWidth + 'px'"
>
<el-row>
<el-col :span="24">
<el-form-item label="所属领域:">
<el-row type="flex" justify="space-between">
<el-row justify="space-between" type="flex">
<el-col :span="7">
<el-form-item prop="industrys">
<el-form-item prop="industrys.2">
<el-select
v-model="modelValue.industrys[0]"
value-key="id"
placeholder="请选择"
value-key="id"
@change="levelIChange"
>
<el-option
@ -30,8 +30,8 @@
<el-col :span="7">
<el-select
v-model="modelValue.industrys[1]"
value-key="id"
placeholder="请选择"
value-key="id"
@change="levelIIChange"
>
<el-option
@ -46,8 +46,8 @@
<el-col :span="7">
<el-select
v-model="modelValue.industrys[2]"
value-key="id"
placeholder="请选择"
value-key="id"
>
<el-option
v-for="item in levelIII"
@ -69,6 +69,7 @@
import { listSysIndustry } from "@/api/config";
// import { watch } from "fs";
import { reactive, ref, toRefs, watch } from "vue";
const props = defineProps({
modelValue: Object,
labelWidth: {
@ -79,9 +80,9 @@ const props = defineProps({
const { modelValue, labelWidth } = toRefs(props);
const data = reactive({
rules: {
industrys: [
"industrys.2": [
{
type: "array",
// type: "array",
required: true,
message: "请选择",
trigger: "change",
@ -94,7 +95,7 @@ const { rules } = toRefs(data);
const levelI = ref([]);
const levelII = ref([]);
const levelIII = ref([]);
const formRef = ref();
// 获取领域树形列表
const getIndustryTreeData = async () => {
const { data } = await listSysIndustry();
@ -155,6 +156,17 @@ getIndustryTreeData().then(() => {
{ immediate: true }
);
});
const validateForm = async () => {
try {
return await formRef.value.validate();
} catch (error) {
console.error(error);
return false;
}
};
defineExpose({
validateForm,
});
</script>
<!-- <script>
// import { industry } from "@/api/config";