Commit 34bed1e7 authored by shaoan123's avatar shaoan123

对接三维矢量数据界面接口

parent 4e3f7147
Pipeline #30909 skipped with stages
......@@ -287,7 +287,7 @@ const AddModal = props => {
<div>
<div className={styles.predict}></div>
<Input style={{ width: '67.2%' }} placeholder="请输入预测间隔" value={CycleValue} onChange={(value) => selectCycleValue(value)} allowClear />
<Select style={{marginLeft:'2rem', width: '28%' }} onChange={handleIntervalType} value={intervalType}>
<Select style={{marginLeft:'1.5rem', width: '28.5%' }} onChange={handleIntervalType} value={intervalType}>
{timeType.length ? timeType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</div>
......@@ -299,7 +299,7 @@ const AddModal = props => {
style={{ marginLeft: '0.8rem' }}
rules={[{ required: true, message: '请选择预测维度' }]}
>
<Select onChange={selectPredictType} style={{ width: '8.8rem' }}>
<Select onChange={selectPredictType} style={{ width: '6rem' }}>
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
......@@ -309,7 +309,7 @@ const AddModal = props => {
style={{ marginLeft: '0.8rem' }}
rules={[{ required: true, message: '请选择维度类别' }]}
>
<Select style={{ width: '8.8rem' }}>
<Select style={{ width: '6rem' }}>
{commonType.length ? commonType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item> : ''}
......@@ -319,7 +319,7 @@ const AddModal = props => {
name="PredictCycleValue"
rules={[{ required: true, message: '请输入预测维度值' }]}
>
<Input placeholder="请输入预测维度值" style={{ width: '12rem' }} allowClear />
<Input placeholder="请输入预测维度值" style={{ width: '9.4rem' }} allowClear />
</Item>
</Row>
<Row gutter='24' >
......@@ -329,7 +329,7 @@ const AddModal = props => {
name="StatisticCycle"
rules={[{ required: true, message: '请选择预测维度' }]}
>
<Select style={{ width: '23.5rem' }}>
<Select style={{ width: '16rem' }}>
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
......
......@@ -348,7 +348,7 @@ const AddModal = props => {
>
<div>
<div className={styles.predict}></div>
<Input style={{ width: '65%' }} placeholder="请输入偏移量" value={dateArr.DeviationValue} onChange={changeDeviationValue} allowClear />
<Input style={{ width: '64%' }} placeholder="请输入偏移量" value={dateArr.DeviationValue} onChange={changeDeviationValue} allowClear />
<Select style={{ marginLeft: '2rem', width: '28%' }} onChange={changeDeviationType} value={dateArr.DeviationType}>
<Select.Option value='秒'></Select.Option>
<Select.Option value='分'></Select.Option>
......@@ -364,7 +364,7 @@ const AddModal = props => {
>
<div>
<div className={styles.predict}></div>
<Input style={{ width: '65%' }} placeholder="请输入时段时长" value={dateArr.DurationValue} onChange={changeDurationValue} allowClear />
<Input style={{ width: '64%' }} placeholder="请输入时段时长" value={dateArr.DurationValue} onChange={changeDurationValue} allowClear />
<Select style={{ marginLeft: '2rem', width: '28%' }} onChange={changeDurationType} value={dateArr.DurationType}>
<Select.Option value='秒'></Select.Option>
<Select.Option value='分'></Select.Option>
......
......@@ -3,21 +3,22 @@ import { Form, Modal, Input, Select, AutoComplete, Button, notification, message
import styles from '../dimensionsConfig.less'
import {
GetGISServerMapList,
AddVectorData,
publisService, GetProjectNames
} from '@/services/webConfig/api';
import {
PlusCircleOutlined,CloseCircleOutlined
PlusCircleOutlined, CloseCircleOutlined
} from '@ant-design/icons';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, solutionNames } = props;
const { callBackSubmit = () => { }, type, formObj, visible } = props;
const [loading, setLoading] = useState(false);
const [attributes, setAttributes] = useState([{ key: '', value: '' }])
const [attributes, setAttributes] = useState([])
const [workList, setWorkList] = useState([]);
const [allData, setAllData] = useState([]);
const [gsIp, setGsIp] = useState([]);
const [ports,setPorts]= useState('');
const [projectNmme, setProjectNmme] = useState([]);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -27,22 +28,26 @@ const AddModal = props => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
let attributesObj = {}
attributes.map((item, index) => {
let key = obj[`key${index}`]
attributesObj[`${key}`] = obj[`value${index}`]
})
if (type === 'add') {
let url =allData[obj.name].fileName?`http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}/${allData[obj.name].fileName}`:`http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}`
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,
type: obj.type,
projectName: obj.projectName,
name: obj.name,
url,
attributes: attributesObj ||{},
ip: obj.ip,
port: obj.port
}
publisService(query, { timeout: 120000 })
AddVectorData(query)
.then(res => {
setLoading(false);
if (res.success) {
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -50,8 +55,7 @@ const AddModal = props => {
duration: 3,
description: '新增成功',
});
setWorkList([])
handlelocalStorage('add', obj.serviceadress, obj.servicename)
handlelocalStorage('add', obj.ip, obj.projectName)
} else {
notification.error({
message: '提示',
......@@ -88,9 +92,13 @@ const AddModal = props => {
}));
}
setGsIp(gsIp)
let localIps = ['192.168.12.7', '192.168.19.100']
let port = localIps.includes(gsIp) ? 8080 : 8088
form.setFieldsValue({ ...formObj, ip: '192.168.12.97' });
setAttributes([])
setProjectNmme([])
setWorkList([])
setPorts('')
let localIps = ['192.168.12.97']
let port = localIps.includes(gsIp) ? '8083' : '8088'
form.resetFields();
break;
case 'edit':
form.setFieldsValue({ ...formObj });
......@@ -140,9 +148,10 @@ const AddModal = props => {
};
const selectIp = (value) => {
let localIps = ['192.168.12.7', '192.168.19.100']
let port = localIps.includes(value) ? 8080 : 8088
let localIps = ['192.168.12.97']
let port = localIps.includes(value) ? '8083' : '8088'
form.setFieldsValue({ port, serviceadress: value });
setPorts(port)
}
// 获取项目名
......@@ -181,6 +190,8 @@ const AddModal = props => {
GetProjectNames({ ip: obj.ip, port: obj.port, projectname: value }).then(response => {
let newArr = JSON.parse(response.data)
let workArr = Object.keys(newArr.data)
console.log('newArr',newArr);
console.log('workArr',workArr);
setAllData(newArr.data)
if (workArr.length) {
setWorkList(workArr)
......@@ -193,7 +204,17 @@ const AddModal = props => {
form.setFieldsValue({ type: allData[value].type });
}
const addExtra = () => {
let attributesArr = [...attributes]
attributesArr.push({})
setAttributes(attributesArr)
}
const deleteExtr = (index) => {
let attributesArr = [...attributes]
attributesArr.splice(index, 1);
setAttributes(attributesArr)
}
const inputPort =(e)=>{
setPorts(e.target.value)
}
return (
<Modal
......@@ -231,7 +252,7 @@ const AddModal = props => {
rules={[{ required: true, message: '请输入端口' }]}
>
<div className={styles.imgList}>
<Input placeholder="请输入GIS服务器端口" allowClear />
<Input placeholder="请输入GIS服务器端口" allowClear value={ports} onChange={inputPort} />
<Button style={{ marginLeft: '0.5rem' }} onClick={getProject}>获取项目名</Button>
</div>
</Item>
......@@ -260,44 +281,35 @@ const AddModal = props => {
>
<Input placeholder="请输入数据类型" allowClear disabled />
</Item>
<Item
label="额外属性"
rules={[{ required: true, message: '请输入额外属性' }]}
>
<Card style={{ maxHeight: '8rem', overflowY: 'scroll', padding: '0.1rem' }}>
<Button size="small" onClick={() => { addExtra() }}>
新增额外属性
</Button>
<div style={{ maxHeight: '14rem', overflowY: 'scroll', marginTop: '0.2rem' }}>
{attributes.length ? attributes.map((item, index) => {
return <div className={styles.containerFileds}>
return <div key={index} className={styles.containerFileds}>
<Item
label="键"
name={`key${index}`}
style={{ width: '45%' }}
style={{ width: '45%', marginTop: '24px' }}
>
<Input placeholder="" allowClear />
</Item>
<Item
label="值"
name={`value${index}`}
style={{ width: '45%' }}
style={{ width: '45%', marginTop: '24px' }}
>
<Input placeholder="" allowClear />
</Item>
<CloseCircleOutlined
onClick={() => { deleteExtr(index) }}
style={{
fontSize: '16px', color: 'red',
cursor: 'pointer',
lineHeight: '1.5rem'
cursor: 'pointer'
}} />
</div>
}) : ''}
<PlusCircleOutlined style={{
fontSize: '16px', color: '#1890FF', position: 'absolute',
right: '0',
top: '0.2rem',
cursor: 'pointer'
}}
onClick={addExtra} />
</Card>
</Item>
</div>
</Form>
)}
</Modal>
......
......@@ -2,7 +2,7 @@ import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../dimensionsConfig.less'
import {
GetVectorDataList, deleteVectorService, getSolutionList, updatePublishedMetaData
GetVectorDataList,DeleteVectorData
} from '@/services/webConfig/api';
import AddModal from './AddModal'
// import PreviewModal from './VectorPreviewModal'
......@@ -10,42 +10,45 @@ 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',
title: '项目名',
dataIndex: 'projectName',
key: 'projectName',
align: 'center'
},
{
title: 'IP',
dataIndex: 'GISServerIP',
key: 'GISServerIP',
dataIndex: 'ip',
key: 'ip',
align: 'center'
},
{
title: '端口',
dataIndex: 'GISServerPort',
key: 'GISServerPort',
dataIndex: 'port',
key: 'port',
align: 'center'
},
{
title: '工程名',
dataIndex: 'GISServerProjectName',
key: 'GISServerProjectName',
title: '数据源名',
dataIndex: 'name',
key: 'name',
align: 'center'
},
{
title: '类型',
dataIndex: 'type',
key: 'type',
align: 'center'
},
{
title: '发布时间',
dataIndex: 'publishTime',
key: 'publishTime',
dataIndex: 'publishDatetime',
key: 'publishDatetime',
align: 'center'
},
{
......@@ -54,9 +57,9 @@ const VectorData = props => {
render: (text, record, index) => (
<Space>
<Button type="primary" size="small" loading={loading[index]} onClick={() => enterLoading(record, index)}>
{/* <Button type="primary" size="small" loading={loading[index]} onClick={() => enterLoading(record, index)}>
更新
</Button>
</Button> */}
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该矢量数据?"
......@@ -78,70 +81,55 @@ const VectorData = props => {
];
//更新
const enterLoading = (record, index) => {
const newLoadings = [...loading];
newLoadings[index] = true
setLoading(newLoadings)
let query = {
serviceName: record.ServiceName,
_version: 9999,
solution: solutionNames
}
// const newLoadings = [...loading];
// newLoadings[index] = true
// setLoading(newLoadings)
// let query = {
// serviceName: record.ServiceName,
// _version: 9999,
// solution: solutionNames
// }
updatePublishedMetaData(query).then(res => {
const newLoadings = [...loading];
newLoadings[index] = false
setLoading(newLoadings)
if (res.success) {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '更新元数据成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: '更新元数据失败',
});
};
}).catch(err => {
const newLoadings = [...loading];
newLoadings[index] = false
setLoading(newLoadings)
notification.error({
message: '提示',
duration: 3,
description: '服务无法访问',
});
})
// updatePublishedMetaData(query).then(res => {
// const newLoadings = [...loading];
// newLoadings[index] = false
// setLoading(newLoadings)
// if (res.success) {
// setFlag(flag + 1)
// notification.success({
// message: '提示',
// duration: 3,
// description: '更新元数据成功',
// });
// } else {
// notification.error({
// message: '提示',
// duration: 3,
// description: '更新元数据失败',
// });
// };
// }).catch(err => {
// const newLoadings = [...loading];
// newLoadings[index] = false
// setLoading(newLoadings)
// notification.error({
// message: '提示',
// duration: 3,
// description: '服务无法访问',
// });
// })
}
// const previewMetaData = (record) => {
// setCurrentMetaData(record)
// setPreviewVisible(true)
// }
const solutionName = () => {
getSolutionList({
_version: 9999
}).then(res => {
setSolutionNames(res.currentSolution)
})
}
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
};
const delConfirm = (record) => {
console.log(' record.ServiceName', record.ServiceName.split("."));
let query = {
serviceName: record.ServiceName.split(".")[0],
_version: 9999,
solution: solutionNames
}
deleteVectorService(query).then(res => {
if (res.success) {
DeleteVectorData(record.id).then(res => {
if (res.msg==='') {
setFlag(flag + 1)
notification.success({
message: '提示',
......@@ -167,7 +155,6 @@ const VectorData = props => {
// 获取瓦片数据配置数据
const renderTile = () => {
setTreeLoading(true);
solutionName();
GetVectorDataList().then(
res => {
if (res.msg === 'Ok') {
......@@ -205,7 +192,7 @@ const VectorData = props => {
columns={columns}
dataSource={tileData}
bordered
rowKey="CreateTime"
rowKey='id'
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) =>
......@@ -220,7 +207,6 @@ const VectorData = props => {
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
solutionNames={solutionNames}
/>
</Spin>
......
......@@ -14,8 +14,8 @@
background-color: #ffffff;
color: #000000;
}
.ant-card-body{
padding: 1.5rem 0.2rem 0 0.2rem;
.ant-card-body {
padding: 12px 24px 24px 25px;
}
}
.imgList{
......@@ -113,5 +113,6 @@
display: flex;
justify-content: space-between;
width: 98%;
border:1px solid #f0f0f0;
margin-top: 1rem;
}
\ No newline at end of file
......@@ -14,6 +14,9 @@
background-color: #ffffff;
color: #000000;
}
.ant-card-body {
padding: 12px 24px 24px 25px;
}
}
.imgList{
display: flex;
......
......@@ -132,7 +132,7 @@ const AddModal = props => {
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 5,
},
wrapperCol: {
span: 16,
......@@ -155,7 +155,7 @@ const AddModal = props => {
_version: 9999,
}
GetGISServerMapList(query).then(res => {
console.log('res',res);
if (Array.isArray(res.data)) {
const defaultValue= res.data[0]||''
form.setFieldsValue({ name:defaultValue,workname:defaultValue});
......
......@@ -239,13 +239,29 @@ export const GetVectorDataList = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/GetVectorDataList`, query);
//删除矢量数据
export const DeleteVectorData = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/DeleteVectorData`, query);
export const DeleteVectorData = (id) =>
post(`${PUBLISH_SERVICE}/Maplayer/DeleteVectorData?id=${id}`);
//添加矢量数据配置服务
export const AddVectorData = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/AddVectorData`, query);
export const AddVectorData = (data) =>
post(`${PUBLISH_SERVICE}/Maplayer/AddVectorData`, data);
//根据IP地址和端口号获取
export const GetProjectNames = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/GetProjectNames`, query);
//查询方案列表
export const GetSchemaInfoList = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/GetSchemaInfoList`, query);
//增加方案
export const AddSchema = (data) =>
post(`${PUBLISH_SERVICE}/Maplayer/AddSchema`, data);
//删除方案
export const DeleteSchema = (query) =>
get(`${PUBLISH_SERVICE}/Maplayer/DeleteSchema`, query);
//编辑方案
export const EditSchema = (data) =>
post(`${PUBLISH_SERVICE}/Maplayer/EditSchema`, data);
\ No newline at end of file
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