mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-10 09:05:07 +08:00
refactor: vxe crud
This commit is contained in:
@ -71,6 +71,18 @@ export const useMessage = () => {
|
||||
}
|
||||
)
|
||||
},
|
||||
// 导出窗体
|
||||
exportConfirm(content?: string, tip?: string) {
|
||||
return ElMessageBox.confirm(
|
||||
content ? content : t('common.exportMessage'),
|
||||
tip ? tip : t('common.confirmTitle'),
|
||||
{
|
||||
confirmButtonText: t('common.ok'),
|
||||
cancelButtonText: t('common.cancel'),
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
},
|
||||
// 提交内容
|
||||
prompt(content: string, tip: string) {
|
||||
return ElMessageBox.prompt(content, tip, {
|
||||
|
@ -13,6 +13,7 @@ interface UseVxeGridConfig<T = any> {
|
||||
getListApi: (option: any) => Promise<T>
|
||||
delListApi?: (option: any) => Promise<T>
|
||||
exportListApi?: (option: any) => Promise<T>
|
||||
exportName?: string
|
||||
}
|
||||
|
||||
const appStore = useAppStore()
|
||||
@ -88,10 +89,29 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
|
||||
return new Promise(async (resolve) => {
|
||||
resolve(await config?.getListApi(queryParams))
|
||||
})
|
||||
},
|
||||
queryAll: ({ form }) => {
|
||||
const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form)))
|
||||
return new Promise(async (resolve) => {
|
||||
if (config?.exportListApi) {
|
||||
resolve(await config?.exportListApi(queryParams))
|
||||
} else {
|
||||
resolve(await config?.getListApi(queryParams))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
exportConfig: {
|
||||
filename: config?.exportName,
|
||||
// 默认选中类型
|
||||
type: 'csv',
|
||||
// 自定义数据量列表
|
||||
modes: ['current', 'all'],
|
||||
columns: config?.allSchemas.printSchema
|
||||
}
|
||||
})
|
||||
|
||||
const delList = (ids: string | number | string[] | number[]) => {
|
||||
return new Promise(async () => {
|
||||
message.delConfirm().then(() => {
|
||||
|
Reference in New Issue
Block a user