mirror of
https://github.com/certd/certd.git
synced 2026-04-14 12:30:54 +08:00
37 lines
720 B
TypeScript
37 lines
720 B
TypeScript
import { request } from "/@/api/service";
|
|
export type ComponentPropsType = {
|
|
type?: string;
|
|
typeName?: string;
|
|
action: string;
|
|
form?: any;
|
|
value?: any;
|
|
};
|
|
export type RequestHandleReq<T = any> = {
|
|
type: string;
|
|
typeName: string;
|
|
action: string;
|
|
data?: any;
|
|
input: T;
|
|
record?: any;
|
|
fromType?: string; // sys、user
|
|
};
|
|
|
|
export async function doRequest(req: RequestHandleReq, opts: any = {}) {
|
|
const url = `/pi/handle/${req.type}`;
|
|
const { typeName, action, data, input, record, fromType } = req;
|
|
const res = await request({
|
|
url,
|
|
method: "post",
|
|
data: {
|
|
typeName,
|
|
action,
|
|
data,
|
|
input,
|
|
record,
|
|
fromType,
|
|
},
|
|
...opts,
|
|
});
|
|
return res;
|
|
}
|