巴林闲侠 2 years ago
parent
commit
6f3b013aba
  1. 14
      web/client/src/sections/problem/actions/dataAlarm.jsx
  2. 4
      web/client/src/sections/problem/actions/index.js
  3. 27
      web/client/src/sections/problem/actions/problem.jsx
  4. 120
      web/client/src/sections/problem/components/inspection.jsx
  5. 8
      web/client/src/sections/problem/components/statistics.jsx
  6. 14
      web/client/src/sections/problem/containers/dataAlarm.jsx
  7. 15
      web/client/src/utils/webapi.js
  8. 6
      web/routes/attachment/index.js

14
web/client/src/sections/problem/actions/dataAlarm.jsx

@ -1,14 +0,0 @@
'use strict';
import { ApiTable ,basicAction} from '$utils'
// export function getMembers (orgId) {
// return dispatch => basicAction({
// type: 'get',
// dispatch: dispatch,
// actionType: 'GET_MEMBERS',
// url: `${ApiTable.getEnterprisesMembers.replace('{enterpriseId}', orgId)}`,
// msg: { error: '' },
// reducer: { name: 'members' }
// });
// }

4
web/client/src/sections/problem/actions/index.js

@ -1,7 +1,7 @@
'use strict';
import * as dataAlarm from './dataAlarm'
import * as problem from './problem'
export default {
...dataAlarm
...problem
}

27
web/client/src/sections/problem/actions/problem.jsx

@ -0,0 +1,27 @@
'use strict';
import { ApiTable, basicAction } from '$utils'
export function getProjectPoms () { //
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_PROJECT_POMS',
url: `${ApiTable.getProjectPoms}`,
msg: { error: '获取已绑定项目失败' },
reducer: { name: '' }
});
}
export function getAlarmLnspection (query) { //
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query,
actionType: 'GET_ALARM_LNICSPECTION',
url: `${ApiTable.getAlarmLnspection}`,
msg: { error: '查询应用巡检信息失败' },
reducer: { name: '' }
});
}

120
web/client/src/sections/problem/components/inspection.jsx

