第一轮改bug
parent
a1c8d2f1d6
commit
180ae2efdb
Binary file not shown.
|
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
// 开发服务
|
||||
server: {
|
||||
// 监听端口号
|
||||
port: "8080",
|
||||
port: "8088",
|
||||
// 服务地址
|
||||
host: "127.0.0.1",
|
||||
// 是否自动打开浏览器
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
"lodash-es": "^4.17.21",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"zy-react-library": "^1.3.8"
|
||||
"zy-react-library": "^1.3.15"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^5.4.1",
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function AssignModal(props) {
|
|||
getUserInfo().then((data) => {
|
||||
setCorpinfoId(data.corpinfoId);
|
||||
});
|
||||
}, [getUserInfo]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (disposeStatus !== 1) {
|
||||
|
|
@ -52,7 +52,7 @@ function AssignModal(props) {
|
|||
alarmLevel: undefined,
|
||||
disposeUserId: undefined,
|
||||
});
|
||||
}, [disposeStatus, form]);
|
||||
}, [disposeStatus]);
|
||||
|
||||
const handleCancel = () => {
|
||||
form.resetFields();
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ function AssignList(props) {
|
|||
{ title: "传感器名称", dataIndex: "sensorName", ellipsis: true },
|
||||
{ title: "报警时间", dataIndex: "alarmTime", width: 180 },
|
||||
{ title: "报警描述", dataIndex: "alarmDesc", ellipsis: true },
|
||||
{ title: "告警值", render: (_, record) => renderAlarmCurrentValue(record) },
|
||||
{ title: "告警值", dataIndex: "currentValue" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 180,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
|||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { ALARM_STATUS_OPTIONS } from "~/enumerate/constant";
|
||||
import { renderAlarmCurrentValue } from "~/utils/alarm";
|
||||
import AlarmRecordView from "../View";
|
||||
|
||||
function AlarmRecordList(props) {
|
||||
|
|
@ -24,6 +23,7 @@ function AlarmRecordList(props) {
|
|||
alarmTimeEnd: formData.alarmTime?.[1],
|
||||
disposeTimeStart: formData.disposeTime?.[0],
|
||||
disposeTimeEnd: formData.disposeTime?.[1],
|
||||
statusList: [20, 30, 40],
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ function AlarmRecordList(props) {
|
|||
{ title: "传感器名称", dataIndex: "sensorName" },
|
||||
{ title: "报警时间", dataIndex: "alarmTime" },
|
||||
{ title: "报警描述", dataIndex: "alarmDesc", ellipsis: true },
|
||||
{ title: "告警值", render: (_, record) => renderAlarmCurrentValue(record) },
|
||||
{ title: "告警值", dataIndex: "currentValue" },
|
||||
{ title: "报警级别", dataIndex: "alarmLevelName" },
|
||||
{ title: "报警类型", dataIndex: "alarmTypeName" },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import Video from "zy-react-library/components/Video";
|
|||
import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
|
||||
import UseGetFile from "zy-react-library/hooks/useGetFile";
|
||||
import { getLabelName } from "zy-react-library/utils";
|
||||
import { DISPOSAL_STATIS, SENSOR_ATTR_OPTIONS } from "~/enumerate/constant";
|
||||
import { SENSOR_ATTR_OPTIONS } from "~/enumerate/constant";
|
||||
import { renderAlarmCurrentValue } from "~/utils/alarm";
|
||||
import BaiduMap from "../../BaiduMap";
|
||||
|
||||
|
|
@ -18,11 +18,10 @@ function DetailModal(props) {
|
|||
const { loading: getFileLoading, getFile } = UseGetFile();
|
||||
|
||||
const getImageFun = async () => {
|
||||
console.log(props);
|
||||
const disposalFiles = props.fireRegionId
|
||||
? await getFile({
|
||||
eqType: UPLOAD_FILE_TYPE_ENUM["800"],
|
||||
eqForeignKey: props.fireRegionId,
|
||||
eqForeignKey: props.alarmRecordId,
|
||||
})
|
||||
: [];
|
||||
setDisposalFiles(disposalFiles);
|
||||
|
|
@ -49,21 +48,6 @@ function DetailModal(props) {
|
|||
return time.isValid() ? time.format("YYYY-MM-DD HH:mm:ss") : value;
|
||||
};
|
||||
|
||||
const renderDisposalStatus = () => {
|
||||
const status = detail.confirmStatus ?? detail.disposeStatus ?? detail.disposalStatus;
|
||||
const statusName = detail.confirmStatusName ?? detail.disposeStatusName ?? detail.disposalStatusName;
|
||||
|
||||
if (statusName) {
|
||||
return statusName;
|
||||
}
|
||||
|
||||
if (status === 0 || status === 1) {
|
||||
return getLabelName({ status, list: DISPOSAL_STATIS }) || status;
|
||||
}
|
||||
|
||||
return "-";
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
destroyOnClose
|
||||
|
|
@ -73,6 +57,7 @@ function DetailModal(props) {
|
|||
footer={null}
|
||||
maskClosable={false}
|
||||
width={1200}
|
||||
confirmLoading={props.confirmLoading || getFileLoading}
|
||||
>
|
||||
<Divider orientation="left">报警信息</Divider>
|
||||
<Descriptions column={2} bordered labelStyle={{ width: 200 }}>
|
||||
|
|
@ -114,7 +99,7 @@ function DetailModal(props) {
|
|||
<div>
|
||||
<Divider orientation="left">报警处置</Divider>
|
||||
<Descriptions column={2} bordered labelStyle={{ width: 200 }}>
|
||||
<Descriptions.Item label="报警确认">{renderDisposalStatus()}</Descriptions.Item>
|
||||
<Descriptions.Item label="报警确认人">{detail.assignUserName}</Descriptions.Item>
|
||||
<Descriptions.Item label="确认时间">{detail.assignTime || "-"}</Descriptions.Item>
|
||||
<Descriptions.Item label="报警类型">{detail.alarmTypeName || detail.alarmType || "-"}</Descriptions.Item>
|
||||
<Descriptions.Item label="报警级别">{detail.alarmLevelName || detail.alarmLevel || "-"}</Descriptions.Item>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Table from "zy-react-library/components/Table";
|
|||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import AlarmRecordView from "~/components/AlarmRecord/View";
|
||||
import { renderAlarmCurrentValue } from "~/utils/alarm";
|
||||
|
||||
function DcsList(props) {
|
||||
const [form] = Form.useForm();
|
||||
|
|
@ -19,6 +18,7 @@ function DcsList(props) {
|
|||
alarmTimeStart: formData.alarmTime?.[0],
|
||||
alarmTimeEnd: formData.alarmTime?.[1],
|
||||
alarmSource: "DCS",
|
||||
status: 10,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ function DcsList(props) {
|
|||
{ title: "传感器名称", dataIndex: "sensorName" },
|
||||
{ title: "报警时间", dataIndex: "alarmTime" },
|
||||
{ title: "报警描述", dataIndex: "alarmDesc", ellipsis: true },
|
||||
{ title: "告警值", render: (_, record) => renderAlarmCurrentValue(record) },
|
||||
{ title: "告警值", dataIndex: "currentValue" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 100,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Form, message, Modal } from "antd";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import Search from "zy-react-library/components/Search";
|
||||
import Table from "zy-react-library/components/Table";
|
||||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
|
|
@ -14,6 +14,28 @@ function BindSensorModal(props) {
|
|||
|
||||
const [selectedSensorIds, setSelectedSensorIds] = useState([]);
|
||||
const { tableProps, getData } = useTable(props.sensorDeviceList, { form });
|
||||
const currentFireRegionId = props.currentRecord?.fireRegionId;
|
||||
|
||||
const hasFireRegionField = record => Object.prototype.hasOwnProperty.call(record || {}, "fireRegionId");
|
||||
const hasBoundFireRegion = record => hasFireRegionField(record) && record.fireRegionId !== null && record.fireRegionId !== undefined;
|
||||
const isSameFireRegion = record => hasBoundFireRegion(record) && String(record.fireRegionId) === String(currentFireRegionId);
|
||||
const isDisabledRow = record => hasBoundFireRegion(record) && !isSameFireRegion(record);
|
||||
// The default selection depends on asynchronously loaded table data, so we sync it after each load.
|
||||
// eslint-disable-next-line react-hooks-extra/no-direct-set-state-in-use-effect
|
||||
const mergeSelectedSensorIds = sensorIds => setSelectedSensorIds(prev => Array.from(new Set([...prev, ...sensorIds])));
|
||||
|
||||
useEffect(() => {
|
||||
const matchedSensorIds = (tableProps.dataSource || [])
|
||||
.filter(isSameFireRegion)
|
||||
.map(item => item.sensorDeviceId)
|
||||
.filter(item => item !== undefined && item !== null);
|
||||
|
||||
if (matchedSensorIds.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
mergeSelectedSensorIds(matchedSensorIds);
|
||||
}, [currentFireRegionId, tableProps.dataSource]);
|
||||
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
|
|
@ -80,7 +102,11 @@ function BindSensorModal(props) {
|
|||
preserveSelectedRowKeys: true,
|
||||
selectedRowKeys: selectedSensorIds,
|
||||
onChange: keys => setSelectedSensorIds(keys),
|
||||
getCheckboxProps: record => ({
|
||||
disabled: isDisabledRow(record),
|
||||
}),
|
||||
}}
|
||||
|
||||
columns={[
|
||||
{ title: "传感器编码", dataIndex: "sensorCode" },
|
||||
{ title: "传感器名称", dataIndex: "sensorName" },
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function ManagerModal(props) {
|
|||
if (submitting) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(props.currentRecord);
|
||||
setSubmitting(true);
|
||||
values.fireRegionId = props.currentRecord.fireRegionId;
|
||||
values.regionConfigId = props.currentRecord.regionConfigId;
|
||||
|
|
@ -54,7 +54,9 @@ function ManagerModal(props) {
|
|||
|
||||
<Form.Item label="负责人" name="managerId" rules={[{ required: true, message: "请选择负责人" }]}>
|
||||
<PersonnelSelect
|
||||
params={{ departmentId: props.currentRecord.departmentId }}
|
||||
isNeedDepartmentId={false}
|
||||
isNeedCorpInfoId={true}
|
||||
params={{ corpinfoId: props.currentRecord.corpinfoId }}
|
||||
onGetLabel={label => form.setFieldValue("managerName", label)}
|
||||
/>
|
||||
</Form.Item>
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ function SensorDeviceList(props) {
|
|||
},
|
||||
{
|
||||
title: "是否通过系统设定报警",
|
||||
ellipsis: false,
|
||||
dataIndex: "thresholdFlag",
|
||||
render: (_, record) => getLabelName({ status: record.thresholdFlag, list: YES_NO_OPTIONS }) || "-",
|
||||
},
|
||||
|
|
|
|||
|
|
@ -45,9 +45,8 @@ function SensorTypeModal(props) {
|
|||
active = false;
|
||||
};
|
||||
}
|
||||
console.log( props.currentId);
|
||||
console.log(props.currentId);
|
||||
props["sensorTypeInfo"]({ id: props.currentId }).then((res) => {
|
||||
|
||||
if (!active || !res?.success) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -139,6 +138,7 @@ function SensorTypeModal(props) {
|
|||
rules={[{ required: true, message: "请选择传感器属性" }]}
|
||||
>
|
||||
<Select
|
||||
disabled={props.currentId}
|
||||
options={SENSOR_ATTR_OPTIONS.map(item => ({
|
||||
value: item.bianma,
|
||||
label: item.name,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import Table from "zy-react-library/components/Table";
|
|||
import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender";
|
||||
import useTable from "zy-react-library/hooks/useTable";
|
||||
import AlarmRecordView from "~/components/AlarmRecord/View";
|
||||
import { renderAlarmCurrentValue } from "~/utils/alarm";
|
||||
|
||||
function ThresholdList(props) {
|
||||
const [form] = Form.useForm();
|
||||
|
|
@ -19,6 +18,7 @@ function ThresholdList(props) {
|
|||
alarmTimeStart: formData.alarmTime?.[0],
|
||||
alarmTimeEnd: formData.alarmTime?.[1],
|
||||
alarmSource: "THRESHOLD",
|
||||
status: 10,
|
||||
}),
|
||||
});
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ function ThresholdList(props) {
|
|||
{ title: "传感器名称", dataIndex: "sensorName" },
|
||||
{ title: "报警时间", dataIndex: "alarmTime" },
|
||||
{ title: "报警描述", dataIndex: "alarmDesc", ellipsis: true },
|
||||
{ title: "告警值", render: (_, record) => renderAlarmCurrentValue(record) },
|
||||
{ title: "告警值", dataIndex: "currentValue" },
|
||||
{
|
||||
title: "操作",
|
||||
width: 100,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
export const APP_IDENTIFIER = "iotalarm";
|
||||
|
||||
export const SENSOR_ATTR_OPTIONS = [
|
||||
{ bianma: "NUMBER", name: "数值型" },
|
||||
{ bianma: "SWITCH", name: "开关量" },
|
||||
{ bianma: "NUMBER", name: "数值类" },
|
||||
{ bianma: "SWITCH", name: "开关类" },
|
||||
];
|
||||
|
||||
export const ENABLE_STATUS_OPTIONS = [
|
||||
|
|
@ -23,9 +23,10 @@ export const SENSOR_STATUS_OPTIONS = [
|
|||
];
|
||||
|
||||
export const ALARM_STATUS_OPTIONS = [
|
||||
{ bianma: 10, name: "已报警" },
|
||||
{ bianma: 20, name: "报警中" },
|
||||
{ bianma: 30, name: "已取消" },
|
||||
{ bianma: 10, name: "报警中" },
|
||||
{ bianma: 20, name: "未处置" },
|
||||
{ bianma: 30, name: "已消警" },
|
||||
{ bianma: 40, name: "误报" },
|
||||
];
|
||||
|
||||
export const ALARM_SOURCE_OPTIONS = [
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ export function renderAlarmCurrentValue(record) {
|
|||
) {
|
||||
suffix = " ↑";
|
||||
color = "red";
|
||||
} else if (
|
||||
}
|
||||
else if (
|
||||
(Number.isFinite(thresholdLowLow) && currentValue < thresholdLowLow)
|
||||
|| (Number.isFinite(thresholdLow) && currentValue < thresholdLow)
|
||||
) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue