@chase-shao/vue-component-lib
Version:
[](https://github.com/your-username/vue-component-lib)
147 lines (146 loc) • 4.31 kB
TypeScript
import { RedirectType } from '../types';
import { ActionTypeEnum } from '../components/data-gen/actions/types';
import { FileItem } from '@arco-design/web-vue';
export type SelectOption = {
value: string | number;
label: string;
[key: string]: unknown;
};
export type WidgetConfig = {
widget: string;
readonly: boolean;
title: string;
dataSourceProvider: string;
options?: SelectOption[];
multiple?: boolean;
remote?: string;
uploadURL?: string;
files?: FileItem[];
removeFile?: (attachmentId: string) => Promise<void>;
[key: string]: unknown;
};
export type ValidationConfig = {
ruleName: string;
ruleParameter: any;
errorMessage: string;
};
export type Trigger = {
event: string;
handlerName: string;
};
export type FieldConfig = {
widget?: WidgetConfig;
order?: number;
validations: ValidationConfig[];
modelValue?: any;
column?: boolean;
triggers?: Trigger[];
uiFilters?: any[];
isFiltered: boolean;
dependent: string;
fieldValue?: any;
};
export type TabsConfig = {
key: string;
title: string;
filters: Record<string, any>[];
order: number;
};
export type Action = {
redirectUrl: string;
location: 'InTable' | 'InOperation';
attributeType: 'UIControl';
readonly: boolean;
widget: ActionTypeEnum;
title: string;
isSubmit: boolean;
requestUrl?: string;
redirectType?: 'Create' | 'Details' | 'Update';
};
export type PageConfig = {
pageType: string;
fields: Record<string, FieldConfig>;
actions?: Action[];
globalValidations: Array<{
rule: string;
errorMessage: string;
param?: any;
appliesTo: string[];
}>;
tabs?: TabsConfig[];
banner: {
title: string;
subTitle: string;
};
};
export declare enum PageActionType {
Create = 0,
Update = 1,
Details = 2,
List = 3
}
export declare const getPageData: (type: PageActionType, className: string, store: {
svrStore: any;
bpmStore: any;
}, opt?: {
workflowId: string;
}) => Promise<PageConfig>;
export declare const getBtnList: (type: PageActionType, className: string, opt: {
workflowId: string;
email: string;
}) => Promise<{
button: string;
isShow: boolean;
}[]>;
export type ListDataRes = {
__ClassAttributes: {
redirectUrl: string;
location: 'InTable' | 'InOperation';
attributeType: 'UIControl';
readonly: boolean;
widget: 'Link';
title: 'Approve' | 'Create' | 'Update';
isSubmit: boolean;
redirectType: RedirectType;
}[];
data: object[];
totalCount: number;
};
export type Paging = {
current: number;
total: number;
pageSize: number;
defaultPageSize: number;
showTotal: boolean;
showPageSize: boolean;
filters: Record<string, any>[];
};
export declare function getListData(className: string, params: {
filters: object[];
sorts: object[];
pageNumber: number;
pageSize: number;
}): Promise<{
data: object[];
totalCount: number;
}>;
export declare function createData(className: string, data: object, url: string): Promise<number>;
export declare function updateData(className: string, id: string, data: object, url: string): Promise<any>;
export declare function approveData(className: string, id: string, email: string, reason: string, data: object, url: string, status: string, ifGlobal: string): Promise<any>;
export declare function getOptions(url: string, value?: string): Promise<SelectOption[]>;
export declare function getProcess(className: string, workflowId: string): Promise<any[]>;
export declare function getFiles(className: string, workflowId: string): Promise<{
[key: string]: any[];
}>;
export declare function removeFile(className: string, attachmentId: string): Promise<void>;
export declare function getApprovers(): Promise<{
label: string;
value: string;
}[]>;
export declare function assignApprover(workflowId: string, email: string): Promise<void>;
export declare function addComments(workflowId: string, email: string, comments: string): Promise<void>;
export declare function getCommentsHistory(workflowId: string): Promise<{
associator: string;
comments: string;
createdAt: string;
}[]>;