bugfixed
This commit is contained in:
@ -76,7 +76,8 @@
|
||||
</template>
|
||||
<script setup name="CityOptions">
|
||||
import { provinceList, cityList, districtList } from "@/api/config";
|
||||
import { reactive, ref, toRefs } from "vue";
|
||||
|
||||
import { reactive, ref, toRefs, watch } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: Object,
|
||||
@ -138,15 +139,15 @@ const provinceChanged = () => {
|
||||
citySelectList.value = [];
|
||||
districtSelectList.value = [];
|
||||
// 重新请求城市列表
|
||||
modelValue.value.province &&
|
||||
getCityListByProvinceId(modelValue.value.province);
|
||||
// modelValue.value.province &&
|
||||
// getCityListByProvinceId(modelValue.value.province);
|
||||
};
|
||||
// 当市改变时
|
||||
const cityChanged = () => {
|
||||
// 清除县区代码列表
|
||||
modelValue.value.district = undefined;
|
||||
districtSelectList.value = [];
|
||||
modelValue.value.city && getAreaListByCityId(modelValue.value.city);
|
||||
// modelValue.value.city && getAreaListByCityId(modelValue.value.city);
|
||||
};
|
||||
|
||||
const validateForm = async () => {
|
||||
@ -157,15 +158,40 @@ const validateForm = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
watch(modelValue, (val) => {
|
||||
if (val.province) {
|
||||
getCityListByProvinceId(val.province);
|
||||
}
|
||||
if (val.city) {
|
||||
getAreaListByCityId(val.city);
|
||||
}
|
||||
});
|
||||
// watch(
|
||||
// () => {
|
||||
// return {
|
||||
// province: modelValue.value.province,
|
||||
// city: modelValue.value.city,
|
||||
// };
|
||||
// },
|
||||
// (val) => {
|
||||
// console.log("changed city");
|
||||
// if (val.province) {
|
||||
// getCityListByProvinceId(val.province);
|
||||
// }
|
||||
// if (val.city) {
|
||||
// getAreaListByCityId(val.city);
|
||||
// }
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
|
||||
watch(
|
||||
() => modelValue.value.province,
|
||||
(val) => {
|
||||
console.log("changed province");
|
||||
getCityListByProvinceId(val);
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => modelValue.value.city,
|
||||
(val) => {
|
||||
console.log("changed city");
|
||||
getAreaListByCityId(val);
|
||||
}
|
||||
);
|
||||
getProvinceList();
|
||||
|
||||
defineExpose({
|
||||
|
@ -108,7 +108,17 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="营业执照:" prop="license">
|
||||
<ImageUpload
|
||||
v-model="modelValue.license"
|
||||
:isShowTip="false"
|
||||
:limit="1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="isAdd">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="营业执照:" prop="license">
|
||||
@ -204,6 +214,13 @@ const data = reactive({
|
||||
trigger: ["change", "blur"],
|
||||
},
|
||||
],
|
||||
license: [
|
||||
{
|
||||
required: true,
|
||||
message: "请上传",
|
||||
trigger: ["blur", "change"],
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const { rules } = toRefs(data);
|
||||
@ -224,7 +241,7 @@ const validateForm = async () => {
|
||||
const cityFormValid = await cityFormRef.value.validateForm(); // 城市选择表单验证
|
||||
const fieldFormValid = await fieldFormRef.value.validateForm(); // 领域选择表单验证
|
||||
const keywordsFormValid = await keywordsFormRef.value.validateForm(); // 关键词表单验证
|
||||
console.log(cityFormValid);
|
||||
// console.log(cityFormValid);
|
||||
if (isAdd.value) {
|
||||
const directionsFormValid = await directionsFormRef.value.validateForm();
|
||||
return (
|
||||
|
@ -23,7 +23,7 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号:" prop="mobile">
|
||||
<el-input v-model="modelValue.mobile"></el-input>
|
||||
<el-input v-model="modelValue.mobile" maxlength="11"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -136,8 +136,8 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="性别:" prop="gender">
|
||||
<el-radio v-model="modelValue.gender" :label="1">男</el-radio>
|
||||
<el-radio v-model="modelValue.gender" :label="2">女</el-radio>
|
||||
<el-radio v-model="modelValue.gender" label="1">男</el-radio>
|
||||
<el-radio v-model="modelValue.gender" label="2">女</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -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";
|
||||
|
Reference in New Issue
Block a user