refactor:修复 antd typecheck 提供的报错
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
||||
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||
|
||||
import { useAccess } from '@vben/access';
|
||||
|
||||
@@ -94,7 +96,7 @@ export function useTypeGridFormSchema(): VbenFormSchema[] {
|
||||
}
|
||||
|
||||
/** 类型列表的字段 */
|
||||
export function useTypeGridColumns<T = any>(
|
||||
export function useTypeGridColumns<T = SystemDictTypeApi.DictType>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
@@ -312,7 +314,7 @@ export function useDataGridFormSchema(): VbenFormSchema[] {
|
||||
/**
|
||||
* 字典数据表格列
|
||||
*/
|
||||
export function useDataGridColumns<T = any>(
|
||||
export function useDataGridColumns<T = SystemDictDataApi.DictData>(
|
||||
onActionClick: OnActionClickFn<T>,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
||||
|
||||
import { watch } from 'vue';
|
||||
|
||||
@@ -100,8 +104,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
return await getDictDataPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
dictType: props.dictType,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -113,7 +117,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
},
|
||||
} as VxeTableGridOptions<SystemDictDataApi.DictData>,
|
||||
});
|
||||
|
||||
/** 监听 dictType 变化,重新查询 */
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
||||
import type {
|
||||
OnActionClickParams,
|
||||
VxeGridListeners,
|
||||
VxeTableGridOptions,
|
||||
} from '#/adapter/vxe-table';
|
||||
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
@@ -67,7 +71,10 @@ async function onDelete(row: SystemDictTypeApi.DictType) {
|
||||
}
|
||||
|
||||
/** 表格操作按钮回调 */
|
||||
function onActionClick({ code, row }: OnActionClickParams) {
|
||||
function onActionClick({
|
||||
code,
|
||||
row,
|
||||
}: OnActionClickParams<SystemDictTypeApi.DictType>) {
|
||||
switch (code) {
|
||||
case 'delete': {
|
||||
onDelete(row);
|
||||
@@ -81,8 +88,7 @@ function onActionClick({ code, row }: OnActionClickParams) {
|
||||
}
|
||||
|
||||
/** 表格事件 */
|
||||
// TODO @芋艿:这里有爆红
|
||||
const gridEvents: VxeGridListeners<RowType> = {
|
||||
const gridEvents: VxeGridListeners<SystemDictTypeApi.DictType> = {
|
||||
cellClick: ({ row }) => {
|
||||
emit('select', row.type);
|
||||
},
|
||||
@@ -115,7 +121,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
refresh: { code: 'query' },
|
||||
search: true,
|
||||
},
|
||||
},
|
||||
} as VxeTableGridOptions<SystemDictTypeApi.DictType>,
|
||||
gridEvents,
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user