From d1cef224b3606818c93012dc827944edfd1822a3 Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Fri, 3 Jan 2025 17:33:00 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E9=A2=84=E8=AD=A6=E8=A7=84=E5=88=99?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A8=A1=E5=9D=97=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/apiurl.js | 16 ++- src/views/AppRouters.tsx | 2 + .../InformationSearch/BasicSituation/index.js | 2 +- src/views/SafeWatch/Gzpz/form.js | 131 ++++++++++++++++++ src/views/SafeWatch/Gzpz/index.js | 127 +++++++++++++++++ src/views/SafeWatch/Gzpz/toolbar.js | 61 ++++++++ src/views/SafeWatch/SlWatch/toolbar.js | 2 +- src/views/SafeWatch/WarnRecord/index.js | 21 +-- src/views/SafeWatch/WarnRecord/toolbar.js | 6 +- src/views/SafeWatch/WarnRuleConfig/form.js | 2 +- src/views/SafeWatch/cdgx/form.js | 23 ++- src/views/SafeWatch/cdgx/index.js | 2 +- .../PoliceMangant/PoliceRuleConfig/index.js | 2 +- 13 files changed, 372 insertions(+), 25 deletions(-) create mode 100644 src/views/SafeWatch/Gzpz/form.js create mode 100644 src/views/SafeWatch/Gzpz/index.js create mode 100644 src/views/SafeWatch/Gzpz/toolbar.js diff --git a/src/service/apiurl.js b/src/service/apiurl.js index 7fcb853..f5e936b 100644 --- a/src/service/apiurl.js +++ b/src/service/apiurl.js @@ -98,13 +98,25 @@ const apiurl = { save: service_ykz + '/attDamProfile/insert', edit: service_ykz + '/attDamProfile/update', delete: service_ykz + '/attDamProfile/del', - list:service_ykz + '/attDamProfile/list' + list: service_ykz + '/attDamProfile/list', + info: service_ykz + '/osmoticStationInfo/list/' }, gl: { page: service_ykz + '/osmoticProfileRel/page', save: service_ykz + '/osmoticProfileRel/insert', delete: service_ykz + '/osmoticProfileRel/del', - } + }, + yjjl: { + page: service_ykz + '/osmoticWarnRecord/page', + export: service_ykz + '/osmoticWarnRecord/export', + }, + bjgzpz: { + page: service_ykz + '/osmoticWarnRule/page', + save: service_ykz +'/osmoticWarnRule/insert', + edit: service_ykz +'/osmoticWarnRule/update', + delete: service_ykz + '/osmoticWarnRule/del', + stop:service_ykz + '/osmoticWarnRule/startStop' + }, }, sbwh: { whfabz: { diff --git a/src/views/AppRouters.tsx b/src/views/AppRouters.tsx index 1a79d45..4c36daf 100644 --- a/src/views/AppRouters.tsx +++ b/src/views/AppRouters.tsx @@ -33,6 +33,7 @@ import Xjwtcl from "./Gcyx/xcxj/xjwtcl" import Xjxpz from "./Gcyx/xcxj/xjxpz" import Dmgl from "./SafeWatch/Dmgl" import Cdgx from "./SafeWatch/cdgx" +import Gzpz from './SafeWatch/Gzpz' import TestLine from './TestLine' // const HomePage = lazy(() => import('./Home')) @@ -66,6 +67,7 @@ const AppRouters: React.FC = () => { { path: 'aqjc/yjgzpz', element: }, { path: 'aqjc/dmgl', element: }, { path: 'aqjc/dmcdglgl', element: }, + { path: 'aqjc/gzpz', element: }, // 设备维护 { path: 'sbwh/wxyhgl/wxfabz', element: }, { path: 'sbwh/wxyhgl/ssgcjl', element: }, diff --git a/src/views/Gcyx/InformationSearch/BasicSituation/index.js b/src/views/Gcyx/InformationSearch/BasicSituation/index.js index cb806e4..daa65cb 100644 --- a/src/views/Gcyx/InformationSearch/BasicSituation/index.js +++ b/src/views/Gcyx/InformationSearch/BasicSituation/index.js @@ -79,7 +79,7 @@ export default function BasicSituation() { style: { marginLeft: "6%" } }} > - + diff --git a/src/views/SafeWatch/Gzpz/form.js b/src/views/SafeWatch/Gzpz/form.js new file mode 100644 index 0000000..75721bc --- /dev/null +++ b/src/views/SafeWatch/Gzpz/form.js @@ -0,0 +1,131 @@ +import React, { useEffect, useState, useMemo, useRef } from 'react'; +import { Form, Button, Input, Row, Upload, Col, Table, DatePicker, InputNumber, message, Image, Modal, Typography, Popconfirm } from 'antd'; +import { formItemLayout, btnItemLayout } from '../../../components/crud/FormLayoutProps'; +import apiurl from '../../../service/apiurl'; +import NormalSelect from '../../../components/Form/NormalSelect'; +import moment from 'moment'; +import { httpget2 } from '../../../utils/request'; +const { RangePicker } = DatePicker +const url = "http://223.75.53.141:9102/test.by-lyf.tmp" + +const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { + const types = [ + { + label: "位移", + value: 0, + }, + { + label: "结构缝", + value: 1, + }, + { + label: "渗压", + value: 2, + }, + ] + const [form] = Form.useForm(); + const onfinish = (values) => { + values.eventsDate = values.eventsDate ? moment(values.eventsDate).format("YYYY-MM-DD 00:00:00") : '' + if (mode === 'edit') { + onEdit(apiurl.aqjc.bjgzpz.edit, { ...record, ...values }) + } + if (mode === 'save') { + onSave(apiurl.aqjc.bjgzpz.save, values) + } + } + + const [cdList, setCdList] = useState([]) + // 测点类型 + const getCdList = async (type) => { + try { + const res = await httpget2(apiurl.aqjc.dmgl.info + type) + if (res.code == 200) { + setCdList(res.data.map(item => ({ label: item.stationCode, value: item.stationCode }))) + } + } catch (error) { + console.log(error); + } + } + const onValuesChange = (val) => { + if ('type' in val) { + getCdList(val.type) + } + } + + + + return ( + <> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + mode === 'view' ? null : ( + <> + + + + + ) + } +
+ + + ); +} + +export default ModalForm; diff --git a/src/views/SafeWatch/Gzpz/index.js b/src/views/SafeWatch/Gzpz/index.js new file mode 100644 index 0000000..aa7beb7 --- /dev/null +++ b/src/views/SafeWatch/Gzpz/index.js @@ -0,0 +1,127 @@ +import React, { Fragment, useRef, useMemo,useEffect,useState } from 'react'; +import BasicCrudModal from '../../../components/crud/BasicCrudModal'; +import { Table, Card, Modal, Form, Input, Button, Row,Col, Timeline, message, Tabs,Image } from 'antd'; +import ToolBar from './toolbar'; +import ModalForm from './form'; +import apiurl from '../../../service/apiurl'; +import usePageTable from '../../../components/crud/usePageTable2'; +import { createCrudService } from '../../../components/crud/_'; +import {CrudOpRender_text} from '../../../components/crud/CrudOpRender'; +import { httppost2 } from '../../../utils/request'; + +const url = "http://223.75.53.141:9102/test.by-lyf.tmp" +const Page = () => { + const types = { + 0: "位移", + 1: '结构缝', + 2: "渗压", + } + const refModal = useRef(); + const [searchVal, setSearchVal] = useState(false) + const columns = [ + { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" }, + { title: '测点', key: 'stationCode', dataIndex: 'stationCode', width: 150}, + { + title: '监测类型', key: 'type', dataIndex: 'type', width: 150, + render: (v) => {types[v]} + }, + { title: '阈值下限', key: 'upperLimit', dataIndex: 'upperLimit', width: 150}, + { title: '阈值上限', key: 'lowerLimit ', dataIndex: 'lowerLimit', width: 150}, + { + title: '是否启用', key: 'status', dataIndex: 'status', width: 150, + render: (v) => { v == 1 ? '否': v==0?'是':''} + }, + { + title: '配置时间', key: 'createTime', dataIndex: 'createTime', width: 150, + }, + { + title: '最近报警时间', key: 'recentWarnTime', dataIndex: 'recentWarnTime', width: 140, + }, + { + title: '操作', key: 'operation', width: 200, fixed: 'right',align: 'center', + render: (value, row, index) => ( + () => command(cmd)(row)} />) + }, + ]; + + + const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]); + + const stopStatus = async (params) => { + try { + const res = await httppost2(apiurl.aqjc.bjgzpz.stop, params) + if (res.code == 200) { + message.success(`${params.status ? '停用':'启用'}成功`) + refresh() + } + } catch (error) { + console.log(error); + } + } + const command = (type) => (params) => { + if (type === 'save') { + refModal.current.showSave(); + } else if (type === 'edit') { + refModal.current.showEdit({ ...params }); + } else if (type === 'view') { + refModal.current.showView(params); + } else if (type === 'del') { + refModal.current.onDeleteGet(apiurl.aqjc.bjgzpz.delete + `/${params.id}`); + } else if (type == 'status') { + stopStatus({ id: params.id, status: params.status == 1 ? 0 : params.status == 0 ? 1 : ''}) + } + } + + + + const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.aqjc.bjgzpz.page).find_noCode); + + /** + * @description 处理成功的回调 + */ + const successCallback = () => { + refresh() +} + + useEffect(()=>{ + const params = { + search: { + ...searchVal, + } + }; + search(params) + }, [searchVal]) + + + return ( + <> +
+
+ + + +
+ + + + + + + + ); +} + +export default Page; diff --git a/src/views/SafeWatch/Gzpz/toolbar.js b/src/views/SafeWatch/Gzpz/toolbar.js new file mode 100644 index 0000000..7219313 --- /dev/null +++ b/src/views/SafeWatch/Gzpz/toolbar.js @@ -0,0 +1,61 @@ +import React, { useEffect,useState } from 'react'; +import { Form, Input, Button, DatePicker } from 'antd'; +import NormalSelect from '../../../components/Form/NormalSelect'; + +import moment from 'moment'; +const { RangePicker } = DatePicker; +const ToolBar = ({ setSearchVal, onSave, storeData, role }) => { + + const types = [ + { + label: "闸后流量", + value: 0, + }, + { + label: "雨量", + value: 1, + }, + { + label: "闸前水位", + value: 2, + }, + { + label: "闸后水位", + value: 3, + }, + ] + const [form] = Form.useForm(); + + const onFinish = (values) => { + setSearchVal({...values}); + } + + + return ( + <> +
+
+ + + + + + + + + + + { + (onSave) ? + + + + :null + } + +
+ + ); +} + +export default ToolBar; \ No newline at end of file diff --git a/src/views/SafeWatch/SlWatch/toolbar.js b/src/views/SafeWatch/SlWatch/toolbar.js index f451cf6..df5c26d 100644 --- a/src/views/SafeWatch/SlWatch/toolbar.js +++ b/src/views/SafeWatch/SlWatch/toolbar.js @@ -39,7 +39,7 @@ const ToolBar = ({ setSearchVal, exportFile1, storeData, role }) => {
- + {/* { const columns = [ { title: '序号', key: 'inx', dataIndex: 'inx', width: 60, align:"center" }, { - title: '监测类型', key: 'projectName', dataIndex: 'projectName', width: 150, + title: '监测类型', key: 'type', dataIndex: 'type', width: 150, render: (v) => {types[v]} }, - { title: '监测点', key: 'projectAddr', dataIndex: 'projectAddr', width: 150}, - { title: '监测值', key: 'projectAddr', dataIndex: 'projectAddr', width: 150}, + { title: '监测点', key: 'stationCode', dataIndex: 'stationCode', width: 150}, + { title: '监测值', key: 'val', dataIndex: 'val', width: 150 }, + { title: '阈值下限', key: 'lowerLimit', dataIndex: 'lowerLimit', width: 150}, + { title: '阈值上限', key: 'upperLimit', dataIndex: 'upperLimit', width: 150}, { - title: '状态', key: 'projectAddr', dataIndex: 'projectAddr', width: 150, + title: '状态', key: 'status', dataIndex: 'status', width: 150, render: (v) => {statusTypes[v]} }, - { title: '预警依据', key: 'projectAddr', dataIndex: 'projectAddr', width: 250}, - { title: '预警时间', key: 'projectAddr', dataIndex: 'projectAddr', width: 150}, + { title: '预警时间', key: 'warnTime', dataIndex: 'warnTime', width: 150}, { - title: '持续时长', key: 'createTime', dataIndex: 'createTime', width: 150, + title: '持续时长', key: 'duration', dataIndex: 'duration', width: 150, }, ]; const width = useMemo(() => columns.reduce((total, cur) => total + (cur.width), 0), [columns]); - const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.sbwh.whfabz.page).find_noCode); + const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.aqjc.yjjl.page).find_noCode); // 导出 const exportExcel = () => { let params = { ...searchVal, } - httppost5(apiurl.sbwh.cgtzgl.export, params).then(res => { - exportFile(`渗流监测.xlsx`,res.data) + httppost5(apiurl.aqjc.yjjl.export, params).then(res => { + exportFile(`预警记录.xlsx`,res.data) }) } diff --git a/src/views/SafeWatch/WarnRecord/toolbar.js b/src/views/SafeWatch/WarnRecord/toolbar.js index 286f41d..ab00f6a 100644 --- a/src/views/SafeWatch/WarnRecord/toolbar.js +++ b/src/views/SafeWatch/WarnRecord/toolbar.js @@ -19,10 +19,6 @@ const ToolBar = ({ setSearchVal, exportFile1, storeData, role }) => { label: "渗流监测", value: 2 }, - { - label: "环境量监测", - value: 3 - } ] const typeStatus = [ @@ -55,7 +51,7 @@ const ToolBar = ({ setSearchVal, exportFile1, storeData, role }) => { <>
- + diff --git a/src/views/SafeWatch/WarnRuleConfig/form.js b/src/views/SafeWatch/WarnRuleConfig/form.js index ffb063b..decc6b5 100644 --- a/src/views/SafeWatch/WarnRuleConfig/form.js +++ b/src/views/SafeWatch/WarnRuleConfig/form.js @@ -41,7 +41,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => {
diff --git a/src/views/SafeWatch/cdgx/form.js b/src/views/SafeWatch/cdgx/form.js index 992098b..6dd8c34 100644 --- a/src/views/SafeWatch/cdgx/form.js +++ b/src/views/SafeWatch/cdgx/form.js @@ -4,7 +4,7 @@ import { formItemLayout, btnItemLayout } from '../../../components/crud/FormLayo import apiurl from '../../../service/apiurl'; import NormalSelect from '../../../components/Form/NormalSelect'; import moment from 'moment'; -import { httppost2 } from '../../../utils/request'; +import { httppost2,httpget2 } from '../../../utils/request'; const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { const [form] = Form.useForm(); const onfinish = (values) => { @@ -29,8 +29,24 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { } + + const [cdList, setCdList] = useState([]) + // 测点类型 + const getCdList = async (type) => { + try { + const res = await httpget2(apiurl.aqjc.dmgl.info + type) + if (res.code == 200) { + setCdList(res.data.map(item => ({label: item.stationCode,value: item.stationCode}))) + } + } catch (error) { + console.log(error); + } + } + + useEffect(() => { - getDmList() + getDmList() + getCdList(2) }, []) return ( @@ -40,6 +56,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { {...formItemLayout} onFinish={onfinish} initialValues={record} + > @@ -56,7 +73,7 @@ const ModalForm = ({ mode, record, onEdit, onSave, onSimilarSave }) => { label="测点名称" name="stationCode" > - + diff --git a/src/views/SafeWatch/cdgx/index.js b/src/views/SafeWatch/cdgx/index.js index 01360be..1137eea 100644 --- a/src/views/SafeWatch/cdgx/index.js +++ b/src/views/SafeWatch/cdgx/index.js @@ -41,7 +41,7 @@ const Page = () => { if (type === 'save') { refModal.current.showSave(); } else if (type === 'edit') { - // refModal.current.showEdit({ ...params }); + refModal.current.showEdit({ ...params }); } else if (type === 'view') { refModal.current.showView(params); } else if (type === 'del') { diff --git a/src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.js b/src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.js index a8f0a68..9052ee2 100644 --- a/src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.js +++ b/src/views/WatchData/PoliceMangant/PoliceRuleConfig/index.js @@ -36,7 +36,7 @@ const Page = () => { title: '配置时间', key: 'createTime', dataIndex: 'createTime', width: 150, }, { - title: '最近报警时间', key: 'eventsDate', dataIndex: 'eventsDate', width: 140, + title: '最近报警时间', key: 'recentWarnTime', dataIndex: 'recentWarnTime', width: 140, }, { title: '操作', key: 'operation', width: 200, fixed: 'right',align: 'center',