From 1e9febbb45137bf601100285a85689ae8442834e Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Fri, 28 Mar 2025 17:33:56 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E9=97=B8=E9=97=A8=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=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 | 4 + src/views/gcaqjc/gcaqfx/jrx/jrxOptions.js | 2 +- src/views/rcgl/byfz/bypc/index.js | 5 +- src/views/rcgl/zmjk/ModalContent.js | 49 +++++--- src/views/rcgl/zmjk/ModalToolBar.js | 28 +++-- src/views/rcgl/zmjk/index.js | 147 ++++++++++++++++++---- 6 files changed, 183 insertions(+), 52 deletions(-) diff --git a/src/service/apiurl.js b/src/service/apiurl.js index cc6b6531b..1c2a80dec 100644 --- a/src/service/apiurl.js +++ b/src/service/apiurl.js @@ -451,6 +451,10 @@ const apiurl = { }, zfzl: { list: service_fxdd + "/gateValveReal/list", + historypage: service_fxdd + '/gateValveReal/log/page', + historyList: service_fxdd + '/gateValveReal/log/loglist', + historyPageExport: service_fxdd + '/gateValveReal/log/exp', + swInfo:service_fxdd + '/reservoir/water/waterInfo', krlist: service_fxdd + "/reservoir/water/data", info: service_fxdd + "/attGateValve/detail", kgpage: service_fxdd + "/gateValveR/page", diff --git a/src/views/gcaqjc/gcaqfx/jrx/jrxOptions.js b/src/views/gcaqjc/gcaqfx/jrx/jrxOptions.js index de909759a..e166781c8 100644 --- a/src/views/gcaqjc/gcaqfx/jrx/jrxOptions.js +++ b/src/views/gcaqjc/gcaqfx/jrx/jrxOptions.js @@ -232,7 +232,7 @@ export default function jrxOptions(data = {}, type = "1",typeName='1') { }, splitLine: { // 网格 - show: true, + show: false, lineStyle: { color: '#CCCCCC', type: 'dashed' diff --git a/src/views/rcgl/byfz/bypc/index.js b/src/views/rcgl/byfz/bypc/index.js index 030abf020..9d3abfd72 100644 --- a/src/views/rcgl/byfz/bypc/index.js +++ b/src/views/rcgl/byfz/bypc/index.js @@ -145,7 +145,8 @@ const Page = () => { pageSo: { pageNumber: 1, pageSize: 99999, - } + }, + searchDate:searchVal?.searchDate } try { const res = await httppost2(apiurl.rcgl.byfz.bypc.count, params); @@ -157,7 +158,7 @@ const Page = () => { } useEffect(() => { getCount(); - }, []) + }, [searchVal]) useEffect(() => { if (searchVal) { const params = { diff --git a/src/views/rcgl/zmjk/ModalContent.js b/src/views/rcgl/zmjk/ModalContent.js index 4ddc22ba2..6a663f977 100644 --- a/src/views/rcgl/zmjk/ModalContent.js +++ b/src/views/rcgl/zmjk/ModalContent.js @@ -4,61 +4,78 @@ import ModalToolBar from './ModalToolBar'; import { httppost5 } from '../../../utils/request'; import { exportFile } from '../../../utils/tools'; import apiurl from '../../../service/apiurl'; -export default function ModalContent() { +import usePageTable from '../../../components/crud/usePageTable2'; +import { createCrudService } from '../../../components/crud/_'; +export default function ModalContent({zfjkData}) { const columns = [ { title: '序号', key: 'inx', + dataIndex:'inx', width: 80, - render: (r, i) => {i + 1} }, { - title: '闸门名称', - key: 'project', + title: '闸阀名称', + key: 'valveName', + dataIndex:'valveName', width: 150, }, { title: '操作内容', - key: 'project', + dataIndex:'opContent', + key: 'opContent', width: 150, }, { title: '操作结果', - key: 'project', + dataIndex:'status', + key: 'status', width: 150, - } - , + }, { title: '操作时间', - key: 'project', + dataIndex:'tm', + key: 'tm', width: 150, } ] const [searchVal, setSearchVal] = useState(false) - + // 闸阀弹框更多数据 + const { tableProps, search, refresh } = usePageTable(createCrudService(apiurl.gsxl.zfzl.historypage).find_noCode); const exportExcel = () => { let params = { ...searchVal, - // pageSo: { - // pageNumber: tableProps.pagination.current, - // pageSize:tableProps.pagination.pageSize - // } + pageSo: { + pageNumber: tableProps.pagination.current, + pageSize:tableProps.pagination.pageSize + } } - httppost5(apiurl.gcaqjc.sjtjcx.ndsytjb.export, params).then(res => { + httppost5(apiurl.gsxl.zfzl.historyPageExport, params).then(res => { exportFile(`闸门操作记录.xlsx`,res.data) }) } + useEffect(() => { + if (searchVal) { + const params = { + search: { + ...searchVal, + } + } + search(params) + } + }, [searchVal]) return (
- +
) diff --git a/src/views/rcgl/zmjk/ModalToolBar.js b/src/views/rcgl/zmjk/ModalToolBar.js index 69d405e47..d22ec2da2 100644 --- a/src/views/rcgl/zmjk/ModalToolBar.js +++ b/src/views/rcgl/zmjk/ModalToolBar.js @@ -4,7 +4,7 @@ import { Form, Input, Button, DatePicker } from 'antd'; import moment from 'moment'; import NormalSelect from '../../../components/Form/NormalSelect'; const { RangePicker } = DatePicker; -const ToolBar = ({ setSearchVal, exportFile }) => { +const ToolBar = ({ setSearchVal, exportFile,list }) => { const optionsType = [ { label: "今日", @@ -44,7 +44,7 @@ const ToolBar = ({ setSearchVal, exportFile }) => { } } delete values.tm - setSearchVal({ ...values, dateTimeSo }); + setSearchVal({ ...values, dateTimeRangeSo:dateTimeSo }); } const onValuesChange = (e) => { @@ -70,20 +70,28 @@ const ToolBar = ({ setSearchVal, exportFile }) => { } useEffect(() => { - let dateTimeSo = { - start: moment().subtract(1, "years").format('YYYY-MM-DD 00:00:00'), - end: moment().format('YYYY-MM-DD 00:00:00') + if (list.length > 0) { + let dateTimeSo = { + start: moment().subtract(7, "days").format('YYYY-MM-DD 00:00:00'), + end: moment().format('YYYY-MM-DD 00:00:00') + } + form.setFieldValue("tm", [moment(dateTimeSo.start), moment(dateTimeSo.end)]) + form.setFieldValue("valveCode", list[0]?.valveCode) + setSearchVal({dateTimeRangeSo:dateTimeSo, valveCode:list[0]?.valveCode}) } - form.setFieldValue("tm", [moment(dateTimeSo.start), moment(dateTimeSo.end)]) - setSearchVal({ dateTimeSo }) - }, []) + }, [list]) return ( <>
- - + + { const jcColumns = [ { title: '项目', - key: 'project', + key: 'name', + dataIndex:'name', width: 150, }, { title: '实时数据', - key: 'project', + key: 'realData', + dataIndex:'realData', width: 150, }, { title: '数据采集时间', - key: 'project', + dataIndex:'tm', + key: 'tm', width: 150, } ] @@ -200,17 +204,20 @@ const Page = () => { const zfColumns = [ { title: '闸阀名称', - key: 'project', + key: 'valveName', + dataIndex:'valveName', width: 150, }, { title: '当前开关状态', - key: 'project', + key: 'status', + dataIndex:'status', width: 150, }, { title: '数据采集时间', - key: 'project', + dataIndex:'tm', + key: 'tm', width: 150, } ] @@ -218,22 +225,26 @@ const Page = () => { const jlColumns = [ { title: '闸阀名称', - key: 'project', + key: 'valveName', + dataIndex:'valveName', width: 150, }, { title: '操作内容', - key: 'project', + dataIndex:'opContent', + key: 'opContent', width: 150, }, { title: '操作结果', - key: 'project', + dataIndex:'status', + key: 'status', width: 150, }, { title: '操作时间', - key: 'project', + dataIndex:'tm', + key: 'tm', width: 150, } ] @@ -252,9 +263,9 @@ const Page = () => { const pts = contextCoordinates(xunit, hole); const eqpnoList = useMemo(() => damList ? new Array(damList.length).fill(0).map((o, index) => index) : [], [damList]); - useEffect(() => { - getList() - }, []) + // useEffect(() => { + // getList() + // }, []) const getList = async () => { const { code, data } = await httppost2(apiurl.zmjk.getList) @@ -262,8 +273,8 @@ const Page = () => { return } const obj = data[0] || {} - getInformation(obj.gateCode) - getDamData(obj.stcd) + // getInformation(obj.gateCode) + // getDamData(obj.stcd) getVideo(obj.gateCode) setData(obj) } @@ -320,6 +331,95 @@ const Page = () => { return num } + +// 闸阀监控列表数据 + const [zfjkData, setzfjkData] = useState([]) + const getZfjkData = async () => { + try { + const res = await httppost2(apiurl.gsxl.zfzl.list) + if (res.code == 200) { + setzfjkData(res.data) + } + } catch (error) { + console.log(error); + + } + } + + // 闸阀历史操作 + const [zfjkHistoryListData, setzfjkHistoryListData] = useState([]) + const getZfjkHistoryData = async () => { + try { + const res = await httppost2(apiurl.gsxl.zfzl.historyList) + if (res.code == 200) { + setzfjkHistoryListData(res.data) + } + } catch (error) { + console.log(error); + + } + } + const swList = [ + { + name: "库水位(m)", + realData:'', + tm:'' + }, + { + name: "今日雨量(mm)", + realData:'', + tm:'' + }, + { + name: "灌溉发电流量(m³/s)", + realData:'', + tm:'' + } +] + // 闸阀历史操作 + const [zfjkSwData, setzfjkSwData] = useState([]) + const getZfjkSwData = async () => { + try { + const res = await httppost2(apiurl.gsxl.zfzl.swInfo) + if (res.code == 200) { + const { + rz, + todayRainNum, + outPowerNum, + todayRainNumTm, + outPowerNumTm, + tm + } = res.data; + const newArr = swList.map(item => { + if (item.name == '库水位(m)') { + item.realData = rz; + item.tm = tm; + } else if (item.name == '今日雨量(mm)') { + item.realData = todayRainNum; + item.tm = todayRainNumTm; + } else { + item.realData = outPowerNum; + item.tm = outPowerNumTm; + } + return item; + }) + setzfjkSwData(newArr) + } + } catch (error) { + console.log(error); + + } + } + + + + useEffect(() => { + getZfjkData() + getZfjkHistoryData() + getZfjkSwData() + }, []) + + return ( <>
@@ -335,12 +435,12 @@ const Page = () => {
record.id} - dataSource={[]} + rowKey={(record) => record.tm} + dataSource={zfjkData} pagination={false} /> -
+
最近操作记录
setOpen(true)}> @@ -353,8 +453,8 @@ const Page = () => {
record.id} - dataSource={[]} + rowKey={(record) => record.tm} + dataSource={zfjkHistoryListData} pagination={false} /> @@ -439,8 +539,8 @@ const Page = () => {
record.id} - dataSource={[]} + rowKey={(record) => record.tm} + dataSource={zfjkSwData} pagination={false} /> {/* { @@ -484,12 +584,13 @@ const Page = () => { width={1100} title="闸门操作记录" footer={null} + destroyOnClose onCancel={() => { setOpen(false) }} >
- + {/*