mirror of
https://github.com/Genshin-bots/gsuid_core.git
synced 2025-05-07 20:45:57 +08:00
🐛 修复BUG, 网页控制台选择框也支持输入文字, 数据库搜索模糊匹配
This commit is contained in:
parent
2979a39d99
commit
a5519ca6c1
@ -419,7 +419,7 @@ async def draw_plugins_status():
|
||||
(605 + 210 * indexj, 11),
|
||||
badge,
|
||||
)
|
||||
if index >= 2:
|
||||
if indexj >= 2:
|
||||
break
|
||||
|
||||
img.paste(
|
||||
|
@ -117,7 +117,7 @@ def get_alert(
|
||||
|
||||
def get_select_panel(label: str, name: str, value: str, options: List[str]):
|
||||
return {
|
||||
'type': 'select',
|
||||
'type': 'input-text',
|
||||
'label': label,
|
||||
'name': name,
|
||||
'options': [{'label': option, 'value': option} for option in options],
|
||||
|
@ -1,6 +1,6 @@
|
||||
# flake8: noqa
|
||||
import platform
|
||||
from typing import Any, Callable
|
||||
from typing import Any, Dict, List, Callable
|
||||
|
||||
from starlette import status
|
||||
from pydantic import BaseModel
|
||||
@ -13,11 +13,13 @@ from fastapi_user_auth.auth.models import User
|
||||
from fastapi_amis_admin.models.fields import Field
|
||||
from fastapi import Depends, Request, HTTPException
|
||||
from fastapi_user_auth.admin.app import UserAuthApp
|
||||
from sqlalchemy.sql.elements import BinaryExpression
|
||||
from fastapi_amis_admin.admin.settings import Settings
|
||||
from fastapi_user_auth.admin.site import AuthAdminSite
|
||||
from fastapi_amis_admin.utils.translation import i18n as _
|
||||
from fastapi_amis_admin.admin import Settings, PageSchemaAdmin
|
||||
from fastapi_amis_admin.admin.site import FileAdmin, APIDocsApp
|
||||
from fastapi_amis_admin.crud.parser import get_python_type_parse
|
||||
from fastapi_amis_admin.amis.constants import LevelEnum, DisplayModeEnum
|
||||
from fastapi_user_auth.admin.admin import (
|
||||
FormAdmin,
|
||||
@ -329,6 +331,23 @@ class GsAdminModel(admin.ModelAdmin):
|
||||
request
|
||||
)
|
||||
|
||||
def calc_filter_clause(
|
||||
self, data: Dict[str, Any]
|
||||
) -> List[BinaryExpression]:
|
||||
lst = []
|
||||
for k, v in data.items():
|
||||
sqlfield = self._filter_entities.get(k)
|
||||
v = '[~]' + v
|
||||
if sqlfield is not None:
|
||||
operator, val = self._parser_query_value(
|
||||
v,
|
||||
python_type_parse=get_python_type_parse(sqlfield),
|
||||
)
|
||||
if operator:
|
||||
sql = getattr(sqlfield, operator)(*val)
|
||||
lst.append(sql)
|
||||
return lst
|
||||
|
||||
|
||||
class GsAdminPage(admin.PageAdmin):
|
||||
async def has_page_permission(
|
||||
|
Loading…
x
Reference in New Issue
Block a user