You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
673 B

# -*- coding:utf-8 -*-
"""
@Created on : 2023/5/24 13:59
@Author: hxl
@Des: 试剂大类
"""
from fastapi import APIRouter
from conf import setting
from helper import respond_to
from models import Archive
router = APIRouter(prefix='/archives')
@router.get('', summary='大类下拉列表')
async def index():
"""
获取大类下拉列表
:return:
"""
archives = await Archive.all().order_by('rank').values('id', 'name', 'params')
archives = [{"name": archive['name'], "id": archive['id'], "params": archive['params']} for archive in archives]
data = {'items': archives, 'select': setting.DEFAULT_ARCHIVE_ID}
return respond_to(data=data)