更新区域

This commit is contained in:
wpf 2023-08-13 11:29:58 +08:00
parent b5f83dab8f
commit 77475478d8

View File

@ -178,13 +178,18 @@
<el-col :span="23">
<el-form-item label="负责区域" prop="region">
<el-checkbox-group
v-model="regionList"
v-model="formData.responsible_area"
@change="handleCheckedCitiesChange"
:disabled="isDisabled"
>
<el-checkbox
v-for="city in datas[regionType + 'Options']"
:key="city[regionType + '_name']"
:label="city[regionType + '_code']"
:label="
regionType == 'brigade'
? city.id + ''
: city[regionType + '_code'] + ''
"
>{{ city[regionType + "_name"] }}</el-checkbox
>
</el-checkbox-group>
@ -666,6 +671,7 @@ const formData = reactive({
village: "",
brigade: "",
address: "",
responsible_area: [],
company_type: "",
avatar: "",
sex: "1",
@ -793,24 +799,24 @@ function openCompany() {
}
//
const regionList = ref([]);
// const formData.responsible_area = ref([]);
//
const regionType = ref("");
watch(
() => formData[regionType.value],
(newValue, oldValue) => {
regionList.value = [];
regionList.value.push(newValue);
formData.responsible_area.value = [];
formData.responsible_area.value.push(newValue);
}
);
//
const handleCheckedCitiesChange = (value: string[]) => {
console.log(value);
// console.log("", value);
};
//
const setFormData = async (data: Record<any, any>) => {
console.log(formData);
// console.log(formData);
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
@ -1092,7 +1098,6 @@ const create = async () => {
data.qualification.other_qualifications = JSON.stringify(
data.qualification.other_qualifications
);
data[regionType.value] = regionList.value;
if (route.query.id) {
await apiCompanyEdit(data);
} else {