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 = [] let exportData = []
for (let item of alarmList.slice(0, 1000000)) {//最多百万条 for (let item of alarmList) {
let projectNames = item.pomsProject.map(p => { let projectNames = item.pomsProject.map(p => {
return p.name || p.pepProject.projectName 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) { async function alarmList (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -461,5 +494,6 @@ module.exports = {
alarmList, alarmList,
confirm, confirm,
alarmAdded, 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 }; app.fs.api.logAttr['GET/vcmp/auth'] = { content: '获取视频平台应用鉴权token', visible: true };
router.get('/vcmp/auth', videoAlarm.vcmpAppAuthToken); 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 React, { useState, useRef, useEffect } from "react";
import { connect } from "react-redux"; 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'; import { IconAlertCircle } from '@douyinfe/semi-icons';
function memberModal (props) { function memberModal (props) {
const { const {
close, close,
cancel, cancel,
visible, visible,
dispatch, dispatch,
pepList, pepList,
actions, actions,
editObj, editObj,
memberEdit, memberEdit,
pomsList, pomsList,
anxinDelete, anxinDelete,
anxincloudArr anxincloudArr
} = props; } = props;
const { install } = actions; const { install } = actions;
const form = useRef();// const form = useRef();//
const [disablePeople, setDisablePeople] = useState(true); // const [disablePeople, setDisablePeople] = useState(true); //
const [peopleList, setPeopleList] = useState([]); //List const [peopleList, setPeopleList] = useState([]); //List
const [departmentId, setDepartmentId] = useState(); //id const [departmentId, setDepartmentId] = useState(); //id
const [jurisdiction, setJurisdiction] = useState([ const [jurisdiction, setJurisdiction] = useState([
{ {
label: '数据分析师', label: '数据分析师',
value: 'data_analyst', value: 'data_analyst',
text: '拥有数据、分析、工单、资料相关的权限' text: '拥有数据、分析、工单、资料相关的权限'
}, { }, {
label: '售后运维', label: '售后运维',
value: 'after_sale', value: 'after_sale',
text: '拥有设备、问题、工单、资料相关的权限' text: '拥有设备、问题、工单、资料相关的权限'
}, { }, {
label: '资源管理者', label: '资源管理者',
value: 'resource_manage', value: 'resource_manage',
text: '拥有资料、设备、工单相关的权限' text: '拥有资料、设备、工单相关的权限'
}, { }, {
label: '客户服务', label: '客户服务',
value: 'customer_service', value: 'customer_service',
text: '拥有服务、工单、资料相关的权限' text: '拥有服务、工单、资料相关的权限'
}, },
]); // ]); //
const [pomsList_, setPomsList_] = useState([]) const [pomsList_, setPomsList_] = useState([])
// //
useEffect(() => { useEffect(() => {
if (editObj.id) { if (editObj.id) {
let departmentList = [] let departmentList = []
for (let i = 0; i < pepList.length; i++) { for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == editObj.departments[0].id) { if (pepList[i].id == editObj.departments[0].id) {
departmentList = pepList[i].users departmentList = pepList[i].users
}
} }
setDepartmentId(editObj.departments[0].id) }
setPeopleList(departmentList) setDepartmentId(editObj.departments[0].id)
} setPeopleList(departmentList)
setPomsList_(pomsList.filter(p=>p.pepProjectIsDelete != -1)) }
}, []); setPomsList_(pomsList.filter(p => p.pepProjectIsDelete != -1))
}, []);
function handleOk () { function handleOk () {
// //
form.current form.current
.validate() .validate()
.then((values) => { .then((values) => {
let roleArr = JSON.parse(JSON.stringify(values.role)) let roleArr = JSON.parse(JSON.stringify(values.role))
if (roleArr.indexOf('admin') != -1) { if (roleArr.indexOf('admin') != -1) {
roleArr.splice(roleArr.indexOf('admin'), 1) roleArr.splice(roleArr.indexOf('admin'), 1)
} }
if (memberEdit) { if (memberEdit) {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//(PEP) dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//(PEP)
if (res.success) { if (res.success) {
close(); close();
} }
}) })
} }
else { else {
dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//(PEP) dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//(PEP)
if (res.success) { if (res.success) {
close(); 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)} getFormApi={(formApi) => (form.current = formApi)}
> >
<div> <div>
<Form.Select <Form.Select
label="选择部门:" label="选择部门:"
field="department" field="department"
placeholder="请选择部门" placeholder="请选择部门"
style={{ width: 417 }} style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]} rules={[{ required: true, message: "请选择部门" }]}
showClear showClear
filter filter
initValue={departmentId || ""} initValue={departmentId || ""}
disabled={memberEdit} 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>
{ {
anxinDelete?.length > 0 ? ( pepList.map((item, index) => {
<div style={{ display: 'flex' }}> return (
<div style={{ marginTop: 3 }}> <Form.Select.Option key={item.id} value={item.id}>
<img src="/assets/images/install/risk.png" alt="" style={{ height: 24, width: 24, }} /> {item.name}
</div> </Form.Select.Option>
<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 </Form.Select>
}}> </div>
确定后{anxinDelete.join('、')}将被系统移除原因是项目已在项企映射关系中被删除 <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>
</div> </Checkbox>
) : ('') )
})
} }
</Form> </Form.CheckboxGroup>
</div> </div>
</Modal> <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) { function mapStateToProps (state) {
const { auth, global, members } = state; const { auth, global, members } = state;
return { return {
// loading: members.isRequesting, // loading: members.isRequesting,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
// members: members.data, // members: members.data,
}; };
} }
export default connect(mapStateToProps)(memberModal); export default connect(mapStateToProps)(memberModal);

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

@ -236,9 +236,9 @@ const Example = (props) => {
{ {
title: '关联时间', title: '关联时间',
dataIndex: "createTime", dataIndex: "createTime",
key: 'createTime', key: 'time',
render: (_, row) => { 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", dataIndex: "updateTime",
key: 'updateTime', key: 'updateTime',
render: (_, row) => { 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", dataIndex: "pepUserName",
key: 'pepUserName', key: 'pepUserName',
render: (_, row) => { 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) { // export function putAlarmVideoConfirm (data) { //
return dispatch => basicAction({ return dispatch => basicAction({
type: 'put', type: 'put',

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

@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from "react"; import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux"; 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 { SkeletonScreen, } from "$components";
import moment from "moment"; import moment from "moment";
import { validate } from "schema-utils"; import { validate } from "schema-utils";
@ -10,14 +10,14 @@ import qs from "qs";
const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition, pepProjectId, 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 { problem } = actions
const [count, setCount] = useState(0) // const [count, setCount] = useState(0) //
const [checkAll, setCheckAll] = useState(true) // const [checkAll, setCheckAll] = useState(true) //
const api = useRef(); const api = useRef();
const search = useRef({ const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', statusId: '',
errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: '' errType: '', confirmState: '', onlineState: '', sustainTimeStart: '', sustainTimeEnd: ''
}) })
const kindName = useRef() const kindName = useRef()
@ -122,7 +122,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
useEffect(() => { useEffect(() => {
if (location) { if (location) {
search.current = { ...search.current, ...location, state: 'new' } search.current = { ...search.current, ...location, state: 'new' }
api.current?.setValues({...location, state: 'new'}) api.current?.setValues({ ...location, state: 'new' })
} }
if (route !== 'videoAbnormal' && route !== 'useAbnormal') { if (route !== 'videoAbnormal' && route !== 'useAbnormal') {
dispatch(problem.getAlarmDataGroup()).then((res) => { 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 }))) 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 = () => { const handleExport = () => {
let url = '' 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) { switch (route) {
case 'useAbnormal': case 'useAbnormal':
url = `alarm/application/api?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keyword=${keyword}&errType=${errType} dispatch(problem.getAlarmLnspectionApi({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
&state=${state}stainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}` 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; break;
case 'videoAbnormal': case 'videoAbnormal':
url = `alarm/video/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&keywordTarget=${keywordTarget} dispatch(problem.getAlarmVideoList({ ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, pepProjectId: pepProjectId })).then((res) => {
&keyword=${keyword}&kindId=${kindId}&state=${state}&sustainTimeStart=${sustainTimeStart}&sustainTimeEnd=${sustainTimeEnd} if (res.success) {
&pepProjectId=${pepProjectId || ''}` 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; break;
default: default:
let groups = { dispatch(problem.getAlarmDataList({ ...query, ...search.current, limit: 1, sustainTimeStart, sustainTimeEnd, groupId: groupId.current.map(v => v.id).join(), pepProjectId: pepProjectId })).then((res) => {
"dataLnterrupt": "1", if (res.success) {
"dataAbnormal": "2", if (res.payload.data.count) {
"strategyHit": "3", let groups = {
"deviceAbnormal": "4,5" "dataLnterrupt": "1",
} "dataAbnormal": "2",
url = `alarm/data/list?token=${user.token}&toExport=1&timestamp=${moment().valueOf()}&state=${state}&keywordTarget=${keywordTarget}&keyword=${keyword}&kindId=${kindId} "strategyHit": "3",
&groupUnitId=${groupUnitId}&errType=${errType}&confirmState=${confirmState}&onlineState=${onlineState}&sustainTimeStart=${sustainTimeStart} "deviceAbnormal": "4,5"
&sustainTimeEnd=${sustainTimeEnd}&pepProjectId=${pepProjectId || ''}&groupId=${groups[route]}` }
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; break;
} }
setExportUrl(url);
} }
return ( return (
@ -269,25 +322,28 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
marginBottom: 16 marginBottom: 16
}} }}
> >
<img title='导出' src="/assets/images/problem/export.png" style={{ width: 20 }} <Tooltip content={'默认导出最近7天的数据,自定义时间跨度不超过7天'}>
onClick={() => { <img title='导出' src="/assets/images/problem/export.png" style={{ width: 20, cursor: 'pointer' }}
api.current.validate().then((v) => { onClick={() => {
search.current = { api.current.validate().then((v) => {
state: v.state, search.current = {
keywordTarget: v.keywordTarget, state: v.state,
keyword: v.keyword, keywordTarget: v.keywordTarget,
kindId: v.kindId, keyword: v.keyword,
groupUnitId: v.groupUnitId, kindId: v.kindId,
errType: v.errType, statusId: v.statusId,
confirmState: v.confirmState, groupUnitId: v.groupUnitId,
onlineState: v.onlineState, errType: v.errType,
sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "", confirmState: v.confirmState,
sustainTimeEnd: v.time && v.time.length > 0 ? moment(v.time[1]).format("YYYY-MM-DD HH:mm:ss") : "", onlineState: v.onlineState,
} sustainTimeStart: v.time && v.time.length > 0 ? moment(v.time[0]).format("YYYY-MM-DD HH:mm:ss") : "",
handleExport(); 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>
<img title='设置' src="/assets/images/problem/setup.png" style={{ width: 20, cursor: 'pointer' }} onClick={() => setSetup(true)} />
<Button <Button
theme="solid" theme="solid"
type="primary" type="primary"
@ -299,6 +355,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
keywordTarget: v.keywordTarget, keywordTarget: v.keywordTarget,
keyword: v.keyword, keyword: v.keyword,
kindId: v.kindId, kindId: v.kindId,
statusId: v.statusId,
groupUnitId: v.groupUnitId, groupUnitId: v.groupUnitId,
errType: v.errType, errType: v.errType,
confirmState: v.confirmState, 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; const { auth, global, members } = state;
// console.log(global); // console.log(global);
return { return {

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

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

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

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

Loading…
Cancel
Save