hbt-training-ui/src/mock/index.ts

950 lines
28 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import Mock from "mockjs"
import moment from "moment"
import * as turf from '@turf/turf'
import bounds from "./bounds";
import realBounds from "./real";
import safeBounds from "./safe";
import planBounds from "./plan";
import line from "./line";
import four from "./four";
import four2 from "./four2";
import dangrous from "./dangrous";
export class MockData{
public static getPeopleList(){
const data = [] as any;
for(let i=0;i<50;i++){
data.push({
id:Mock.mock("@id"),
name:Mock.mock("@cname"),
job:"",
position:turf.randomPosition([
11660757, 3692398.75,
11661124, 3692643.5
]),
time:moment().subtract(Math.floor(Math.random()*30),"minutes").format("YYYY-MM-DD HH:mm:ss"),
tel:Mock.mock("@integer(13200000000, 13299999999)")
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getCameraList(){
const data = [] as any;
const positions=[[
13312915.200000001,
4098598.08,
0.51
],[
13313086.72,
4098442.24,
0.51001953125
],[
13312961.280000001,
4098238.72,
0.5099609375
],[
13312853.76,
4098298.88,
0.5099609375
],[
13312756.48,
4098408.96,
0.51
],[
13312967.68,
4098156.48,
0.6099609375
],[
13313036.8,
4098762.24,
0.51
],[
13312883.200000001,
4098757.7600000002,
0.4
],[
13313327.36,
4098413.12,
0.51
],[
13312756.48,
4098400.96,
0.51
]]
const typeList = ["","",""]
//turf.randomPosition([119.588709 ,34.514257,119.596724,34.520382]),
for(let i=0;i<10;i++){
data.push({
id:Mock.mock("@id"),
position:positions[i],
remark:typeList[i%3],
type:i%4,
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getCompanyList(){
const data = [] as any;
const typeList = ["",""];
const areaList = [[[
13312797.44,
4098625.6,
0.400078125
],[
13312634.88,
4098467.8400000003,
0.400078125
],[
13312825.6,
4098269.12,
0.4
],[
13312852.48,
4098290.56,
0.6099218750000001
],[
13313027.84,
4098100.8000000003,
0.4000390625
],[
13313169.92,
4098240,
0.4000390625
]],[[
13312771.84,
4098628.48,
5.8119531250000005
],[
13312986.88,
4098841.6,
0.399921875
],[
13313376,
4098431.36,
0.399921875
],[
13313145.6,
4098222.4,
0.400078125
]
]];
const positionList = [[
13312874.24,
4098367.68,
20
],[
13313114.88,
4098505.92,
20
]]
for(let i=0;i<2;i++){
data.push({
id:Mock.mock("@id"),
position:positionList[i%2],
area:areaList[i%2],
name:typeList[i%2],
peopleCount:100,
master:Mock.mock("@cname"),
city:Mock.mock("@city(true)"),
address:Mock.mock("@county(true)")
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getFourList(){
const data = [] as any;
const areaList = four;
for(let i=0;i<areaList.length;i++){
data.push({
id:Mock.mock("@id"),
position:turf.center(turf.points(areaList[i])).geometry.coordinates,
area:areaList[i],
name:""+ (i+1)
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getFourList2(){
const data = [] as any;
const areaList = four2;
for(let i=0;i<areaList.length;i++){
data.push({
id:Mock.mock("@id"),
position:turf.center(turf.points(areaList[i])).geometry.coordinates,
area:areaList[i],
name:""+ (i+1)
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getCheckPoint(){
const data = [] as any;
const points = [[
13312962.56,
4098166.4,
0.50998046875
],[
13313314.56,
4098401.6,
5.5896484375
],[
13312739.84,
4098371.2,
0.400009765625
],[
13312806.4,
4098604.48,
7.02779296875
]];
const nameList = ["",""]
for(let i=0;i<points.length;i++){
data.push({
id:Mock.mock("@id"),
position:points[i],
name:nameList[i % 2],
remark:['',''][i%2]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getStoreList(){
const points = [[
13312875.52,
4098452.8000000003,
24.715585937500002
],[
13313103.36,
4098514.24,
37.52975830078125
]];
const data = [] as any;
for(let i=0;i<points.length;i++){
data.push({
id:Mock.mock("@id"),
position:points[i],
name:i<1?"":"",
remark:"70%"
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getBuildingList(){
const remarkList = ["","","",""];
const points = [[
13312805.120000001,
4098358.72,
10.280234375000001
],[
13312769.280000001,
4098483.52,
8.729609375
],[
13312807.68,
4098549.12,
15.363359375
],[
13312970.24,
4098203.8400000003,
6.366074218750001
],[
13312910.08,
4098531.52,
16.74486328125
],[
13313018.88,
4098431.04,
7.350400390625
],[
13313209.6,
4098483.2,
10.4424609375
],[
13313276.16,
4098580.8000000003,
3.9199951171875003
]];
const data = [] as any;
for(let i=0;i<points.length;i++){
data.push({
id:Mock.mock("@id"),
position:points[i],
name:i<4?"":"",
remark:remarkList[i%4]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getDangrous(){
const data = [] as any;
const areaList = dangrous;
const typeList = ["","",""];
const levelList=["","",""];
const statusList=["",""];
for(let i=0;i<areaList.length;i++){
data.push({
id:Mock.mock("@id"),
position:turf.center(turf.points(areaList[i])).geometry.coordinates,
area:areaList[i],
type:typeList[i%3],
level:levelList[i%3],
name:""+ (i+1),
status:statusList[i%2]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getStopCarList(){
const plateList = ["A7E8U6","A3X4K5","J8868P","A7E8U6","A9H2K0","A756H3","A886E7","J12321","A11123","A92984"];
const typeList = ["",""];
const positions = [[
13312862.72,
4098773.12,
0.4
],[
13312828.16,
4098812.8000000003,
0.4
],[
13312791.040000001,
4098854.4,
0.39998046875
],[
13312764.16,
4098881.92,
0.40001953125
],[
13312730.88,
4098916.16,
0.4
],[
13312478.72,
4098763.8400000003,
0.40001953125
],[
13312524.8,
4098713.6,
0.39998046875
],[
13312568.32,
4098665.6,
0.4
],[
13312615.68,
4098621.12,
0.39998046875
],[
13312422.4,
4098839.36,
0.3999609375
]]
const data = [] as any;
for(let i=0;i<10;i++){
data.push({
id:Mock.mock("@id"),
time:moment().subtract(Math.floor(Math.random()*30),"minutes").format("YYYY-MM-DD HH:mm:ss"),
startTime : "7:00",
endTime : "8:00",
position:positions[i],
plate:plateList[i],
type:typeList[i<5?0:1]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getRandomData(){
const data = [] as any;
for(let i=0;i<5;i++){
data.push({
id:Mock.mock("@id"),
position:turf.randomPosition([119.588709 ,34.514257,119.596724,34.520382]),
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getDangrousWork(){
const typeList = ["",""];
const nameList = ["","","","","",""];
const nameList2 = ["",""];
const data = [] as any;
const positions = [[[
13312903.68,
4098505.6,
0.4
],[
13312883.200000001,
4098492.16,
0.5099609375
],[
13312902.4,
4098471.36,
0.7631250000000005
],[
13312921.6,
4098486.4,
0.3999609375
]],[[
13312864,
4098649.2800000003,
0.1734375
],[
13312826.88,
4098614.08,
0.59904296875
],[
13312872.96,
4098566.08,
0.51
],[
13312910.08,
4098600.3200000003,
0.51001953125
]]]
for(let i=0;i<nameList2.length;i++){
data.push({
id:Mock.mock("@id"),
area:positions[i],
enterprise:typeList[i%2],
"operationLevel": i+1,
operationContent:"线"+nameList[i % 2]+"",
"operationStart": "2023-09-24 00:00:00",
"operationEnd": "2024-01-28 23:23:00",
"operationSite": "西128-12-4",
operationType:nameList2[i % 2],
position:turf.center(turf.points(positions[i])).geometry.coordinates,
name:nameList2[i % 2]
})
}
for(let i=0;i<nameList.length*3;i++){
data.push({
id:Mock.mock("@id"),
position:turf.randomPosition([
13312995.84,
4098177.2800000003,
13313096.96,
4098754.88,
]),
operationContent:"线"+nameList[i % 6]+"",
operationType:nameList[i % 6],
enterprise:typeList[i%2],
"operationLevel": (i%3)+1,
"operationStart": "2023-09-24 00:00:00",
"operationEnd": "2024-01-28 23:23:00",
"operationSite": "西128-12-4",
name:nameList[i % 6]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getCarList(){
const plateList = ["A7E8U6","A3X4K5","J8868P","A7E8U6","A9H2K0"];
const typeList = ["","",""];
const data = [] as any;
for(let i=0;i<10;i++){
data.push({
id:Mock.mock("@id"),
time:moment().subtract(Math.floor(Math.random()*30),"minutes").format("YYYY-MM-DD HH:mm:ss"),
startTime : "7:00",
endTime : "8:00",
position:turf.randomPosition([
11660757, 3692398.75,
11661124, 3692643.5
]),
plate:plateList[i%5],
remark:typeList[i%3],
type:i%2
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getBounds(){
const areaList = bounds
const data = [] as any;
for(let i=0;i<10;i++){
data.push({
id:Mock.mock("@id"),
area:areaList[i%2],
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getRealBounds(){
const data = [] as any;
for(let i=0;i<1;i++){
data.push({
id:Mock.mock("@id"),
area:realBounds,
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getSafeBounds(){
const data = [] as any;
for(let i=0;i<1;i++){
data.push({
id:Mock.mock("@id"),
area:safeBounds,
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getPlanBounds(){
const data = [] as any;
for(let i=0;i<1;i++){
data.push({
id:Mock.mock("@id"),
area:planBounds,
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getSafeLine(){
const data = [] as any;
for(let i=0;i<2;i++){
data.push({
id:Mock.mock("@id"),
positions:line[i%2],
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getBlackCarList(){
const plateList = ["A7E8U6","A3X4K5","J8868P","A7E8U6","A9H2K0"];
const data = [] as any;
for(let i=0;i<5;i++){
data.push({
id:Mock.mock("@id"),
time:moment().subtract(Math.floor(Math.random()*30),"minutes").format("YYYY-MM-DD HH:mm:ss"),
plate:plateList[i%5]
})
}
return Mock.mock({
code:0,
message:"",
data,
})
}
public static getHiddenDangrous(){
/* const data = hiddenDangerList.map((item,i)=>{
Object.assign(item,{
time : moment().subtract(i,"days").format("YYYY-MM-DD HH:mm:ss"),
position:turf.randomPosition([
13312995.84,
4098177.2800000003,
13313096.96,
4098754.88,
]),
head:Mock.mock("@cname"),
phone:Mock.mock("@integer(13200000000, 13299999999)"),
enterprise:'联化科',
risk:'管廊管道破裂',
reportingDate:moment().subtract(i,"days").format("YYYY-MM-DD HH:mm:ss"),
inspector:Mock.mock("@cname"),
hiddenDangerDetails:'南区6号管廊巡检过程中存在少量裂缝目前未发现泄露',
rectificationMeasure:'整改措施:需要尽快进行管道评估,\n' +
'并根据评估结果,实施修复工作',
period:moment().subtract(i,"days").format("YYYY年M月DD日"),
remark:'管廊修复工作必须提前发布园\n' +
'区公告,并发函通知相关使用企业',
status:1,
})
return item
});
return Mock.mock({
code:200,
message:"成功",
data,
})*/
}
public static getWaringList(){
/* {
type:"fire",
id:new Date().getTime()+"",
typeName:"火灾",
position:[13312990.72, 4098613.12, 0.51],
reporter:"张三",
content:"北京汉邦唐化工厂区发生火灾"
}*/
const data = [
{
title: '风险点异常',
info: '煤化工艺3号点温度异常',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"风险告警",
reporter:"张三",
tel:"13337542569",
content:"煤化工艺3号点温度异常"
}
, {
title: '环境告警',
info: '土壤污染指数超标',
time: '2023年1月20日 14:33:33',
level: '1',
type:"normal",
typeName:"环境告警",
reporter:"李四",
tel:"13985412541",
content:"土壤污染指数超标"
}, {
title: '隐患整改超期',
info: '南区6号管廊存在少许裂缝',
time: '2023年1月20日 14:33:33',
level: '3',
type:"normal",
typeName:"隐患整改超期",
reporter:"张三",
tel:"13337542569",
content:"南区6号管廊存在少许裂缝"
}, {
title: '大气环境蓝色预警',
info: '大气5号监测点蓝色预警',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"大气环境蓝色预警",
reporter:"张三",
tel:"13337542569",
content:"大气5号监测点蓝色预警"
}, {
title: '风险告警',
info: '富土康厂区4号设备监测数值异常',
time: '2023年1月20日 14:33:33',
level: '3',
type:"normal",
typeName:"风险告警",
reporter:"张三",
tel:"13337542569",
content:"富土康厂区4号设备监测数值异常"
}, {
title: '车辆告警',
info: '电子围栏-车辆非法进入',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"车辆告警",
reporter:"李四",
tel:"13985412541",
content:"电子围栏-车辆非法进入"
},
].map((item:any)=>{
item.id = Mock.mock("@id");
if (item.type === 'normal'){
item.position=turf.randomPosition([
13312995.84,
4098177.2800000003,
13313096.96,
4098754.88,
]);
}else if(item.type === 'fire'){
item.position= [13312990.72, 4098613.12, 0.51]
}
item.reporter = Mock.mock("@cname")
item.tel = Mock.mock("@integer(13200000000, 13299999999)")
item.time = moment().subtract(0,"days").format("YYYY-MM-DD HH:mm:ss")
return item
});
const i = Math.floor(Math.random()*5)+1
return Mock.mock({
code:200,
message:"成功",
data:[data[i]],
})
}
public static deviceList(){
const nameList = [
"2号区3号库采样点",
"1号区13号库采样点",
"22号区4号库采样点",
"12号区33号库采样点",
"12号区3号库采样点",
"22号区32号库采样点",
"6号区3号库采样点",
"8号区2号库采样点",
"6号区9号库采样点",
"7号区1号库采样点",
]
const values = [90,80,70,60,55,50,46,40,30,20];
const data = {
nameList,
values
};
return Mock.mock({
code:200,
message:"成功",
data,
})
}
public static xkz(){
const data = [
{
id: '12987122',
name: 'C区排放口',
type: 'COD',
unit: '3.2',
year1: 1075,
year2: 2075,
year3: 2275,
}, {
id: '12987123',
name: 'C区排放口',
type: '氨氮',
unit: '4.43',
year1: 1075,
year2: 2075,
year3: 2275,
}, {
id: '12987124',
name: 'C区排放口',
type: '氨氮',
unit: '4.43',
year1: 1075,
year2: 2075,
year3: 2275,
}, {
id: '12987125',
name: 'C区排放口',
type: '氨氮',
unit: '1.43',
year1: 1275,
year2: 2775,
year3: 2175,
}, {
id: '12987126',
name: 'C区排放口',
type: '氨氮',
unit: '2.43',
year1: 1275,
year2: 2375,
year3: 2575,
}];
return Mock.mock({
code:200,
message:"成功",
data,
})
}
public static dangerSourceDetail(){
const data = {
"id": "954e5e6f-91c5-46d1-a085-ad0e6cdae10c",
"mainResponsiblePersonId": "14acb7b9-83b2-4231-8eb2-d65f90ee49c8",
"mainResponsiblePerson": "璩筠月",
"technologyResponsiblePersonId": "18c563b8-9e7e-4055-b4d0-333e30dfe70b",
"technologyResponsiblePerson": "殳淑美",
"operateResponsiblePersonId": "1e3d6d39-6fa8-43ec-9577-cb734ede549c",
"operateResponsiblePerson": "况毅强",
"name": "氯气瓶仓库单元",
"riskFactor": "易燃易爆",
"consequence": "气体泄漏,导致燃烧爆炸,人员伤亡",
"remark": "气体泄漏,导致燃烧爆炸,人员伤亡",
"level": 3,
"controlMeasures": "1.采用密封存储容器,定期检修\r2.安装高精度气体泄漏检测仪器,及时预警",
"unifiedCoding": "BA京1101152019007号",
"unitType": 0,
"memorySpace": "14",
"enterprise": "中石油兰州石化榆林化工有限公司",
"hazardousChemicalsName": "氯气"
};
return Mock.mock({
code:200,
message:"成功",
data,
})
}
public static getEventList(){
/* {
type:"fire",
id:new Date().getTime()+"",
typeName:"火灾",
position:[13312990.72, 4098613.12, 0.51],
reporter:"张三",
content:"北京汉邦唐化工厂区发生火灾"
}*/
const data = [
{
title: '高空坠落',
info: '物体高空坠落',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"安全事故",
reporter:"张三",
tel:"13337542569",
content:"物体高空坠落"
}
, {
title: '火灾告警',
info: '北京汉邦唐化工厂区发生火灾',
time: '2023年1月20日 14:33:33',
level: '1',
type:"fire",
typeName:"火灾",
reporter:"李四",
tel:"13985412541",
content:"北京汉邦唐化工厂区发生火灾"
}, {
title: '坍塌事故',
info: '建筑坍塌及时处理',
time: '2023年1月20日 14:33:33',
level: '1',
type:"normal",
typeName:"坍塌事故",
reporter:"张三",
tel:"13337542569",
content:"建筑坍塌及时处理"
}, {
title: '气液泄露',
info: 'NO气体泄露',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"气液泄露",
reporter:"张三",
tel:"13337542569",
content:"NO气体泄露"
}, {
title: '火灾爆炸',
info: '富土康厂区火灾爆炸',
time: '2023年1月20日 14:33:33',
level: '2',
type:"normal",
typeName:"火灾爆炸",
reporter:"张三",
tel:"13337542569",
content:"富土康厂区火灾爆炸"
}, {
title: '火灾爆炸',
info: '北京汉邦唐化工厂区发生火灾',
time: '2023年1月20日 14:33:33',
level: '1',
type:"fire",
typeName:"火灾",
reporter:"李四",
tel:"13985412541",
content:"北京汉邦唐化工厂区发生火灾"
},
].map((item:any)=>{
item.id = Mock.mock("@id");
if (item.type === 'normal'){
item.position=turf.randomPosition([
13312995.84,
4098177.2800000003,
13313096.96,
4098754.88,
]);
}else if(item.type === 'fire'){
item.position= [13312990.72, 4098613.12, 0.51]
}
item.reporter = Mock.mock("@cname")
item.tel = Mock.mock("@integer(13200000000, 13299999999)")
item.time = moment().subtract(0,"days").format("YYYY-MM-DD HH:mm:ss")
return item
});
const i = Math.floor(Math.random()*5)+1
return Mock.mock({
code:200,
message:"成功",
data:[data[i]],
})
}
}