Commit 51c90761 authored by 皮倩雯's avatar 皮倩雯

fix: '元数据'

parent 59262a79
Pipeline #61152 passed with stages
...@@ -19,8 +19,11 @@ export default props => { ...@@ -19,8 +19,11 @@ export default props => {
const [epKeys, setEpKeys] = useState([expandedKeys]); const [epKeys, setEpKeys] = useState([expandedKeys]);
useEffect(() => { useEffect(() => {
console.log(expandedKeys); console.log(expandedKeys);
console.log(selectedKeys); if (!expandedKeys || expandedKeys == null) {
setEpKeys(['0-0']);
} else {
setEpKeys([expandedKeys]); setEpKeys([expandedKeys]);
}
}, [expandedKeys]); }, [expandedKeys]);
const handleExpand = (keys, { expanded, node }) => { const handleExpand = (keys, { expanded, node }) => {
......
...@@ -992,12 +992,19 @@ const AddModal = props => { ...@@ -992,12 +992,19 @@ const AddModal = props => {
arr.push(item.fieldName); arr.push(item.fieldName);
}); });
} }
console.log(tempObj)
if(aa.length>0){ if(aa.length>0){
tempObj.内置字段 = [...aa]; tempObj.内置字段 = [...aa];
} }
console.log(tempObj); let list ={}
return tempObj; Object.keys(tempObj).forEach(i=>{
console.log(i)
if(tempObj[i].length>0){
console.log(tempObj[i])
list[i]=[...tempObj[i]]
}
})
console.log(list)
return list;
}; };
const groupArr = (initialArr, name) => { const groupArr = (initialArr, name) => {
......
...@@ -186,6 +186,26 @@ ...@@ -186,6 +186,26 @@
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
} }
} }
.titleText {
width: 700px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.title1 {
display: flex;
align-items: center;
width: 100%;
}
// .solutionConfig { // .solutionConfig {
// height: calc(100% - 30px); // height: calc(100% - 30px);
// } // }
.treeHeight{
.ant-tree-list-holder {
overflow: auto;
height: 638px !important;
}
}
.clickRowStyle {
background: #cfe7fd;
}
import React, { useEffect, useState, useRef } from 'react';
import { Spin, notification, Table, Modal, Tooltip } from 'antd';
import { ApartmentOutlined, PartitionOutlined } from '@ant-design/icons';
import Tree from '@/components/ExpendableTree';
import { GetLayerList, GetMetaDataPreview, GetLayerMetaDataPreview } from '@/services/gis/gis';
import { set } from 'lodash';
import styles from '../SchemeConfig.less';
const MeteDataModal = props => {
const { metaData, visible, onCancel } = props;
const [currentMeta, setCurrentMeta] = useState([]);
const [metedataList, setMetedataList] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const [loading, setLoading] = useState(false);
const [expendKey, setExpendKey] = useState(''); // 保存默认展开项
const [recored, setRecored] = useState('');
const setRowClassName = e => (e.layerID === recored.layerID ? styles.clickRowStyle : '');
useEffect(() => {
if (visible) {
getMeteData();
} else {
setMetedataList([]);
setCurrentMeta([]);
}
}, [visible]);
const getMeteData = () => {
GetLayerList({ serviceName: metaData.GISServerProjectName }).then(res => {
if (res.success) {
getTree();
setMetedataList(res.root);
setRecored(res.root[0]);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message,
});
}
});
};
const getTree = () => {
setLoading(true);
GetMetaDataPreview({ serviceName: metaData.GISServerProjectName }).then(res => {
console.log(res);
setExpendKey('0-0');
setLoading(false);
setCurrentMeta(res);
});
};
const columns = [
{
title: '图层',
dataIndex: 'layerName',
width: 150,
key: 'layerName',
},
];
// 渲染机构树
const mapTree = org => {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
return {
title: (
<div className={styles.title1}>
<span className={styles.titleText}>
{org.children.length == 0 ? (
<span />
) : (
<PartitionOutlined style={{ fontSize: '14px', color: '#1890FF' }} />
)}
<span style={{ marginLeft: '5px' }}>
<Tooltip
placement="left"
title={org.text}
overlayStyle={{
maxWidth: 800,
maxHeight: 900,
overflowY: 'scroll',
overflowX: 'hidden',
}}
>
{org.text}
</Tooltip>
</span>
</span>
</div>
),
key: org.id,
// 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
children: haveChildren ? org.children.map(i => mapTree(i)) : [],
};
};
const onSelect = e => {
console.log(e);
setRecored(e);
setLoading(true);
if (e.layerID != null) {
GetLayerMetaDataPreview({
serviceName: metaData.GISServerProjectName,
layerID: e.layerID,
}).then(res => {
setLoading(false);
setCurrentMeta(res);
});
} else {
getTree();
}
};
const onSubmit = () => {};
return (
<Modal
visible={visible}
title={metaData ? `${metaData.ServiceName}的元数据` : '元数据'}
bodyStyle={{ width: '100%', height: '650px' }}
style={{ top: 50, borderRadius: '20px' }}
width="1050px"
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
>
<div className={styles.treeHeight}>
<Spin spinning={isLoading}>
<div style={{ width: '1000px', height: '640px', display: 'flex' }}>
<div style={{ width: '300px' }}>
<Table
onRow={record => ({
onClick: e => {
onSelect(record);
}, // 点击行
})}
bordered
rowClassName={setRowClassName}
pagination={false}
style={{ width: '300px' }}
columns={columns}
dataSource={metedataList}
size="small"
scroll={{
y: '600px',
}}
/>
</div>
<Spin spinning={loading}>
<div
style={{
display: 'inline-block',
border: '1px solid #f0f0f0',
width: '700px',
}}
>
<Tree
showIcon="true"
blockNode
defaultExpandAll
autoExpandParent
treeData={currentMeta.map(t => mapTree(t))}
// selectedKeys={[menuID]}
expandedKeys={currentMeta[0] && currentMeta[0].id}
/>
</div>
</Spin>
</div>
</Spin>
</div>
</Modal>
);
};
export default MeteDataModal;
...@@ -9,11 +9,13 @@ import { ...@@ -9,11 +9,13 @@ import {
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import AddModal from './AddModal'; import AddModal from './AddModal';
import PreviewModal from './VectorPreviewModal'; import PreviewModal from './VectorPreviewModal';
import MeteDataModal from './MeteDataModal';
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据 const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗 const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗
const [meteDataVisible, setMeteDataVisible] = useState(false); // 预览弹窗
const [flag, setFlag] = useState(0); // 更新list const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态 const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
...@@ -47,8 +49,8 @@ const VectorData = props => { ...@@ -47,8 +49,8 @@ const VectorData = props => {
}, },
{ {
title: '发布时间', title: '发布时间',
dataIndex: 'publishTime', dataIndex: 'PublishTime',
key: 'publishTime', key: 'PublishTime',
align: 'center', align: 'center',
}, },
{ {
...@@ -56,6 +58,9 @@ const VectorData = props => { ...@@ -56,6 +58,9 @@ const VectorData = props => {
align: 'center', align: 'center',
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<Button type="primary" size="small" onClick={() => metadata(record)}>
元数据
</Button>
<Button type="primary" size="small" onClick={() => previewMetaData(record, index)}> <Button type="primary" size="small" onClick={() => previewMetaData(record, index)}>
预览 预览
</Button> </Button>
...@@ -132,6 +137,11 @@ const VectorData = props => { ...@@ -132,6 +137,11 @@ const VectorData = props => {
setPreviewVisible(true); setPreviewVisible(true);
}; };
const metadata = record => {
setCurrentMetaData(record);
setMeteDataVisible(true);
};
const solutionName = () => { const solutionName = () => {
getSolutionList({ getSolutionList({
_version: 9999, _version: 9999,
...@@ -236,6 +246,11 @@ const VectorData = props => { ...@@ -236,6 +246,11 @@ const VectorData = props => {
onCancel={() => setPreviewVisible(false)} onCancel={() => setPreviewVisible(false)}
metaData={currentMetaData} metaData={currentMetaData}
/> />
<MeteDataModal
visible={meteDataVisible}
onCancel={() => setMeteDataVisible(false)}
metaData={currentMetaData}
/>
</Spin> </Spin>
</div> </div>
</> </>
......
...@@ -22,7 +22,7 @@ const VectorPreviewModal = props => { ...@@ -22,7 +22,7 @@ const VectorPreviewModal = props => {
useEffect(() => { useEffect(() => {
if (document.getElementById('map-container')) { if (document.getElementById('map-container')) {
if (!mapID.current) { if (!mapID.current) {
//1.加载底图 // 1.加载底图
let m = new window.AMap.Map('map-container'); let m = new window.AMap.Map('map-container');
mapID.current = m; mapID.current = m;
} }
...@@ -55,7 +55,7 @@ const VectorPreviewModal = props => { ...@@ -55,7 +55,7 @@ const VectorPreviewModal = props => {
metaData.GISServerProjectName metaData.GISServerProjectName
}/GeoServerProxy/wms`, }/GeoServerProxy/wms`,
blend: false, blend: false,
params: params, params,
zooms: [2, 20], zooms: [2, 20],
}; };
let wms = new window.AMap.TileLayer.WMS(wmsOption); let wms = new window.AMap.TileLayer.WMS(wmsOption);
...@@ -109,7 +109,7 @@ const VectorPreviewModal = props => { ...@@ -109,7 +109,7 @@ const VectorPreviewModal = props => {
backgroundColor: 'white', backgroundColor: 'white',
}} }}
> >
<ReactJson src={currentMeta} /> {/* <ReactJson src={currentMeta} /> */}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -28,6 +28,8 @@ import { ...@@ -28,6 +28,8 @@ import {
EditOutlined, EditOutlined,
DeleteOutlined, DeleteOutlined,
UserAddOutlined, UserAddOutlined,
WindowsOutlined,
IeOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { import {
setMenuToRole, setMenuToRole,
...@@ -246,6 +248,8 @@ const SiteManage = () => { ...@@ -246,6 +248,8 @@ const SiteManage = () => {
if (item.type === 'mobile') { if (item.type === 'mobile') {
item.icon = <MobileOutlined />; item.icon = <MobileOutlined />;
// newArr[0] = item; // newArr[0] = item;
} else if (item.visibleValue == 'CS') {
item.icon = <WindowsOutlined />;
} else { } else {
item.icon = <DesktopOutlined />; item.icon = <DesktopOutlined />;
} }
......
...@@ -8,3 +8,13 @@ export const GetMetaData = param => get(`${PANDA_GIS}/${param.mapServerName}`); ...@@ -8,3 +8,13 @@ export const GetMetaData = param => get(`${PANDA_GIS}/${param.mapServerName}`);
export const GetMetaDataNew = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`); export const GetMetaDataNew = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`);
// 获取mapsetting配置 // 获取mapsetting配置
export const GetWebSiteConfig = param => get(`${PANDA_GIS}/MapLayer/LayerSetting`, param); export const GetWebSiteConfig = param => get(`${PANDA_GIS}/MapLayer/LayerSetting`, param);
// 获取图层列表
export const GetLayerList = param => get(`${PANDA_GIS}/MetaData/D_GetLayerList`, param);
// 查看元数据
export const GetMetaDataPreview = param => get(`${PANDA_GIS}/MetaData/D_GetMetaDataPreview`, param);
// 查看图层元数据
export const GetLayerMetaDataPreview = param =>
get(`${PANDA_GIS}/MetaData/D_GetLayerMetaDataPreview`, param);
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