peng.peng 1 year ago
parent
commit
6d187a84da
  1. 26
      super-screen/client/src/sections/water-prevention/containers/homePage.js
  2. 13
      web/client/src/sections/dataService/containers/serviceManagement.js

26
super-screen/client/src/sections/water-prevention/containers/homePage.js

@ -46,15 +46,26 @@ function homePage(props) {
const currentContainer = SCREEN_COMPONENTS[tab]; const currentContainer = SCREEN_COMPONENTS[tab];
useEffect(() => { useEffect(() => {
getData(); getWaterData();
}, []) }, [])
const getData = () => { // 获取水务数据
// 水务 const getWaterData = async () => {
dispatch(waterLogin({ username: "123456", password: "123456", pcode: 'fce4afe2-5b6a-408a-ab18-a2afa7fa027c' })).then(loginRes => { const waterToken = sessionStorage.getItem('waterToken')
let token = waterToken;
if (!token) {
try {
const loginRes = await dispatch(waterLogin({ username: "123456", password: "123456", pcode: 'fce4afe2-5b6a-408a-ab18-a2afa7fa027c' }))
if (loginRes.success) { if (loginRes.success) {
const { token } = loginRes.payload.data; sessionStorage.setItem('waterToken', loginRes.payload.data.token);
sessionStorage.setItem('waterUser', JSON.stringify(loginRes.payload.data)); token = loginRes.payload.data.token;
} else {
return;
}
} catch (error) {
return;
}
}
// 水位趋势 // 水位趋势
dispatch(getWaterLevelTrend({ orgId: 84, keyword: '', token })).then(trendRes => { dispatch(getWaterLevelTrend({ orgId: 84, keyword: '', token })).then(trendRes => {
let fifterData = [] let fifterData = []
@ -130,9 +141,6 @@ function homePage(props) {
} }
}) })
} }
})
}
const getPumpStatusData = async (structId) => { const getPumpStatusData = async (structId) => {
return await dispatch(getPumpStatus(structId)); return await dispatch(getPumpStatus(structId));

13
web/client/src/sections/dataService/containers/serviceManagement.js

@ -4,7 +4,7 @@ import moment from 'moment';
import { RouteRequest } from '@peace/utils'; import { RouteRequest } from '@peace/utils';
import { RouteTable } from '$utils' import { RouteTable } from '$utils'
import { Tabs, Form, Input, Space, Button, Table, Popconfirm } from 'antd'; import { Tabs, Form, Input, Space, Button, Table, Popconfirm, message } from 'antd';
const { Search } = Input; const { Search } = Input;
import EditModal from '../components/editModal'; import EditModal from '../components/editModal';
@ -65,10 +65,13 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) {
}}>编辑</a> }}>编辑</a>
{/* {record?.enabled ? */} {/* {record?.enabled ? */}
<Popconfirm {record?.resourceConsumptions?.length > 0 ? <a onClick={() => {
title="是否确认删除该业务规则?" message.warning('已有关联数据,无法删除')
}}>删除</a>
: <Popconfirm
title="是否确认删除该服务?"
onConfirm={() => { onConfirm={() => {
dispatch(dataService.delBusinessRules(record.id)).then(res => { dispatch(dataService.delServiceManagement(record.id)).then(res => {
if (res.success) { if (res.success) {
setQuery({ limit: 10, page: 0 }); setQuery({ limit: 10, page: 0 });
resourceData({ limit: 10, page: 0, keyword }) resourceData({ limit: 10, page: 0, keyword })
@ -77,7 +80,7 @@ function ServiceManagement ({ loading, clientHeight, actions, dispatch, }) {
}} }}
> >
<a >删除</a> <a >删除</a>
</Popconfirm> </Popconfirm>}
{/* // } */} {/* // } */}
{record?.enabled ? {record?.enabled ?

Loading…
Cancel
Save