/* * @Author: donghao donghao@supervision.ltd * @Date: 2025-03-11 11:30:09 * @LastEditors: donghao donghao@supervision.ltd * @LastEditTime: 2025-03-17 15:24:42 * @FilePath: \5G-Loading-Bay-Web\mock\pools\poleMonitorData.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import Mock from "mockjs"; import { isImage } from "../utils/is"; const videoUrls = [ "https://www.learningcontainer.com/wp-content/uploads/2020/05/sample-mp4-file.mp4", "http://192.168.10.14:8123/ftp/1.jpg", "https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", "https://www.sample-videos.com/video123/mp4/360/big_buck_bunny_360p_5mb.mp4", "https://media.w3.org/2010/05/video/movie_300.mp4", "https://www.w3schools.com/html/mov_bbb.mp4", "https://media.w3.org/2010/05/sintel/trailer.mp4", "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4", "https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4", "https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4", ]; const mockListData = Mock.mock({ // 生成 10 条数据,可以根据需要调整数量 "data|140": [ { // 车号,生成随机的 4 位字母和数字组合 train_number: /[A-Z0-9]{10}/, // 车型,从预定义的数组中随机选择一个 train_model: () => Mock.Random.pick(["轿车", "SUV", "客车", "货车"]), // 车厢号,生成 1 到 10 的随机整数 "train_carriage_number|1-10": 1, // 告警类型,从预定义的数组中随机选择一个 alarm_type: () => Mock.Random.pick(["超速告警", "碰撞告警", "低电量告警"]), // 故障类型,从预定义的数组中随机选择一个 faultType: () => Mock.Random.pick(["撑杆弯曲", "撑杆断折"]), // 等级,生成 1 到 3 的随机整数 "level|1-3": 1, // 复核,随机生成 '是' 或 '否' is_reviewed: () => Mock.Random.pick([true, false]), // 时间,生成过去一个月内的随机日期和时间 created_at: () => Mock.Random.date("yyyy-MM-dd") + " " + Mock.Random.time("HH:mm:ss"), }, ], }); const mockFilesData = Mock.mock({ [`list|${videoUrls.length}`]: [ { "id|+1": 10, key: "@id", name: "@animal", video_url: function () { // 依次取出视频链接 const currFile = videoUrls[this.id - 10]; if (!isImage(currFile)) { return videoUrls[this.id - 10]; } return null; }, image_url: function () { // 依次取出视频链接 const currFile = videoUrls[this.id - 10]; if (isImage(currFile)) { return videoUrls[this.id - 10]; } return null; }, created_at: '@datetime("yyyy-MM-dd HH:mm:ss")', updated_at: '@datetime("yyyy-MM-dd HH:mm:ss")', length: "@float(0.1, 10, 2, 2)", width: "@float(0.1, 10, 2, 2)", height: "@float(0.1, 10, 2, 2)", weight: "@float(0.1, 1000, 1, 2)", volume: function () { return (this.length * this.width * this.height).toFixed(2); }, record: 1, }, ], }); // console.log(mockListData, 'mockListData'); const currentData = mockListData.data; const currentFilesData = mockFilesData.list; export const poleMonitorListData = { data: { list: currentData, total: currentData.length, page: 1, pageSize: 10, }, }; export const fileListData = { data: { data: currentFilesData, }, };