mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-08 08:05:07 +08:00
fix
This commit is contained in:
@ -15,12 +15,10 @@ import { FormSchema } from '@/types/form'
|
||||
import { ComponentOptions } from '@/types/components'
|
||||
|
||||
export type VxeCrudSchema = {
|
||||
// 主键ID
|
||||
primaryKey?: string
|
||||
primaryType?: VxeColumnPropTypes.Type
|
||||
// 是否开启操作栏插槽
|
||||
action?: boolean
|
||||
actionWidth?: string
|
||||
primaryKey?: string // 主键ID
|
||||
primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null
|
||||
action?: boolean // 是否开启操作栏插槽
|
||||
actionWidth?: string // 操作栏插槽宽度,一般1个 text 类型按钮 60-80
|
||||
columns: VxeCrudColumns[]
|
||||
}
|
||||
type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
|
||||
@ -173,7 +171,7 @@ const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns
|
||||
const tableSchemaItem = {
|
||||
title: t('common.index'),
|
||||
field: crudSchema.primaryKey,
|
||||
type: crudSchema.primaryType ? crudSchema.primaryType : 'seq',
|
||||
type: crudSchema.primaryType ? crudSchema.primaryType : null,
|
||||
width: '50px'
|
||||
}
|
||||
tableSchema.push(tableSchemaItem)
|
||||
|
@ -12,7 +12,7 @@ const message = useMessage() // 消息弹窗
|
||||
interface UseVxeGridConfig<T = any> {
|
||||
allSchemas: VxeAllSchemas
|
||||
getListApi: (option: any) => Promise<T>
|
||||
delListApi?: (option: any) => Promise<T>
|
||||
deleteApi?: (option: any) => Promise<T>
|
||||
exportListApi?: (option: any) => Promise<T>
|
||||
exportName?: string
|
||||
}
|
||||
@ -150,12 +150,12 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
* @param ids rowid
|
||||
* @returns
|
||||
*/
|
||||
const delList = async (ref, ids: string | number | string[] | number[]) => {
|
||||
const deleteData = async (ref, ids: string | number) => {
|
||||
if (!ref) {
|
||||
console.error('未传入gridRef')
|
||||
return
|
||||
}
|
||||
if (!config?.delListApi) {
|
||||
if (!config?.deleteApi) {
|
||||
console.error('未传入delListApi')
|
||||
return
|
||||
}
|
||||
@ -164,7 +164,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
message
|
||||
.delConfirm()
|
||||
.then(() => {
|
||||
config?.delListApi && config?.delListApi(ids)
|
||||
config?.deleteApi && config?.deleteApi(ids)
|
||||
message.success(t('common.delSuccess'))
|
||||
})
|
||||
.finally(async () => {
|
||||
@ -216,7 +216,7 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
gridOptions,
|
||||
reloadList,
|
||||
getSearchData,
|
||||
delList,
|
||||
deleteData,
|
||||
exportList,
|
||||
zoom
|
||||
}
|
||||
|
Reference in New Issue
Block a user