Commit fbe4558f authored by shaoan123's avatar shaoan123

修改运维系统中人工智能模块路由

parent 667c0333
Pipeline #26653 skipped with stages
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select , notification } from 'antd'; import { Form, Modal, Input, Select, notification, DatePicker } from 'antd';
import styles from './taskScheduling.less' import styles from './taskScheduling.less'
import { import { ConfigProvider } from 'antd';
GetGISServerMapList,
publisService // import moment from 'moment';
} from '@/services/webConfig/api'; // import locale from 'antd/es/date-picker/locale/zh_CN';
// import 'moment/locale/zh-cn';
import moment from 'moment'
import locale from 'antd/lib/date-picker/locale/zh_CN'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
import {
getIotDeviceType, algorithmList, getEquipmentInfo
} from '@/services/intelligence/api';
const { RangePicker } = DatePicker;
const { TextArea } = Input; const { TextArea } = Input;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, solutionNames } = props; const { callBackSubmit = () => { }, type, formObj, visible, solutionNames } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [workSpace, setWorkSpace] = useState(''); const [workSpace, setWorkSpace] = useState(''); //
const [serviceName, setServicename] = useState([{ const [workList, setWorkList] = useState([]); //设备类型列表
}]); const [deviceType, setDeviceType] = useState([]); //设备类型列表
const [workList, setWorkList] = useState([]); const [deviceCode, setDeviceCode] = useState([]); //设备编码列表
const [timeType, setTimeType] = useState(['分钟', '小时', '天']);
const [intervalType, setIntervalType] = useState('分钟')
const [gsIp, setGsIp] = useState([]); const [gsIp, setGsIp] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
...@@ -26,8 +38,8 @@ const AddModal = props => { ...@@ -26,8 +38,8 @@ const AddModal = props => {
setLoading(true); setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
if (type === 'add') { if (type === 'add') {
} else if (type === 'edit') { } else if (type === 'edit') {
handleEdit(); handleEdit();
} }
...@@ -67,7 +79,7 @@ const AddModal = props => { ...@@ -67,7 +79,7 @@ const AddModal = props => {
useEffect(() => { useEffect(() => {
switch (type) { switch (type) {
case 'add': case 'add':
form.setFieldsValue({ ...formObj }); getDeviceInfo()
break; break;
case 'edit': case 'edit':
form.setFieldsValue({ ...formObj }); form.setFieldsValue({ ...formObj });
...@@ -78,7 +90,19 @@ const AddModal = props => { ...@@ -78,7 +90,19 @@ const AddModal = props => {
}, [visible]); }, [visible]);
const getDeviceInfo = () => {
const getIotDevice = getIotDeviceType()
const algorithm = algorithmList()
Promise.all([getIotDevice, algorithm]).then(res => {
if (res[0].getMe.length) {
setDeviceType(res[0].getMe)
getEquipmentInfo(res[0].getMe[0].DeviceType).then(respone => {
respone.getMe[0].DeviceList.length && setDeviceCode(respone.getMe[0].DeviceList)
form.setFieldsValue({ deviceType: res[0].getMe[0].DeviceType, deviceCode: respone.getMe[0].DeviceList[0].Code });
})
}
})
}
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
labelCol: { labelCol: {
...@@ -90,7 +114,9 @@ const AddModal = props => { ...@@ -90,7 +114,9 @@ const AddModal = props => {
}; };
const handleWorkspace = () => { } const handleWorkspace = () => { }
const handleIntervalType = (value) => {
setIntervalType(value)
}
return ( return (
<Modal <Modal
...@@ -112,87 +138,91 @@ const AddModal = props => { ...@@ -112,87 +138,91 @@ const AddModal = props => {
<Form form={form} {...layout} onFinish={onFinish}> <Form form={form} {...layout} onFinish={onFinish}>
<Item <Item
label="任务名称" label="任务名称"
name="serviceadress" name="TaskName"
rules={[{ required: true, message: '请输入任务名称' }]} rules={[{ required: true, message: '请输入任务名称' }]}
> >
<Input placeholder="请输入任务名称" allowClear /> <Input placeholder="请输入任务名称" allowClear />
</Item> </Item>
<Item <Item
label="场景" label="场景"
name="port" name="scene"
rules={[{ required: true, message: '请选择场景' }]} rules={[{ required: true, message: '请选择场景' }]}
> >
<Select onChange={handleWorkspace} value={workSpace}> <Select onChange={handleWorkspace} >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */} {/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select> </Select>
</Item> </Item>
<Item <Item
label="策略名称" label="策略名称"
name="servicename" name="strategy"
rules={[{ required: true, message: '请选择策略名称' }]} rules={[{ required: true, message: '请选择策略名称' }]}
> >
<Select onChange={handleWorkspace} value={workSpace}> <Select onChange={handleWorkspace} >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */} {/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select> </Select>
</Item> </Item>
<Item <Item
label="类型" label="类型"
name="user" name="type"
rules={[{ required: true, message: '请选择类型' }]} rules={[{ required: true, message: '请选择类型' }]}
> >
<Select onChange={handleWorkspace} value={workSpace}> <Select onChange={handleWorkspace} >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */} <Select.Option value='水龄预测'>水龄预测</Select.Option>
<Select.Option value='二供泵房'>二供泵房</Select.Option>
</Select> </Select>
</Item> </Item>
<Item <Item
label="设备类型" label="设备类型"
name="password" name="deviceType"
rules={[{ required: true, message: '请输入设备类型' }]} rules={[{ required: true, message: '请输入设备类型' }]}
> >
<Select onChange={handleWorkspace} value={workSpace}> <Select onChange={handleWorkspace} >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */} {deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select> </Select>
</Item> </Item>
<Item <Item
label="设备编码" label="设备编码"
name="workname" name="deviceCode"
rules={[{ required: true, message: '请选择设备编码' }]} rules={[{ required: true, message: '请选择设备编码' }]}
> >
<Select onChange={handleWorkspace} value={workSpace}> <Select onChange={handleWorkspace} >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */} {deviceCode.length ? deviceCode.map((item, index) => { return <Select.Option key={index} value={item.PointAddressID}>{item.Code}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="预测间隔"
name="name"
rules={[{ required: true, message: '请输入预测间隔' }]}
>
<div className={styles.predict}></div>
<Input style={{width:'70%' }} placeholder="请输入预测间隔" allowClear />
<Select style={{ marginLeft: '0.5rem',width:'28%' }} onChange={handleWorkspace} value={workSpace}>
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select> </Select>
</Item> </Item>
<Item <Item
label="间隔(Cron)" label="间隔(Cron)"
name="serviceadress" name="Interval"
rules={[{ required: true, message: '请输入间隔' }]} rules={[{ required: true, message: '请输入间隔' }]}
> >
<Input placeholder="请输入间隔" allowClear /> <Input placeholder="请输入间隔" allowClear />
</Item> </Item>
<Item <Item
label="首次预测时间" label="首次预测时间"
name="serviceadress" name="Date"
rules={[{ required: true, message: '请选择首次预测时间' }]} rules={[{ required: true, message: '请选择首次预测时间' }]}
> >
<Input placeholder="请选择首次预测时间" allowClear />
<RangePicker locale={locale}
style={{ width: '100%' }} />
</Item> </Item>
<Item
label="预测间隔"
rules={[{ required: true, message: '请输入预测间隔' }]}
>
<div className={styles.predict}></div>
<Input style={{ width: '70%' }} placeholder="请输入预测间隔" allowClear />
<Select style={{ marginLeft: '0.5rem', width: '28%' }} onChange={handleIntervalType} value={intervalType}>
{timeType.length ? timeType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
<Item <Item
label="描述" label="描述"
name="serviceadress" name="des"
> >
<TextArea placeholder="可输入描述信息" rows={4} allowClear /> <TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item> </Item>
</Form> </Form>
)} )}
......
...@@ -208,6 +208,24 @@ export default { ...@@ -208,6 +208,24 @@ export default {
'/web4/?widget=product/oms/MqttConfig/MqttConfig.js|hideMap=true', '/web4/?widget=product/oms/MqttConfig/MqttConfig.js|hideMap=true',
component: HostManager, component: HostManager,
}, },
{
path: '/platformCenter/artificial',
component: BlankLayout,
name: '人工智能',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/platformCenter/artificial/taskScheduling',
name: '任务调度',
component: TaskScheduling,
},
{
path: '/platformCenter/artificial/policiesIssued',
name: '策略下发',
component: PoliciesIssued,
}
],
},
], ],
}, },
{ {
...@@ -275,25 +293,7 @@ export default { ...@@ -275,25 +293,7 @@ export default {
component: OmsLog, component: OmsLog,
}, },
], ],
}, }
{
path: '/artificial',
component: BlankLayout,
name: '人工智能',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/artificial/taskScheduling',
name: '任务调度',
component: TaskScheduling,
},
{
path: '/artificial/policiesIssued',
name: '策略下发',
component: PoliciesIssued,
}
],
},
], ],
}, },
], ],
......
import qs from 'qs';
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
//获取设备类型
export const getIotDeviceType = () =>
get(`${CITY_SERVICE}/IOTPlatform.svc/WaterAge/GetIotDeviceType` );
//获取场景列表
export const algorithmList = () =>
get(`${CITY_SERVICE}/IOTPlatform.svc/WaterAge/AlgorithmList` );
//获取设备列表
export const getEquipmentInfo = (query) =>
get(`${CITY_SERVICE}/IOTPlatform.svc/AcrossTable/GetEquipmentInfo?equipType=${query}` );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment