This commit is contained in:
weipengfei 2023-08-17 15:51:38 +08:00
parent e2845df5bf
commit 11a6f0e6ea
2 changed files with 42 additions and 14 deletions

View File

@ -48,4 +48,9 @@ export function authentication(params: any) {
// 平台公司
export function companyListTwo(params: any) {
return request.get({ url: '/company/list_two', params })
}
// 获取管辖区域
export function companyResponsibleArea(params: any) {
return request.get({ url: '/company/responsible_area', params })
}

View File

@ -218,13 +218,7 @@
</el-form-item>
</el-col>
<el-col :span="23">
<el-form-item
label="负责区域"
:rules="[
{ required: true, message: '不可为空', trigger: 'blur' },
]"
prop="region"
>
<el-form-item label="负责区域" prop="region">
<el-checkbox-group
v-model="formData.responsible_area"
@change="handleCheckedCitiesChange"
@ -233,7 +227,8 @@
<el-checkbox
:disabled="
formData[regionType] == city[regionType + '_code'] ||
formData[regionType] == city.id
formData[regionType] == city.id ||
city.disabled
"
v-for="city in datas[regionType + 'Options']"
:key="city[regionType + '_name']"
@ -654,6 +649,7 @@ import {
apiCompanyEdit,
apiCompanyDetail,
apiCompanyLists,
companyResponsibleArea,
} from "@/api/company";
import {
apiCityList,
@ -854,9 +850,11 @@ function openCompany() {
// const formData.responsible_area = ref([]);
//
const regionType = ref("");
const wathcFlag = ref(0); //
watch(
() => formData[regionType.value],
(newValue, oldValue) => {
if (wathcFlag.value == 0) return wathcFlag.value++;
formData.responsible_area = [];
formData.responsible_area.push(newValue + "");
}
@ -1032,27 +1030,52 @@ function village_change(value: string) {
// formData.brigade = value
// }
const getProvinceList = async () => {
const data = await apiProvinceList({});
let data = await apiProvinceList({});
datas["provinceOptions"] = data;
};
const getCityList = async () => {
const data = await apiCityList({ city: formData.province });
let data = await apiCityList({ city: formData.province });
datas["cityOptions"] = data;
};
const getAreaList = async () => {
const data = await apiAreaList({ area: formData.city });
let data = await apiAreaList({ area: formData.city });
datas["areaOptions"] = data;
};
const getStreetList = async () => {
const data = await apiStreetList({ street: formData.area });
let data = await apiStreetList({ street: formData.area });
// let f = await companyResponsibleArea({
// key: "area",
// value: formData.area,
// });
// data.forEach((item: any) => {
// if (f.find((t: any) => item.area_code == t)) item.disabled = true;
// else item.disabled = false;
// });
datas["streetOptions"] = data;
};
const getVillageList = async () => {
const data = await apiVillageList({ village: formData.street });
let data = await apiVillageList({ village: formData.street });
// let f = await companyResponsibleArea({
// key: "street",
// value: formData.street,
// });
// data.forEach((item: any) => {
// if (f.find((t: any) => item.street_code == t)) item.disabled = true;
// else item.disabled = false;
// });
datas["villageOptions"] = data;
};
const getBrigadeList = async () => {
const data = await apiBrigadeList();
let data = await apiBrigadeList();
// //
// let f = await companyResponsibleArea({
// key: "village",
// value: formData.village,
// });
// data.forEach((item: any) => {
// if (f.find((t: any) => item.id == t + "")) item.disabled = true;
// else item.disabled = false;
// });
datas["brigadeOptions"] = data;
};
getProvinceList();