From 547b648140c9f7e0dde2d59d5c1319043ce1f381 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Wed, 4 Dec 2024 18:31:12 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 1 + src/http/api/home/index.ts | 4 ++-- src/views/user/sourcingNeed/index.vue | 34 ++++++++++++++++++++------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/components.d.ts b/components.d.ts index 6627051..443565a 100644 --- a/components.d.ts +++ b/components.d.ts @@ -10,6 +10,7 @@ declare module 'vue' { Breadcrumb: typeof import('./src/components/Breadcrumb/index.vue')['default'] ElButton: typeof import('element-plus/es')['ElButton'] ElCascader: typeof import('element-plus/es')['ElCascader'] + ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCol: typeof import('element-plus/es')['ElCol'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] diff --git a/src/http/api/home/index.ts b/src/http/api/home/index.ts index 43d494b..a503c51 100644 --- a/src/http/api/home/index.ts +++ b/src/http/api/home/index.ts @@ -18,8 +18,8 @@ export const getBookCarDetailsApi = (data: any = {}) => { export const getLeaseInfoByIdApi = (data: any = {}) => { return get('/material-mall/ma-lease/getById', data) } -export const getAreaApi = (data: any = {}) => { - return get('/material-mall/maType/getArea', data) +export const getAreaApi = (areaCode: any) => { + return get(`/material-mall/maType/getArea?areaCode=${areaCode}`,) } // 立即接单 export const setAcceptByIdApi = (data: any = {}) => { diff --git a/src/views/user/sourcingNeed/index.vue b/src/views/user/sourcingNeed/index.vue index 53780a0..3912c4f 100644 --- a/src/views/user/sourcingNeed/index.vue +++ b/src/views/user/sourcingNeed/index.vue @@ -249,10 +249,11 @@ style="width: 95%" placeholder="请选择项目所在省" v-model="addOrEditForm.areaId" + @change="onProvinceChange($event)" > @@ -265,13 +266,14 @@ clearable style="width: 95%" placeholder="请选择项目所在市" - v-model="addOrEditForm.areaId" + v-model="addOrEditForm.areaId2" + @change="onCityChange($event)" > @@ -282,13 +284,14 @@ clearable style="width: 95%" placeholder="请选择项所在县" - v-model="addOrEditForm.areaId" + v-model="addOrEditForm.areaId1" + @change="onCountyChange($event)" > @@ -299,7 +302,7 @@ style="width: 100%" clearable placeholder="请输入详细地址" - v-model="addOrEditForm.areaId" + v-model="addOrEditForm.areaId3" /> @@ -608,6 +611,9 @@ const addOrEditFormRef = ref(null) const addOrEditDialogVisible = ref(false) const addOrEditDemandFormList = ref([]) const addOrEditDemandFormRefList = ref([]) +const areaProvinceList = ref([]) +const areaCityList = ref([]) +const areaCountyList = ref([]) const uploadUrl = import.meta.env.VITE_API_URL + '/file/upload' const searchParams = reactive({ @@ -705,7 +711,7 @@ const getLeaseListData = async () => { } const getAreaData = async () => { - const res: any = await getAreaApi() + const res: any = await getAreaApi(0) areaList.value = res.data } @@ -874,6 +880,16 @@ const onDeleteDemand = (index: any) => { }) } +const onProvinceChange = async (id: any) => { + const res: any = await getAreaApi(id) + areaCityList.value = res.data +} +const onCityChange = async (id: any) => { + const res: any = await getAreaApi(id) + areaCountyList.value = res.data +} +const onCountyChange = async (id: any) => {} + onMounted(() => { getClassAndCompanyData() getLeaseListData()