From 6f00c9c540249d012d11f3c0840b51f6f10a9189 Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Fri, 27 Sep 2024 09:35:41 +0800 Subject: [PATCH] =?UTF-8?q?feat():=20=E5=BA=93=E5=AE=B9=E6=9B=B2=E7=BA=BF?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/auth/_.ts | 74 +++++++++++++------------- src/service/apiurl.js | 7 +++ src/views/AppRouters.tsx | 4 ++ src/views/KrLine/drpOption.js | 97 +++++++++++++++++++++++++++++++++++ src/views/KrLine/form.js | 79 ++++++++++++++++++++++++++++ src/views/KrLine/index.js | 88 +++++++++++++++++++++++++++++++ src/views/gbyj/index.js | 2 +- 7 files changed, 315 insertions(+), 36 deletions(-) create mode 100644 src/views/KrLine/drpOption.js create mode 100644 src/views/KrLine/form.js create mode 100644 src/views/KrLine/index.js diff --git a/src/models/auth/_.ts b/src/models/auth/_.ts index 4e3dd638a..3df05e73d 100644 --- a/src/models/auth/_.ts +++ b/src/models/auth/_.ts @@ -193,6 +193,41 @@ export async function loadMenu(): Promise { const id = idgen() return [ { id: id(), title: '水库一张图', path: '/mgr/home', icon: 'jbqk' }, + { + id: id(), title: '四全', redirect: '/mgr/sq/qfg/zcdjxx', icon: 'fxzb', + children: [ + { + id: id(), title: '全覆盖', redirect: '/mgr/sq/qfg/zcdjxx', + children: [ + { id: id(), title: '注册登记信息', path: '/mgr/sq/qfg/zcdjxx' }, + ] + }, + { + id: id(), title: '全要素', redirect: '/mgr/sq/qys/kqys', + children: [ + { id: id(), title: '库区要素', path: '/mgr/sq/qys/kqys' }, + { id: id(), title: '工程要素', path: '/mgr/sq/qys/gcys' }, + { id: id(), title: '下游要素', path: '/mgr/sq/qys/xyys' }, + + ] + }, + { id: id(), title: '全周期', redirect: '/mgr/sq/qzq/gcdsj', + children: [ + { id: id(), title: '工程大事记', path: '/mgr/sq/qzq/gcdsj'}, + { id: id(), title: '全周期档案', path: '/mgr/sq/qys/qzqda'}, + ] + }, + { id: id(), title: '全天候', redirect: '/mgr/sq/qth/sksq', + children: [ + { id: id(), title: '水库水情', path: '/mgr/sq/qth/sksq'}, + { id: id(), title: '河道水情', path: '/mgr/sq/qth/hdsq'}, + { id: id(), title: '实时雨情', path: '/mgr/sq/qth/ssyq'}, + { id: id(), title: '大坝安全监测', path: '/mgr/sq/qth/dbaqjc'}, + { id: id(), title: '视频监控', path: '/mgr/sq/qth/spjk'}, + ] + }, + ] + }, { id: id(), title: '四制', redirect: '/mgr/sz/gltx/zzjgck', icon: 'jbqk', children: [ @@ -318,6 +353,9 @@ export async function loadMenu(): Promise { { id: id(), title: '维修养护', path: '/mgr/sg/wxyh', }, + { + id: id(), title: '库容管理', path: '/mgr/sg/krgl', + }, { id: id(), title: '值班管理', redirect: '/mgr/sg/zbgl/zbb', children: [ @@ -375,41 +413,7 @@ export async function loadMenu(): Promise { }, ], }, - { - id: id(), title: '四全', redirect: '/mgr/sq/qfg/zcdjxx', icon: 'fxzb', - children: [ - { - id: id(), title: '全覆盖', redirect: '/mgr/sq/qfg/zcdjxx', - children: [ - { id: id(), title: '注册登记信息', path: '/mgr/sq/qfg/zcdjxx' }, - ] - }, - { - id: id(), title: '全要素', redirect: '/mgr/sq/qys/kqys', - children: [ - { id: id(), title: '库区要素', path: '/mgr/sq/qys/kqys' }, - { id: id(), title: '工程要素', path: '/mgr/sq/qys/gcys' }, - { id: id(), title: '下游要素', path: '/mgr/sq/qys/xyys' }, - - ] - }, - { id: id(), title: '全周期', redirect: '/mgr/sq/qzq/gcdsj', - children: [ - { id: id(), title: '工程大事记', path: '/mgr/sq/qzq/gcdsj'}, - { id: id(), title: '全周期档案', path: '/mgr/sq/qys/qzqda'}, - ] - }, - { id: id(), title: '全天候', redirect: '/mgr/sq/qth/sksq', - children: [ - { id: id(), title: '水库水情', path: '/mgr/sq/qth/sksq'}, - { id: id(), title: '河道水情', path: '/mgr/sq/qth/hdsq'}, - { id: id(), title: '实时雨情', path: '/mgr/sq/qth/ssyq'}, - { id: id(), title: '大坝安全监测', path: '/mgr/sq/qth/dbaqjc'}, - { id: id(), title: '视频监控', path: '/mgr/sq/qth/spjk'}, - ] - }, - ] - }, + // { id: id(), title: '基本情况', path: '/mgr/home', icon: 'jbqk' }, diff --git a/src/service/apiurl.js b/src/service/apiurl.js index bcba9dc8d..8f1906c38 100644 --- a/src/service/apiurl.js +++ b/src/service/apiurl.js @@ -8,6 +8,13 @@ const service_fxdd = '/gunshiApp/tsg' const service_xyt = '/gunshiApp/tsg'//登陆先用小玉潭 const service_shzh = '/shzh' const apiurl = { + + krline: { + list: service_fxdd + "/stZvarlB/list", + save: service_fxdd + "/stZvarlB/insert", + update: service_fxdd + "/stZvarlB/update", + delete: service_fxdd + "/stZvarlB/del" + }, gbyj: { list: service_fxdd + "/broadcastStation/list", //广播站 page: service_fxdd + "/broadcastWarn/page", diff --git a/src/views/AppRouters.tsx b/src/views/AppRouters.tsx index fa4ffc054..ff1dfd261 100644 --- a/src/views/AppRouters.tsx +++ b/src/views/AppRouters.tsx @@ -108,6 +108,9 @@ import Ajdj from './sz/szzf/ajdj' import Ajtj from './sz/szzf/ajtj' import Clyj from './sz/szzf/clyj' +import Krgl from './KrLine' + + const HomePage = lazy(() => import('./Home')) @@ -202,6 +205,7 @@ const AppRouters: React.FC = () => { { path: 'sg/aqgl/aqsgdj', element: }, { path: 'sg/gcdsj', element: }, { path: 'sg/szzb', element: }, + { path: 'sg/krgl', element: }, { path: 'rcgl/stlljc', element: }, { path: 'sg/zbgl/zbb', element: }, { path: 'sg/zbgl/zbrz', element: }, diff --git a/src/views/KrLine/drpOption.js b/src/views/KrLine/drpOption.js new file mode 100644 index 000000000..90beeb43d --- /dev/null +++ b/src/views/KrLine/drpOption.js @@ -0,0 +1,97 @@ +import echarts from 'echarts/lib/echarts'; +import { GetInterval } from '../../utils/tools' + +export default function drpOption({data}) { + const maxVal = Math.ceil(Math.max(...data.map(obj => obj.rz))) + const minVal = Math.floor(Math.min(...data.map(obj => obj.rz))) + const maxValX = Math.max(...data.map(obj => obj.w)) + const minValX = Math.min(...data.map(obj => obj.w)) + + + + let arr =[] + data.forEach(item=>{ + console.log(data); + arr.push([item.w,item.rz]) + }) + // console.log(GetInterval(minValX,maxValX),'jhsdjkashdjkahjk'); + return { + toolbox: { + show: true, + feature: { + saveAsImage: { + show: true, + excludeComponents: ['toolbox'], + pixelRatio: 2, + name:"库容曲线图" + } + }, + right: "14%", + top:"5%" + }, + title: { + text: "库容曲线图", + left: "40%", + }, + tooltip: { + trigger: 'axis', + }, + grid: [ + { + top: "10%", + left: "15%", + right: "15%", + bottom: "8%" + }, + ], + xAxis: [ + { + name: "库容(万m³)", + nameGap: 5, + type: 'value', + min:Math.floor(minValX / 5) *5, + max:Math.ceil(maxValX / 5) *5, + interval:GetInterval(minValX,maxValX), + data: data.map(o => o.w), + splitLine: { + show: false + }, + } + ], + yAxis: [ + { + type: 'value', + name: "库水位(m)", + minInterval:1, + splitLine: { + show: true, + lineStyle: { + color: '#07a6ff', + width: 0.25, + type: 'dotted' + } + }, + axisLabel: { + color: '#333', + fontSize: 12, + }, + axisLine: { + show: true + }, + axisTick: { + show: true, + }, + min: minVal, + max: maxVal + } + ], + series: [ + { + type: 'line', + color: "#007AFD", + data: arr, + smooth: true + }, + ] + }; +} diff --git a/src/views/KrLine/form.js b/src/views/KrLine/form.js new file mode 100644 index 000000000..5e099e1a7 --- /dev/null +++ b/src/views/KrLine/form.js @@ -0,0 +1,79 @@ +import React,{useEffect,useState,useRef} from 'react'; +import { Form, Button, Input, Row, Col} from 'antd'; +import { formItemLayout, btnItemLayout } from '../../components/crud/FormLayoutProps'; +import apiurl from '../../service/apiurl'; +const ModalForm = ({ mode, record,onEdit,onSave,onCrudSuccess }) => { + const [form] = Form.useForm(); + const onFinish = async (values) => { + values.resCode = "42120250085" + values.id = record?.id + if (mode === 'edit') { + const params = { + ...record, + rz: Number(values?.rz), + w: Number(values?.w), + } + onEdit(apiurl.krline.update,params) + } + if (mode === 'save') { + onSave(apiurl.krline.save,values) + } + } + + return ( + <> +
+ + + + + + + + + + + + + + + + { + mode==='view'?null:( + <> + + + + + ) + } +
+ + ); +} + +export default ModalForm; diff --git a/src/views/KrLine/index.js b/src/views/KrLine/index.js new file mode 100644 index 000000000..494906710 --- /dev/null +++ b/src/views/KrLine/index.js @@ -0,0 +1,88 @@ +import React,{useEffect,useState,useRef,useMemo} from 'react' +import { Table, Button } from 'antd' +import ModalForm from './form'; +import ReactEcharts from 'echarts-for-react'; +import drpOption from './drpOption' +import apiurl from '../../service/apiurl'; +import { httppost2 } from '../../utils/request'; +import { CrudOpRender_text } from '../../components/crud/CrudOpRender'; +import BasicCrudModal from '../../components/crud/BasicCrudModal2'; +export default function Zrtx() { + const refModal = useRef(); + const columns = [ + { + title: '序号', dataIndex: 'index', key: 'index', align: "center", + render: (r, c,i) => {i + 1} + }, + { title: '水位(m)', dataIndex: 'rz', key: 'rz',align:"center" }, + { title: '库容(万m³)', dataIndex: 'w', key: 'w',align:"center" }, + { + title: '操作', dataIndex: 'op', key: 'op', align: "center",width:200, + render: (value, row, index) => ( () => command(cmd)(row)} />) + }, + ]; + const [data, setData] = useState([]) + const option = useMemo(() => { + return drpOption({data}); + }, [data]) + const getData = async () => { + try { + const res = await httppost2(apiurl.krline.list) + setData(res.data.map((item,i) => ({...item,inx:i + 1}))) + } 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.onDeletePost(apiurl.krline.delete,params); + } + } + useEffect(() => { + getData(); + }, []) + + return ( +
+

+
+
+ + +
+ { + data.length > 0 ? + :
+ +
+ } +
+ + + + + ) +} diff --git a/src/views/gbyj/index.js b/src/views/gbyj/index.js index 764300db9..93489dcb3 100644 --- a/src/views/gbyj/index.js +++ b/src/views/gbyj/index.js @@ -170,7 +170,7 @@ export default function Gbyj() { jh={jh} /> -
+