90 lines
3.0 KiB
Python
90 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""检查工单领取菜单配置"""
|
|
|
|
import asyncio
|
|
from sqlalchemy.ext.asyncio import create_async_engine
|
|
from sqlalchemy import text
|
|
|
|
DB_CONFIG = {
|
|
'host': '123.57.81.127',
|
|
'port': 3306,
|
|
'user': 'cpy_admin',
|
|
'password': 'Tgzz2025+',
|
|
'database': 'ruoyi-fastapi'
|
|
}
|
|
|
|
DATABASE_URL = (
|
|
f"mysql+asyncmy://{DB_CONFIG['user']}:{DB_CONFIG['password']}@"
|
|
f"{DB_CONFIG['host']}:{DB_CONFIG['port']}/{DB_CONFIG['database']}"
|
|
)
|
|
|
|
async def check_workorder_menu():
|
|
engine = create_async_engine(DATABASE_URL, echo=False)
|
|
|
|
async with engine.connect() as conn:
|
|
print("=" * 80)
|
|
print("Work Order Menu Configuration")
|
|
print("=" * 80)
|
|
|
|
# 1. 检查工单管理目录
|
|
print("\n[1] Work Order Management Directory:")
|
|
result = await conn.execute(text("""
|
|
SELECT menu_id, menu_name, path, component, menu_type, visible, status
|
|
FROM sys_menu
|
|
WHERE path = 'workorder' AND menu_type = 'M'
|
|
"""))
|
|
row = result.fetchone()
|
|
if row:
|
|
print(f" ID: {row[0]}")
|
|
print(f" Name: {row[1]}")
|
|
print(f" Path: {row[2]}")
|
|
print(f" Component: {row[3]}")
|
|
print(f" Type: {row[4]}")
|
|
print(f" Visible: {row[5]}")
|
|
print(f" Status: {row[6]}")
|
|
|
|
# 2. 检查工单领取菜单
|
|
print("\n[2] Work Order Claim Menu:")
|
|
result = await conn.execute(text("""
|
|
SELECT menu_id, menu_name, parent_id, path, component, menu_type, visible, status, perms
|
|
FROM sys_menu
|
|
WHERE path = 'workorder/claim'
|
|
"""))
|
|
row = result.fetchone()
|
|
if row:
|
|
print(f" ID: {row[0]}")
|
|
print(f" Name: {row[1]}")
|
|
print(f" Parent ID: {row[2]}")
|
|
print(f" Path: {row[3]}")
|
|
print(f" Component: {row[4]}")
|
|
print(f" Type: {row[5]}")
|
|
print(f" Visible: {row[6]}")
|
|
print(f" Status: {row[7]}")
|
|
print(f" Perms: {row[8]}")
|
|
else:
|
|
print(" [WARN] Not found!")
|
|
|
|
# 3. 检查所有工单相关菜单
|
|
print("\n[3] All Work Order Related Menus:")
|
|
result = await conn.execute(text("""
|
|
SELECT menu_id, menu_name, parent_id, path, component, menu_type
|
|
FROM sys_menu
|
|
WHERE path LIKE '%workorder%' OR menu_name LIKE '%工单%'
|
|
ORDER BY menu_id
|
|
"""))
|
|
rows = result.fetchall()
|
|
for row in rows:
|
|
print(f" ID:{row[0]} | Parent:{row[2]} | Type:{row[5]} | Path:{row[3]}")
|
|
print(f" Name: {row[1]}")
|
|
print(f" Component: {row[4]}")
|
|
print()
|
|
|
|
print("\n" + "=" * 80)
|
|
print("\nExpected frontend component path: workorder/claim/index")
|
|
print("Database component path should be: workorder/claim/index")
|
|
|
|
await engine.dispose()
|
|
|
|
if __name__ == '__main__':
|
|
asyncio.run(check_workorder_menu())
|