@ -0,0 +1,12 @@ |
|||
const proxy = require('koa-proxy'); |
|||
|
|||
module.exports.entry = function (app, router, opts) { |
|||
app.use(proxy({ |
|||
host: opts.host, |
|||
match: opts.match, |
|||
map: function (path) { |
|||
return path.replace(opts.match, ''); |
|||
}, |
|||
suppressRequestHeaders: ['content-length'], |
|||
})) |
|||
} |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 665 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
@ -1,7 +1,11 @@ |
|||
'use strict'; |
|||
|
|||
import * as example from './example' |
|||
import * as waterconservancy from './waterconservancy' |
|||
import * as worksafety from './worksafety' |
|||
|
|||
export default { |
|||
...example, |
|||
...waterconservancy, |
|||
...worksafety, |
|||
} |
@ -0,0 +1,83 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getPcode(orgId) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_PCODE', |
|||
url: `${ApiTable.getPcode}`, |
|||
msg: { error: '获取水环境pcode失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function waterLogin(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'POST_WATER_LOGIN', |
|||
url: `${ApiTable.waterLogin}`, |
|||
msg: { error: '登录水环境失败' }, |
|||
// reducer: { name: 'members' }
|
|||
}); |
|||
} |
|||
|
|||
export function getWaterLevelTrend(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_WATER_LEVEL_TREND', |
|||
url: `${ApiTable.getWaterLevelTrend}`, |
|||
msg: { error: '获取水位趋势失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getWaterStructures(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_WATER_STRUCTURES', |
|||
url: `${ApiTable.getWaterStructures}`, |
|||
msg: { error: '获取水务结构物失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getWaterVideoList(struIds, query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_WATER_VIDEO_LIST', |
|||
url: `${ApiTable.getWaterVideoList.replace('{struIds}', struIds)}`, |
|||
msg: { error: '获取水务视频失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getYsAccessToken(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_YS_ACCESS_TOKEN', |
|||
url: `${ApiTable.getYsAccessToken}`, |
|||
msg: { error: '获取萤石授权失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getWaterAlarms(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
query, |
|||
// data: { "keywords": "", "status": "new", "levels": [1, 2, 3], "orderBy": "endTime", "orderDirection": "desc", "limit": 10, "offset": 0, "structures": null, "types": [1] },
|
|||
data: { "structures": null, "orderBy": "endTime", "endTime": "2022-06-30 23:59:59", "keywords": "", "levels": [1, 2, 3], "startTime": "2022-06-01 00:00:00", "orderDirection": "desc", "status": "history", "offset": 0, "types": [1], "limit": 10 }, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_WATER_ALARMS', |
|||
url: `${ApiTable.getWaterAlarms}`, |
|||
msg: { error: '获取告警失败' }, |
|||
}); |
|||
} |
@ -0,0 +1,70 @@ |
|||
'use strict'; |
|||
|
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function worksafetyLogin(data) { |
|||
return dispatch => basicAction({ |
|||
type: 'post', |
|||
data, |
|||
dispatch: dispatch, |
|||
actionType: 'POST_WORKSAFETY_LOGIN', |
|||
url: `${ApiTable.worksafetyLogin}`, |
|||
msg: { error: '登录安监失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getEmerOrgList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_EMER_ORG_LIST', |
|||
url: `${ApiTable.getEmerOrgList}`, |
|||
msg: { error: '登录应急机构失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getEmerTeamList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_EMER_TEAM_LIST', |
|||
url: `${ApiTable.getEmerTeamList}`, |
|||
msg: { error: '登录应急队伍失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getEmerExpertList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_EMER_EXPERT_LIST', |
|||
url: `${ApiTable.getEmerExpertList}`, |
|||
msg: { error: '登录应急专家失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getEmerMedicalList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_EMER_MEDICAL_LIST', |
|||
url: `${ApiTable.getEmerMedicalList}`, |
|||
msg: { error: '登录医疗机构失败' }, |
|||
}); |
|||
} |
|||
|
|||
export function getEmerRefugeList(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
query, |
|||
dispatch: dispatch, |
|||
actionType: 'GET_EMER_REFUGE_LIST', |
|||
url: `${ApiTable.getEmerRefugeList}`, |
|||
msg: { error: '登录避难场所失败' }, |
|||
}); |
|||
} |
@ -1,55 +1,42 @@ |
|||
import React from 'react' |
|||
import { Box } from '$components'; |
|||
import { Tooltip } from 'antd'; |
|||
|
|||
function Infrastructure(props) { |
|||
|
|||
const { waterLevelAlarms } = props; |
|||
|
|||
return <Box title={"预警统计"} > |
|||
<div className='_city_safty'> |
|||
<div className='alarm_handle'> |
|||
<div className='handle_img' /> |
|||
<div className='alarm_content'> |
|||
<div className='alarm_bg'> |
|||
<div className='alarm_title1'>2023-06-20 17:00:00</div> |
|||
<div className='alarm_title2' style={{ color: '#FFEA00' }}>二级预警</div> |
|||
</div> |
|||
<div className='alarm_text'>萌萌小区25栋305等等等等等发生等等火灾扥大哥大呢个</div> |
|||
</div> |
|||
</div> |
|||
<div className='alarm_unhandle'> |
|||
<div className='handle_img' /> |
|||
<div className='alarm_content'> |
|||
<div className='alarm_bg'> |
|||
<div className='alarm_title1'>2023-06-20 17:00:00</div> |
|||
<div className='alarm_title2' style={{ color: '#FF2C2C' }}>一级预警</div> |
|||
</div> |
|||
<div className='alarm_text'>萌萌小区25栋305等等等等等发生等等火灾扥大哥大呢个</div> |
|||
</div> |
|||
</div> |
|||
<div className='alarm_unhandle'> |
|||
<div className='handle_img' /> |
|||
<div className='alarm_content'> |
|||
<div className='alarm_bg'> |
|||
<div className='alarm_title1'>2023-06-20 17:00:00</div> |
|||
<div className='alarm_title2' style={{ color: '#FF2C2C' }}>二级预警</div> |
|||
{ |
|||
// alarm_unhandle FF2C2C alarm_handle FFEA00
|
|||
waterLevelAlarms.map(a => <div className={a.alarms[0]?.state >= 3 ? 'alarm_handle' : 'alarm_unhandle'}> |
|||
<div className='handle_img' /> |
|||
<div className='alarm_content'> |
|||
<div className='alarm_bg'> |
|||
<Tooltip title={a.alarms[0]?.source?.name}> |
|||
<div className='alarm_title1'>{a.alarms[0]?.source?.name}</div> |
|||
</Tooltip> |
|||
<div className='alarm_title2' style={{ color: a.alarms[0]?.state >= 3 ? '#FFEA00' : '#FF2C2C' }}>{convertLevelToLabel(a.alarms[0]?.level)}</div> |
|||
</div> |
|||
<div className='alarm_text'>{a.alarms[0]?.content}</div> |
|||
</div> |
|||
<div className='alarm_text'>萌萌小区25栋305等等等等等发生等等火灾扥大哥大呢个</div> |
|||
</div> |
|||
</div> |
|||
<div className='alarm_unhandle'> |
|||
<div className='handle_img' /> |
|||
<div className='alarm_content'> |
|||
<div className='alarm_bg'> |
|||
<div className='alarm_title1'>2023-06-20 17:00:00</div> |
|||
<div className='alarm_title2' style={{ color: '#FF2C2C' }}>二级预警</div> |
|||
</div> |
|||
<div className='alarm_text'>萌萌小区25栋305等等等等等发生等等火灾扥大哥大呢个</div> |
|||
</div> |
|||
</div> |
|||
</div>) |
|||
} |
|||
</div> |
|||
</Box> |
|||
} |
|||
|
|||
export default Infrastructure; |
|||
|
|||
|
|||
function convertLevelToLabel(level) { |
|||
switch (level) { |
|||
case 1: |
|||
return '一级预警'; |
|||
case 2: |
|||
return '二级预警'; |
|||
case 3: |
|||
return '三级预警'; |
|||
default: |
|||
return ''; |
|||
} |
|||
} |
|||
|
@ -0,0 +1,22 @@ |
|||
export const SHUI_ZHAN = [ |
|||
{ name: '莲塘渡槽', location: [115.95219, 28.5429711], }, |
|||
{ name: '雄溪站', location: [115.908888, 28.5337351], structId: 2945 }, |
|||
{ name: '塔田站', location: [115.916979, 28.5319411], }, |
|||
{ name: '万寿湖站', location: [115.929167, 28.5222881], }, |
|||
{ name: '张坊站', location: [115.9092, 28.5049421], }, |
|||
{ name: '东山站', location: [115.887528, 28.4872531], }, |
|||
{ name: '河外泵站', location: [115.889888, 28.4856311], }, |
|||
{ name: '三山站', location: [115.888521, 28.4726391], }, |
|||
{ name: '内湖电排站', location: [115.891311, 28.4692441], }, |
|||
{ name: '沥山站', location: [115.897692, 28.5616881], }, |
|||
{ name: '象湖站', location: [115.894774, 28.5789311], }, |
|||
{ name: '姚塘站', location: [115.863709, 28.579954], }, |
|||
{ name: '河下站', location: [115.844769, 28.5602231], }, |
|||
{ name: '霞山站', location: [115.841465, 28.5508371], }, |
|||
{ name: '石岐站', location: [115.838675, 28.5507611], }, |
|||
{ name: '清湖站', location: [115.838418, 28.5378311], }, |
|||
{ name: '虎山站', location: [115.843673, 28.5366861], }, |
|||
{ name: '新八月湖站', location: [115.880322, 28.6076911], }, |
|||
// { name: '八月湖站', location: [115.868392, 28.6091981], },
|
|||
{ name: '河口电排站', location: [115.924659, 28.52865] }, |
|||
] |
@ -0,0 +1,55 @@ |
|||
const request = require('superagent'); |
|||
|
|||
let _weatherUrl = ''; |
|||
module.exports.entry = function (app, router, opts) { |
|||
const { weatherUrl } = opts; |
|||
console.log(weatherUrl, '天气'); |
|||
_weatherUrl = weatherUrl; |
|||
// _weatherUrl = "https://weatherssj.anxinyun.cn/weatherApp/weather/getImmeData"
|
|||
|
|||
router.get('/query/weather', weather); |
|||
}; |
|||
|
|||
async function weather(ctx) { |
|||
try { |
|||
const { cname } = ctx.query; |
|||
const reg = /.+?(省|市|自治区|自治州|县|区)/g; |
|||
const arr = cname.match(reg); |
|||
if (Array.isArray(arr)) { |
|||
let cityName = arr[0]; |
|||
if (arr[1]) { |
|||
cityName = arr[1]; |
|||
} |
|||
const weatherRes = await request.post(_weatherUrl).send({ cityName }); |
|||
const { body } = weatherRes; |
|||
if (body && body.data) { |
|||
ctx.status = 200; |
|||
ctx.body = { ...body.data, cname, texta: _weatherUrl }; |
|||
} else { |
|||
ctx.status = 400; |
|||
ctx.body = { msg: '获取天气错误' }; |
|||
} |
|||
} else { |
|||
ctx.status = 400; |
|||
ctx.body = { msg: '地址解析错误' }; |
|||
} |
|||
} catch (error) { |
|||
console.log('[*err]', error); |
|||
ctx.status = 400; |
|||
ctx.body = error; |
|||
} |
|||
} |
|||
|
|||
// ip地址识别库
|
|||
// 淘宝IP地址查询接口:http://ip.taobao.com/service/getIpInfo.php?ip=1.1.35.57
|
|||
// 腾讯IP地址查询接口:http://fw.qq.com/ipaddress
|
|||
// 新浪的IP地址查询接口:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js
|
|||
// 新浪多地域测试方法:http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js&ip=218.192.3.42
|
|||
// 搜狐IP地址查询接口(默认GBK):http://pv.sohu.com/cityjson
|
|||
// 搜狐IP地址查询接口(可设置编码):http://pv.sohu.com/cityjson?ie=utf-8
|
|||
// 搜狐另外的IP地址查询接口:http://txt.go.sohu.com/ip/soip
|
|||
// 谷歌IP地址查询接口:http://j.maxmind.com/app/geoip.js
|
|||
// 1616 IP地址查询接口:http://w.1616.net/chaxun/iptolocal.php
|
|||
// 126 http://ip.ws.126.net/ipquery hao123
|
|||
// http://app.hao123.com/ipquery/getcity.php?rtype=2
|
|||
// 太平洋电脑网 http://whois.pconline.com.cn/
|