将getSelectAppointItemList重命名getMatchedItems

新增getUnmatchedItems
master
LiuJiaNan 2025-12-30 15:32:17 +08:00
parent 0c39baeb49
commit f74290bdda
2 changed files with 25 additions and 5 deletions

18
src/utils/index.d.ts vendored
View File

@ -201,13 +201,25 @@ export function calculateFileSize(size: number | string): string;
export function idCardGetDateAndGender(idCard: string): { sex: "1" | "0"; date: string };
/**
* select
*
*/
export function getSelectAppointItemList<T>(options: {
export function getMatchedItems<T>(options: {
/** 获取的数组 */
list: any[];
/** 获取的值 */
value: any[];
value: (number | string)[];
/** 获取的id字段名 */
idKey?: string;
}): T[];
/**
*
*/
export function getUnmatchedItems<T>(options: {
/** 获取的数组 */
list: any[];
/** 获取的值 */
value: (number | string)[];
/** 获取的id字段名 */
idKey?: string;
}): T[];

View File

@ -343,13 +343,21 @@ export function idCardGetDateAndGender(idCard) {
}
/**
* 获取select中指定项组成的数组
* 获取匹配项
*/
export function getSelectAppointItemList(options) {
export function getMatchedItems(options) {
const { list, value, idKey = "bianma" } = options;
return list.filter(item => value.includes(item[idKey]));
}
/**
* 获取未匹配项
*/
export function getUnmatchedItems(options) {
const { list, value, idKey = "bianma" } = options;
return list.filter(item => !value.includes(item[idKey]));
}
/**
* json转换为树形结构
*/