@@ -9,6 +9,6 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services | |||||
public interface IKepDataService | public interface IKepDataService | ||||
{ | { | ||||
Task<Dictionary<string, object>> GetList(); | |||||
Task<List<object>> GetList(); | |||||
} | } | ||||
} | } |
@@ -20,21 +20,32 @@ namespace BPA.MES.Base.Application.Services.KepServerDataService.Services | |||||
} | } | ||||
[HttpPost] | [HttpPost] | ||||
[AllowAnonymous] | [AllowAnonymous] | ||||
public async Task<Dictionary<string, object>> GetList() | |||||
public async Task<List<object>> GetList() | |||||
{ | { | ||||
var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); | |||||
var dicdatass = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); | |||||
//to_days(now()) - to_days(o._TIMESTAMP) = 1 | |||||
// to_days(o._TIMESTAMP) = to_days(now()) | |||||
var list = KepDb.Queryable<object>().AS("ch01_device1", "o").Where(" to_days(o._TIMESTAMP) = to_days(now())").ToList(); | |||||
//var data =await KepDb.Queryable<ch1_device1>().Where(x=> SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Take(1000).ToListAsync(); | |||||
//var dicdatass = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x => x._NAME).ToArray(); | |||||
//var dicdata = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x=>x._NAME).ToDictionary(); | //var dicdata = KepDb.Queryable<ch1_device1>().GroupBy(x => x._NAME).Where(x => SqlFunc.DateIsSame(x._TIMESTAMP, DateTime.Now)).Select(x=>x._NAME).ToDictionary(); | ||||
Dictionary<string, object> dic = new Dictionary<string, object>(); | Dictionary<string, object> dic = new Dictionary<string, object>(); | ||||
DataTable table = new DataTable(); | |||||
foreach (var item in dicdatass) | |||||
{ | |||||
var key = item.ToString(); | |||||
var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); | |||||
dic.Add(key, values); | |||||
} | |||||
var JsonString = JsonConvert.SerializeObject(dic); | |||||
return dic; | |||||
//DataTable table = new DataTable(); | |||||
//foreach (var item in dicdatass) | |||||
//{ | |||||
// var key = item.ToString(); | |||||
// var values = data.Where(x => x._NAME == key).Select(x=>x._VALUE).ToList(); | |||||
// dic.Add(key, values); | |||||
//} | |||||
//var JsonString = JsonConvert.SerializeObject(dic); | |||||
return list; | |||||
} | |||||
[HttpGet] | |||||
[AllowAnonymous] | |||||
public async Task<bool> DeleteKep() | |||||
{ | |||||
var sql = "delete from ch01_device1 where 1=1 order by id limit 1000;"; | |||||
var list = KepDb.Ado.ExecuteCommand(sql); | |||||
return true; | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -48,6 +48,7 @@ | |||||
"not ie <= 10" | "not ie <= 10" | ||||
], | ], | ||||
"dependencies": { | "dependencies": { | ||||
"@ant-design/charts": "^1.4.2", | |||||
"@ant-design/icons": "^4.8.0", | "@ant-design/icons": "^4.8.0", | ||||
"@ant-design/pro-components": "^2.3.44", | "@ant-design/pro-components": "^2.3.44", | ||||
"@ant-design/pro-layout": "^7.8.3", | "@ant-design/pro-layout": "^7.8.3", | ||||
@@ -0,0 +1,16 @@ | |||||
import { request } from '@umijs/max'; | |||||
export default { | |||||
//列表 | |||||
List() { | |||||
return request('/api/kepdata/getlist', { | |||||
method: 'POST', | |||||
}); | |||||
}, | |||||
DeleteKep() { | |||||
return request('/api/kepdata/deletekep', { | |||||
method: 'Get', | |||||
}); | |||||
}, | |||||
} |
@@ -107,7 +107,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => { | |||||
}, | }, | ||||
footerRender: () => <Footer />, | footerRender: () => <Footer />, | ||||
onPageChange: () => { | onPageChange: () => { | ||||
console.log("11111111111111") | |||||
const userToken = localStorage.getItem('USER_TOKEN'); | const userToken = localStorage.getItem('USER_TOKEN'); | ||||
if (userToken) { | if (userToken) { | ||||
const userInfo = JSON.parse(userToken); | const userInfo = JSON.parse(userToken); | ||||
@@ -122,7 +121,6 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => { | |||||
menuDataRender: () => loopMenuItem(initialState?.menuData as any[]), | menuDataRender: () => loopMenuItem(initialState?.menuData as any[]), | ||||
childrenRender: (children: any) => { | childrenRender: (children: any) => { | ||||
// children.pathname = history.location.pathname; | // children.pathname = history.location.pathname; | ||||
console.log(children,"3333333333") | |||||
return ( | return ( | ||||
<> | <> | ||||
{children} | {children} | ||||
@@ -0,0 +1,39 @@ | |||||
#data-view { | |||||
width: 100%; | |||||
height: 100%; | |||||
background-color: #030409; | |||||
color: #fff; | |||||
#dv-full-screen-container { | |||||
background-image: url('./img/bg.png'); | |||||
background-size: 100% 100%; | |||||
box-shadow: 0 0 3px blue; | |||||
display: flex; | |||||
flex-direction: column; | |||||
#chart_title{ | |||||
padding:10; | |||||
color: '#04b2f7'; | |||||
font-size: '18px'; | |||||
font-weight: 'bold' | |||||
} | |||||
} | |||||
.head_title{ | |||||
text-align: center; | |||||
position: relative; | |||||
} | |||||
.head_title_txt{ | |||||
position: absolute; | |||||
top: 15px; | |||||
font-size: 24px; | |||||
right: 46%; | |||||
} | |||||
.g2-tooltip-title{ | |||||
color: white; | |||||
} | |||||
.g2-html-annotation{ | |||||
font-size: 14px; | |||||
} | |||||
} | |||||
@@ -42,7 +42,6 @@ export default () => ( | |||||
</div> | </div> | ||||
</BorderBox5> | </BorderBox5> | ||||
</div> */} | </div> */} | ||||
<BorderBox8> | |||||
<BorderBox13> | <BorderBox13> | ||||
<div className="dc-text"> | <div className="dc-text"> | ||||
传感器 | 传感器 | ||||
@@ -73,6 +72,5 @@ export default () => ( | |||||
<span style={{'margin-left': '10px',fontSize:18}}>P</span> | <span style={{'margin-left': '10px',fontSize:18}}>P</span> | ||||
</div> | </div> | ||||
</BorderBox13> | </BorderBox13> | ||||
</BorderBox8> | |||||
</div> | </div> | ||||
) | ) |
@@ -1,11 +1,27 @@ | |||||
import { Card } from 'antd'; | import { Card } from 'antd'; | ||||
import React from 'react'; | |||||
import React,{ useState, useEffect } from 'react'; | |||||
import { PageContainer } from '@ant-design/pro-components'; | import { PageContainer } from '@ant-design/pro-components'; | ||||
import DataV from '../../components/datav' | |||||
// import DataV from '../../components/datav' | |||||
import KepServiceAPI from '@/api/KepService'; | |||||
import KepData from '../../components/KepData' | |||||
const Kep: React.FC = () => { | const Kep: React.FC = () => { | ||||
useEffect( () => { | |||||
// const timer = window.setInterval(() => { | |||||
// KepServiceAPI.List().then((t)=>{ | |||||
// console.log(JSON.stringify(t.data)) | |||||
// }) | |||||
// }, 1000); | |||||
// return () => { | |||||
// clearInterval(timer); | |||||
// }; | |||||
// KepServiceAPI.List().then((t)=>{ | |||||
// console.log(JSON.stringify(t.data[0])) | |||||
// }) | |||||
},[]) | |||||
return ( | return ( | ||||
<div id="app"> | <div id="app"> | ||||
<DataV /> | |||||
<KepData /> | |||||
</div> | </div> | ||||
); | ); | ||||
}; | }; | ||||