3. 表单设计

3.1 查询

3.2 新增

3.3 设计

3.3.1 组件

3.3.1.1 常用组件

3.3.1.2 图表组件

3.3.1.1 自定义组件

3.3.2 在表单上下文中可以直接调用的方法

/**
 * This function takes two arrays, `srcData` and `dstData`, and compares each element in `srcData` to every element in `dstData`. If the comparison function returns true, the element from `dstData` is added to a temporary array called `temp`. Otherwise, the element from `srcData` is used to create a new element using the `newData` function and added to `temp`. Finally, the `dstData` array is updated with the elements in `temp`.
 *
 * @param values - An object containing the data for the two arrays.
 * @param field1 - The name of the field in `values` that contains the `srcData` array.
 * @param field2 - The name of the field in `values` that contains the `dstData` array.
 * @param compare - A function that takes two elements from the `srcData` and `dstData` arrays and returns true if they are equal.
 * @param newData - A function that takes an element from the `srcData` array and creates a new element to be added to the `dstData` array.
 */
export declare function submitBeforeConvertArrayData(values: any, field1: string, field2: string, compare: (data1: any, data2: any) => boolean, newData: (values: any, field1Data: any) => any): void;
/**
 * Removes any data from `dstData` that is not present in `srcData` using the provided comparison function. It also calls the `removeFn` function for each removed data item.
 * @param {any[]} srcData - The source data array.
 * @param {any[]} dstData - The destination data array.
 * @param {function(data1: any, data2: any): boolean} compare - The comparison function to use for determining if two data items are the same.
 * @param {function(field1Data: any): any} newData - The function to call to create a new data item if it is not found in `dstData`.
 * @param {function(data2: any): void} removeFn - The function to call for each removed data item.
 * @returns {any[]} The updated destination data array.
 */
export declare function removeAdd(srcData: any[], dstData: any[], compare: (data1: any, data2: any) => boolean, newData: (field1Data: any) => any, removeFn: (data2: any) => void): any[];
/**
 * 转换树形数据并添加 key、value、label 和 title 属性
 * 原方法名称: convertTreeData
 * @param $self - 当前组件的实例
 * @param url - 数据请求的 URL
 */
export declare function convertAndEnhanceTreeData($self: any, url: string): Promise<void>;
/**
 * 转换树形数据并根据提供的函数自定义 value 和 label 属性
 * 原方法名称: convertTreeDataLableAndValue
 * @param $self - 当前组件的实例
 * @param url - 数据请求的 URL
 * @param valueFn - 根据 item 计算 value 的函数
 * @param labelFn - 根据 item 计算 label 的函数
 * @param success - 成功回调函数,可选
 *
 * 使用示例:
 * convertAndCustomizeTreeDataLabelsAndValues($self, 'https://api.example.com/data', item => item.id, item => item.name, data => console.log(data));
 */
export declare function convertAndCustomizeTreeDataLabelsAndValues($self: any, url: string, valueFn: (item: any) => any, labelFn: (item: any) => string, success?: (data: any[]) => void): Promise<void>;
/**
 * 将数据转换为树形结构,并为每个节点设置 key、value 和 label 属性。
 * @param $self - 当前组件的实例
 * @param data - 需要转换的数据数组
 */
export declare function convertDataToTree($self: any, data: any): void;
/**
 * 将数据转换为树形结构,并为每个节点设置 key、value 和 label 属性。
 * @param $self - 当前组件的实例
 * @param data - 需要转换的数据数组
 */
export declare function convertDataToTree2($self: any, data: any): void;
/**
 * 将 tags 字段转换为标签数组。
 * @param $deps - 当前组件的依赖项对象
 * @param $self - 当前组件的实例
 * @param tagsField - 需要转换的 tags 字段名
 * @param tagNameField - 标签名称字段名
 */
export declare function convertTags($deps: any, $self: any, tagsField: string, tagNameField: string): void;
/**
 * 将 url 获取的数据转换为 Select 组件所需的格式。
 * @param $self - 当前组件的实例
 * @param url - 数据来源的 URL
 * @param labelFieldName - 需要转换的 label 字段名
 * @param sucess - 成功获取数据后的回调函数,接受转换后的数组和原始响应对象作为参数
 */
