<script lang="ts" setup>
|
import type { BasicColumn } from '@jnpf/ui/vxeTable';
|
|
import { nextTick, onMounted, reactive } from 'vue';
|
|
import { BasicVxeTable, useVxeTable } from '@jnpf/ui/vxeTable';
|
|
import { useBaseStore } from '#/store';
|
|
defineOptions({ name: 'ExtendTableDemoTableTree' });
|
|
interface State {
|
industryTypeList: any[];
|
}
|
|
const state = reactive<State>({
|
industryTypeList: [],
|
});
|
const baseStore = useBaseStore();
|
const columns: BasicColumn[] = [
|
{ title: '名称', dataIndex: 'fullName', minWidth: 200 },
|
{ title: '编码', dataIndex: 'id', width: 300 },
|
];
|
const [registerTable, { expandAll }] = useVxeTable({
|
columns,
|
useSearchForm: false,
|
isTreeTable: true,
|
immediate: false,
|
showTableSetting: false,
|
pagination: false,
|
});
|
|
async function init() {
|
state.industryTypeList = (await baseStore.getDictionaryData('IndustryType')) as any[];
|
nextTick(() => expandAll());
|
}
|
|
onMounted(() => init());
|
</script>
|
<template>
|
<div class="jnpf-content-wrapper">
|
<div class="jnpf-content-wrapper-center">
|
<div class="jnpf-content-wrapper-content">
|
<BasicVxeTable :data-source="state.industryTypeList" @register="registerTable" />
|
</div>
|
</div>
|
</div>
|
</template>
|