mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-21 05:25:45 +08:00
♻️ 调整筛选逻辑
This commit is contained in:
@@ -507,24 +507,20 @@ function selectRole(role: TGApp.Sqlite.Character.TableTrans): void {
|
|||||||
|
|
||||||
function handleSelect(val: UavSelectModel): void {
|
function handleSelect(val: UavSelectModel): void {
|
||||||
selectOpts.value = val;
|
selectOpts.value = val;
|
||||||
const filterC = AppCharacterData.filter((avatar) => {
|
const filterC = roleList.value.filter((role) => {
|
||||||
if (val.star.length > 0 && !val.star.includes(avatar.star.toString())) return false;
|
const info = AppCharacterData.find((i) => i.id === role.cid);
|
||||||
if (val.weapon.length > 0 && !val.weapon.includes(avatar.weapon)) return false;
|
if (val.star.length > 0 && !val.star.includes(role.avatar.rarity.toString())) return false;
|
||||||
if (val.element.length > 0 && !val.element.includes(avatar.element)) return false;
|
if (val.weapon.length > 0 && !val.weapon.includes(role.weapon.type_name)) return false;
|
||||||
if (val.area.length > 0 && !val.area.includes(avatar.area)) return false;
|
if (val.element.length > 0 && !val.element.includes(getZhElement(role.avatar.element)))
|
||||||
return roleList.value.find(
|
return false;
|
||||||
(role) =>
|
return !(val.area.length > 0 && !val.area.includes(info?.area ?? ""));
|
||||||
role.avatar.id === avatar.id && getZhElement(role.avatar.element) === avatar.element,
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
if (filterC.length === 0) {
|
if (filterC.length === 0) {
|
||||||
showSnackbar.warn("未找到符合条件的角色");
|
showSnackbar.warn("未找到符合条件的角色");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showSnackbar.success(`筛选出符合条件的角色 ${filterC.length} 个`);
|
showSnackbar.success(`筛选出符合条件的角色 ${filterC.length} 个`);
|
||||||
const selectedId = filterC.map((item) => item.id);
|
selectedList.value = getOrderedList(filterC);
|
||||||
const tmpSelect = roleList.value.filter((role) => selectedId.includes(role.cid));
|
|
||||||
selectedList.value = getOrderedList(tmpSelect);
|
|
||||||
if (!dataVal.value) return;
|
if (!dataVal.value) return;
|
||||||
if (!selectedList.value.includes(dataVal.value)) {
|
if (!selectedList.value.includes(dataVal.value)) {
|
||||||
dataVal.value = selectedList.value[0];
|
dataVal.value = selectedList.value[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user