export declare function convertSelectData($self: any, url: string, labelFieldName: string, success?: (temp: any[], res?: any) => {}): void;
/**
 * 将 url 获取的数据转换为 Select 组件所需的格式,同时为每个项设置 value 字段。
 * @param $self - 当前组件的实例
 * @param url - 数据来源的 URL
 * @param valueFn - 定义每个项 value 属性的函数
 * @param labelFieldName - 需要转换的 label 字段名
 * @param sucess - 成功获取数据后的回调函数,接受转换后的数组和原始响应对象作为参数
 */
export declare function convertSelectDataLabel($self: any, url: string, labelFn: (item: any) => string, sucess?: (temp: any[], res?: any) => {}): void;
/**
 * 转换选择数据的标签和值
 * 原方法名称: convertSelectDataLableAndValue
 * @param $self - 当前组件的实例
 * @param url - 数据请求的 URL
 * @param valueFn - 根据 item 计算 value 的函数
 * @param labelFn - 根据 item 计算 label 的函数
 * @param success - 成功回调函数,可选
 *
 * 使用例子:
 * transformSelectDataLabelAndValue(this, '/api/data', item => item.id, item => item.name, (temp, res) => {
 *   console.log('转换后的数据:', temp);
 * });
 */
export declare function transformSelectDataLabelAndValue($self: any, url: string, valueFn: (item: any) => any, labelFn: (item: any) => string, success?: (temp: any[], res?: any) => {}): void;
/**
 * 转换为选择器数据源
 * 原方法名称: convertToSelectDataSource
 * @param $self - 当前组件的实例
 * @param url - 数据请求的 URL
 * @param valueFn - 根据 item 计算 value 的函数
 * @param labelFn - 根据 item 计算 label 的函数
 * @param success - 成功回调函数,可选
 * @param getData - 获取数据的函数,可选
 */
export declare function transformToSelectDataSource($self: any, url: string, valueFn: (item: any) => any, labelFn: (item: any) => string, success?: (temp: any[], res?: any) => {}, getData?: (obj: any) => any): void;
/**
 * 更新选择器组件的值
 * @param $self - 当前组件的实例
 * @param temp - 选择器的选项数据源
 */
export declare function updateSelectValue($self: any, temp: any[]): void;
/**
 * 将文件数据转换为新的格式
 * @param $deps - 依赖对象,包含 getToken 函数和 convertFiles 方法
 * @param $self - 当前组件的实例
 * @param filesFieldName - 文件字段的名称
 * @param urlPrefix - 文件下载 URL 前缀,可选
 */
export declare function convertFilesData($deps: any, $self: any, filesFieldName: string, urlPrefix?: string): void;
/**
 * 将文件数组转换为新的格式
 * @param $deps - 依赖对象,包含 getToken 函数和 convertFiles 方法
 * @param $self - 当前组件的实例
 * @param filesFieldName - 文件字段的名称
 * @param fileIDField - 文件 ID 字段名
 * @param fileNameField - 文件名称字段名
 * @param fileTypeField - 文件类型字段名
 * @param urlPrefix - 文件下载 URL 前缀,可选
 */
export declare function convertFiles($deps: any, $self: any, filesFieldName: string, fileIDField: string, fileNameField: string, fileTypeField: string, urlPrefix?: string): void;
/**
 * 将文件数据转换为新的格式
 * @param $self - 当前组件的实例
 * @param oldFile - 原始文件对象
 * @param urlPrefix - 文件下载 URL 前缀,可选
 */
export declare function convertFileData($self: any, oldFile: any, urlPrefix?: string): void;
/**
 * 将单个文件对象转换为新的格式
 * @param $self - 当前组件的实例
 * @param obj - 原始文件对象
 * @param fileIDField - 文件 ID 字段名
 * @param fileNameField - 文件名称字段名
 * @param fileTypeField - 文件类型字段名
 * @param urlPrefix - 文件下载 URL 前缀,可选
 */
export declare function convertFile($self: any, obj: any, fileIDField: string, fileNameField: string, fileTypeField: string, urlPrefix?: string): void;
/**
 * 创建一个文件对象,包含response、url、type和name字段
 * @param obj - 原始文件对象
 * @param fileIDField - 文件 ID 字段名
 * @param fileNameField - 文件名称字段名,可选
 * @param fileTypeField - 文件类型字段名,可选
 * @param urlPrefix - 文件下载 URL 前缀,可选
 */
