Files
2026-09-24 17:06:46 +08:00

104 lines
5.3 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================================
-- CRM 招投标管理 —— 菜单配置(yz_system_menu)
-- 幂等脚本:按 path 判重,重复执行不会产生重复菜单
-- 执行:mysql -h <host> -P <port> -u <user> -p <db> < bidding_menus.sql
-- ============================================================
-- 菜单表字段说明(yz_system_menu)
-- type: 1=目录菜单,2=页面菜单
-- pid : 父菜单ID
-- views: 可见端标识,沿用父级 '[2]'(后台)
-- is_visible / status: 1 表示显示并启用
-- 顶层入口「招投标」已存在:path = '/apps/crm/bidding'
SET @bidding_id := (
SELECT id FROM yz_system_menu
WHERE path = '/apps/crm/bidding' AND delete_time IS NULL
LIMIT 1
);
-- ---------- 一级子页面 ----------
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @bidding_id, '我要投标', '/apps/crm/bidding/bid', 'apps/crm/bidding/bid/index.vue',
'Trophy', 1, 1, 1, '[2]', 2, 'system', '投标方视角:从商机/项目发起投标,中标可转合同/项目'
FROM DUAL
WHERE @bidding_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/bid' AND delete_time IS NULL) x);
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @bidding_id, '我要招标', '/apps/crm/bidding/tender', 'apps/crm/bidding/tender/index.vue',
'Document', 2, 1, 1, '[2]', 2, 'system', '招标方视角:发布公告、报名、评标、定标'
FROM DUAL
WHERE @bidding_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/tender' AND delete_time IS NULL) x);
-- ---------- 公共资料库(目录 + 两个页面) ----------
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @bidding_id, '公共资料库', '/apps/crm/bidding/library', NULL,
'Folder', 3, 1, 1, '[2]', 1, 'system', '标书模板 + 企业资质'
FROM DUAL
WHERE @bidding_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/library' AND delete_time IS NULL) x);
SET @library_id := (
SELECT id FROM yz_system_menu
WHERE path = '/apps/crm/bidding/library' AND delete_time IS NULL
LIMIT 1
);
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @library_id, '标书模板', '/apps/crm/bidding/library/template', 'apps/crm/bidding/library/template.vue',
'Files', 1, 1, 1, '[2]', 2, 'system', '技术标/商务标/综合标模板库'
FROM DUAL
WHERE @library_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/library/template' AND delete_time IS NULL) x);
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @library_id, '企业资质', '/apps/crm/bidding/library/qualification', 'apps/crm/bidding/library/qualification.vue',
'Stamp', 2, 1, 1, '[2]', 2, 'system', '证照资质库,临期自动预警'
FROM DUAL
WHERE @library_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/library/qualification' AND delete_time IS NULL) x);
-- ---------- 统计报表(目录 + 两个页面) ----------
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @bidding_id, '统计报表', '/apps/crm/bidding/statistics', NULL,
'DataAnalysis', 4, 1, 1, '[2]', 1, 'system', '招标/投标数据统计'
FROM DUAL
WHERE @bidding_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/statistics' AND delete_time IS NULL) x);
SET @stats_id := (
SELECT id FROM yz_system_menu
WHERE path = '/apps/crm/bidding/statistics' AND delete_time IS NULL
LIMIT 1
);
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @stats_id, '招标统计', '/apps/crm/bidding/statistics/tender', 'apps/crm/bidding/statistics/tender.vue',
'PieChart', 1, 1, 1, '[2]', 2, 'system', '招标状态/类型分布、预算与中标金额'
FROM DUAL
WHERE @stats_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/statistics/tender' AND delete_time IS NULL) x);
INSERT INTO yz_system_menu
(pid, title, path, component_path, icon, sort, status, is_visible, views, type, creater, remark)
SELECT @stats_id, '投标统计', '/apps/crm/bidding/statistics/bid', 'apps/crm/bidding/statistics/bid.vue',
'Histogram', 2, 1, 1, '[2]', 2, 'system', '投标数量、中标率、费用投入与月度趋势'
FROM DUAL
WHERE @stats_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM (SELECT id FROM yz_system_menu WHERE path = '/apps/crm/bidding/statistics/bid' AND delete_time IS NULL) x);
-- ---------- 结果校验 ----------
SELECT id, pid, title, path, component_path, type, sort
FROM yz_system_menu
WHERE delete_time IS NULL AND path LIKE '/apps/crm/bidding%'
ORDER BY pid, sort;