You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.1 KiB
TypeScript
81 lines
3.1 KiB
TypeScript
3 weeks ago
|
/*
|
||
|
* @Author: donghao donghao@supervision.ltd
|
||
|
* @Date: 2025-03-11 11:30:09
|
||
|
* @LastEditors: donghao donghao@supervision.ltd
|
||
|
* @LastEditTime: 2025-08-19 17:35:17
|
||
|
* @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 fileUrls = [
|
||
|
"https://t7.baidu.com/it/u=72176654,472254471&fm=193",
|
||
|
"https://img2.baidu.com/it/u=1319203967,453193481&fm=253&fmt=auto&app=120&f=JPEG?w=1023&h=685",
|
||
|
"https://img2.baidu.com/it/u=1876217523,3868046800&fm=253&fmt=auto&app=120&f=JPEG?w=1200&h=800",
|
||
|
"https://picx.zhimg.com/v2-a8b8217d6aad02940be44a657cb55a99_r.jpg?source=1940ef5c",
|
||
|
"https://img0.baidu.com/it/u=108226426,371429720&fm=253&fmt=auto&app=138&f=JPEG?w=749&h=500",
|
||
|
"https://img1.baidu.com/it/u=967792105,51180745&fm=253&fmt=auto?w=1200&h=800",
|
||
|
"https://picx.zhimg.com/v2-026d3f92c9984a21dc217018d3b228a7_r.jpg?source=1def8aca",
|
||
|
];
|
||
|
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|${fileUrls.length}`]: [
|
||
|
{
|
||
|
"id|+1": 10,
|
||
|
key: "@id",
|
||
|
name: "@animal",
|
||
|
image_url: function () {
|
||
|
// 依次取出视频链接
|
||
|
const currFile = fileUrls[this.id - 10];
|
||
|
return fileUrls[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 fileListData = {
|
||
|
data: {
|
||
|
data: currentFilesData,
|
||
|
},
|
||
|
};
|