通过字典获取下拉选项

dianlixunjian
Zhufu 2024-08-29 11:03:37 +08:00
parent e4dfff5eeb
commit 94333929e8
2 changed files with 20 additions and 51 deletions

View File

@ -11,61 +11,17 @@
*/
// 图斑来源
import { getChildrenTree } from '@/api/demo/system';
import { asyncGetOptions } from '@/utils/global';
const counties = await getChildrenTree({ parentId: 371300 })
console.log(counties,'counties')
export const polygonSourceOptions= [
{ label: '群众举报', value: '群众举报'},
{ label: '舆情', value: '舆情'},
{ label: '12345', value: '12345'},
{ label: '矿产卫片', value: '矿产卫片'},
{ label: '无人机巡查', value: '无人机巡查'},
{ label: '其他部门移交', value: '其他部门移交'},
{ label: '上级领导交班', value: '上级领导交班'},
{ label: '县级自查上报', value: '县级自查上报'},
]
export const polygonSourceOptions= await asyncGetOptions('tubanlaiyuan')
// 图斑类型
export const polygonTypeOptions= [
{ label: '开采', value: '开采'},
{ label: '加工', value: '加工'},
]
export const polygonTypeOptions= await asyncGetOptions('kctubanleixing')
// 当前状态
export const statusOptions = [
{ label: '待填报', value: '1'},
{ label: '待整改', value: '2'},
{ label: '待县级审核', value: '3'},
{ label: '待市级审核', value: '4'},
{ label: '待查处', value: '5'},
{ label: '查处待县级审核', value: '6'},
{ label: '查处待市级审核', value: '7'},
{ label: '查处后待整改', value: '8'},
{ label: '整改后待县级审核', value: '9'},
{ label: '整改后待市级审核', value: '10'},
{ label: '已归档', value: '99'},
]
// 整改类型
export const rectifyTypeOptions = [
{ label: '取缔', value: '取缔'},
{ label: '保留', value: '保留'},
]
// 违法类型(开采)
export const mineIllegalTypeOptions = [
{ label: '无证开采类', value: '无证开采类'},
{ label: '越界开采类', value: '越界开采类'},
{ label: '持证矿山类', value: '持证矿山类'},
{ label: '以项目名义类', value: '以项目名义类'},
{ label: '其他', value: '其他'},
]
// 违法类型(加工)
export const processIllegalTypeOptions = [
{ label: '违法占地', value: '违法占地'},
{ label: '购销非法开采矿产品', value: '购销非法开采矿产品'},
{ label: '其他', value: '其他'},
]
export const statusOptions = await asyncGetOptions('kcdangqianzhuangtai')
// 是否立案
export const registerOptions = [
{ label: '是', value: 1},
{ label: '否', value: 0},
]
export const registerOptions =await asyncGetOptions('kcregister')
export const countiesOptions = counties.map(item => {
return {
label: item.name,

View File

@ -191,3 +191,16 @@ export const getOptions = (code: string) => {
});
return arry;
};
// 根据字典async获取对应的筛选数据
export const asyncGetOptions = async (code: string) => {
let arry: any = [];
await getLoad({ code: code }).then((res) => {
res.forEach((item: any) => {
arry.push({
label: item.itemName,
value: item.itemValue,
});
});
});
return arry;
};