This commit is contained in:
cxc
2022-10-31 17:46:09 +08:00
parent 652ce4c9d3
commit c2327f30cb
63 changed files with 1698 additions and 479 deletions

View File

@ -7,7 +7,7 @@
>
<el-row>
<el-col :span="24">
<el-form-item label="所属领域:" required>
<el-form-item label="所属领域:">
<el-row type="flex" justify="space-between">
<el-col :span="7">
<el-form-item prop="industrys">
@ -67,7 +67,8 @@
<script setup>
import { listSysIndustry } from "@/api/config";
import { reactive, toRefs } from "vue";
// import { watch } from "fs";
import { reactive, toRefs, watch } from "vue";
const props = defineProps({
modelValue: Object,
labelWidth: {
@ -100,19 +101,60 @@ const getIndustryTreeData = async () => {
levelI.value = data;
};
// watch(
// modelValue,
// (val) => {
// if (val.industrys[1]) {
// // delete val.industrys[2];
// levelIII.value = levelII.value.find((el) => el.id === item).children;
// }
// if (val.industrys[0]) {
// // delete val.industrys[1];
// // delete val.industrys[2];
// // levelII.value = levelI.value.find((el) => {
// // return el.id === item;
// // }).children;
// console.log(123);
// }
// },
// { deep: true, immediate: true }
// );
const levelIChange = async (item) => {
delete modelValue.value.industrys[1];
delete modelValue.value.industrys[2];
levelII.value = levelI.value.find((el) => {
return el.id === item;
}).children;
// levelII.value = levelI.value.find((el) => {
// return el.id === item;
// }).children;
};
const levelIIChange = async (item) => {
delete modelValue.value.industrys[2];
levelIII.value = levelII.value.find((el) => el.id === item).children;
// levelIII.value = levelII.value.find((el) => el.id === item).children;
};
getIndustryTreeData();
getIndustryTreeData().then(() => {
watch(
() => modelValue.value.industrys[0],
(val) => {
// console.log(val);
levelII.value =
levelI.value.find((el) => {
return el.id === val;
})?.children ?? [];
},
{ immediate: true }
);
watch(
() => modelValue.value.industrys[1],
(val) => {
levelIII.value =
levelII.value.find((el) => {
return el.id === val;
})?.children ?? [];
},
{ immediate: true }
);
});
</script>
<!-- <script>
// import { industry } from "@/api/config";