diff --git a/mock/computePower.ts b/mock/computePower.ts new file mode 100644 index 0000000..d2d5910 --- /dev/null +++ b/mock/computePower.ts @@ -0,0 +1,33 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-17 13:54:43 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-03-07 17:29:22 + * @FilePath: \General-AI-Platform-Web-Client\mock\alarm.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +import { MockMethod } from "vite-plugin-mock"; +import { + powerGroupListData, + powerPoolsListData +} from "./pools/computePowerData"; +import { fetchMockSuccessFullByOther } from "./utils/apiMock"; + +export default [ + { + url: "/getPowerPoolsList", + method: "post", + response: req => { + console.log(req); + return fetchMockSuccessFullByOther({ data: powerPoolsListData.data }); + } + }, + { + url: "/getPowerGroupList", + method: "post", + response: req => { + console.log(req); + return fetchMockSuccessFullByOther({ data: powerGroupListData.data }); + } + } +] as MockMethod[]; diff --git a/mock/list.ts b/mock/list.ts index 89812e7..58af8a4 100644 --- a/mock/list.ts +++ b/mock/list.ts @@ -14,7 +14,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -24,7 +24,7 @@ export default [ isEnabled: false, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -34,7 +34,7 @@ export default [ isEnabled: false, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "故障", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -44,7 +44,7 @@ export default [ isEnabled: false, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "离线", description: "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" @@ -55,7 +55,7 @@ export default [ type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" @@ -65,7 +65,7 @@ export default [ isEnabled: true, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -75,7 +75,7 @@ export default [ isEnabled: false, type: 1, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "离线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -85,7 +85,7 @@ export default [ isEnabled: true, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -95,7 +95,7 @@ export default [ isEnabled: false, type: 1, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "离线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -105,7 +105,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" @@ -115,7 +115,7 @@ export default [ isEnabled: true, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -125,7 +125,7 @@ export default [ isEnabled: true, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -135,7 +135,7 @@ export default [ isEnabled: true, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-db.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -145,7 +145,7 @@ export default [ isEnabled: false, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -155,7 +155,7 @@ export default [ isEnabled: true, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -165,7 +165,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "离线", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -176,7 +176,7 @@ export default [ type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -187,7 +187,7 @@ export default [ type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "离线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -197,7 +197,7 @@ export default [ isEnabled: true, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -208,7 +208,7 @@ export default [ type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -218,7 +218,7 @@ export default [ isEnabled: false, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -228,7 +228,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-db.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -238,7 +238,7 @@ export default [ isEnabled: true, type: 1, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -248,7 +248,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -259,7 +259,7 @@ export default [ type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -269,7 +269,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -279,7 +279,7 @@ export default [ isEnabled: true, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -289,7 +289,7 @@ export default [ isEnabled: false, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -299,7 +299,7 @@ export default [ isEnabled: false, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-db.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "故障", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -309,7 +309,7 @@ export default [ isEnabled: true, type: 1, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "离线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -319,7 +319,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -329,7 +329,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -339,7 +339,7 @@ export default [ isEnabled: true, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" @@ -349,7 +349,7 @@ export default [ isEnabled: false, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -359,7 +359,7 @@ export default [ isEnabled: false, type: 1, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "基于腾讯优图强大的面部分析技术,提供包括人脸检测与分析、五官定位、人脸搜索、人脸比对、人脸" @@ -370,7 +370,7 @@ export default [ type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/face-recognition.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -380,7 +380,7 @@ export default [ isEnabled: true, type: 5, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "离线", description: "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" @@ -390,7 +390,7 @@ export default [ isEnabled: false, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "故障", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -400,7 +400,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -410,7 +410,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -420,7 +420,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -430,7 +430,7 @@ export default [ isEnabled: true, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -440,7 +440,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-db.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "故障", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -450,7 +450,7 @@ export default [ isEnabled: true, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/t-sec.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" @@ -460,7 +460,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "离线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -470,7 +470,7 @@ export default [ isEnabled: true, type: 2, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" @@ -480,7 +480,7 @@ export default [ isEnabled: false, type: 4, banner: "https://tdesign.gtimg.com/tdesign-pro/cloud-server.jpg", - deviceSort: "分析设备", + deviceSort: "精密仪器设备", state: "在线", description: "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" @@ -490,7 +490,7 @@ export default [ isEnabled: false, type: 3, banner: "https://tdesign.gtimg.com/tdesign-pro/ssl.jpg", - deviceSort: "监控1", + deviceSort: "机械加工设备", state: "在线", description: "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" diff --git a/mock/pools/alarmData.ts b/mock/pools/alarmData.ts index 33751a3..a92e246 100644 --- a/mock/pools/alarmData.ts +++ b/mock/pools/alarmData.ts @@ -2,33 +2,11 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-02-22 13:38:04 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-02-29 17:53:39 + * @LastEditTime: 2024-03-06 10:06:11 * @FilePath: \General-AI-Platform-Web-Client\mock\pools\alarmData.ts -// * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ -function generateRandomDateTime(year) { - // 生成随机月份(1-12) - const month = Math.floor(Math.random() * 12) + 1; - - // 生成随机日期(1-31) - const day = Math.floor(Math.random() * 31) + 1; - - // 生成随机小时(0-23) - const hour = Math.floor(Math.random() * 24); - - // 生成随机分钟(0-59) - const minute = Math.floor(Math.random() * 60); - - // 生成随机秒钟(0-59) - const second = Math.floor(Math.random() * 60); - - // 返回随机日期和时间的字符串 - return `${year}-${month < 10 ? "0" : ""}${month}-${ - day < 10 ? "0" : "" - }${day} ${hour < 10 ? "0" : ""}${hour}:${minute < 10 ? "0" : ""}${minute}:${ - second < 10 ? "0" : "" - }${second}`; -} +import { generateRandomDateTimeByYear } from "../utils/mockMoment"; function fetchList(): Record[] { const currList: Record[] = []; const nameArr = [ @@ -50,7 +28,7 @@ function fetchList(): Record[] { for (let i = 0; i < 35; i++) { currList.push({ id: 1, - createTime: generateRandomDateTime(2023), + createTime: generateRandomDateTimeByYear(2023), updateTime: "2023-10-17T02:35:41.14308Z", name: nameArr[Math.floor(Math.random() * 3)], code: codeArr[Math.floor(Math.random() * 4)] + "-" + i, diff --git a/mock/pools/computePowerData.ts b/mock/pools/computePowerData.ts new file mode 100644 index 0000000..c6fa4d1 --- /dev/null +++ b/mock/pools/computePowerData.ts @@ -0,0 +1,122 @@ +export type ComputePowerPoolItem = { + name: string; + type: number; // 类别 + color?: string; // + proportion: number; + pretreatmentEfficiency?: number; + bgColor?: string; +}; + +const groupList: Record[] = [ + { + label: "NVIDIA GeForce 4090", + type: 1 + }, + { + label: "瑞芯微 RK3566", + type: 0 + }, + { + label: "瑞芯微 RK3566", + type: 0 + }, + { + label: "NVIDIA GeForce 4090", + type: 1 + }, + { + label: "NVIDIA GeForce 4090", + type: 1 + } +]; + +const poolsData: ComputePowerPoolItem[] = [ + { + name: "焊线颜色检测", + type: 9, + proportion: 7, + pretreatmentEfficiency: 20, + color: "#014BE6", + bgColor: "linear-gradient(180deg, #015DE6 0%, #4881F6 100%)" + }, + { + name: "螺纹缺陷检测", + type: 8, + proportion: 8, + pretreatmentEfficiency: 20, + color: "#FAA90B", + bgColor: "linear-gradient(180deg, #E64601 0%, #F6A648 100%)" + }, + { + name: "PIN间距测量", + type: 7, + proportion: 4, + pretreatmentEfficiency: 15, + color: "#EA1281", + bgColor: "linear-gradient(180deg, #E60161 0%, #F648E5 100%)" + }, + { + name: "螺纹无牙缺陷检测", + type: 6, + proportion: 7, + pretreatmentEfficiency: 20, + color: "#FA8616", + bgColor: "linear-gradient(180deg, #FA8316 0%, #FAAD16 100%)" + }, + { + name: "压板缺陷检测", + type: 5, + proportion: 32, + pretreatmentEfficiency: 38, + color: "#F9DB18", + bgColor: "linear-gradient(180deg, #FFC56F 0%, #F9E006 100%)" + }, + { + name: "划伤缺陷检测", + type: 4, + proportion: 8, + pretreatmentEfficiency: 38, + color: "#1CCCFA", + bgColor: "linear-gradient(180deg, #6FFFFF 0%, #06BEF9 100%)" + }, + { + name: "披锋(毛刺)缺陷检测", + type: 3, + proportion: 12, + pretreatmentEfficiency: 38, + color: "#9E26EE", + bgColor: "linear-gradient(180deg, #FF2494 0%, #8D27FF 100%)" + }, + { + name: "工件尺寸测量", + type: 2, + proportion: 7, + pretreatmentEfficiency: 38, + color: "#6F50F6", + bgColor: "linear-gradient(180deg, #6B55F6 0%, #8C38F8 100%)" + }, + { + name: "打孔不良检测", + type: 1, + proportion: 5, + pretreatmentEfficiency: 38, + color: "#24ED75", + bgColor: "linear-gradient(180deg, #43EA80 0%, #38F8D4 100%)" + }, + { + name: "空闲算力", + type: 0, + proportion: 10, + pretreatmentEfficiency: 0, + color: "#DCDCDC", + bgColor: "linear-gradient(90deg, #7B7979 0%, #C1C1C1 100%)" + } +]; + +export const powerGroupListData = { + data: groupList +}; + +export const powerPoolsListData = { + data: poolsData +}; diff --git a/mock/pools/serverListData.ts b/mock/pools/serverListData.ts index 5888a0e..cde4b88 100644 --- a/mock/pools/serverListData.ts +++ b/mock/pools/serverListData.ts @@ -1,3 +1,48 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-03-01 16:34:06 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-03-07 17:07:56 + * @FilePath: \General-AI-Platform-Web-Client\mock\pools\serverListData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +const generateRandomTwoDecimal = () => { + // 生成一个在 [0, 1) 范围内的随机数 + const randomFraction = Math.random(); + + // 乘以一个倍数,例如 100,以增加小数位数 + const multipliedValue = randomFraction * 100; + + // 使用 Math.round() 进行四舍五入,并将结果除以倍数,得到两位小数 + return Math.round(multipliedValue) / 100; +}; + +const progressData = () => { + const finalArr = [ + { + label: "CPU", + percent: generateRandomTwoDecimal(), + strokeColor: "rgb(243,48,5)" + }, + { + label: "内存", + percent: (15 + Math.floor(Math.random() * 85)) / 100, + strokeColor: "rgb(33,169,122)" + }, + { + label: "存储", + percent: (15 + Math.floor(Math.random() * 85)) / 100, + strokeColor: "rgb(33,169,122)" + }, + { + label: "GPU", + percent: (85 + Math.floor(Math.random() * 15)) / 100, + strokeColor: "rgb(250,173,20)" + } + ]; + return finalArr; +}; + const serverList = [ { index: 1, @@ -7,7 +52,8 @@ const serverList = [ deviceSort: "服务器1", state: "在线", description: - "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" + "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部", + progressData }, { index: 2, @@ -17,7 +63,8 @@ const serverList = [ deviceSort: "服务器2", state: "在线", description: - "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" + "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部", + progressData }, { index: 3, @@ -27,7 +74,8 @@ const serverList = [ deviceSort: "服务器3", state: "在线", description: - "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" + "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗", + progressData }, { index: 4, @@ -37,7 +85,8 @@ const serverList = [ deviceSort: "服务器4", state: "离线", description: - "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" + "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。", + progressData }, { index: 5, @@ -47,7 +96,8 @@ const serverList = [ deviceSort: "服务器4", state: "在线", description: - "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" + "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。", + progressData }, { index: 6, @@ -57,7 +107,8 @@ const serverList = [ deviceSort: "服务器5", state: "在线", description: - "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" + "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客", + progressData }, { index: 7, @@ -67,7 +118,8 @@ const serverList = [ deviceSort: "服务器6", state: "离线", description: - "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" + "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客", + progressData }, { index: 8, @@ -77,7 +129,8 @@ const serverList = [ deviceSort: "服务器7", state: "在线", description: - "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗" + "云硬盘为您提供用于CVM的持久性数据块级存储服务。云硬盘中的数据自动地可用区内以多副本冗", + progressData }, { index: 9, @@ -87,7 +140,8 @@ const serverList = [ deviceSort: "服务器8", state: "离线", description: - "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" + "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客", + progressData }, { index: 10, @@ -97,7 +151,8 @@ const serverList = [ deviceSort: "服务器9", state: "在线", description: - "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。" + "云数据库MySQL为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。", + progressData }, { index: 11, @@ -107,7 +162,8 @@ const serverList = [ deviceSort: "服务器10", state: "在线", description: - "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" + "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部", + progressData }, { index: 12, @@ -117,7 +173,8 @@ const serverList = [ deviceSort: "服务器11", state: "在线", description: - "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部" + "SSL证书又叫服务器证书,腾讯云为您提供证书的一站式服务,包括免费、付费证书的申请、管理及部", + progressData }, { index: 13, @@ -127,7 +184,8 @@ const serverList = [ deviceSort: "服务器12", state: "在线", description: - "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客" + "腾讯安全云防火墙产品,是腾讯云安全团队结合云原生的优势,自主研发的SaaS化防火墙产品,无需客无需客无需客无需客无需客无需客无需客", + progressData } ]; @@ -139,3 +197,7 @@ export const serverListData = { pageSize: 10 } }; + +export const serverParamsListData = { + data: progressData +}; diff --git a/mock/screenData.ts b/mock/screenData.ts index 14fc593..4cd378a 100644 --- a/mock/screenData.ts +++ b/mock/screenData.ts @@ -1,7 +1,18 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-03-01 16:34:06 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-03-07 11:44:52 + * @FilePath: \General-AI-Platform-Web-Client\mock\screenData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ import { MockMethod } from "vite-plugin-mock"; -import { serverListData } from "./pools/serverListData"; +import { serverListData, serverParamsListData } from "./pools/serverListData"; import { modelListData } from "./pools/modelListData"; -import { fetchCurrPageByList } from "./utils/apiMock"; +import { + fetchCurrPageByList, + fetchMockSuccessFullByOther +} from "./utils/apiMock"; export default [ { @@ -22,6 +33,48 @@ export default [ }; } }, + { + url: "/updateServerBoxList", + method: "post", + response: req => { + const { currServerList } = req.body; + console.log(currServerList, "currServerList"); + const finalServerList = currServerList.map(item => { + if (item.isEnabled) { + item.progressData = item.progressData.map(itemChild => { + switch (itemChild.label) { + case "CPU": + case "GPU": + // eslint-disable-next-line no-case-declarations + const randomNumber = Math.random(); + // eslint-disable-next-line no-case-declarations + const changeNumberValue = 10; + // 通过逻辑判断,将随机数转换为正数或负数 + // 如果随机数小于0.5,则为负数;否则为正数 + // eslint-disable-next-line no-case-declarations + const changeNumber = + randomNumber < 0.5 ? -changeNumberValue : changeNumberValue; + itemChild.percent += changeNumber / 100; + if (itemChild.percent >= 1) { + itemChild.percent = 1; + } + if (itemChild.percent <= 0.1) { + itemChild.percent = 0.1; + } + break; + default: + break; + } + return itemChild; + }); + } + return item; + }); + + // console.log(req); + return fetchMockSuccessFullByOther({ data: finalServerList }); + } + }, { url: "/getModelBoxList", method: "post", diff --git a/mock/utils/mockMoment.ts b/mock/utils/mockMoment.ts new file mode 100644 index 0000000..5bdbeb0 --- /dev/null +++ b/mock/utils/mockMoment.ts @@ -0,0 +1,38 @@ +export function generateRandomDateTimeByYear(year) { + // 生成随机月份(1-12) + const month = Math.floor(Math.random() * 12) + 1; + + // 生成随机日期(1-31) + const day = Math.floor(Math.random() * 31) + 1; + + // 生成随机小时(0-23) + const hour = Math.floor(Math.random() * 24); + + // 生成随机分钟(0-59) + const minute = Math.floor(Math.random() * 60); + + // 生成随机秒钟(0-59) + const second = Math.floor(Math.random() * 60); + + // 返回随机日期和时间的字符串 + return `${year}-${month < 10 ? "0" : ""}${month}-${ + day < 10 ? "0" : "" + }${day} ${hour < 10 ? "0" : ""}${hour}:${minute < 10 ? "0" : ""}${minute}:${ + second < 10 ? "0" : "" + }${second}`; +} + +export function generateRandomMoment(date = new Date(), type = "HH:mm:ss") { + // 生成随机小时(0-23) + const hour = Math.floor(Math.random() * 24); + + // 生成随机分钟(0-59) + const minute = Math.floor(Math.random() * 60); + + // 生成随机秒钟(0-59) + const second = Math.floor(Math.random() * 60); + // 返回随机日期和时间的字符串 + return `${hour < 10 ? "0" : ""}${hour}:${minute < 10 ? "0" : ""}${minute}:${ + second < 10 ? "0" : "" + }${second}`; +} diff --git a/src/api/list.ts b/src/api/list.ts index d8e0d7c..82237fe 100644 --- a/src/api/list.ts +++ b/src/api/list.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-01-15 14:45:56 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-01-18 14:43:01 + * @LastEditTime: 2024-03-07 17:14:04 * @FilePath: \General-AI-Platform-Web-Client\src\api\list.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -29,6 +29,10 @@ export const getServerBoxList = (data?: object) => { return http.request("post", "/getServerBoxList", { data }); }; +export const updateServerBoxList = (data?: object) => { + return http.request("post", "/updateServerBoxList", { data }); +}; + export const getModelList = (data?: object) => { return http.request("post", "/getModelList", { data }); }; @@ -41,3 +45,10 @@ export const getModelBoxList = (data?: object) => { export const getAlarmList = (data?: object) => { return http.request("post", "/getAlarmList", { data }); }; +/** 算力分配 */ +export const getPowerPoolsList = (data?: object) => { + return http.request("post", "/getPowerPoolsList", { data }); +}; +export const getPowerGroupList = (data?: object) => { + return http.request("post", "/getPowerGroupList", { data }); +}; diff --git a/src/assets/dataScreen/serverList/serverIcon_offline.svg b/src/assets/dataScreen/serverList/serverIcon_offline.svg index d890495..5c64374 100644 --- a/src/assets/dataScreen/serverList/serverIcon_offline.svg +++ b/src/assets/dataScreen/serverList/serverIcon_offline.svg @@ -1,9 +1,11 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/src/components/CustomTree/src/collapseTree.tsx b/src/components/CustomTree/src/collapseTree.tsx index e491e6f..15175b2 100644 --- a/src/components/CustomTree/src/collapseTree.tsx +++ b/src/components/CustomTree/src/collapseTree.tsx @@ -11,47 +11,13 @@ const testDeviceTreeData = [ expended: true, childList: [ { - name: "车间1", - id: "分析设备", - level: 1, - childList: [ - { - name: "控制器A", - id: "1101001", - level: 2, - childList: [ - { - name: "控制器a", - id: "110100101", - level: 3 - }, - { - name: "控制器b", - id: "110100202", - level: 3 - } - ] - }, - { - name: "控制器B", - id: "1101002", - level: 2 - } - ] - }, - { - name: "车间2", - id: "1102", - level: 1 - }, - { - name: "车间3", - id: "1103", + name: "精密仪器车间", + id: "精密仪器设备", level: 1 }, { - name: "车间4", - id: "1104", + name: "装配间", + id: "装配设备", level: 1 } ] @@ -62,20 +28,10 @@ const testDeviceTreeData = [ level: 0, childList: [ { - name: "车间1", - id: "监控1", - level: 1 - }, - { - name: "车间2", - id: "1203", + name: "机械加工车间", + id: "机械加工设备", level: 1 } - // { - // name: "控制器D", - // id: "1204", - // level: 1 - // } ] } ]; diff --git a/src/pages/dataScreen/components/alarmInfoList.vue b/src/pages/dataScreen/components/alarmInfoList.vue index 48b5a84..f8dc69a 100644 --- a/src/pages/dataScreen/components/alarmInfoList.vue +++ b/src/pages/dataScreen/components/alarmInfoList.vue @@ -2,11 +2,12 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-02-28 15:21:32 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-02-28 15:25:08 + * @LastEditTime: 2024-03-06 09:46:59 * @FilePath: \General-AI-Platform-Web-Client\src\pages\dataScreen\components\alarmInfoList.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE -->