feat: 新增IM即时通讯(浮窗)、工作流、打印模块及工作台增强

- IM: 新增浮窗聊天(ImFloatWindow)、管理页(monitor/config/service/message)、SSE推送
- 工作流: 新增待办/我的流程页面及后端服务
- 打印: 新增打印模板、出库单打印(PrintPage)、模板种子脚本
- 工作台: 增强快捷入口与工作台数据
- 修复: TagsView页签关闭、CrudPage通用表格增强
- 移除导航菜单中的即时通讯入口,改为右下角浮窗
This commit is contained in:
2026-08-16 00:19:24 +08:00
parent 7235265749
commit 1bec470647
49 changed files with 5791 additions and 51 deletions
+96
View File
@@ -0,0 +1,96 @@
/**
* IM 管理菜单种子:协作(目录)下追加 4 个管理页面
* - 性能监测(/im/monitor
* - 服务监测(/im/service
* - 配置界面(/im/config
* - 消息与公告管理(/im/message
* ⚠️ 顶层必须用目录节点(MenuType=0),页面节点(MenuType=1)必须挂目录下。
* 用法:node server/scripts/seed-im-admin.mjs
*/
const BASE = process.env.F9MES_API || 'http://localhost:5136';
const PHONE = '13800000000';
const PASSWORD = '123456';
async function api(h, method, url, body) {
const res = await fetch(BASE + url, {
method,
headers: h,
body: body ? JSON.stringify(body) : undefined,
});
const text = await res.text();
let json = null;
try { json = JSON.parse(text); } catch { /* ignore */ }
if (!res.ok || (json && json.code !== 0)) {
throw new Error(`HTTP ${res.status} ${url}: ${text.slice(0, 300)}`);
}
return json;
}
const PAGES = [
{ name: '性能监测', routePath: '/im/monitor', component: 'Im/monitor', icon: 'Monitor', sort: 20 },
{ name: '服务监测', routePath: '/im/service', component: 'Im/service', icon: 'Connection', sort: 30 },
{ name: '配置界面', routePath: '/im/config', component: 'Im/config', icon: 'Setting', sort: 40 },
{ name: '消息与公告管理', routePath: '/im/message', component: 'Im/message', icon: 'Bell', sort: 50 },
];
async function main() {
const login = await api({ 'Content-Type': 'application/json' }, 'POST', '/api/auth/login', {
phone: PHONE,
password: PASSWORD,
});
const token = login.data.token;
const h = { Authorization: 'Bearer ' + token, 'Content-Type': 'application/json' };
const menus = await api(h, 'GET', '/api/data/BaseSys_Menu/all');
const items = menus.data?.data || [];
let dir = items.find((m) => m.name === '协作' && m.menuType === 0);
if (!dir) {
const r = await api(h, 'POST', '/api/data/BaseSys_Menu/add', {
name: '协作',
menuType: 0,
routePath: '',
component: '',
icon: 'ChatDotRound',
isVisible: 1,
isEnable: 1,
sort: 998,
parentId: 0,
level: 0,
path: '',
});
dir = { id: r.data && (r.data.id ?? r.data) };
console.log('菜单目录「协作」已创建 id=' + dir.id);
} else {
console.log('菜单目录「协作」已存在 id=' + dir.id);
}
const dirId = dir.id;
for (const p of PAGES) {
const exists = items.find((m) => m.parentId === dirId && m.routePath === p.routePath);
if (exists) {
console.log(`菜单「${p.name}」已存在 id=${exists.id}`);
continue;
}
const r = await api(h, 'POST', '/api/data/BaseSys_Menu/add', {
name: p.name,
menuType: 1,
routePath: p.routePath,
component: p.component,
icon: p.icon,
isVisible: 1,
isEnable: 1,
sort: p.sort,
parentId: dirId,
level: 1,
path: '/' + dirId,
});
console.log(`菜单「${p.name}」已创建 id=${r.data && (r.data.id ?? r.data)}`);
}
console.log('\n完成。协作菜单下已就绪 4 个 IM 管理页面。');
}
main().catch((e) => {
console.error('ERR: ' + e.message);
process.exit(1);
});