diff --git a/apps/server/src/tasks/init/gendev.service.ts b/apps/server/src/tasks/init/gendev.service.ts index 76c3542..76ddd6e 100755 --- a/apps/server/src/tasks/init/gendev.service.ts +++ b/apps/server/src/tasks/init/gendev.service.ts @@ -53,7 +53,7 @@ export class GenDevService { EventBus.emit('genDataEvent', { type: 'end' }); } - private async initializeDeviceSystemType() { + public async initializeDeviceSystemType() { this.logger.log('初始化设备分类'); // 创建网系类别分类 let systemTypeTaxonomy = await db.taxonomy.findFirst({ @@ -62,7 +62,7 @@ export class GenDevService { if (!systemTypeTaxonomy) { systemTypeTaxonomy = await db.taxonomy.create({ data: { - name: '网系类别', + name: '网系类型', slug: 'system_type', objectType: ['device'], }, @@ -87,57 +87,57 @@ export class GenDevService { // 定义网系类别 const systemTypes = [ - { - name: '文印系统', - children: [ - '电源故障', - '主板故障', - '内存故障', - '硬盘故障', - '显示器故障', - '键盘故障', - '鼠标故障', - ], - }, - { - name: '内网系统', - children: [ - '系统崩溃', - '应用程序错误', - '病毒感染', - '驱动问题', - '系统更新失败', - ], - }, - { - name: 'Windows系统', - children: [ - '系统响应慢', - '资源占用过高', - '过热', - '电池寿命短', - '存储空间不足', - ], - }, - { - name: 'Linux系统', - children: ['未知错误', '用户操作错误', '环境因素', '设备老化'], - }, - { - name: '移动设备系统', - children: ['参数设置错误', '配置文件损坏', '兼容性问题', '初始化失败'], - }, + // { + // name: '文印系统', + // children: [ + // '电源故障', + // '主板故障', + // '内存故障', + // '硬盘故障', + // '显示器故障', + // '键盘故障', + // '鼠标故障', + // ], + // }, + // { + // name: '内网系统', + // children: [ + // '系统崩溃', + // '应用程序错误', + // '病毒感染', + // '驱动问题', + // '系统更新失败', + // ], + // }, + // { + // name: 'Windows系统', + // children: [ + // '系统响应慢', + // '资源占用过高', + // '过热', + // '电池寿命短', + // '存储空间不足', + // ], + // }, + // { + // name: 'Linux系统', + // children: ['未知错误', '用户操作错误', '环境因素', '设备老化'], + // }, + // { + // name: '移动设备系统', + // children: ['参数设置错误', '配置文件损坏', '兼容性问题', '初始化失败'], + // }, ]; // 定义安防设备的子类型 const securityDevices = { - 未知错误: [ - '未授权访问', - '数据泄露', - '密码重置', - '权限异常', - '安全策略冲突', - ], + // 未知错误: [ + // '未授权访问', + // '数据泄露', + // '密码重置', + // '权限异常', + // '安全策略冲突', + // ], }; // 创建网系类别及其关联的设备类型 diff --git a/apps/server/src/tasks/init/init.service.ts b/apps/server/src/tasks/init/init.service.ts index a24a472..b24c36a 100755 --- a/apps/server/src/tasks/init/init.service.ts +++ b/apps/server/src/tasks/init/init.service.ts @@ -146,7 +146,13 @@ export class InitService { } catch (error) { this.logger.error('Minio initialization failed:', error); } - + // 修改这里:在生产环境也初始化设备分类数据 + try { + this.logger.log('Initializing device system types...'); + await this.genDevService.initializeDeviceSystemType(); + } catch (error) { + this.logger.error('Device system type initialization failed:', error); + } if (process.env.NODE_ENV === 'development') { try { await this.genDevService.genDataEvent(); diff --git a/apps/web/index.html b/apps/web/index.html old mode 100644 new mode 100755 diff --git a/apps/web/src/app/main/devicepage/select/Device-manager.tsx b/apps/web/src/app/main/devicepage/select/Device-manager.tsx index ef2bdd5..67c5c7f 100755 --- a/apps/web/src/app/main/devicepage/select/Device-manager.tsx +++ b/apps/web/src/app/main/devicepage/select/Device-manager.tsx @@ -12,6 +12,7 @@ import { Col, Typography, Divider, + message, } from "antd"; import { api } from "@nice/client"; import { useState, useEffect } from "react"; @@ -260,7 +261,14 @@ export default function DeviceManager({ title }: TermManagerProps) { Modal.confirm({ title: "确认删除", content: `确定要删除"${term.name}"吗?这将同时删除其下所有子项!`, - onOk: () => softDeleteByIds({ ids: [term.id] }), + onOk: () => softDeleteByIds({ ids: [term.id] },{ + onSuccess: () => { + message.success("删除成功"); + }, + onError: () => { + message.error("删除失败"); + }, + }), }); refetchSystemType(); refetchDeviceType(); @@ -278,6 +286,7 @@ export default function DeviceManager({ title }: TermManagerProps) { hasChildren: editingTerm.hasChildren, }, }); + message.success("修改成功"); } else { createTerm({ data: { @@ -286,6 +295,7 @@ export default function DeviceManager({ title }: TermManagerProps) { parentId: parentId, }, }); + message.success("添加成功"); } refetchSystemType(); refetchDeviceType();