Commit 18fb4fae authored by shaoan123's avatar shaoan123

更改新运维中人工智能页面

parent 43d69214
Pipeline #26830 skipped with stages
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import styles from './SchemeConfig.less'
import {
GetGISServerMapList,
publisService
} from '@/services/webConfig/api';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible,solutionNames } = props;
const [loading, setLoading] = useState(false);
const [workSpace, setWorkSpace] = useState('');
const [serviceName, setServicename] = useState([{
value: 'geoserver',
item: 'geoserver'
}]);
const [workList, setWorkList] = useState([]);
const [gsIp, setGsIp] = useState([]);
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
if (type === 'add') {
let query = {
_version: 9999,
gsIP: obj.serviceadress,
gsPort: obj.port,
gsAppName: obj.servicename,
gsUser: obj.user,
gsWorkspaceName: obj.workname,
gsPwd: obj.password,
serviceName: obj.name,
solution: solutionNames,
}
publisService(query,{timeout:120000})
.then(res => {
setLoading(false);
if (res.success) {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
setWorkList([])
handlelocalStorage('add',obj.serviceadress, obj.servicename)
} else {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
}
})
.catch(err => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
} else if (type === 'edit') {
handleEdit();
}
}
});
};
const handleEdit = () => {
// SetServiceConfig({
// servicename: serviceName,
// terminalType: 'base',
// isBaseMap: true,
// jsonCfg: JSON.stringify(query)
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '编辑成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '编辑失败',
// });
// }
// })
// .catch(err => setLoading(false));
};
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
let gsIp = [];
let localStorageData = handlelocalStorage('get');
if (localStorageData) {
gsIp = localStorageData.map(item => ({
value: item.gsIp,
item: item.gsIp
}));
}
setGsIp(gsIp)
let localIps = ['192.168.12.7', '192.168.19.100']
let port = localIps.includes(gsIp) ? 8080 : 8088
form.setFieldsValue({ servicename: serviceName[0].value, port, ...formObj });
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
}
}, [visible]);
//存储到localstorage
const handlelocalStorage = (type, gsIp, gisAppName) => {
if (!localStorage) return null;
let result = JSON.parse(localStorage.getItem('metaData'))
if (type == 'get') {
return result;
}
if (!result || !result.find(item => item.gsIp == gsIp)) {
if (!result) result = [];
result.push({
gsIp,
gisAppName: [{
value: gisAppName,
item: gisAppName
}]
})
localStorage.setItem('metaData', JSON.stringify(result))
return
}
let data = result.find(item => item.gsIp == gsIp)
let isHasGisAppName = data.gisAppName.find(item => item.value == gisAppName);
if (isHasGisAppName) return;
data.gisAppName.push({
value: gisAppName,
item: gisAppName
})
localStorage.setItem('metaData', JSON.stringify(result))
};
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
},
};
const handleChange = () => { }
//选择工作空间
const selectWorkspace = () => {
let obj = form.getFieldsValue();
form.validateFields(['serviceadress', 'port', 'servicename', 'user', 'password']).then(validate => {
if (validate) {
let query = {
GISServerIP: obj.serviceadress,
GISServerPort: obj.port,
gsAppName: obj.servicename,
gsUser: obj.user,
gsPwd: obj.password,
isGeoServer: true,
_version: 9999,
}
GetGISServerMapList(query).then(res => {
if (Array.isArray(res)) {
const defaultValue= res[0].name||''
form.setFieldsValue({ name:defaultValue,workname:defaultValue});
setWorkList(res)
setWorkSpace(defaultValue)
}
else {
notification.error({
message: '提示',
duration: 3,
description: '获取工作空间失败',
});
}
})
}
})
};
//选择工作空间
const handleWorkspace = (value) => {
form.setFieldsValue({
workname: value,
name:value
})
setWorkSpace(value)
}
const selectIp = (value)=>{
let localIps = ['192.168.12.7', '192.168.19.100']
let port = localIps.includes(value) ? 8080 : 8088
form.setFieldsValue({ port,serviceadress:value });
}
return (
<Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="GIS服务器地址"
name="serviceadress"
rules={[{ required: true, message: '请选择服务名' }]}
>
<AutoComplete
placeholder="请输入GIS服务器地址"
options={gsIp}
onSelect={selectIp}
/>
</Item>
<Item
label="GIS服务器端口"
name="port"
rules={[{ required: true, message: '请输入GIS服务器端口' }]}
>
<Input placeholder="请输入GIS服务器端口" allowClear />
</Item>
<Item
label="GIS服务器名"
name="servicename"
rules={[{ required: true, message: '请输入GIS服务器名' }]}
>
<AutoComplete
placeholder="Email"
options={serviceName}
/>
</Item>
<Item
label="用户名称"
name="user"
rules={[{ required: true, message: '请输入用户名称' }]}
>
<Input placeholder="请输入用户名称" allowClear />
</Item>
<Item
label="用户密码"
name="password"
rules={[{ required: true, message: '请输入用户密码' }]}
>
<Input.Password placeholder="请输入用户密码" allowClear />
</Item>
<Item
label="工作空间名称"
name="workname"
rules={[{ required: true, message: '请选择工作空间名称' }]}
>
<div className={styles.imgList}>
<Select onChange={handleWorkspace} value ={workSpace}>
{workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''}
</Select>
<Button style={{ marginLeft: '0.5rem' }} onClick={() => { selectWorkspace() }}>选择工作空间</Button>
</div>
</Item>
<Item
label="服务名称"
name="name"
rules={[{ required: true, message: '请输入服务名称' }]}
>
<Input placeholder="请输入服务名称" allowClear />
</Item>
</Form>
)}
</Modal>
);
};
export default AddModal;
.container{
width: 100%;
height: calc(100vh - 100px) ;
background-color: #ffffff;
display: flex;
padding: 0.8rem;
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
overflow-y: scroll;
.ant-input-number-input{
background-color: #ffffff;
color: #000000;
}
}
.imgList{
display: flex;
}
.imgItem{
display: flex;
flex-direction: column;
align-items: center;
margin:0 1rem 1rem 0;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 0 0 2rem
}
.schemeName{
margin-right: 0.8rem;
font-weight: bold;
}
.schemeItem,.schemeBtn{
display: flex;
align-items: center;
}
.schemeBtn{
width: 12rem;
justify-content: center;
}
.mapItem{
display: flex;
border: 1px solid #ccc;
border-radius: 4px;
height: 2.2rem;
align-items: center;
margin: 0.5rem 0;
width: 14.5rem;
}
.defaultTile{
background: #ccc;
color: white;
cursor: pointer;
height: 100%;
display: flex;
align-items: center;
width: 3rem;
justify-content: center;
}
.mapText{
width: 10rem;
text-align: center;
}
.mapIcon{
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.activeTile{
background-color: #4699f4
}
.dropList {
position: absolute;
right: 2%;
top: 25%;
color: rgba(0, 0, 0, 0.25);
z-index: 99;
}
.divider{
display: flex;
align-items: center;
line-height: 100%;
padding: 0.5rem;
.dividerIcon{
margin-left: 0.8rem;
color: #4699f4;
cursor: pointer;
}
}
.ant-table {
min-height: 15rem !important;
}
.cardsList{
display: flex;
flex-wrap: wrap;
}
.cardItem{
width: 18rem;
height: 18rem;
margin: 0 2rem;
}
import { Space, Table, Button, Popconfirm, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from './SchemeConfig.less'
import {
GetVectorService, deleteVectorService, getSolutionList, updatePublishedMetaData
} from '@/services/webConfig/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗
const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [currentMetaData,setCurrentMetaData] = useState(null)
const columns = [
{
title: '序号',
dataIndex: 'serviceName',
key: 'serviceName',
align: 'center'
},
{
title: '方案名称',
dataIndex: 'GISServerIP',
key: 'GISServerIP',
align: 'center'
},
{
title: '方案类型',
dataIndex: 'GISServerPort',
key: 'GISServerPort',
align: 'center'
},
{
title: '任务名称',
dataIndex: 'GISServerProjectName',
key: 'GISServerProjectName',
align: 'center'
},
{
title: '创建时间',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '描述',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该矢量数据?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag+1)
};
const delConfirm = (record) => {
let query = {
serviceName: record.serviceName,
_version: 9999,
solution: solutionNames
}
deleteVectorService(query).then(res => {
if (res.success) {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '删除元数据成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: '删除元数据失败',
});
};
})
}
const handleAdd = () => {
// setType('add');
// setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
};
import { Tabs } from 'antd';
import React from 'react';
import PageContainer from '@/components/BasePageContainer';
import styles from './policiesIssued.less'
import PredictionConfig from './predictionConfig/predictionConfig';
import StrategyConfig from './strategyConfig/strategyConfig';
const { TabPane } = Tabs;
const SchemeConfig = () => {
return (
<>
<div className={styles.tileBtn}>
<Button type="primary" onClick={() => {
handleAdd();
}} >
新增
</Button>
<PageContainer>
<div className={styles.container}>
<Tabs type="card">
<TabPane tab="预测方案" key="1">
<PredictionConfig />
</TabPane>
<TabPane tab="策略下发" key="2">
<StrategyConfig />
</TabPane>
</Tabs>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey="createTime"
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
solutionNames={solutionNames}
/>
</>
</PageContainer>
)
}
export default VectorData
\ No newline at end of file
export default SchemeConfig;
\ No newline at end of file
.container{
width: 100%;
height: calc(100vh - 100px) ;
background-color: #ffffff;
display: flex;
padding: 0.8rem;
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
overflow-y: scroll;
.ant-input-number-input{
background-color: #ffffff;
color: #000000;
}
}
.predict{
display: flex;
align-items: flex-end;
justify-content: space-between;
width: 100%;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 0 0 2rem
}
.corn{
cursor: pointer;
margin-left:1rem;
text-decoration: underline;
width: 8rem;
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, DatePicker, Spin } from 'antd';
import styles from '../policiesIssued.less'
// import moment from 'moment';
// 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 {
getEquipmentInfo
} from '@/services/intelligence/api';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
const [loading, setLoading] = useState(false);
const [isloading, setIsLoading] = useState(false);
const [deviceCodes, setDeviceCode] = useState([]); //设备编码列表
const [timeType, setTimeType] = useState(['分钟', '小时', '天']);
const [intervalType, setIntervalType] = useState('分钟')
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let DateFrom = moment(obj.Date[0]).format('YYYY-MM-DD')
let DateTo = moment(obj.Date[1]).format('YYYY-MM-DD')
setLoading(true);
if (type === 'add') {
} else if (type === 'edit') {
handleEdit();
}
}
});
};
const handleEdit = () => {
// SetServiceConfig({
// servicename: serviceName,
// terminalType: 'base',
// isBaseMap: true,
// jsonCfg: JSON.stringify(query)
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '编辑成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '编辑失败',
// });
// }
// })
// .catch(err => setLoading(false));
};
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
deviceType.length && getDeviceCode(deviceType[0].DeviceType)
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
}
}, [visible]);
const getDeviceCode = (type) => {
setLoading(false)
getEquipmentInfo(type).then(respone => {
const divProps = [];
respone.getMe[0].DeviceList.map((item) => {
divProps.push({ disabled: false, value: item.Code, pid: item.PointAddressID })
})
console.log('respone', divProps);
respone.getMe[0].DeviceList.length && setDeviceCode(divProps)
form.setFieldsValue({
deviceType: deviceType[0].DeviceType
});
setLoading(false)
})
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
},
};
//选择设备类型
const handleDeviceType = (value) => {
getDeviceCode(value)
}
const handleIntervalType = (value) => {
setIntervalType(value)
}
const handleChange = (value) => {
console.log(value, 'value');
}
const handleChangeIndex = (value) => {
console.log(value, 'value');
}
return (
<Modal
title={`${type === 'add' ? '方案发布' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Spin spinning={isloading} delay={300}>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="方案名称"
name="TaskName"
rules={[{ required: true, message: '请输入方案名称' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="算法名称"
name="TaskName"
rules={[{ required: true, message: '请输入算法名称' }]}
>
<Input placeholder="请输入算法名称" allowClear />
</Item>
<Item
label="设备类型"
name="deviceType"
rules={[{ required: true, message: '请输入设备类型' }]}
>
<Select onChange={handleDeviceType} >
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="设备编码"
rules={[{ required: true, message: '请选择设备编码' }]}
>
<Select
mode="multiple"
style={{ width: '100%' }}
placeholder="请选择设备编码"
options={deviceCodes}
defaultValue={[]}
onChange={handleChange}
/>
</Item>
<Item
label="指标名称"
rules={[{ required: true, message: '请选择指标名称' }]}
>
<Select
mode="multiple"
style={{ width: '100%' }}
placeholder="请选择指标"
options={deviceCodes}
defaultValue={[]}
onChange={handleChangeIndex}
/>
</Item>
{/* <Item
label="间隔(Cron)"
name="Interval"
rules={[{ required: true, message: '请输入间隔' }]}
>
<div className={styles.predict}>
<Input placeholder="请输入间隔" allowClear />
<a className={styles.corn} target="view_window" href="https://cron.qqe2.com/">cron在线生成</a>
</div>
</Item> */}
<Item
label="首次执行时间"
name="Date"
rules={[{ required: true, message: '请选择首次执行时间' }]}
>
<RangePicker locale={locale}
style={{ width: '100%' }} />
</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
label="描述"
name="dec"
>
<TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item>
</Form>
)}
</Spin>
</Modal>
);
};
export default AddModal;
import { Space, Table, Button, Popconfirm, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../policiesIssued.less'
import {
deleteTaskOptions, taskOptionsList, getIotDeviceType, algorithmList, getEquipmentInfo
} from '@/services/intelligence/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [deviceType, setDeviceType] = useState([]); //设备类型列表
const columns = [
{
title: '序号',
dataIndex: 'serviceName',
key: 'serviceName',
align: 'center'
},
{
title: '方案名称',
dataIndex: 'GISServerIP',
key: 'GISServerIP',
align: 'center'
},
{
title: '算法名称',
dataIndex: 'GISServerPort',
key: 'GISServerPort',
align: 'center'
},
{
title: '设备类型',
dataIndex: 'GISServerProjectName',
key: 'GISServerProjectName',
align: 'center'
},
{
title: '设备编码',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '指标名称',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '预测间隔',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '首次执行时间',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '描述',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该矢量数据?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag+1)
};
const delConfirm = (record) => {
}
const handleAdd = () => {
setType('add');
setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
const getIotDevice = getIotDeviceType()
const algorithm = algorithmList()
const taskOption = taskOptionsList()
Promise.all([getIotDevice, algorithm, taskOption]).then(res => {
res[0].getMe && res[0].getMe.length && setDeviceType(res[0].getMe)
res[2].getMe && res[2].getMe.length && setTileData(res[2].getMe)
setTreeLoading(false)
}).catch(err => {
setTreeLoading(false)
})
};
return (
<>
<div className={styles.tileBtn}>
<Button type="primary" onClick={() => {
handleAdd();
}} >
新增
</Button>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey="createTime"
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
deviceType={deviceType}
formObj={formObj}
/>
</>
)
}
export default VectorData
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, DatePicker, Spin } from 'antd';
import styles from '../policiesIssued.less'
// import moment from 'moment';
// 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 {
getEquipmentInfo
} from '@/services/intelligence/api';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
const [loading, setLoading] = useState(false);
const [isloading, setIsLoading] = useState(false);
const [deviceCodes, setDeviceCode] = useState([]); //设备编码列表
const [timeType, setTimeType] = useState(['分钟', '小时', '天']);
const [intervalType, setIntervalType] = useState('分钟')
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let DateFrom = moment(obj.Date[0]).format('YYYY-MM-DD')
let DateTo = moment(obj.Date[1]).format('YYYY-MM-DD')
setLoading(true);
if (type === 'add') {
} else if (type === 'edit') {
handleEdit();
}
}
});
};
const handleEdit = () => {
// SetServiceConfig({
// servicename: serviceName,
// terminalType: 'base',
// isBaseMap: true,
// jsonCfg: JSON.stringify(query)
// })
// .then(res => {
// setLoading(false);
// if (res.success) {
// form.resetFields();
// callBackSubmit();
// notification.success({
// message: '提示',
// duration: 3,
// description: res.message || '编辑成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: res.message || '编辑失败',
// });
// }
// })
// .catch(err => setLoading(false));
};
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
deviceType.length && getDeviceCode(deviceType[0].DeviceType)
break;
case 'edit':
form.setFieldsValue({ ...formObj });
break;
default:
break;
}
}, [visible]);
const getDeviceCode = (type) => {
setLoading(false)
getEquipmentInfo(type).then(respone => {
respone.getMe[0].DeviceList.length && setDeviceCode(respone.getMe[0].DeviceList)
form.setFieldsValue({
deviceType: deviceType[0].DeviceType,
deviceCode: respone.getMe[0].DeviceList[0].Code
});
setLoading(false)
})
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
},
};
//选择设备类型
const handleDeviceType = (value) => {
getDeviceCode(value)
}
const handleIntervalType = (value) => {
setIntervalType(value)
}
return (
<Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Spin spinning={isloading} delay={300}>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="任务名称"
name="TaskName"
rules={[{ required: true, message: '请输入任务名称' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="场景"
name="scene"
rules={[{ required: true, message: '请选择场景' }]}
>
<Select >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select>
</Item>
<Item
label="策略名称"
name="strategy"
// rules={[{ required: true, message: '请选择策略名称' }]}
>
<Select >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select>
</Item>
<Item
label="类型"
name="type"
rules={[{ required: true, message: '请选择类型' }]}
>
<Select>
<Select.Option value='水龄预测'>水龄预测</Select.Option>
<Select.Option value='二供泵房'>二供泵房</Select.Option>
</Select>
</Item>
<Item
label="设备类型"
name="deviceType"
rules={[{ required: true, message: '请输入设备类型' }]}
>
<Select onChange={handleDeviceType} >
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="设备编码"
name="deviceCode"
rules={[{ required: true, message: '请选择设备编码' }]}
>
<Select>
{deviceCodes.length ? deviceCodes.map((item, index) => { return <Select.Option key={index} value={item.PointAddressID}>{item.Code}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="间隔(Cron)"
name="Interval"
rules={[{ required: true, message: '请输入间隔' }]}
>
<div className={styles.predict}>
<Input placeholder="请输入间隔" allowClear />
<a className={styles.corn} target="view_window" href="https://cron.qqe2.com/">cron在线生成</a>
</div>
</Item>
<Item
label="首次预测时间"
name="Date"
rules={[{ required: true, message: '请选择首次预测时间' }]}
>
<RangePicker locale={locale}
style={{ width: '100%' }} />
</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
label="描述"
name="dec"
>
<TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item>
</Form>
)}
</Spin>
</Modal>
);
};
export default AddModal;
import { Space, Table, Button, Popconfirm, notification } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../policiesIssued.less'
import {
GetVectorService, deleteVectorService, getSolutionList, updatePublishedMetaData
} from '@/services/webConfig/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗
const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [currentMetaData,setCurrentMetaData] = useState(null)
const columns = [
{
title: '序号',
dataIndex: 'serviceName',
key: 'serviceName',
align: 'center'
},
{
title: '方案名称',
dataIndex: 'GISServerIP',
key: 'GISServerIP',
align: 'center'
},
{
title: '方案类型',
dataIndex: 'GISServerPort',
key: 'GISServerPort',
align: 'center'
},
{
title: '任务名称',
dataIndex: 'GISServerProjectName',
key: 'GISServerProjectName',
align: 'center'
},
{
title: '创建时间',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '描述',
dataIndex: 'publishTime',
key: 'publishTime',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该矢量数据?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag+1)
};
const delConfirm = (record) => {
let query = {
serviceName: record.serviceName,
_version: 9999,
solution: solutionNames
}
deleteVectorService(query).then(res => {
if (res.success) {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '删除元数据成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: '删除元数据失败',
});
};
})
}
const handleAdd = () => {
// setType('add');
// setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
};
return (
<>
<div className={styles.tileBtn}>
<Button type="primary" onClick={() => {
handleAdd();
}} >
新增
</Button>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey="createTime"
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
solutionNames={solutionNames}
/>
</>
)
}
export default VectorData
\ No newline at end of file
......@@ -75,7 +75,7 @@ const AddModal = props => {
useEffect(() => {
switch (type) {
case 'add':
deviceType.length && getDeviceCode(deviceType[0].DeviceType)
form.setFieldsValue({ ...formObj });
break;
case 'edit':
form.setFieldsValue({ ...formObj });
......@@ -87,33 +87,18 @@ const AddModal = props => {
const getDeviceCode = (type) => {
setLoading(false)
getEquipmentInfo(type).then(respone => {
respone.getMe[0].DeviceList.length && setDeviceCode(respone.getMe[0].DeviceList)
form.setFieldsValue({
deviceType: deviceType[0].DeviceType,
deviceCode: respone.getMe[0].DeviceList[0].Code
});
setLoading(false)
})
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 5,
},
wrapperCol: {
span: 16,
},
};
//选择设备类型
const handleDeviceType = (value) => {
getDeviceCode(value)
}
const handleIntervalType = (value) => {
setIntervalType(value)
}
return (
......@@ -143,26 +128,7 @@ const AddModal = props => {
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="场景"
name="scene"
rules={[{ required: true, message: '请选择场景' }]}
>
<Select >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select>
</Item>
<Item
label="策略名称"
name="strategy"
// rules={[{ required: true, message: '请选择策略名称' }]}
>
<Select >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select>
</Item>
<Item
label="类型"
label="方案类型"
name="type"
rules={[{ required: true, message: '请选择类型' }]}
>
......@@ -172,26 +138,15 @@ const AddModal = props => {
</Select>
</Item>
<Item
label="设备类型"
name="deviceType"
rules={[{ required: true, message: '请输入设备类型' }]}
>
<Select onChange={handleDeviceType} >
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="设备编码"
name="deviceCode"
rules={[{ required: true, message: '请选择设备编码' }]}
label="方案名称"
name="strategy"
>
<Select>
{deviceCodes.length ? deviceCodes.map((item, index) => { return <Select.Option key={index} value={item.PointAddressID}>{item.Code}</Select.Option> }) : ''}
<Select >
{/* {workList.length ? workList.map((item, index) => { return <Option key={index} value={item.name}>{item.name}</Option> }) : ''} */}
</Select>
</Item>
<Item
label="间隔(Cron)"
label="调度间隔(Cron)"
name="Interval"
rules={[{ required: true, message: '请输入间隔' }]}
>
......@@ -199,27 +154,7 @@ const AddModal = props => {
<Input placeholder="请输入间隔" allowClear />
<a className={styles.corn} target="view_window" href="https://cron.qqe2.com/">cron在线生成</a>
</div>
</Item>
<Item
label="首次预测时间"
name="Date"
rules={[{ required: true, message: '请选择首次预测时间' }]}
>
<RangePicker locale={locale}
style={{ width: '100%' }} />
</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="描述"
name="dec"
......
......@@ -11,11 +11,9 @@ const VectorData = props => {
const [visible, setVisible] = useState(false); // 弹窗
const [deviceType, setDeviceType] = useState([]); //设备类型列表
const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [currentMetaData, setCurrentMetaData] = useState(null)
const [formObj, setFormObj] = useState({});
const columns = [
{
title: '序号',
......
......@@ -127,7 +127,6 @@ const ProjectManage = () => {
handleShowModal("editVisible", true)
}
const TestDesc = (record) => {
console.log(record, "选中的方案")
if(record.ThemeName)
TestPush({
theme:record.ThemeName,
......@@ -137,7 +136,6 @@ const ProjectManage = () => {
msgTypeId:record.ID
}).then(
res =>{
if(res.code === 0){
message.success("测试推送成功")
}else{
......
......@@ -214,15 +214,16 @@ export default {
name: '人工智能',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/platformCenter/artificial/policiesIssued',
name: '方案管理',
component: PoliciesIssued,
},
{
path: '/platformCenter/artificial/taskScheduling',
name: '任务调度',
component: TaskScheduling,
},
{
path: '/platformCenter/artificial/policiesIssued',
name: '策略下发',
component: PoliciesIssued,
}
],
},
......
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