Commit 1e35bbac authored by 邓超's avatar 邓超

fix: 更新gis接口,添加主站配置,修改路由可以外部访问

parent 41eb0505
Pipeline #50877 passed with stages
......@@ -22,42 +22,45 @@ module.exports = require('./webpack.base.babel')({
optimization: {
minimize: true,
// minimizer: [
// new TerserPlugin({
// terserOptions: {
// warnings: false,
// compress: {
// comparisons: false,
// },
// parse: {},
// mangle: true,
// output: {
// comments: false,
// ascii_only: true,
// },
// },
// parallel: true,
// cache: true,
// sourceMap: true,
// }),
// ],
minimizer: [
new TerserPlugin({
terserOptions: {
warnings: false,
compress: {
comparisons: false,
drop_console: true,
drop_debugger: true,
pure_funcs: ['console.log'], //移除console
},
parse: {},
mangle: true,
output: {
comments: false,
ascii_only: true,
},
},
parallel: true,
cache: true,
sourceMap: true,
}),
],
nodeEnv: 'production',
sideEffects: true,
concatenateModules: true,
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
// maxInitialRequests: 10,
// minSize: 0,
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name(module) {
// const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
// return `npm.${packageName.replace('@', '')}`;
// },
// },
// },
maxInitialRequests: 10,
minSize: 0,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
return `npm.${packageName.replace('@', '')}`;
},
},
},
},
},
......
......@@ -90,9 +90,9 @@
"@babel/preset-typescript": "^7.12.1",
"@babel/runtime": "^7.10.5",
"@wisdom-cesium/cesium": "^1.0.78",
"@wisdom-map/Amap": "^1.0.49-21",
"@wisdom-map/Map": "^1.0.12-34",
"@wisdom-map/arcgismap": "^1.0.79-34",
"@wisdom-map/amap": "^1.0.49--27.2",
"@wisdom-map/basemap": "^1.0.12-43",
"@wisdom-map/arcgismap": "^1.0.79-43",
"@esri/arcgis-html-sanitizer": "^2.9.0",
"@esri/calcite-colors": "6.0.3",
"ace-builds": "^1.4.12",
......@@ -254,7 +254,7 @@
"stylelint-config-styled-components": "0.1.1",
"stylelint-processor-styled-components": "1.6.0",
"svg-url-loader": "2.3.2",
"terser-webpack-plugin": "1.2.3",
"terser-webpack-plugin": "4.2.3",
"url-loader": "1.1.2",
"webpack": "5.70.0",
"webpack-cli": "4.2.0",
......
......@@ -31,9 +31,7 @@ const logger = {
${chalk.bold('Access URLs:')}${divider}
Localhost: ${chalk.magenta(`http://${host}:${port}`)}
LAN: ${chalk.magenta(`http://${ip.address()}:${port}`) +
(tunnelStarted
? `\n Proxy: ${chalk.magenta(tunnelStarted)}`
: '')}${divider}
(tunnelStarted ? `\n Proxy: ${chalk.magenta(tunnelStarted)}` : '')}${divider}
${chalk.blue(`Press ${chalk.italic('CTRL-C')} to stop`)}
`);
},
......
......@@ -11,9 +11,7 @@ module.exports = function addProdMiddlewares(app, options) {
// and other good practices on official Express.js docs http://mxs.is/googmy
app.use(compression());
app.use(publicPath, express.static(outputPath));
addProxyMiddleware(app)
addProxyMiddleware(app);
app.get('*', (req, res) =>
res.sendFile(path.resolve(outputPath, 'index.html')),
);
app.get('*', (req, res) => res.sendFile(path.resolve(outputPath, 'index.html')));
};
......@@ -9,9 +9,7 @@ const setupProxyFeature = (app, webpackConfig) => {
webpackConfig.proxy = Object.keys(webpackConfig.proxy).map(context => {
let proxyOptions;
// For backwards compatibility reasons.
const correctedContext = context
.replace(/^\*$/, '**')
.replace(/\/\*$/, '');
const correctedContext = context.replace(/^\*$/, '**').replace(/\/\*$/, '');
if (typeof webpackConfig.proxy[context] === 'string') {
proxyOptions = {
......@@ -60,9 +58,7 @@ const setupProxyFeature = (app, webpackConfig) => {
let proxyMiddleware;
let proxyConfig =
typeof proxyConfigOrCallback === 'function'
? proxyConfigOrCallback()
: proxyConfigOrCallback;
typeof proxyConfigOrCallback === 'function' ? proxyConfigOrCallback() : proxyConfigOrCallback;
proxyMiddleware = getProxyMiddleware(proxyConfig);
......@@ -85,9 +81,7 @@ const setupProxyFeature = (app, webpackConfig) => {
// - In case the bypass function is defined we'll retrieve the
// bypassUrl from it otherwise bypassUrl would be null
const isByPassFuncDefined = typeof proxyConfig.bypass === 'function';
const bypassUrl = isByPassFuncDefined
? proxyConfig.bypass(req, res, proxyConfig)
: null;
const bypassUrl = isByPassFuncDefined ? proxyConfig.bypass(req, res, proxyConfig) : null;
if (typeof bypassUrl === 'boolean') {
// skip the proxy
......
......@@ -25,12 +25,12 @@ const store = configureStore(initialState, history);
const MOUNT_NODE = document.getElementById('app');
const render = () => {
ReactDOM.render(
<Provider store = { store }>
<ConnectedRouter history = { history }>
<ConfigProvider locale = { zhCN } >
{ /* <PictureWallProvider> */ }
<App routesConfig = { config }/>
{ /* </PictureWallProvider> */ }
<Provider store={store}>
<ConnectedRouter history={history}>
<ConfigProvider locale={zhCN}>
{/* <PictureWallProvider> */}
<App routesConfig={config} />
{/* </PictureWallProvider> */}
</ConfigProvider>
</ConnectedRouter>
</Provider>,
......
......@@ -39,9 +39,7 @@ export default appConnector(function App(props) {
}
authority={[AUTHORITY.LOGIN]}
>
<PictureWallProvider>
<Switch>{renderRoutes(routesConfig.routes)}</Switch>
</PictureWallProvider>
<PictureWallProvider>{renderRoutes(routesConfig.routes)}</PictureWallProvider>
</Authozed>
</Router>
</>
......
......@@ -41,9 +41,33 @@ const BasicLayout = props => {
})
.filter(Boolean);
const handleMenuCollapse = () => {}; // get children authority
// 获取url地址参数
const getQueryVariable = name => {
// 获取url上的参数(使用decodeURIComponent对url参数进行解码)
let search = decodeURIComponent(window.location.search).replace('?', '');
const tempArr = search !== '' ? search.split('&') : [];
// 将参数名转小写,参数值保留原大小写
tempArr.forEach(item => {
if (item) {
const itemArr = item.split('=');
search = search.replace(itemArr[0], itemArr[0].toLowerCase());
}
});
// 正则匹配指定的参数
const reg = new RegExp(`(^|&)${name.toLowerCase()}=([^&]*)(&|$)`);
const result = search.match(reg);
return result != null ? result[2] : '';
};
matchRoutes(props.route.routes, props.location.pathname);
return (
<>
{getQueryVariable('isSandbox') == 'true' ? (
<>{renderRoutes(props.route.routes)}</>
) : (
<ProLayout
logo={() => <img src={logo} style={{ width: '32px', height: '32px' }} alt="" />}
style={{ height: '100vh' }}
......@@ -81,6 +105,8 @@ const BasicLayout = props => {
>
{renderRoutes(props.route.routes)}
</ProLayout>
)}
</>
);
};
......
......@@ -27,8 +27,17 @@ const AddModal = props => {
if (modalType === 'edit') {
getFormData();
} else {
form.setFieldsValue({ FlowName: title, TimeLimitInt: 0, TimeUnit: '小时' });
form.setFieldsValue({
FlowName: title,
TimeLimit: 0,
TimeUnit: '小时',
TimeLimitField: '(未配置)',
TimeoutField: '(未配置)',
});
}
} else {
setTimeLimitFlowNodes([]);
setTimeLimitFlowNodesEnd([]);
}
}, [visible]);
// 获取到节点后存入当前选中对应的索引用于限制选择节点
......@@ -205,7 +214,7 @@ const AddModal = props => {
<Form.Item label="默认时限" style={{ marginBottom: 0 }} required>
<div style={{ display: 'flex' }}>
<Form.Item
name="TimeLimitInt"
name="TimeLimit"
style={{ marginRight: '18px', width: '100%' }}
rules={[
{ required: true, message: '请选填写时限' },
......
import React, { useState } from 'react';
import { Card, Tabs } from 'antd';
import React, { useState, useEffect } from 'react';
import { Card, Tabs, Form, Input, Button, notification } from 'antd';
import { CheckOutlined, CloseOutlined } from '@ant-design/icons';
import { SaveMainServer, GetMainServer, DeleteMainServer } from '@/services/database/api';
import PageContainer from '@/components/BasePageContainer';
import SQLServerTable from './sqlServer/SQLServerTable';
import OracleTable from './oracle/OracleTable';
......@@ -31,12 +33,61 @@ const dataArr = [
];
const Hr = () => <hr style={{ width: 'calc( 100% - 40px)' }} />;
const DatabaseConnectConfig = props => {
const [form] = Form.useForm();
const [flag, setFlag] = useState(false);
const [active, setActive] = useState('0');
const [isLink, setIsLink] = useState(false); //主站配置是否连接
useEffect(() => {
getData();
}, []);
const handleChange = e => {
setActive(e);
};
const getData = () => {
GetMainServer().then(res => {
if (res.code === 0) {
form.setFieldsValue({ url: res.data });
// if (res.data) {
// setIsLink(true);
// form.setFieldsValue({ url: res.data });
// } else {
// setIsLink(false);
// form.setFieldsValue({ url: window.location.origin });
// }
}
});
};
const deleteConfig = () => {
DeleteMainServer().then(res => {
if (res.code === 0) {
notification.success({ message: '提示', duration: 3, description: '删除成功' });
getData();
} else {
notification.error({ message: '提示', duration: 3, description: res.msg });
}
});
};
// 提交主站配置
const onFinish = values => {
console.log('Success:', values);
SaveMainServer(values).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '保存成功',
});
getData();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
return (
<PageContainer>
......@@ -56,6 +107,45 @@ const DatabaseConnectConfig = props => {
<MongDBTable />
<MySQLTable />
{/* 主站配置 */}
<div
style={{
fontWeight: 'bold',
fontSize: '16px',
marginLeft: '30x',
marginBottom: '10px',
}}
>
主站配置
</div>
<Form form={form} labelCol={{ span: 1 }} wrapperCol={{ span: 23 }} onFinish={onFinish}>
<Form.Item label="Url地址" required>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Form.Item
name="url"
rules={[
{ required: true, message: '请输入url地址' },
{ type: 'url', message: '请输入完整url' },
]}
style={{ marginBottom: '0', width: '100%' }}
>
<Input placeholder={`如:${window.location.origin}`} />
</Form.Item>
{/* {isLink ? (
<CheckOutlined style={{ margin: '12px 10px 0 10px' }} />
) : (
<CloseOutlined style={{ margin: '12px 10px 0 10px' }} />
)} */}
<Button type="primary" htmlType="submit" style={{ margin: '0 10px' }}>
提交
</Button>
<Button type="primary" onClick={deleteConfig}>
删除
</Button>
</div>
</Form.Item>
</Form>
</Card>
</PageContainer>
);
......
......@@ -34,7 +34,7 @@ const AddModal = props => {
gsUser: obj.user,
gsWorkspaceName: obj.workname,
gsPwd: obj.password,
serviceName: obj.name,
mapServerName: obj.name,
solution: solutionNames,
};
publisService(query, { timeout: 120000 })
......
......@@ -34,7 +34,7 @@ const VectorPreviewModal = props => {
map && map.remove(map.getLayers());
setIsLoading(true);
map &&
GetMetaData(metaData.GISServerProjectName).then(res2 => {
GetMetaData({ mapServerName: metaData.GISServerProjectName }).then(res2 => {
if (res2 && res2.units) {
setIsLoading(false);
setCurrentMeta(res2);
......@@ -51,7 +51,7 @@ const VectorPreviewModal = props => {
};
const wmsOption = {
tileSize: 512,
url: `${location.origin}/Cityinterface/rest/services/MapServer.svc/${
url: `${location.origin}/PandaGIS/MapServer/Export/${
metaData.GISServerProjectName
}/GeoServerProxy/wms`,
blend: false,
......
......@@ -147,7 +147,7 @@ const AddModal = props => {
const handleService = value => {
form.setFieldsValue({
label: value,
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`,
url: `http://{IP}/PandaGIS/MapServer/Export?mapServerName=${value}`,
});
};
......
......@@ -166,7 +166,7 @@ const VectorData = props => {
};
SetServiceConfig(query)
.then(res => {
if (res.code === 0) {
if (res.code == 0) {
prompt('success', '关联角色成功');
setFlag(flag + 1);
} else {
......@@ -219,7 +219,7 @@ const VectorData = props => {
if (!newLoadings[index]) {
setServiceType(query).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
if (res.code == 0) {
const changehandData = [...webData];
changehandData[index].type = 'dynamic';
console.log(changehandData);
......@@ -238,7 +238,7 @@ const VectorData = props => {
type: 'pipenet',
}).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
if (res.code == 0) {
const changehandData = [...webData];
changehandData[index].type = 'pipenet';
console.log(changehandData);
......@@ -249,7 +249,7 @@ const VectorData = props => {
type: 'dynamic',
}).then(resdata => {
setCheckLoading(false);
if (resdata.IsSuccess) {
if (resdata.code == 0) {
const changehandData1 = [...webData];
changehandData1[beforeDefault].type = 'dynamic';
console.log(changehandData1);
......@@ -280,7 +280,7 @@ const VectorData = props => {
if (!newLoadings[index]) {
setServiceType(query).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
if (res.code == 0) {
const changehandData = [...webData];
changehandData[index].type = 'dynamic';
// setWebData(changehandData);
......@@ -297,7 +297,7 @@ const VectorData = props => {
type: 'pipenet',
}).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
if (res.code == 0) {
const changehandData = [...webData];
changehandData[index].type = 'pipenet';
// setWebData(changehandData);
......@@ -307,7 +307,7 @@ const VectorData = props => {
type: 'dynamic',
}).then(resdata => {
setCheckLoading(false);
if (resdata.IsSuccess) {
if (resdata.code == 0) {
const changehandData1 = [...webData];
changehandData1[beforeDefault].type = 'dynamic';
// setWebData(changehandData1);
......@@ -379,7 +379,7 @@ const VectorData = props => {
}),
}).then(resdata => {
setCheckLoading(false);
if (resdata.code === 0) {
if (resdata.code == 0) {
const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false;
setHandData(changehandData1);
......@@ -446,7 +446,7 @@ const VectorData = props => {
}),
}).then(resdata => {
setCheckLoading(false);
if (resdata.code === 0) {
if (resdata.code == 0) {
const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false;
// setHandData(changehandData1);
......
......@@ -199,3 +199,11 @@ export const InitAddDataBase = params =>
// 二次初始化
export const InitEditDataBase = params =>
post(`${PUBLISH_SERVICE}/DBManager/InitEditDataBase`, params);
// 保存主站配置
export const SaveMainServer = params => get(`${PUBLISH_SERVICE}/DBManager/SaveMainServer`, params);
// 获取主站配置
export const GetMainServer = params => get(`${PUBLISH_SERVICE}/DBManager/GetMainServer`, params);
// 删除主站配置
export const DeleteMainServer = params =>
post(`${PUBLISH_SERVICE}/DBManager/DeleteMainServer`, params);
import { get, post, PUBLISH_SERVICE, CITY_SERVICE } from '@/services/index';
import { get, post, PUBLISH_SERVICE, CITY_SERVICE, PANDA_GIS } from '@/services/index';
// 1.获取全部地图方案配置
export const GetAllConfig = param => get(`${CITY_SERVICE}/OMS.svc/GetAllConfig`, param);
// 2.获取元数据
export const GetMetaData = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`);
export const GetMetaData = param => get(`${PANDA_GIS}/Export`, param);
// 3.获取元数据新
export const GetMetaDataNew = param => get(`${CITY_SERVICE}/MapServer.svc/${param}`);
......
/*
* @Description:
* @Author: leizhe
* @Date: 2021-12-23 17:51:09
* @LastEditTime: 2022-05-12 18:51:42
* @LastEditors: leizhe
*/
import { request } from '../utils/request';
const CITY_SERVICE = '/Cityinterface/rest/services';
......@@ -13,6 +6,7 @@ const PUBLISH_SERVICE = '/PandaOMS/OMS';
// export const PUBLISH_SERVICE = '/Publish/GateWay/OMS';
const WebSERVICE = '/Publish/Web';
const CoreSERVICE = '/PandaCore/GCK';
const PANDA_GIS = '/PandaGIS/MapServer';
const get = async (url, params, options = {}) =>
request({
url,
......@@ -35,4 +29,4 @@ const postForm = async (url, params = {}, options = {}) => {
return post(url, formData, options);
};
export { get, post, postForm, CITY_SERVICE, PUBLISH_SERVICE, WebSERVICE, CoreSERVICE };
export { get, post, postForm, CITY_SERVICE, PUBLISH_SERVICE, WebSERVICE, CoreSERVICE, PANDA_GIS };
import qs from 'qs';
import axios from 'axios';
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm, PANDA_GIS } from '../index';
/**
* 获取所有网站配置
......@@ -162,18 +162,18 @@ export const GetGISServerMapList = query =>
// 发布原数据
export const publisService = (query, timeout) =>
get(`${CITY_SERVICE}/OMS.svc/D_Publish_GS_Service`, query, timeout);
get(`${PANDA_GIS}/MetaData/D_Publish_GS_Service`, query, timeout);
// 解决方案名称
export const getSolutionList = query => get(`${CITY_SERVICE}/OMS.svc/W4_GetSolutionList`, query);
export const getSolutionList = query => get(`${PANDA_GIS}/MetaData/W5_GetSolutionList`, query);
// 删除元数据
export const deleteVectorService = query =>
get(`${CITY_SERVICE}/OMS.svc/D_DeleteVectorService`, query);
get(`${PANDA_GIS}/MetaData/D_DeleteVectorService`, query);
// 更新元数据
export const updatePublishedMetaData = query =>
get(`${CITY_SERVICE}/OMS.svc/D_UpdatePublishedMetaData`, query);
get(`${PANDA_GIS}/MetaData/D_UpdatePublishedMetaData`, query);
// 删除配置
export const deleteConfig = query => get(`${PUBLISH_SERVICE}/Maplayer/DeletMaplayer`, query);
......@@ -187,7 +187,7 @@ export const unbindSchemeBaseMap = query =>
get(`${PUBLISH_SERVICE}/Maplayer/UnBindSchemeBaseMap`, query);
// 设置web状态
export const setServiceType = query => get(`${CITY_SERVICE}/OMS.svc/SetServiceType`, query);
export const setServiceType = query => get(`${PANDA_GIS}/MetaData/SetServiceType`, query);
// 获取角色
export const getUserRelationList = query =>
......
import RenderAuthorize from '@/components/Authorized';
import RenderAuthorize from '@/components/Authorized/index.jsx';
import { isDev } from './tools.ts';
// const isDev = false;
let auth = [];
/* eslint-disable eslint-comments/disable-enable-pair */
/* eslint-disable import/no-mutable-exports */
// 获取url地址参数
const getQueryVariable = name => {
// 获取url上的参数(使用decodeURIComponent对url参数进行解码)
let search = decodeURIComponent(window.location.search).replace('?', '');
const tempArr = search !== '' ? search.split('&') : [];
// 将参数名转小写,参数值保留原大小写
tempArr.forEach(item => {
if (item) {
const itemArr = item.split('=');
search = search.replace(itemArr[0], itemArr[0].toLowerCase());
}
});
// 正则匹配指定的参数
const reg = new RegExp(`(^|&)${name.toLowerCase()}=([^&]*)(&|$)`);
const result = search.match(reg);
return result != null ? result[2] : '';
};
console.log(getAuthority(), 'getAuthority()');
let Authorized = RenderAuthorize(getAuthority());
// Reload the rights component
......@@ -22,7 +43,16 @@ export default Authorized;
// use localStorage to store the authority info, which might be sent from server in actual project.
export function getAuthority(str) {
if (!isDev) return [...auth];
const isSandBox = getQueryVariable('isSandbox');
if (!isDev) {
// return [...auth];
// 支持可以指直接访问
if (isSandBox == 'true') {
return ['LOGIN', 'admin'];
} else {
return [...auth];
}
}
const authorityString =
typeof str === 'undefined' && localStorage ? localStorage.getItem('panda-oms-authority') : str;
// authorityString could be admin, "admin", ["admin"]
......
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