国家地区回显

This commit is contained in:
‘huanghaiixia’
2025-11-06 17:19:03 +08:00
parent 76fbfca5f5
commit d6cc433b26
2 changed files with 35 additions and 19 deletions

View File

@ -15,7 +15,8 @@ enum Api {
DataLog = '/mdm/countryRegion/datalog',
TreeData = '/mdm/countryRegion/tree',
TreeChild = '/mdm/countryRegion/child'
TreeChild = '/mdm/countryRegion/child',
TreeChildInfo = '/mdm/countryRegion/getParentByCode'
}
/**
@ -46,7 +47,20 @@ export async function getAreaList(params: LngBRegionPageParams, mode: ErrorMessa
},
);
}
/**
* @description: 分节点查询LngBRegion树回显
*/
export async function getAreaInfo(params: LngBRegionPageParams, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngBRegionPageResult>(
{
url: Api.TreeChildInfo,
params,
},
{
errorMessageMode: mode,
},
);
}
/**
* @description: 查询LngBRegion分页列表
*/

View File

@ -1,5 +1,5 @@
<template>
<Cascader v-model:value="emitData" :options="options" :load-data="loadData" change-on-select @change="handleChange" :displayRender="handleRenderDisplay">
<Cascader v-model:value="emitData" :options="options" :load-data="loadData" @change="handleChange" :displayRender="handleRenderDisplay">
<template #suffixIcon v-if="loading">
<LoadingOutlined spin />
</template>
@ -17,7 +17,7 @@
import { get, omit } from 'lodash-es';
import { LoadingOutlined } from '@ant-design/icons-vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { getAreaList } from '/@/api/mdm/CountryRegion';
import { getAreaList, getAreaInfo} from '/@/api/mdm/CountryRegion';
import { requestMagicApi } from '/@/api/magicApi';
interface Option {
@ -60,22 +60,24 @@
if (isChange.value) return;
if (val) {
let arr = val.split(',')
console.log(arr, 88888)
const resData = await requestMagicApi({
method: "get",
url: "mdm/getRegionByCode",
body: undefined,
query: {
code: arr[arr.length-1]
}
});
console.log(resData, 'resData')
emitData.value = val.split(',');
const resData = await getAreaInfo({code: val,excludeType:props.excludeType });
options.value = resData.areaList
emitData.value = resData.regionCode
// const resData = await requestMagicApi({
// method: "get",
// url: "mdm/countryRegion/getParentByCode",
// body: undefined,
// query: {
// code: arr[arr.length-1]
// }
// });
// console.log(resData, 'resData')
// emitData.value = val.split(',');
} else {
emitData.value = [];
await initialFetch();
}
await initialFetch();
// await initialFetch();
},
{
immediate: true
@ -186,8 +188,8 @@
emit('change', keys);
return;
}
emit('change', keys.join(','));
emit('update:value', keys?.join(','));
emit('change', keys[keys.length -1]);
emit('update:value', keys[keys.length -1]);
emitData.value = props.value === undefined ? keys : emitData.value;
}