指标集管理中指标集类型改为树形结构

main
zhangxiaodi1 9 months ago
parent a605dd14da
commit 7b058fed2a

@ -25,14 +25,19 @@ import Detail from './components/Detail.vue'
import { Upload } from '@/components/Upload' import { Upload } from '@/components/Upload'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { getIndexType } from '@/api/dataset/RepIndexSet'; import { getIndexType } from '@/api/dataset/RepIndexSet';
import {
getIndexCategoryTreeApi
} from '@/api/dataset/IndexCategory'
import { transfDictList } from '@/utils'; import { transfDictList } from '@/utils';
const router = useRouter(); const router = useRouter();
const { t } = useI18n() const { t } = useI18n()
const ids = ref<string[]>([]) const ids = ref<string[]>([])
let indexType_param_LIST = ref([]); let indexType_param_LIST = ref([]);//
let IndexTypeParamsList = ref([]);//
let frequency_param_LIST = ref([]); let frequency_param_LIST = ref([]);
// //
const getDictInfoList = async ()=>{ const getDictInfoList = async ()=>{
const res = await getIndexType({ paramName: 'frequency_param', systemCode: 'ordb' }); const res = await getIndexType({ paramName: 'frequency_param', systemCode: 'ordb' });
@ -107,7 +112,10 @@ const tableColumns = reactive<TableColumn[]>([
label: '指标集类型', label: '指标集类型',
slots:{ slots:{
default:(data)=>{ default:(data)=>{
return <span>{indexType_param_LIST[parseInt(data.row.indexsetType) - 1]?.label}</span> const node = indexType_param_LIST.value.filter(item=>{
return item.id == data.row.indexsetType
})[0];
return <span>{node?node.nodeName:''}</span>
} }
} }
}, },
@ -173,13 +181,29 @@ const searchSchema = reactive<FormSchema[]>([
{ {
field: 'indexsetType', field: 'indexsetType',
label: '指标集类型', label: '指标集类型',
optionApi: async () => { colProps: { span: 100 },
const res = await getIndexType({ paramName: 'indexType_param', systemCode: 'ordb' }); componentProps: {
indexType_param_LIST = transfDictList(res.body.result); checkStrictly: true,
return indexType_param_LIST; nodeKey: 'id',
}, props: { children: 'childs', label: 'nodeName' },
value: '1', filterable: true,
component: 'Select' multiple: true,
collapseTags: true,
showCheckbox: true,
style: { minWidth: '200px' },
checkOnClickNode: true,
},
component: 'TreeSelect',
optionApi: async () => {
const res = await getIndexCategoryTreeApi();
IndexTypeParamsList.value = res;
indexType_param_LIST.value = res;
res.forEach(item=>{
indexType_param_LIST.value = indexType_param_LIST.value.concat(item.childs);
});
console.log(indexType_param_LIST,"indexType_param_LIST");
return res;
}
} }
]) ])
@ -328,6 +352,7 @@ const exportExcel = async () => {
v-if="actionType !== 'detail'" v-if="actionType !== 'detail'"
ref="writeRef" ref="writeRef"
:current-row="currentRow" :current-row="currentRow"
:indexTypeParam = "IndexTypeParamsList"
:action-type="actionType" :action-type="actionType"
/> />
<Detail v-if="actionType === 'detail'" :current-row="currentRow" /> <Detail v-if="actionType === 'detail'" :current-row="currentRow" />

@ -16,6 +16,10 @@ const props = defineProps({
actionType: { actionType: {
type: String, type: String,
default: 'add' default: 'add'
},
indexTypeParam:{
type:Object,
default:()=>[]
} }
}) })
@ -84,12 +88,22 @@ const formSchema = reactive<FormSchema[]>([
{ {
field: 'indexsetType', field: 'indexsetType',
label: '指标集类型', label: '指标集类型',
optionApi: async () => { componentProps: {
const res = await getIndexType({ paramName: 'indexType_param', systemCode: 'ordb' }); checkStrictly: true,
return transfDictList(res.body.result); nodeKey: 'id',
}, props: { children: 'childs', label: 'nodeName' },
value: '1', filterable: true,
component: 'Select' multiple: true,
collapseTags: true,
showCheckbox: true,
style: { minWidth: '200px' },
checkOnClickNode: true,
},
component: 'TreeSelect',
optionApi: async () => {
return props.indexTypeParam;
}
}, },
{ {
field: 'modelCode', field: 'modelCode',

Loading…
Cancel
Save