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{ 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京110115〔2019〕007号", "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]], }) } }