Commit 5c469cbf authored by shaoan123's avatar shaoan123

根据预测方案接口的更改修改界面传值

parent e58aea02
Pipeline #27557 skipped with stages
# PUBLIC_PATH = reactOMS, 默认转发 /cityinterface
PROXY=/Cityinterface:http://192.168.19.105:8049;/Publish:http://192.168.19.105:8049;/Web4:http://192.168.19.105:8049;/CityTemp:http://192.168.19.105:8049
PROXY=/Cityinterface:http://192.168.12.121:8082;/Publish:http://192.168.12.121:8082;/Web4:http://192.168.12.121:8082;/CityTemp:http://192.168.12.121:8082
# 可设置第二个代理,test为转发前缀,后面为代理转发的地址
# PROXY2 = test : http://localhost:8006/
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, DatePicker, Spin, Button, Card, Row, Col } from 'antd';
import { Form, Modal, Input, Select, notification, Spin, Button, Card, Row, Col } 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, getQutaList, addPredictOptions, getSceneNameInfo, editPredictOptions
} from '@/services/intelligence/api';
import { DeleteOutlined } from '@ant-design/icons';
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
......@@ -25,6 +15,9 @@ const AddModal = props => {
const [deviceList, setDeviceList] = useState([]); //设备列表
const [card, setCard] = useState([]); //卡片列表值
const [timeType, setTimeType] = useState(['分钟', '小时', '天']);
const [PredictType, setPredictType] = useState(['日', '周', '月']);
const [showTime, setShowTime] = useState(true);
const [commonType, setCommonType] = useState(['自定义', '同周日', '同月日']);
const [intervalType, setIntervalType] = useState('分钟')
const [CycleValue, setCycleValue] = useState('')
const [sceneList, setSceneList] = useState([])
......@@ -35,23 +28,21 @@ const AddModal = props => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let DateFrom = moment(obj.time[0]).format('YYYY-MM-DD')
let DateTo = moment(obj.time[1]).format('YYYY-MM-DD')
let PredictDateFrom = moment(obj.PredictTime[0]).format('YYYY-MM-DD')
let PredictDateTo = moment(obj.PredictTime[1]).format('YYYY-MM-DD')
let api = addPredictOptions
let query = {
SceneName: obj.SceneName,
Cycle: intervalType,
CycleValue: CycleValue,
DateFrom: DateFrom,
DateTo: DateTo,
DeviceType: obj.DeviceType,
PredictDateFrom,
PredictDateTo,
PredictName: obj.PredictName,
Remarks: obj.Remarks,
DeviceDetails: card
DeviceDetails: card,
PredictCycle: obj.PredictCycle ? obj.PredictCycle : '',
PredictCycleValue: obj.PredictCycleValue,
StatisticCycle: obj.StatisticCycle,
PredictType: obj.PredictType,
StatisticCycleValue: obj.StatisticCycleValue
}
// card.length ? query.DeviceDetails = card : delete query.DeviceDetails
type === 'edit' ? (query.ID = formObj.ID) && (api = editPredictOptions) : delete query.ID && (api = addPredictOptions)
......@@ -110,7 +101,8 @@ const AddModal = props => {
}
else {
setDeviceList([])
form.setFieldsValue({ time: [moment(formObj.DateFrom, "YYYYMMDD"), moment(formObj.DateTo, "YYYYMMDD")], PredictTime: [moment(formObj.PredictDateFrom, "YYYYMMDD"), moment(formObj.PredictDateTo, "YYYYMMDD")], ...formObj });
formObj.PredictType === '日' ? setShowTime(true) : setShowTime(false)
form.setFieldsValue({ ...formObj });
setCycleValue(formObj.CycleValue);
setIntervalType(formObj.Cycle);
if (formObj.DeviceDetails.length) {
......@@ -239,11 +231,14 @@ const AddModal = props => {
const clearInput = (index) => {
form.setFieldsValue({
[`deviceCode${index}`]: undefined,
[`indextr${index}`]:undefined,
[`max${index}`]:undefined,
[`min${index}`]:undefined
[`indextr${index}`]: undefined,
[`max${index}`]: undefined,
[`min${index}`]: undefined
})
}
const selectPredictType = (value) => {
value === '日' ? setShowTime(true) : setShowTime(false)
}
//选择小时,分,天
const selectCycleValue = (e) => {
setCycleValue(e.target.value)
......@@ -292,23 +287,48 @@ const AddModal = props => {
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="首次执行时间"
name="time"
rules={[{ required: true, message: '请选择首次执行时间' }]}
label="预测维度"
name="PredictType"
rules={[{ required: true, message: '请选择预测维度' }]}
>
<Select onChange={selectPredictType} >
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
{showTime ? <Item
label="维度类别"
name="PredictCycle"
rules={[{ required: true, message: '请选择维度类别' }]}
>
<Select >
{commonType.length ? commonType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item> : ''}
<RangePicker locale={locale}
style={{ width: '100%' }} />
<Item
label="预测维度值"
name="PredictCycleValue"
rules={[{ required: true, message: '请输入预测维度值' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="首次计算时间"
name="PredictTime"
rules={[{ required: true, message: '请选择首次执行时间' }]}
label="统计维度"
name="StatisticCycle"
rules={[{ required: true, message: '请选择预测维度' }]}
>
<RangePicker locale={locale}
style={{ width: '100%' }} />
<Select>
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="统计维度值"
name="StatisticCycleValue"
rules={[{ required: true, message: '请选择维度类别' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="预测间隔"
......@@ -372,7 +392,7 @@ const AddModal = props => {
label="最小值"
name={'min' + index}
>
<Input placeholder="请输入最小值" style={{width:'98%'}} onChange={(value) => inputMin(value, index)} index={index} allowClear />
<Input placeholder="请输入最小值" style={{ width: '98%' }} onChange={(value) => inputMin(value, index)} index={index} allowClear />
</Item>
</Col>
<Col span={12}>
......@@ -380,7 +400,7 @@ const AddModal = props => {
label="最大值"
name={'max' + index}
>
<Input style={{ width: '98%' ,marginLeft:'0.4rem'}} placeholder="请输入最大值" onChange={(value) => inputMax(value, index)} index={index} allowClear />
<Input style={{ width: '98%', marginLeft: '0.4rem' }} placeholder="请输入最大值" onChange={(value) => inputMax(value, index)} index={index} allowClear />
</Item>
</Col>
</Row>
......
......@@ -51,18 +51,6 @@ const VectorData = props => {
</Space>
)
},
{
title: '首次执行时间',
dataIndex: 'DateFrom',
key: 'DateFrom',
align: 'center'
},
{
title: '首次计算时间',
dataIndex: 'PredictDateFrom',
key: 'PredictDateFrom',
align: 'center'
},
{
title: '描述',
dataIndex: 'Remarks',
......
import React, { useState, useEffect } from 'react'
import {CM_Table_ReloadFields} from '@/services/platform/bs'
const FieldEdit = () => {
return (
<div>
</div>
)
}
export default FieldEdit
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import {
SetServiceConfig, GetAllConfig
} from '@/services/webConfig/api';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, listData } = props;
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
SetServiceConfig({
schemename: obj.schemename,
terminalType: type === 'add' ? 'web' : 'phone',
isBaseMap: 'false',
jsonCfg: type === 'add' ? JSON.stringify({ type: 'dynamic' }) : JSON.stringify({ isDefault: false })
})
.then(res => {
setLoading(false);
if (res.msg === "Ok") {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
}
})
.catch(err => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
}
});
};
const onFinish = value => { };
useEffect(() => {
if(type!=''){
form.setFieldsValue({ schemename: listData[0] });
}
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
},
};
const handleChange = (value) => {
form.setFieldsValue({ schemename: 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="方案名"
name="schemename"
rules={[{ required: true, message: '请选择服务名' }]}
>
<Select onChange={handleChange}>
{listData.map((item, index) => { return <Option value={item} key={index}>{item}</Option> }) }
</Select>
</Item>
</Form>
)}
</Modal>
);
};
export default AddModal;
......@@ -7,20 +7,23 @@ import {
Input,
Button,
Select,
Popconfirm,
message
Popconfirm
} from 'antd';
import { PlusCircleOutlined } from '@ant-design/icons';
import PageContainer from '@/components/BasePageContainer';
import { CM_Table_LoadTable } from '@/services/platform/bs'
import styles from './index.less'
import AddModal from './components/Field/index'
const { Search } = Input;
const { Option } = Select;
const placeholder = "请输入表名"
const TableManager = () => {
const [visible, setVisible] = useState(false); // 弹窗
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({});
const [flag, setFlag] = useState(0); // 弹窗类型
const columns = [
{
......@@ -98,8 +101,6 @@ const TableManager = () => {
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
width: 250,
ellipsis: true,
render: (text, record) => (
......@@ -143,14 +144,18 @@ const TableManager = () => {
];
const [tableData, setTableData] = useState([])
useEffect(() => {
useEffect((record) => {
loadTable()
}, [])
//修改表名
const changeDesc = () => {
}
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
};
const AddTable = () => {
}
......@@ -195,10 +200,18 @@ const TableManager = () => {
dataSource={tableData}
pagination={{pageSize:20}}
scroll={{ y: 700 }}
size="small"
size="small"
rowKey={(record, index) => `complete${record.tableID}${index}`}
/>
</div>
</div>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
/>
</PageContainer>
)
......
......@@ -163,7 +163,7 @@ export const GetMaplayerByTerminalType = query =>
// 获取全部
export const GettMaplayer = query =>
get(`${PUBLISH_SERVICE}/Maplayer/GetMaplayer`, query);
get(`${PUBLISH_SERVICE}/Maplayer/GettMaplayer`, 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