export declare function createFile(obj: any, fileIDField: string, fileNameField?: string, fileTypeField?: string, urlPrefix?: string): {
    response: {
        fileID: any;
    };
    url: string;
    type: any;
    name: any;
};
/**
 * 将新文件与旧文件比对,找出新增的文件并进行处理
 * @param values - 表单数据
 * @param field1 - 新文件字段名
 * @param field2 - 旧文件字段名
 * @param compare - 文件对比函数,用于比较新文件和旧文件是否相同
 * @param newData - 处理新增文件的函数,用于将新文件转换为新的格式
 */
export declare function submitBeforeConvertFilesData(values: any, field1: string, field2: string, compare: (data1: any, data2: any) => boolean, newData: (values: any, field1Data: any) => any): void;
export declare function submitBeforeConvertFileData(values: any, fromFileField: string): void;
export declare function fileToValue(values: any, fromFileField: string, fileIDField: string, fileNameField?: string, fileTypeField?: string, fileSizeField?: string): void;
export declare function filesToValue(values: any, fromFileField: string, toFileField: string, fileIDField: string, fileNameField?: string, fileTypeField?: string, fileSizeField?: string): void;
/** 将级联选择器值转换为数组,并设置idField和parentIDsField的值。
 *
 * @param values 表单值。
 * @param idField 要设置的ID字段。
 * @param idsField 级联选择器的值字段。
 * @param parentIDsField 要设置的父级ID字段。
 * @returns undefined
 */
export declare function submitBeforeConvertCascaderData(values: any, idField: string, idsField: string, parentIDsField: string): void;
/** 将级联选择器值转换为数组,并设置idField和parentIDsField的值。
 * 此函数接受一个表单值对象,以及三个参数:idField、idsField和parentIDsField。它会提取级联选择器的值,并将其转换为一个数组。它还会设置idField和parentIDsField的值。如果级联选择器的值为空,则设置idField和parentIDsField的值为空。
 * @param values 表单值对象。
 * @param idField 要设置的ID字段。
 * @param idsField 级联选择器的值字段。
 * @param parentIDsField 要设置的父级ID字段。
 * @returns undefined。该函数不会返回任何值。它会修改传入的表单值对象。
 */
export declare function convertCascaderData($self: any, values: any, idField: string, parentIDsField: string): void;
/** Converts a timestamp to a string using the specified format. The default format is "YYYY-MM-DD HH:mm".
 *
 * @param value The timestamp to convert.
 * @param format The format to use for the string. If not provided, the default format will be used.
 * @returns A string representation of the timestamp.
 */
export declare function timeStampToString(value: any, format?: string): string;
/** Converts a timestamp to a string using the specified format. The default format is "YYYY-MM-DD HH:mm".
 * This function takes a timestamp value and an optional format string as input. It returns a string representation of the timestamp in the specified format. If no format is provided, the default format will be used. The `moment` library is used to perform the conversion.
 *
 * @param value The timestamp to convert.
 * @param format The format to use for the string. If not provided, the default format will be used.
 * @returns A string representation of the timestamp.
 */
export declare function timeStamp2ToString(value: any, format?: string): string;
/** This function formats a currency value as a string. It takes a value as input and returns a string with the currency symbol and the value formatted with commas every 3 digits. The default currency symbol is "$". You can specify a custom currency symbol by passing it as an argument.
 *
 * @param value The currency value to format.
 * @param symbol The currency symbol to use. If not provided, the default symbol will be used.
 * @returns A string representation of the currency value.
 */
export declare function currencyFormatter(value: string | number, symbol?: string): string;
/** This function parses a currency value string and returns the numeric value. It removes any currency symbol or commas from the input string before returning the numeric value. The default currency symbol is "$". You can specify a custom currency symbol by passing it as an argument.
 *
 * @param value The currency value string to parse.
 * @param symbol The currency symbol to use. If not provided, the default symbol will be used.
 * @returns The numeric value of the currency string.
 */
export declare function currencyParse(value: string, symbol?: string): number;
/** 获取当前时间。返回格式为 "YYYY-MM-DD HH:mm:ss" 的字符串。 */
export declare function getCurrentTime(): string;
/** 获取当前日期。返回格式为 "YYYY-MM-DD" 的字符串。 */
export declare function getCurrentDate(): string;
export declare function isPlatformTenant(platformTenantID: string): boolean;

export declare function commonService: CommonService<any>;
export declare function getToken():string;
export declare function getTenantID():string;
export declare function getUserInfo():ProfileInfo;