feat(ui):细节调整

This commit is contained in:
huangqj
2024-03-08 10:24:38 +08:00
parent 13c9594be0
commit 5ad9adeb4a
11 changed files with 94 additions and 32 deletions

View File

@@ -1,4 +1,4 @@
import usePopup from "./usePopup";
import usePopup, { type Config } from "./usePopup";
import { Message } from "@arco-design/web-vue";
import type { Component } from "vue";
import type { BaseResponse } from "@gpt-vue/packages/type";
@@ -6,19 +6,23 @@ interface Arg {
reload?: () => void;
record?: Record<string, any>;
}
export default function (
node: Component,
api: (params?: any) => Promise<BaseResponse<any>>
api: (params?: any) => Promise<BaseResponse<any>>,
config?: Config
): (arg: Arg) => void {
const nodeProps = (arg: Arg[]) => {
return {
data: arg[0].record || {},
...config.nodeProps?.(arg),
};
};
const popupProps = (arg: Arg[], getExposed) => {
return {
width: 800,
width: 750,
maskClosable: false,
onBeforeOk: async () => {
const exposed = getExposed();
const validateRes = await exposed?.formRef.value.validate();
@@ -32,6 +36,7 @@ export default function (
arg[0]?.reload?.();
return code === 0;
},
...config.popupProps?.(arg, getExposed),
};
};

View File

@@ -4,7 +4,7 @@ import { Modal, Drawer } from "@arco-design/web-vue";
import type { ModalConfig, DrawerConfig } from "@arco-design/web-vue";
import app from "@/main";
interface Config {
export interface Config {
nodeProps?: (...arg: any) => Record<string, any>;
popupProps?: (
arg: any[],