Browse Source

解决冲突

dev
wenlele 2 years ago
parent
commit
7bd3cbf77a
  1. 2
      api/app/lib/controllers/alarm/data.js
  2. 36
      api/app/lib/controllers/alarm/video.js
  3. 3
      api/app/lib/routes/alarm/index.js
  4. 504
      web/client/src/sections/install/components/memberModal.jsx
  5. 8
      web/client/src/sections/install/containers/system.jsx
  6. 11
      web/client/src/sections/problem/actions/problem.jsx
  7. 137
      web/client/src/sections/problem/components/tableData.jsx
  8. 7
      web/client/src/sections/problem/containers/dataAlarm.jsx
  9. 1
      web/client/src/utils/webapi.js

2
api/app/lib/controllers/alarm/data.js

@ -253,7 +253,7 @@ async function exportDataAlarms(ctx, alarmList, groupId) {
})
let exportData = []
for (let item of alarmList.slice(0, 1000000)) {//最多百万条
for (let item of alarmList) {
let projectNames = item.pomsProject.map(p => {
return p.name || p.pepProject.projectName
})

36
api/app/lib/controllers/alarm/video.js

@ -38,6 +38,39 @@ async function deviceType (ctx) {
}
}
async function exceptionType(ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
const { database: anxinyun } = clickHouse.anxinyun.opts.config
const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs
let anxinStruc = await anxinStrucIdRange({
ctx,
})
const anxinStrucIds = anxinStruc.map(a => a.strucId)
const statusRes = await clickHouse.vcmp.query(`
SELECT DISTINCT
camera_status.id AS statusId,camera_status.describe AS describe
FROM camera_status
INNER JOIN camera_status_alarm
ON camera_status.id = camera_status_alarm.status_id
INNER JOIN ${anxinyun}.t_video_ipc
ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no
AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no
${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`}
`).toPromise()
ctx.status = 200;
ctx.body = statusRes
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
async function alarmList (ctx) {
try {
const { models } = ctx.fs.dc;
@ -461,5 +494,6 @@ module.exports = {
alarmList,
confirm,
alarmAdded,
vcmpAppAuthToken
vcmpAppAuthToken,
exceptionType
};

3
api/app/lib/routes/alarm/index.js

@ -60,4 +60,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/vcmp/auth'] = { content: '获取视频平台应用鉴权token', visible: true };
router.get('/vcmp/auth', videoAlarm.vcmpAppAuthToken);
app.fs.api.logAttr['GET/alarm/video/exceptionType'] = { content: '查询视频异常类型', visible: true };
router.get('/alarm/video/exceptionType', videoAlarm.exceptionType);
};

504
web/client/src/sections/install/components/memberModal.jsx

@ -1,268 +1,272 @@
import React, { useState, useRef, useEffect } from "react";
import { connect } from "react-redux";
import { Modal, Form, CheckboxGroup, Checkbox,Button } from "@douyinfe/semi-ui";
import { Modal, Form, CheckboxGroup, Checkbox, Button } from "@douyinfe/semi-ui";
import { IconAlertCircle } from '@douyinfe/semi-icons';
function memberModal (props) {
const {
close,
cancel,
visible,
dispatch,
pepList,
actions,
editObj,
memberEdit,
pomsList,
anxinDelete,
anxincloudArr
} = props;
const { install } = actions;
const form = useRef();//
const [disablePeople, setDisablePeople] = useState(true); //
const [peopleList, setPeopleList] = useState([]); //List
const [departmentId, setDepartmentId] = useState(); //id
const [jurisdiction, setJurisdiction] = useState([
{
label: '数据分析师',
value: 'data_analyst',
text: '拥有数据、分析、工单、资料相关的权限'
}, {
label: '售后运维',
value: 'after_sale',
text: '拥有设备、问题、工单、资料相关的权限'
}, {
label: '资源管理者',
value: 'resource_manage',
text: '拥有资料、设备、工单相关的权限'
}, {
label: '客户服务',
value: 'customer_service',
text: '拥有服务、工单、资料相关的权限'
},
]); //
const [pomsList_, setPomsList_] = useState([])
//
useEffect(() => {
if (editObj.id) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == editObj.departments[0].id) {
departmentList = pepList[i].users
}
const {
close,
cancel,
visible,
dispatch,
pepList,
actions,
editObj,
memberEdit,
pomsList,
anxinDelete,
anxincloudArr
} = props;
const { install } = actions;
const form = useRef();//
const [disablePeople, setDisablePeople] = useState(true); //
const [peopleList, setPeopleList] = useState([]); //List
const [departmentId, setDepartmentId] = useState(); //id
const [jurisdiction, setJurisdiction] = useState([
{
label: '数据分析师',
value: 'data_analyst',
text: '拥有数据、分析、工单、资料相关的权限'
}, {
label: '售后运维',
value: 'after_sale',
text: '拥有设备、问题、工单、资料相关的权限'
}, {
label: '资源管理者',
value: 'resource_manage',
text: '拥有资料、设备、工单相关的权限'
}, {
label: '客户服务',
value: 'customer_service',
text: '拥有服务、工单、资料相关的权限'
},
]); //
const [pomsList_, setPomsList_] = useState([])
//
useEffect(() => {
if (editObj.id) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == editObj.departments[0].id) {
departmentList = pepList[i].users
}
setDepartmentId(editObj.departments[0].id)
setPeopleList(departmentList)
}
setPomsList_(pomsList.filter(p=>p.pepProjectIsDelete != -1))
}, []);
}
setDepartmentId(editObj.departments[0].id)
setPeopleList(departmentList)
}
setPomsList_(pomsList.filter(p => p.pepProjectIsDelete != -1))
}, []);
function handleOk () {
//
form.current
.validate()
.then((values) => {
let roleArr = JSON.parse(JSON.stringify(values.role))
if (roleArr.indexOf('admin') != -1) {
roleArr.splice(roleArr.indexOf('admin'), 1)
}
if (memberEdit) {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//(PEP)
if (res.success) {
close();
}
})
}
else {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//(PEP)
if (res.success) {
close();
function handleOk () {
//
form.current
.validate()
.then((values) => {
let roleArr = JSON.parse(JSON.stringify(values.role))
if (roleArr.indexOf('admin') != -1) {
roleArr.splice(roleArr.indexOf('admin'), 1)
}
if (memberEdit) {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//(PEP)
if (res.success) {
close();
}
})
}
else {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//(PEP)
if (res.success) {
close();
}
})
}
})
}
function handleCancel () {
cancel();
//
}
return (
<>
<Modal
title="成员设置"
okText="确定"
cancelText="取消"
visible={visible}
onOk={handleOk}
width={607}
onCancel={handleCancel}
>
<div style={{ margin: "0px 25px" }}>
<div style={{ width: '100%', height: 32, background: '#F4F8FF', borderRadius: 2, border: '1px solid #C7E1FF', display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', marginLeft: 12 }}><IconAlertCircle style={{ color: '#0F7EFB' }} /></div>
<div style={{ color: '#0F7EFB', fontSize: 12, marginLeft: 8 }}>成员成为管理员后拥有平台所有权限和项目成员的普通角色会被禁用</div>
</div>
<Form
allowEmpty
labelPosition="left"
labelAlign="right"
labelWidth="90px"
onValueChange={(values, field) => {
for (var key in field) {
if (key == 'department') {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == values.department) {
departmentList = pepList[i].users
}
}
setPeopleList(departmentList)
setDisablePeople(false)
form.current.setValue('pepUserId', undefined);
}
else {
setPeopleList([])
setDisablePeople(true)
form.current.setValue('pepUserId', undefined);
}
}
})
}
})
}
function handleCancel () {
cancel();
//
}
return (
<>
<Modal
title="成员设置"
okText="确定"
cancelText="取消"
visible={visible}
onOk={handleOk}
width={607}
onCancel={handleCancel}
>
<div style={{ margin: "0px 25px" }}>
<div style={{ width: '100%', height: 32, background: '#F4F8FF', borderRadius: 2, border: '1px solid #C7E1FF', display: 'flex', alignItems: 'center' }}>
<div style={{ display: 'flex', alignItems: 'center', marginLeft: 12 }}><IconAlertCircle style={{ color: '#0F7EFB' }} /></div>
<div style={{ color: '#0F7EFB', fontSize: 12, marginLeft: 8 }}>成员成为管理员后拥有平台所有权限和项目成员的普通角色会被禁用</div>
</div>
<Form
allowEmpty
labelPosition="left"
labelAlign="right"
labelWidth="90px"
onValueChange={(values, field) => {
for (var key in field) {
if (key == 'department') {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == values.department) {
departmentList = pepList[i].users
}
}
setPeopleList(departmentList)
setDisablePeople(false)
form.current.setValue('pepUserId', undefined);
}
else {
setPeopleList([])
setDisablePeople(true)
form.current.setValue('pepUserId', undefined);
}
}
}
}
}}
getFormApi={(formApi) => (form.current = formApi)}
>
<div>
<Form.Select
label="选择部门:"
field="department"
placeholder="请选择部门"
style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]}
showClear
filter
initValue={departmentId || ""}
disabled={memberEdit}
>
{
pepList.map((item, index) => {
return (
<Form.Select.Option key={item.id} value={item.id}>
{item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
<div>
<Form.Select
label="选择人员:"
field="pepUserId"
filter
placeholder="请选择人员"
style={{ width: 417 }}
rules={[{ required: true, message: "请选择人员" }]}
showClear
initValue={editObj.pepUserId || ""}
disabled={disablePeople}
>
{
peopleList.map((item, index) => {
return (
<Form.Select.Option key={item.id} value={item.id}>
{item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
<div>
<Form.CheckboxGroup
field="role"
label='权限配置:'
showClear
initValue={editObj.role || []}
>
{
jurisdiction.map((item, index) => {
return (
<Checkbox value={item.value} key={index} >
<div style={{ display: 'flex' }}>
<div style={{ fontSize: 13, color: '#4A4A4A' }}>
{item.label}
</div>
<div style={{ fontSize: 12, color: '#969799', marginLeft: 12 }}>
{item.text}
</div>
</div>
</Checkbox>
)
})
}
</Form.CheckboxGroup>
</div>
<div>
<Form.Select
label="关联项目:"
field="correlationProject"
multiple
placeholder="请选择关联项目"
initValue={anxincloudArr}
style={{ width: 417 }}
filter
showClear
outerBottomSlot={
<p style={{ margin:"6px 26px",}}>
<Button theme='borderless' onClick={()=>{
form.current.setValue('correlationProject',pomsList_.map(p=> p.id))
}}>全选</Button>
</p>
}
>
{
pomsList_.map((item, index) => {
return (
<Form.Select.Option key={index} value={item.id}>
{item.pepProjectName || item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
}}
getFormApi={(formApi) => (form.current = formApi)}
>
<div>
<Form.Select
label="选择部门:"
field="department"
placeholder="请选择部门"
style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]}
showClear
filter
initValue={departmentId || ""}
disabled={memberEdit}
>
{
anxinDelete?.length > 0 ? (
<div style={{ display: 'flex' }}>
<div style={{ marginTop: 3 }}>
<img src="/assets/images/install/risk.png" alt="" style={{ height: 24, width: 24, }} />
</div>
<div style={{
background: 'rgba(255, 51, 0, 0.28)', color: '#FF3300',
fontSize: 12, marginLeft: 8, lineHeight: 2, padding: '0px 5px',
border: '1px solid rgba(255,51,0,0.3)', width: 515
}}>
确定后{anxinDelete.join('、')}将被系统移除原因是项目已在项企映射关系中被删除
pepList.map((item, index) => {
return (
<Form.Select.Option key={item.id} value={item.id}>
{item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
<div>
<Form.Select
label="选择人员:"
field="pepUserId"
filter
placeholder="请选择人员"
style={{ width: 417 }}
rules={[{ required: true, message: "请选择人员" }]}
showClear
initValue={editObj.pepUserId || ""}
disabled={disablePeople}
>
{
peopleList.map((item, index) => {
return (
<Form.Select.Option key={item.id} value={item.id}>
{item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
<div>
<Form.CheckboxGroup
field="role"
label='权限配置:'
showClear
initValue={editObj.role || []}
>
{
jurisdiction.map((item, index) => {
return (
<Checkbox value={item.value} key={index} >
<div style={{ display: 'flex' }}>
<div style={{ fontSize: 13, color: '#4A4A4A' }}>
{item.label}
</div>
<div style={{ fontSize: 12, color: '#969799', marginLeft: 12 }}>
{item.text}
</div>
</div>
</div>
) : ('')
</Checkbox>
)
})
}
</Form>
</div>
</Modal>
</>
);
</Form.CheckboxGroup>
</div>
<div>
<Form.Select
label="关联项目:"
field="correlationProject"
multiple
placeholder="请选择关联项目"
initValue={anxincloudArr}
style={{ width: 417 }}
filter
showClear
// autoAdjustOverflow={false}
outerBottomSlot={
<p style={{ margin: "6px 26px", }}>
<Button theme='borderless' onClick={() => {
form.current.setValue('correlationProject', pomsList_.map(p => p.id))
}}>全选</Button>
<Button theme='borderless' onClick={() => {
form.current.setValue('correlationProject', [])
}}>取消选择</Button>
</p>
}
>
{
pomsList_.map((item, index) => {
return (
<Form.Select.Option key={index} value={item.id}>
{item.pepProjectName || item.name}
</Form.Select.Option>
)
})
}
</Form.Select>
</div>
{
anxinDelete?.length > 0 ? (
<div style={{ display: 'flex' }}>
<div style={{ marginTop: 3 }}>
<img src="/assets/images/install/risk.png" alt="" style={{ height: 24, width: 24, }} />
</div>
<div style={{
background: 'rgba(255, 51, 0, 0.28)', color: '#FF3300',
fontSize: 12, marginLeft: 8, lineHeight: 2, padding: '0px 5px',
border: '1px solid rgba(255,51,0,0.3)', width: 515
}}>
确定后{anxinDelete.join('、')}将被系统移除原因是项目已在项企映射关系中被删除
</div>
</div>
) : ('')
}
</Form>
</div>
</Modal>
</>
);
}
function mapStateToProps (state) {
const { auth, global, members } = state;
return {
// loading: members.isRequesting,
user: auth.user,
actions: global.actions,
// members: members.data,
};
const { auth, global, members } = state;
return {
// loading: members.isRequesting,
user: auth.user,
actions: global.actions,
// members: members.data,
};
}
export default connect(mapStateToProps)(memberModal);

8
web/client/src/sections/install/containers/system.jsx

@ -236,9 +236,9 @@ const Example = (props) => {
{
title: '关联时间',
dataIndex: "createTime",
key: 'createTime',
key: 'time',
render: (_, row) => {
return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss")
return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss") || '无';
}
},
{
@ -246,7 +246,7 @@ const Example = (props) => {
dataIndex: "updateTime",
key: 'updateTime',
render: (_, row) => {
return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss")
return (row.updateTime ? moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss") : moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"));
}
},
{
@ -254,7 +254,7 @@ const Example = (props) => {
dataIndex: "pepUserName",
key: 'pepUserName',
render: (_, row) => {
return row.pepUserName
return row.pepUserName || '无'
}
},
{

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

@ -149,6 +149,17 @@ export function getAlarmVideoDeviceKind () { //查询视频设备类型
});
}
export function getAlarmVideoExceptionType () { //
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_ALARM_VIDEO_EXCEPTION_TYPE',
url: `${ApiTable.getAlarmVideoExceptionType}`,
msg: { option: '查询视频异常类型' },
reducer: { name: '' }
});
}
export function putAlarmVideoConfirm (data) { //
return dispatch => basicAction({
type: 'put',

137
web/client/src/sections/problem/components/tableData.jsx

@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux";
import { Button, Form, Modal, Skeleton, Pagination, Table } from "@douyinfe/semi-ui";
import { Button, Form, Modal, Skeleton, Pagination, Table, Tooltip, Toast } from "@douyinfe/semi-ui";
import { SkeletonScreen, } from "$components";
import moment from "moment";
import { validate } from "schema-utils";
@ -10,14 +10,14 @@ import qs from "qs";
const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition, pepProjectId,
selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user }) => {
selected, setSelected, setIfBulk, setConfirm, genre, setGenre, query, setQuery, tableData, setTableData, location, user, statusId, setStatusId }) => {
const { problem } = actions
const [count, setCount] = useState(0) //
const [checkAll, setCheckAll] = useState(true) //
const api = useRef();
const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '',
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', statusId: '',
errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: ''
})
const kindName = useRef()
@ -122,7 +122,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
useEffect(() => {
if (location) {
search.current = { ...search.current, ...location, state: 'new' }
api.current?.setValues({...location, state: 'new'})
api.current?.setValues({ ...location, state: 'new' })
}
if (route !== 'videoAbnormal' && route !== 'useAbnormal') {
dispatch(problem.getAlarmDataGroup()).then((res) => {
@ -153,35 +153,88 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
setGenre(res.payload.data.map(v => ({ name: v.kind, value: v.id })))
}
})
dispatch(problem.getAlarmVideoExceptionType()).then((res) => {
if (res.success) {
setStatusId(res.payload.data.map(v => ({ name: v.describe, value: v.statusId })))
}
})
}
}, [])
const handleExport = () => {
let url = ''
let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current
let { keywordTarget, keyword = '', errType = '', state = '', kindId = '', statusId = '', groupUnitId = '', confirmState = '', onlineState = '', sustainTimeStart = '', sustainTimeEnd = '' } = search.current
if (sustainTimeStart && sustainTimeEnd) {
let range = moment(sustainTimeEnd).diff(moment(sustainTimeStart), 'minutes')
if (range > 24 * 60 * 7) {
Toast.warning({
content: '导出自定义时间跨度不超过7天',
duration: 3,
})
return false;
}
} else {
sustainTimeStart = moment().add(-7, 'day').format("YYYY-MM-DD HH:mm:ss")
sustainTimeEnd = moment().format("YYYY-MM-DD HH:mm:ss")
}
switch (route) {
case 'useAbnormal':
url = `alarm/application/api?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType}
&state=${state}stainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}`
dispatch(problem.getAlarmLnspectionApi({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
if (res.success) {
if (res.payload.data.count) {
url = `alarm/application/api?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType}
&state=${state}stainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}`
setExportUrl(url);
} else {
Toast.info({
content: '暂无可导出的数据',
duration: 3,
})
}
}
})
break;
case 'videoAbnormal':
url = `alarm/video/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keywordTarget=${keywordTarget}
&keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}
&pepProjectId=${pepProjectId || ''}`
dispatch(problem.getAlarmVideoList({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
if (res.success) {
if (res.payload.data.count) {
url = `alarm/video/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keywordTarget=${keywordTarget}
&keyword=${keyword}&kindId=${kindId}&statusId=${statusId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}
&pepProjectId=${pepProjectId || ''}`
setExportUrl(url);
} else {
Toast.info({
content: '暂无可导出的数据',
duration: 3,
})
}
}
})
break;
default:
let groups = {
"dataLnterrupt": "1",
"dataAbnormal": "2",
"strategyHit": "3",
"deviceAbnormal": "4,5"
}
url = `alarm/data/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&state=${state}&keywordTarget=${keywordTarget}&keyword=${keyword}&kindId=${kindId}
&groupUnitId=${groupUnitId}&errType=${errType}&confirmState=${confirmState}&onlineState=${onlineState}&sustainTimeStart=${sustainTimeStart}
&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}&groupId=${groups[route]}`
dispatch(problem.getAlarmDataList({ ...query, ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, groupId: groupId.current.map(v => v.id).join(), pepProjectId: pepProjectId })).then((res) => {
if (res.success) {
if (res.payload.data.count) {
let groups = {
"dataLnterrupt": "1",
"dataAbnormal": "2",
"strategyHit": "3",
"deviceAbnormal": "4,5"
}
url = `alarm/data/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&state=${state}&keywordTarget=${keywordTarget}&keyword=${keyword}&kindId=${kindId}
&groupUnitId=${groupUnitId}&errType=${errType}&confirmState=${confirmState}&onlineState=${onlineState}&sustainTimeStart=${sustainTimeStart}
&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}&groupId=${groups[route]}`
setExportUrl(url);
} else {
Toast.info({
content: '暂无可导出的数据',
duration: 3,
})
}
}
})
break;
}
setExportUrl(url);
}
return (
@ -269,25 +322,28 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
marginBottom: 16
}}
>
<img title='导出' src="/assets/images/problem/export.png" style={{ width: 20 }}
onClick={() => {
api.current.validate().then((v) => {
search.current = {
state: v.state,
keywordTarget: v.keywordTarget,
keyword: v.keyword,
kindId: v.kindId,
groupUnitId: v.groupUnitId,
errType: v.errType,
confirmState: v.confirmState,
onlineState: v.onlineState,
sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
}
handleExport();
});
}} />
<img title='设置' src="/assets/images/problem/setup.png" style={{ width: 20 }} onClick={() => setSetup(true)} />
<Tooltip content={'默认导出最近7天的数据,自定义时间跨度不超过7天'}>
<img title='导出' src="/assets/images/problem/export.png" style={{ width: 20, cursor: 'pointer' }}
onClick={() => {
api.current.validate().then((v) => {
search.current = {
state: v.state,
keywordTarget: v.keywordTarget,
keyword: v.keyword,
kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId,
errType: v.errType,
confirmState: v.confirmState,
onlineState: v.onlineState,
sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "",
}
handleExport();
});
}} />
</Tooltip>
<img title='设置' src="/assets/images/problem/setup.png" style={{ width: 20, cursor: 'pointer' }} onClick={() => setSetup(true)} />
<Button
theme="solid"
type="primary"
@ -299,6 +355,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
keywordTarget: v.keywordTarget,
keyword: v.keyword,
kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId,
errType: v.errType,
confirmState: v.confirmState,
@ -415,7 +472,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
}
function mapStateToProps (state) {
function mapStateToProps(state) {
const { auth, global, members } = state;
// console.log(global);
return {

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

@ -31,6 +31,7 @@ const DataAlarm = (props) => {
const [content, setContent] = useState(false); //
const [selected, setSelected] = useState([]) //
const [genre, setGenre] = useState([]) //
const [statusId, setStatusId] = useState([]) //
const [checkPop, setCheckPop] = useState(false) //
const [alarmId, setAlarmId] = useState(false) //alarmId
const [query, setQuery] = useState({ limit: 10, page: 0 }) //
@ -112,6 +113,10 @@ const DataAlarm = (props) => {
name: '设备类型', field: 'kindId',
data: genre,
},
{
name: '异常类型', field: 'statusId',
data: statusId,
},
{
name: '异常状态', field: 'state',
data: [
@ -424,11 +429,13 @@ const DataAlarm = (props) => {
selected={selected}
setSelected={setSelected}
setGenre={setGenre}
setStatusId={setStatusId}
query={query}
setQuery={setQuery}
tableData={tableData}
setTableData={setTableData}
genre={genre}
statusId={statusId}
location={props.location?.query}
/>
{setup ? (

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

@ -47,6 +47,7 @@ export const ApiTable = {
getAlarmVideoDeviceKind: 'alarm/video/device_kind', //查询视频设备类型
putAlarmVideoConfirm: 'alarm/video/confirm', //确认视频告警信息
getVcmpAuth: 'vcmp/auth', // 获取视频平台应用鉴权token
getAlarmVideoExceptionType: 'alarm/video/exceptionType', //查询视频设备类型
//服务-信鸽服务
getPush: "push", //获取推送配置列表

Loading…
Cancel
Save