@ -1,22 +1,128 @@
import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux";
import { DatePicker } from "@douyinfe/semi-ui";
import { Button, Form, Modal, Skeleton, Pagination, Table } from "@douyinfe/semi-ui";
const Inspection = ({ dispatch, actions, route, statistic }) => {
const { problem } = actions
const [selectProject, setSelectProject] = useState([])
const [applyFilter, setApplyFilter] = useState([])
const api = useRef();
// console.log(actions);
useEffect(() => {
dispatch(problem.getProjectPoms()).then((res) => {
// console.log(res.payload.data);
if (res.success) {
let project = []
let apply = []
res.payload.data?.rows?.map(v => {
project.push({ name: v.pepProjectName || v.name || v.id, value: v.id })
v.projectApps.map(app => apply.push({ name: app.name, value: app.id }))
})
setSelectProject(project)
setApplyFilter(apply)
}
})
dispatch(problem.getAlarmLnspection({})).then((res) => {
console.log(res.payload.data);
})
}, [])
const Inspection = ({ dispatch, actions, route }) => {
console.log(route);
return (
<div style={{ width: '100%', height: 180, backgroundColor: 'white', marginBottom: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ width: 190, fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', }}><span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 10px" }}></span>数据异常统计</div>
<div style={{ fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#BDDBFC' }}><img src="/assets/images/problem/keyboard.png" style={{ width: 30, height: 17, marginRight: 10 }} />开发中敬请期待</div>
<div style={{ width: 400, }}>
<span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 20px" }}></span>
<span style={{ fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', marginRight: 10 }}>{statistic[route]}</span>
<span style={{ fontSize: 12 }}>APPLY SEMI-AUTOMATIC INSPECTION</span>
<div style={{ fontSize: 12 }}>仅保留48小时内的图片数据,每小时覆盖执行一次 <span style={{ fontWeight: 500, color: '#005ABD', fontSize: 12 }}>03专项2期已阅共123个</span></div>
</div>
<div style={{}}>
<Form
onSubmit={(values) => console.log(values)}
// onValueChange={values=>console.log(values)}
getFormApi={(formApi) => (api.current = formApi)}
layout="horizontal"
style={{ position: "relative", width: "100%", flex: 1 }}
>
<Form.DatePicker
type="dateTimeRange"
labelPosition="left"
style={{ width: 352 }}
label='时间筛选:'
field='time'
key='time'
// defaultPickerValue={[new Date('2022-08-08 00:00'), new Date('2022-08-09 12:00')]}
// initValue={[new Date('2022-08-08 00:00'), new Date()]}
onChange={(v) => console.log(v)}
/>
<Form.Select
label='所选项目:'
labelPosition="left"
field='projectId'
key='projectId'
style={{ width: 116, marginRight: 10, color: "#F9F9F9", }}
placeholder="全部"
showClear
>
{selectProject?.map((item) => {
return (
<Form.Select.Option key={item.value} value={item.value}>
{item.name}
</Form.Select.Option>
);
})}
</Form.Select>
<Form.Select
label='应用筛选:'
labelPosition="left"
field='appId'
key='appId'
style={{ width: 116, marginRight: 10, color: "#F9F9F9", }}
placeholder="全部"
showClear
>
{applyFilter?.map((item) => {
return (
<Form.Select.Option key={item.value} value={item.value}>
{item.name}
</Form.Select.Option>
);
})}
</Form.Select>
<Form.Select
label='显示范围:'
labelPosition="left"
field='noted'
key='noted'
style={{ width: 116, marginRight: 10, color: "#F9F9F9", }}
placeholder="全部"
showClear
>
{[{ name: '已阅', value: 'noted' }, { name: '未阅', value: 'unnote' }].map((item) => {
return (
<Form.Select.Option key={item.value} value={item.value}>
{item.name}
</Form.Select.Option>
);
})}
</Form.Select>
</Form>
</div>
</div>
<div style={{}}>
<img src="/_file-server/project/da09f988-4c62-46fc-a532-b4cf053a4b6d/accurate_invest.png" style={{ width: 400, height: 128 }} />
</div>
<img src="project/da09f988-4c62-46fc-a532-b4cf053a4b6d/accurate_invest.png" alt="" />
</div >
)
}
@ -26,7 +132,7 @@ function mapStateToProps (state) {
const { auth, global, members } = state;
return {
// user: auth.user,
// actions: global.actions,
actions: global.actions,
// global: global,
// members: members.data,
};

8
web/client/src/sections/problem/components/statistics.jsx

@ -3,15 +3,15 @@ import { connect } from "react-redux";
import { DatePicker } from "@douyinfe/semi-ui";
import Inspection from "./inspection";
const Statistics = ({ dispatch, actions, route }) => {
const Statistics = ({ dispatch, actions, route ,statistic}) => {
console.log(route);
// console.log(route);
return (
<>{route == 'useAbnormal' ?
<Inspection /> :
<Inspection statistic={statistic} route={route} /> :
<div style={{ width: '100%', height: 180, backgroundColor: 'white', marginBottom: 20 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<div style={{ width: 190, fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', }}><span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 10px" }}></span>数据异常统计</div>
<div style={{ width: 190, fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', }}><span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 10px" }}></span>{statistic[route]}</div>
{/* <DatePicker
type="dateTimeRange"
style={{ width: 405 }}

14
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -17,12 +17,13 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
const [exhibition, setExhibition] = useState([]); //
const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' }
const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' }
useEffect(() => {
setRoute(match.url.substring(match.url.lastIndexOf("/") + 1, match.url.length))
console.log(match.url)
console.log(tableType);
// console.log(match.url)
// console.log(tableType);
}, [])
@ -203,7 +204,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
let arr = localStorage.getItem(name)
? JSON.parse(localStorage.getItem(name))
: [];
console.log(arr);
// console.log(arr);
if (route) {
let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value))
@ -216,7 +217,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
}
console.log(data)
// console.log(data)
let TableDisplay = data.map(v => {
let datas = columnAll.find(vv => v == vv.value)
@ -226,8 +227,8 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
})
console.log(TableDisplay);
console.log(setup);
// console.log(TableDisplay);
// console.log(setup);
setExhibition(TableDisplay)
setTableSetup([{ list: setup }])
}
@ -264,6 +265,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
<Statistics
route={route}
tableType={tableType}
statistic={statistic}
/>
<TableData
route={route}

15
web/client/src/utils/webapi.js

@ -16,11 +16,16 @@ export const ApiTable = {
login: "login",
logout: "logout",
getOrganizationDeps:'organization/deps',//获取项企(PEP)全部部门及其下用户
getOrganizationUser:'organization/user',//获取成员列表
putOrganizationUser:'organization/user/{pomsUserId}',//更新成员状态
postOrganizationUser:'organization/user',//添加/编辑成员
deteleOrganizationAdmin:'organization/admin/{pomsUserId}',//删除管理员
getOrganizationDeps: 'organization/deps',//获取项企(PEP)全部部门及其下用户
getOrganizationUser: 'organization/user',//获取成员列表
putOrganizationUser: 'organization/user/{pomsUserId}',//更新成员状态
postOrganizationUser: 'organization/user',//添加/编辑成员
deteleOrganizationAdmin: 'organization/admin/{pomsUserId}',//删除管理员
//告警
getProjectPoms: 'project/poms', //获取已绑定项目
getAlarmLnspection: 'alarm/application/inspection', //查询应用巡检信息
};
export const RouteTable = {
apiRoot: "/api/root",

6
web/routes/attachment/index.js

@ -1,8 +1,8 @@
'use strict';
const request = require('superagent');
const parse = require('async-busboy');
const path = require('path')
const fs = require('fs');
// const parse = require('async-busboy');
// const path = require('path')
// const fs = require('fs');
const ext = {
project: [".txt", ".dwg", ".doc", ".docx", ".xls", ".xlsx", ".pdf", ".png", ".jpg", ".svg"],

Loading…
Cancel
Save