|
|
@ -39,6 +39,7 @@ export interface Action { |
|
|
|
type?: string; //按钮 primary | ghost | dashed | link | text | default
|
|
|
|
dynamicDisabled?: boolean | Function; |
|
|
|
isReload?: boolean; |
|
|
|
isClearCheck?: boolean; // 清空table选中行数据
|
|
|
|
state?: String; // edit 为编辑态 其他为编辑中
|
|
|
|
extra?: Recordable; |
|
|
|
} |
|
|
@ -50,11 +51,12 @@ export interface Action { |
|
|
|
*/ |
|
|
|
interface actionParams { |
|
|
|
reload?: Function; |
|
|
|
clearCheck?: Function; |
|
|
|
} |
|
|
|
export function useAction(actionParams: actionParams = {}) { |
|
|
|
const router = useRouter(); |
|
|
|
const route = useRoute(); |
|
|
|
const { reload } = actionParams; |
|
|
|
const { reload, clearCheck } = actionParams; |
|
|
|
const { getPath } = usePath(); |
|
|
|
const { httpRequest } = useApi(); |
|
|
|
const authService = authorizationService(); |
|
|
@ -169,6 +171,7 @@ export function useAction(actionParams: actionParams = {}) { |
|
|
|
checkDefaultParams, |
|
|
|
handle, |
|
|
|
isReload = false, |
|
|
|
isClearCheck = false, |
|
|
|
extra, |
|
|
|
} = action; |
|
|
|
const { getParams } = useParams(); |
|
|
@ -239,6 +242,7 @@ export function useAction(actionParams: actionParams = {}) { |
|
|
|
api: null, |
|
|
|
handle, |
|
|
|
isReload, |
|
|
|
isClearCheck, |
|
|
|
}; |
|
|
|
let modelInstance: Recordable = {}; |
|
|
|
if (name && name.toLowerCase().includes('exports')) { |
|
|
@ -332,6 +336,9 @@ export function useAction(actionParams: actionParams = {}) { |
|
|
|
if (isReload) { |
|
|
|
isFunction(reload) && reload(); |
|
|
|
} |
|
|
|
if (isClearCheck) { |
|
|
|
isFunction(clearCheck) && clearCheck(); |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
modeUpdate({ |
|
|
|
okButtonProps: { |
|
|
|