refactor: move match live admin ui to dedicated page

This commit is contained in:
hajimi
2026-06-21 16:30:28 +08:00
parent 875a770c5a
commit f654081e8f
2 changed files with 24 additions and 13 deletions
+7 -7
View File
@@ -1,35 +1,35 @@
INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT parent.`id`, 'C', '直播线路管理', '', 0, 'match.matchLive/lists', 'match_live', 'match/lists/index', 'match/lists', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() SELECT parent.`id`, 'C', '直播线路管理', '', 0, 'match.matchLive/index', 'match_live', 'match/live/index', '/match/lists', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
FROM `la_system_menu` parent FROM `la_system_menu` parent
WHERE parent.`perms` = 'match.match/lists' WHERE parent.`perms` = 'match.match/lists'
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 FROM `la_system_menu` SELECT 1 FROM `la_system_menu`
WHERE `perms` = 'match.matchLive/lists' WHERE `perms` = 'match.matchLive/index'
); );
INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路详情', '', 0, 'match.matchLive/detail', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路详情', '', 0, 'match.matchLive/detail', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM `la_system_menu` SELECT 1 FROM `la_system_menu`
WHERE `perms` = 'match.matchLive/detail' WHERE `perms` = 'match.matchLive/detail'
); );
INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路新增', '', 0, 'match.matchLive/add', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路新增', '', 0, 'match.matchLive/add', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM `la_system_menu` SELECT 1 FROM `la_system_menu`
WHERE `perms` = 'match.matchLive/add' WHERE `perms` = 'match.matchLive/add'
); );
INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路编辑', '', 0, 'match.matchLive/edit', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路编辑', '', 0, 'match.matchLive/edit', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM `la_system_menu` SELECT 1 FROM `la_system_menu`
WHERE `perms` = 'match.matchLive/edit' WHERE `perms` = 'match.matchLive/edit'
); );
INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`) INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1), 'A', '直播线路删除', '', 0, 'match.matchLive/delete', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP() SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1), 'A', '直播线路删除', '', 0, 'match.matchLive/delete', '', '', '', '', 0, 0, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS ( WHERE NOT EXISTS (
SELECT 1 FROM `la_system_menu` SELECT 1 FROM `la_system_menu`
WHERE `perms` = 'match.matchLive/delete' WHERE `perms` = 'match.matchLive/delete'
@@ -39,7 +39,7 @@ INSERT INTO `la_system_role_menu` (`role_id`, `menu_id`)
SELECT 1, m.`id` SELECT 1, m.`id`
FROM `la_system_menu` m FROM `la_system_menu` m
WHERE m.`perms` IN ( WHERE m.`perms` IN (
'match.matchLive/lists', 'match.matchLive/index',
'match.matchLive/detail', 'match.matchLive/detail',
'match.matchLive/add', 'match.matchLive/add',
'match.matchLive/edit', 'match.matchLive/edit',
+17 -6
View File
@@ -6,6 +6,7 @@ REPO_ROOT = Path(__file__).resolve().parents[2]
MATCH_API = ROOT / "src" / "api" / "match.ts" MATCH_API = ROOT / "src" / "api" / "match.ts"
MATCH_INDEX = ROOT / "src" / "views" / "match" / "lists" / "index.vue" MATCH_INDEX = ROOT / "src" / "views" / "match" / "lists" / "index.vue"
MATCH_LIVE_TABLE = ROOT / "src" / "views" / "match" / "lists" / "components" / "MatchLiveTable.vue" MATCH_LIVE_TABLE = ROOT / "src" / "views" / "match" / "lists" / "components" / "MatchLiveTable.vue"
MATCH_LIVE_PAGE = ROOT / "src" / "views" / "match" / "live" / "index.vue"
MENU_SQL = REPO_ROOT / "docs" / "sql" / "insert_menu_match_live.sql" MENU_SQL = REPO_ROOT / "docs" / "sql" / "insert_menu_match_live.sql"
@@ -16,15 +17,20 @@ def assert_contains(path: Path, needle: str) -> None:
def main() -> None: def main() -> None:
match_api = MATCH_API.read_text(encoding="utf-8") match_api = MATCH_API.read_text(encoding="utf-8")
match_index = MATCH_INDEX.read_text(encoding="utf-8")
match_live_table = MATCH_LIVE_TABLE.read_text(encoding="utf-8") match_live_table = MATCH_LIVE_TABLE.read_text(encoding="utf-8")
match_live_page = MATCH_LIVE_PAGE.read_text(encoding="utf-8")
assert MENU_SQL.is_file(), f"missing menu seed file: {MENU_SQL}" assert MENU_SQL.is_file(), f"missing menu seed file: {MENU_SQL}"
menu_sql = MENU_SQL.read_text(encoding="utf-8") menu_sql = MENU_SQL.read_text(encoding="utf-8")
normalized_menu_sql = " ".join(menu_sql.split()) normalized_menu_sql = " ".join(menu_sql.split())
first_insert_block = menu_sql.split(";", 1)[0] + ";" first_insert_block = menu_sql.split(";", 1)[0] + ";"
normalized_first_insert = " ".join(first_insert_block.split()) normalized_first_insert = " ".join(first_insert_block.split())
assert_contains(MATCH_INDEX, 'type="expand"') assert MATCH_LIVE_PAGE.is_file(), f"missing page file: {MATCH_LIVE_PAGE}"
assert_contains(MATCH_INDEX, "MatchLiveTable") assert 'type="expand"' not in match_index, f"{MATCH_INDEX} should not use expand child table anymore"
assert "MatchLiveTable" not in match_index, f"{MATCH_INDEX} should not render MatchLiveTable inline anymore"
assert "match.matchLive/index" in match_index, f"{MATCH_INDEX} missing route perms match.matchLive/index"
assert "getRoutePath('match.matchLive/index')" in match_index, f"{MATCH_INDEX} must route to match.matchLive/index"
for needle in ( for needle in (
"matchLiveLists", "matchLiveLists",
@@ -42,6 +48,11 @@ def main() -> None:
): ):
assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing: {needle}" assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing: {needle}"
assert "MatchLiveTable" in match_live_page, f"{MATCH_LIVE_PAGE} should reuse MatchLiveTable"
assert "matchDetail" in match_live_page, f"{MATCH_LIVE_PAGE} should load match detail"
assert "useRoute" in match_live_page, f"{MATCH_LIVE_PAGE} should read route query"
assert "router.back()" in match_live_page, f"{MATCH_LIVE_PAGE} should provide back navigation"
readonly_fields = ( readonly_fields = (
'play_url_m3u8" readonly', 'play_url_m3u8" readonly',
'play_url_hd_m3u8" readonly', 'play_url_hd_m3u8" readonly',
@@ -96,7 +107,7 @@ def main() -> None:
assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing fetch_status mapping: {needle}" assert needle in match_live_table, f"{MATCH_LIVE_TABLE} missing fetch_status mapping: {needle}"
for needle in ( for needle in (
"match.matchLive/lists", "match.matchLive/index",
"match.matchLive/detail", "match.matchLive/detail",
"match.matchLive/add", "match.matchLive/add",
"match.matchLive/edit", "match.matchLive/edit",
@@ -120,7 +131,7 @@ def main() -> None:
), f"{MENU_SQL} must bind the match live menu to parent match.match/lists explicitly" ), f"{MENU_SQL} must bind the match live menu to parent match.match/lists explicitly"
assert ( assert (
"SELECT parent.`id`, 'C', '直播线路管理'" in menu_sql "SELECT parent.`id`, 'C', '直播线路管理'" in menu_sql
), f"{MENU_SQL} must insert the list menu only when the parent match.match/lists record exists" ), f"{MENU_SQL} must insert the page menu only when the parent match.match/lists record exists"
assert ( assert (
"WHERE parent.`perms` = 'match.match/lists' AND NOT EXISTS (" in normalized_first_insert "WHERE parent.`perms` = 'match.match/lists' AND NOT EXISTS (" in normalized_first_insert
), f"{MENU_SQL} first insert must combine parent binding with AND NOT EXISTS in a single WHERE predicate" ), f"{MENU_SQL} first insert must combine parent binding with AND NOT EXISTS in a single WHERE predicate"
@@ -131,8 +142,8 @@ def main() -> None:
f"{MENU_SQL} first insert should only have the outer WHERE plus the nested WHERE inside NOT EXISTS" f"{MENU_SQL} first insert should only have the outer WHERE plus the nested WHERE inside NOT EXISTS"
) )
assert ( assert (
"SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/lists' LIMIT 1)" in normalized_menu_sql "SELECT (SELECT `id` FROM `la_system_menu` WHERE `perms` = 'match.matchLive/index' LIMIT 1)" in normalized_menu_sql
), f"{MENU_SQL} child permissions must bind to the inserted match.matchLive/lists menu" ), f"{MENU_SQL} child permissions must bind to the inserted match.matchLive/index menu"
print("match live admin static checks passed") print("match live admin static checks passed")