menu-seeds.ts 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. import type { Prisma, MenuType } from '@prisma/mysql/client';
  2. export interface SeedMenu {
  3. legacyId: number;
  4. legacyParentId: number | null;
  5. title: string; // Chinese display title
  6. type: MenuType; // DIRECTORY | MENU | SUBMENU | BUTTON
  7. name: string; // English, camelCase
  8. path: string; // English, /kebab-case/route
  9. icon: string | null; // Iconify / material-symbols / mdi
  10. order: number; // Sort order
  11. meta?: Prisma.JsonValue;
  12. }
  13. /**
  14. * Hybrid style:
  15. * - title: Chinese (for UI)
  16. * - name/path/icon: English & structured
  17. */
  18. export const MENU_SEEDS: SeedMenu[] = [
  19. // ======================
  20. // 营销中心 (Marketing)
  21. // ======================
  22. {
  23. legacyId: 1,
  24. legacyParentId: null,
  25. title: '营销中心',
  26. type: 'DIRECTORY',
  27. name: 'marketingRoot',
  28. path: '/marketing',
  29. icon: 'material-symbols-light:campaign',
  30. order: 100,
  31. meta: {
  32. title: '营销中心',
  33. i18n: 'route.marketing.root',
  34. icon: 'material-symbols-light:campaign',
  35. },
  36. },
  37. {
  38. legacyId: 2,
  39. legacyParentId: 1,
  40. title: '视频管理',
  41. type: 'MENU',
  42. name: 'marketingVideos',
  43. path: '/marketing/videos',
  44. icon: 'material-symbols-light:notifications-active-outline',
  45. order: 1,
  46. meta: {
  47. title: '视频管理',
  48. i18n: 'route.marketing.videos',
  49. icon: 'material-symbols-light:notifications-active-outline',
  50. },
  51. },
  52. {
  53. legacyId: 3,
  54. legacyParentId: 1,
  55. title: '分类管理',
  56. type: 'MENU',
  57. name: 'marketingCategories',
  58. path: '/marketing/categories',
  59. icon: 'material-symbols-light:ads-click-rounded',
  60. order: 2,
  61. meta: {
  62. title: '分类管理',
  63. i18n: 'route.marketing.categories',
  64. icon: 'material-symbols-light:ads-click-rounded',
  65. },
  66. },
  67. {
  68. legacyId: 4,
  69. legacyParentId: 1,
  70. title: '标签管理',
  71. type: 'MENU',
  72. name: 'marketingTags',
  73. path: '/marketing/tags',
  74. icon: 'material-symbols-light:label-outline',
  75. order: 3,
  76. meta: {
  77. title: '标签管理',
  78. i18n: 'route.marketing.tags',
  79. icon: 'material-symbols-light:label-outline',
  80. },
  81. },
  82. {
  83. legacyId: 5,
  84. legacyParentId: 1,
  85. title: '广告管理',
  86. type: 'MENU',
  87. name: 'marketingAds',
  88. path: '/marketing/ads',
  89. icon: 'material-symbols-light:group-outline',
  90. order: 4,
  91. meta: {
  92. title: '广告管理',
  93. i18n: 'route.marketing.ads',
  94. icon: 'material-symbols-light:group-outline',
  95. },
  96. },
  97. {
  98. legacyId: 6,
  99. legacyParentId: 1,
  100. title: '参数管理',
  101. type: 'MENU',
  102. name: 'marketingParams',
  103. path: '/marketing/params',
  104. icon: 'material-symbols-light:format-quote',
  105. order: 5,
  106. meta: {
  107. title: '参数管理',
  108. i18n: 'route.marketing.params',
  109. icon: 'material-symbols-light:format-quote',
  110. },
  111. },
  112. // ======================
  113. // 数据中心 (Data Center)
  114. // ======================
  115. {
  116. legacyId: 7,
  117. legacyParentId: null,
  118. title: '数据中心',
  119. type: 'DIRECTORY',
  120. name: 'dataCenterRoot',
  121. path: '/data',
  122. icon: 'material-symbols-light:monitoring',
  123. order: 200,
  124. meta: {
  125. title: '数据中心',
  126. i18n: 'route.data.root',
  127. icon: 'material-symbols-light:monitoring',
  128. },
  129. },
  130. {
  131. legacyId: 8,
  132. legacyParentId: 7,
  133. title: 'APP访问记录',
  134. type: 'MENU',
  135. name: 'dataAppAccessLogs',
  136. path: '/data/app-access-logs',
  137. icon: 'material-symbols-light:smartphone',
  138. order: 1,
  139. meta: {
  140. title: 'APP访问记录',
  141. i18n: 'route.data.appAccessLogs',
  142. icon: 'material-symbols-light:smartphone',
  143. },
  144. },
  145. {
  146. legacyId: 9,
  147. legacyParentId: 7,
  148. title: '广告点击记录',
  149. type: 'MENU',
  150. name: 'dataAdsClickLogs',
  151. path: '/data/ads-click-logs',
  152. icon: 'mdi:bank-transfer',
  153. order: 2,
  154. meta: {
  155. title: '广告点击记录',
  156. i18n: 'route.data.adsClickLogs',
  157. icon: 'mdi:bank-transfer',
  158. },
  159. },
  160. // ======================
  161. // 统计中心 (Stats Center)
  162. // ======================
  163. {
  164. legacyId: 10,
  165. legacyParentId: null,
  166. title: '统计中心',
  167. type: 'DIRECTORY',
  168. name: 'statsCenterRoot',
  169. path: '/stats',
  170. icon: 'material-symbols-light:query-stats',
  171. order: 300,
  172. meta: {
  173. title: '统计中心',
  174. i18n: 'route.stats.root',
  175. icon: 'material-symbols-light:query-stats',
  176. },
  177. },
  178. {
  179. legacyId: 11,
  180. legacyParentId: 10,
  181. title: '每日统计',
  182. type: 'MENU',
  183. name: 'statsDaily',
  184. path: '/stats/daily',
  185. icon: 'material-symbols-light:today',
  186. order: 1,
  187. meta: {
  188. title: '每日统计',
  189. i18n: 'route.stats.daily',
  190. icon: 'material-symbols-light:today',
  191. },
  192. },
  193. {
  194. legacyId: 12,
  195. legacyParentId: 10,
  196. title: '广告统计',
  197. type: 'MENU',
  198. name: 'statsAds',
  199. path: '/stats/ads',
  200. icon: 'material-symbols-light:insights',
  201. order: 2,
  202. meta: {
  203. title: '广告统计',
  204. i18n: 'route.stats.ads',
  205. icon: 'material-symbols-light:insights',
  206. },
  207. },
  208. {
  209. legacyId: 13,
  210. legacyParentId: 10,
  211. title: '广告汇总',
  212. type: 'MENU',
  213. name: 'statsAdsSummary',
  214. path: '/stats/ads-summary',
  215. icon: 'material-symbols-light:stacked-line-chart',
  216. order: 3,
  217. meta: {
  218. title: '广告汇总',
  219. i18n: 'route.stats.adsSummary',
  220. icon: 'material-symbols-light:stacked-line-chart',
  221. },
  222. },
  223. {
  224. legacyId: 14,
  225. legacyParentId: 10,
  226. title: '网站统计',
  227. type: 'MENU',
  228. name: 'statsSite',
  229. path: '/stats/site',
  230. icon: 'material-symbols-light:language',
  231. order: 4,
  232. meta: {
  233. title: '网站统计',
  234. i18n: 'route.stats.site',
  235. icon: 'material-symbols-light:language',
  236. },
  237. },
  238. // ======================
  239. // 账号管理 (Account)
  240. // ======================
  241. {
  242. legacyId: 15,
  243. legacyParentId: null,
  244. title: '系统管理',
  245. type: 'DIRECTORY',
  246. name: 'systemRoot',
  247. path: '/system',
  248. icon: 'ic:round-manage-accounts',
  249. order: 400,
  250. meta: {
  251. title: '系统管理',
  252. i18n: 'route.system.root',
  253. icon: 'ic:round-manage-accounts',
  254. },
  255. },
  256. {
  257. legacyId: 16,
  258. legacyParentId: 15,
  259. title: '系统用户',
  260. type: 'MENU',
  261. name: 'systemUsers',
  262. path: '/system/users',
  263. icon: 'mdi:account-multiple-outline',
  264. order: 1,
  265. meta: {
  266. title: '系统用户',
  267. i18n: 'route.system.users',
  268. icon: 'mdi:account-multiple-outline',
  269. },
  270. },
  271. {
  272. legacyId: 17,
  273. legacyParentId: 15,
  274. title: '角色列表',
  275. type: 'MENU',
  276. name: 'systemRoles',
  277. path: '/system/roles',
  278. icon: 'mdi:account-tie-hat',
  279. order: 20,
  280. meta: {
  281. title: '角色列表',
  282. i18n: 'route.system.roles',
  283. icon: 'mdi:account-tie-hat',
  284. },
  285. },
  286. {
  287. legacyId: 18,
  288. legacyParentId: 15,
  289. title: '菜单管理',
  290. type: 'MENU',
  291. name: 'systemMenus',
  292. path: '/system/menus',
  293. icon: 'mdi:menu-open',
  294. order: 30,
  295. meta: {
  296. title: '菜单管理',
  297. i18n: 'route.system.menus',
  298. icon: 'mdi:menu-open',
  299. },
  300. },
  301. {
  302. legacyId: 19,
  303. legacyParentId: 15,
  304. title: '操作日志',
  305. type: 'MENU',
  306. name: 'systemOperationLogs',
  307. path: '/system/operation-logs',
  308. icon: 'mdi:history',
  309. order: 40,
  310. meta: {
  311. title: '操作日志',
  312. i18n: 'route.system.operationLogs',
  313. icon: 'mdi:history',
  314. },
  315. },
  316. // ======================
  317. // SUBMENUs under Roles
  318. // ======================
  319. {
  320. legacyId: 20,
  321. legacyParentId: 17,
  322. title: '角色列表',
  323. type: 'SUBMENU',
  324. name: 'systemRoleList',
  325. path: '/system/roles/list',
  326. icon: 'mdi:account-tie-hat',
  327. order: 1,
  328. meta: {
  329. title: '角色列表',
  330. i18n: 'route.system.role.list',
  331. sidebar: false,
  332. breadcrumb: false,
  333. cache: ['systemRoleCreate', 'systemRoleEdit'],
  334. },
  335. },
  336. {
  337. legacyId: 21,
  338. legacyParentId: 17,
  339. title: '新增角色',
  340. type: 'SUBMENU',
  341. name: 'systemRoleCreate',
  342. path: '/system/roles/create',
  343. icon: 'material-symbols-light:add-circle-outline',
  344. order: 2,
  345. meta: {
  346. title: '新增角色',
  347. i18n: 'route.system.role.create',
  348. sidebar: false,
  349. cache: true,
  350. activeMenu: '/system/roles',
  351. noCache: 'systemRoleList',
  352. },
  353. },
  354. {
  355. legacyId: 22,
  356. legacyParentId: 17,
  357. title: '编辑角色',
  358. type: 'SUBMENU',
  359. name: 'systemRoleEdit',
  360. path: '/system/roles/:id/edit',
  361. icon: 'material-symbols-light:edit',
  362. order: 3,
  363. meta: {
  364. title: '编辑角色',
  365. i18n: 'route.system.role.edit',
  366. sidebar: false,
  367. cache: true,
  368. activeMenu: '/system/roles',
  369. noCache: 'systemRoleList',
  370. },
  371. },
  372. // ======================
  373. // SUBMENUs under Menus
  374. // ======================
  375. {
  376. legacyId: 23,
  377. legacyParentId: 18,
  378. title: '菜单列表',
  379. type: 'SUBMENU',
  380. name: 'systemMenuList',
  381. path: '/system/menus/list',
  382. icon: 'mdi:menu-open',
  383. order: 1,
  384. meta: {
  385. title: '菜单列表',
  386. i18n: 'route.system.menu.list',
  387. sidebar: false,
  388. breadcrumb: false,
  389. cache: ['systemMenuCreate', 'systemMenuEdit'],
  390. },
  391. },
  392. {
  393. legacyId: 24,
  394. legacyParentId: 18,
  395. title: '新增菜单',
  396. type: 'SUBMENU',
  397. name: 'systemMenuCreate',
  398. path: '/system/menus/create',
  399. icon: 'material-symbols-light:add-circle-outline',
  400. order: 2,
  401. meta: {
  402. title: '新增菜单',
  403. i18n: 'route.system.menu.create',
  404. sidebar: false,
  405. cache: true,
  406. activeMenu: '/system/menus',
  407. noCache: 'systemMenuList',
  408. },
  409. },
  410. {
  411. legacyId: 25,
  412. legacyParentId: 18,
  413. title: '编辑菜单',
  414. type: 'SUBMENU',
  415. name: 'systemMenuEdit',
  416. path: '/system/menus/:id/edit',
  417. icon: 'material-symbols-light:edit',
  418. order: 3,
  419. meta: {
  420. title: '编辑菜单',
  421. i18n: 'route.system.menu.edit',
  422. sidebar: false,
  423. cache: true,
  424. activeMenu: '/system/menus',
  425. noCache: 'systemMenuList',
  426. },
  427. },
  428. ];