Commit 6c9ce0a4 authored by 邓晓峰's avatar 邓晓峰

feat: 集成ARGGIS

parents fc08153e 2c95e174
......@@ -59,8 +59,8 @@ push:
- 'git clean -fd'
- 'git remote set-url origin "https://${GIT_ACCESS_USER}:${GIT_ACCESS_PASSWORD}@g.civnet.cn:8443/CivPublish/CivWebPublish2021.git"'
- 'git pull origin map'
- 'git rm -rf "${TARGET_REPO}/civbase"'
- 'git commit -m "chore: clear folder"'
#- 'git rm -rf "${TARGET_REPO}/civbase"'
#- 'git commit -m "chore: clear folder"'
#- 'git push origin map'
- 'robocopy "${CI_PROJECT_DIR}/../CivWebPublish2021/civbase" "${TARGET_REPO}/civbase" /S ;
IF ((${LASTEXITCODE} -le 8)) {cmd /c "exit /b 0"}'
......
const slash = require('slash2');
const proxy = require('./proxy');
const defaultSetting = require('./defaultSetting');
const { REACT_APP_ENV } = process.env;
const cesiumBuild = '../node_modules/cesium/Build/Cesium';
const pkgName = require('../package.json').name;
// eslint-disable-next-line import/order
const path = require('path');
const { REACT_APP_ENV } = process.env;
const pkgName = require('../package.json').name;
const path = require('path');
const CESIUM_BASE_URL = `/${pkgName}`;
module.exports = {
......@@ -33,7 +36,12 @@ module.exports = {
ignoreMomentLocale: true,
nodeModulesTransform: {
type: 'none',
exclude: ['@wisdom-map/arcgismap', 'swagger-ui-react'],
exclude: [
// '@wisdom-map/arcgismap',
// '@wisdom-map/arcgismap/lib/arcgisapi',
'swagger-ui-react',
'Cesium'
],
},
proxy: proxy[REACT_APP_ENV || 'dev'],
// openAPI: {
......@@ -105,5 +113,30 @@ module.exports = {
cesium: path.resolve(__dirname, cesiumBuild),
},
workerLoader: {},
copy: [
{
from: path.join(pkgName, cesiumBuild, './Workers'),
to: 'Workers',
},
{
from: path.join(pkgName, cesiumBuild, 'Assets'),
to: 'Assets',
},
{
from: path.join(pkgName, cesiumBuild, 'Widgets'),
to: 'Widgets',
},
{
from: path.join(pkgName, cesiumBuild, 'ThirdParty'),
to: 'ThirdParty',
},
],
define: {
CESIUM_BASE_URL: JSON.stringify(CESIUM_BASE_URL).replace(/\"/g, ''),
},
alias: {
cesium: path.resolve(__dirname, cesiumBuild),
},
// esbuild: {}
};
......@@ -16,10 +16,10 @@ export default {
// activeRule: '/civbase/civ_water',
// },
{
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`,
name: 'civ_configuration',
entry: `//${window.location.hostname}:8080/civ_configuration`,
container: '#micro-container',
activeRule: '/civbase/civ_pandawork',
activeRule: '/civbase/civ_configuration',
},
{
name: 'report',
......@@ -48,6 +48,12 @@ export default {
container: '#micro-container',
activeRule: '/civbase/middleground',
},
{
name: 'civ_3d',
entry: `//${window.location.hostname}:12000/civ_3d`,
container: '#micro-container',
activeRule: '/civbase/civ_3d',
},
],
prod: [
{
......
......@@ -20,25 +20,18 @@ module.exports = opts => {
const preset = {
presets: [
opts.env && [
'@babel/preset-env',
require('@umijs/deps/compiled/babel/preset-env'),
{
...mergeConfig(defaultEnvConfig,{}),
modules: false,
...opts.env
},
],
// opts.react && ['@babel/preset-react'],
// opts.typescript && [
// '@babel/preset-typescript',
// {
// allowNamespaces: true,
// },
// ],
].filter(Boolean),
plugins: [
['@babel/plugin-proposal-optional-chaining', { loose: false }],
['@babel/plugin-proposal-nullish-coalescing-operator', { loose: false }],
'@babel/plugin-syntax-top-level-await',
require('@umijs/deps/compiled/babel/plugin-syntax-top-level-await').default,
['@babel/plugin-transform-destructuring', { loose: false }],
// opts.typescript && ['babel-plugin-transform-typescript-metadata'],
['@babel/plugin-proposal-decorators', { legacy: true }],
......@@ -58,7 +51,7 @@ module.exports = opts => {
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-transform-react-jsx',
opts.transformRuntime && [
'@babel/plugin-transform-runtime',
require('@umijs/deps/compiled/babel/plugin-transform-runtime').default,
{
version: require('@babel/runtime/package.json').version,
absoluteRuntime: dirname(
......@@ -98,10 +91,23 @@ module.exports = opts => {
'@umijs/babel-plugin-import-to-await-require',
opts.importToAwaitRequire,
],
// opts.lockCoreJS3 && [
// '@umijs/babel-plugin-lock-core-js-3',
// opts.lockCoreJS3,
// ],
'react-activation/babel',
opts.lockCoreJS3 && [
'@umijs/babel-plugin-lock-core-js-3',
opts.lockCoreJS3,
],
opts.noAnonymousDefaultExport && [
require.resolve('@umijs/babel-plugin-no-anonymous-default-export'),
],
[
require('@umijs/deps/compiled/babel/plugin-proposal-record-and-tuple')
.default,
{
syntaxType: 'hash',
polyfillModuleName: '@umijs/deps/reexported/record-tuple-polyfill',
importPolyfill: true,
},
],
].filter(Boolean),
env: {
production: {
......
......@@ -18,7 +18,7 @@ const TYPE_ALL_EXCLUDE = [
'lodash',
'react',
'react-dom',
'@wisdom-map/arcgismap'
// '@wisdom-map/arcgismap'
];
......
......@@ -215,7 +215,7 @@ module.exports = options => {
chainConfig.module
.rule('js')
.test(/\.(js|mjs|jsx|ts|tsx)$/)
.include.add([cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.include.add([/node_modules\/@esri/, cwd, ...(process.env.APP_ROOT ? [process.cwd()] : [])])
.end()
.exclude.add(/node_modules/)
.add(/\.mfsu/)
......
......@@ -3996,6 +3996,11 @@
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fnearest-point/-/nearest-point-6.5.0.tgz",
"integrity": "sha1-LxeBwm/z8FQAXU/zUgQpczGLkvE=",
<<<<<<< HEAD
"requires": {
"@turf/clone": "^6.5.0",
"@turf/distance": "^6.5.0",
=======
"requires": {
"@turf/clone": "^6.5.0",
"@turf/distance": "^6.5.0",
......@@ -4135,15 +4140,160 @@
"integrity": "sha1-0qrYYjcL8D8icHARFUZKhAbBRLI=",
"requires": {
"@turf/clone": "^6.5.0",
>>>>>>> master
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
<<<<<<< HEAD
"@turf/nearest-point-on-line": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fnearest-point-on-line/-/nearest-point-on-line-6.5.0.tgz",
"integrity": "sha1-jhzSzcC1rK9MjYs7M7sAjTy5nns=",
"requires": {
"@turf/bearing": "^6.5.0",
"@turf/destination": "^6.5.0",
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/line-intersect": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
"@turf/nearest-point-to-line": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fnearest-point-to-line/-/nearest-point-to-line-6.5.0.tgz",
"integrity": "sha1-VUm0hpDVI/mvR2X+ZKPL6/vGu3U=",
"requires": {
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/meta": "^6.5.0",
"@turf/point-to-line-distance": "^6.5.0",
"object-assign": "*"
}
},
"@turf/planepoint": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fplanepoint/-/planepoint-6.5.0.tgz",
"integrity": "sha1-XLeIZwwxprBkrkZBgNUbTVUNh94=",
"requires": {
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0"
}
},
"@turf/point-grid": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpoint-grid/-/point-grid-6.5.0.tgz",
"integrity": "sha1-9ijTCv4p1g3L9UsZXkbqtIpPv6o=",
"requires": {
"@turf/boolean-within": "^6.5.0",
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0"
}
},
"@turf/point-on-feature": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpoint-on-feature/-/point-on-feature-6.5.0.tgz",
"integrity": "sha1-N9B6/rMYluU8CDOqQEmTun1QDww=",
"requires": {
"@turf/boolean-point-in-polygon": "^6.5.0",
"@turf/center": "^6.5.0",
"@turf/explode": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/nearest-point": "^6.5.0"
}
},
"@turf/point-to-line-distance": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpoint-to-line-distance/-/point-to-line-distance-6.5.0.tgz",
"integrity": "sha1-vEb+CepjCq9z8TxAs4p995BQ//g=",
"requires": {
"@turf/bearing": "^6.5.0",
"@turf/distance": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/meta": "^6.5.0",
"@turf/projection": "^6.5.0",
"@turf/rhumb-bearing": "^6.5.0",
"@turf/rhumb-distance": "^6.5.0"
}
},
"@turf/points-within-polygon": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpoints-within-polygon/-/points-within-polygon-6.5.0.tgz",
"integrity": "sha1-1J9NfPGbekQL8eBvdx/04d8TEH8=",
"requires": {
"@turf/boolean-point-in-polygon": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
"@turf/polygon-smooth": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpolygon-smooth/-/polygon-smooth-6.5.0.tgz",
"integrity": "sha1-AMo2aHHLbqO+5E/z6ocKr3VxFzM=",
"requires": {
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
"@turf/polygon-tangents": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpolygon-tangents/-/polygon-tangents-6.5.0.tgz",
"integrity": "sha1-3AJSAnJ7ovM0e6qV28pOD/2y3fU=",
"requires": {
"@turf/bbox": "^6.5.0",
"@turf/boolean-within": "^6.5.0",
"@turf/explode": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/nearest-point": "^6.5.0"
}
},
"@turf/polygon-to-line": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpolygon-to-line/-/polygon-to-line-6.5.0.tgz",
"integrity": "sha1-TchttmFosyu4PORIz5ZiCKRH2VI=",
"requires": {
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0"
}
},
"@turf/polygonize": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fpolygonize/-/polygonize-6.5.0.tgz",
"integrity": "sha1-iqDx44bpbFM6MgxCaq84cCAyD6M=",
"requires": {
"@turf/boolean-point-in-polygon": "^6.5.0",
"@turf/envelope": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/invariant": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
"@turf/projection": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2fprojection/-/projection-6.5.0.tgz",
"integrity": "sha1-0qrYYjcL8D8icHARFUZKhAbBRLI=",
"requires": {
"@turf/clone": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
}
},
"@turf/random": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2frandom/-/random-6.5.0.tgz",
"integrity": "sha1-sZZyz0VJVXZgA01KMDkRZW33dH4=",
"requires": {
=======
"@turf/random": {
"version": "6.5.0",
"resolved": "https://g.civnet.cn:4873/@turf%2frandom/-/random-6.5.0.tgz",
"integrity": "sha1-sZZyz0VJVXZgA01KMDkRZW33dH4=",
"requires": {
>>>>>>> master
"@turf/helpers": "^6.5.0"
}
},
......@@ -4677,9 +4827,9 @@
}
},
"@types/eslint-scope": {
"version": "3.7.2",
"resolved": "https://g.civnet.cn:4873/@types%2feslint-scope/-/eslint-scope-3.7.2.tgz",
"integrity": "sha512-TzgYCWoPiTeRg6RQYgtuW7iODtVoKu3RVL72k3WohqhjfaOLK5Mg2T4Tg1o2bSfu0vPkoI48wdQFv5b/Xe04wQ==",
"version": "3.7.3",
"resolved": "https://g.civnet.cn:4873/@types%2feslint-scope/-/eslint-scope-3.7.3.tgz",
"integrity": "sha512-PB3ldyrcnAicT35TWPs5IcwKD8S333HMaa2VVv4+wdvebJkjWuW/xESoB8IwRcog8HYVYamb1g/R31Qv5Bx03g==",
"dev": true,
"requires": {
"@types/eslint": "*",
......@@ -7598,6 +7748,17 @@
"turf": "^3.0.14"
}
},
<<<<<<< HEAD
=======
"@wisdom-components/basictable": {
"version": "1.5.16",
"resolved": "https://g.civnet.cn:4873/@wisdom-components%2fbasictable/-/basictable-1.5.16.tgz",
"integrity": "sha512-JQpAldDk31bvXia5WnKirC+6s0gKGWXVVLncCdxS4dsKA2u+6imC9vnnwA4igIIS318D9jw0X9MGN+6h0JGJjQ==",
"requires": {
"classnames": "^2.2.6"
}
},
>>>>>>> master
"@wisdom-components/empty": {
"version": "1.4.3",
"resolved": "https://g.civnet.cn:4873/@wisdom-components%2fempty/-/empty-1.4.3.tgz",
......@@ -11044,6 +11205,10 @@
"version": "0.3.0",
"resolved": "https://g.civnet.cn:4873/create-react-context/-/create-react-context-0.3.0.tgz",
"integrity": "sha512-dNldIoSuNSvlTJ7slIKC/ZFGKexBMBrrcc+TTe1NdmROnaASuLPvqpwj9v4XS4uXZ8+YPu0sNmShX2rXI5LNsw==",
<<<<<<< HEAD
=======
"dev": true,
>>>>>>> master
"requires": {
"gud": "^1.0.0",
"warning": "^4.0.3"
......@@ -12174,6 +12339,31 @@
"safer-buffer": "^2.1.0"
}
},
"echarts": {
"version": "5.3.0",
"resolved": "https://g.civnet.cn:4873/echarts/-/echarts-5.3.0.tgz",
"integrity": "sha512-zENufmwFE6WjM+24tW3xQq4ICqQtI0CGj4bDVDNd3BK3LtaA/5wBp+64ykIyKy3QElz0cieKqSYP4FX9Lv9MwQ==",
"requires": {
"tslib": "2.3.0",
"zrender": "5.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://g.civnet.cn:4873/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha1-gDuM2rPhK6WBpMpByIObuw2ssJ4="
}
}
},
"echarts-for-react": {
"version": "3.0.2",
"resolved": "https://g.civnet.cn:4873/echarts-for-react/-/echarts-for-react-3.0.2.tgz",
"integrity": "sha1-rFhZFXBIoQZtRVPjSzKKuyTyt8E=",
"requires": {
"fast-deep-equal": "^3.1.3",
"size-sensor": "^1.0.1"
}
},
"editor": {
"version": "1.0.0",
"resolved": "https://g.civnet.cn:4873/editor/-/editor-1.0.0.tgz",
......@@ -12263,6 +12453,16 @@
"once": "^1.4.0"
}
},
"enhanced-resolve": {
"version": "5.9.2",
"resolved": "https://g.civnet.cn:4873/enhanced-resolve/-/enhanced-resolve-5.9.2.tgz",
"integrity": "sha512-GIm3fQfwLJ8YZx2smuHpBKkXC1yOk+OBEmKckVyL0i/ea8mqDEykK3ld5dgH1QYPNyT/lIllxV2LULnxCHaHkA==",
"dev": true,
"requires": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
}
},
"enquirer": {
"version": "2.3.6",
"resolved": "https://g.civnet.cn:4873/enquirer/-/enquirer-2.3.6.tgz",
......@@ -14896,7 +15096,12 @@
"gud": {
"version": "1.0.0",
"resolved": "https://g.civnet.cn:4873/gud/-/gud-1.0.0.tgz",
<<<<<<< HEAD
"integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw=="
=======
"integrity": "sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw==",
"dev": true
>>>>>>> master
},
"gzip-size": {
"version": "5.1.1",
......@@ -25067,6 +25272,10 @@
"version": "0.9.9",
"resolved": "https://g.civnet.cn:4873/react-activation/-/react-activation-0.9.9.tgz",
"integrity": "sha512-KeCbPGkWnRzYKxwaS3nEnsDIWLzrjKT5GfBb3WlzT1lunSVIeAhUP8vu6yoCgTv/GRYLpC+SGEmVGULyegKlaw==",
<<<<<<< HEAD
=======
"dev": true,
>>>>>>> master
"requires": {
"create-react-context": "^0.3.0",
"hoist-non-react-statics": "^3.3.0",
......@@ -25293,6 +25502,10 @@
"version": "0.3.1",
"resolved": "https://g.civnet.cn:4873/react-node-key/-/react-node-key-0.3.1.tgz",
"integrity": "sha512-PPMeZiDD5Od4cnEamiDZUifVgK7DKhan2NeYZPCmH5xsaeKDc+UrcQJK21CelLcyaMjPiQz1cxAR2hD4AB9I7g==",
<<<<<<< HEAD
=======
"dev": true,
>>>>>>> master
"requires": {
"jsx-ast-utils": "^2.2.1",
"szfe-tools": "^0.0.0-beta.7"
......@@ -27203,6 +27416,14 @@
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
"dev": true
},
<<<<<<< HEAD
=======
"size-sensor": {
"version": "1.0.1",
"resolved": "https://g.civnet.cn:4873/size-sensor/-/size-sensor-1.0.1.tgz",
"integrity": "sha1-+E5GIG0+JZ+v8dVI5LO+ypMhnbs="
},
>>>>>>> master
"skmeans": {
"version": "0.9.7",
"resolved": "https://g.civnet.cn:4873/skmeans/-/skmeans-0.9.7.tgz",
......@@ -29114,6 +29335,10 @@
"version": "0.0.0-beta.7",
"resolved": "https://g.civnet.cn:4873/szfe-tools/-/szfe-tools-0.0.0-beta.7.tgz",
"integrity": "sha1-WAusvD1ONTxqwAqzN7A3qlPRTpY=",
<<<<<<< HEAD
=======
"dev": true,
>>>>>>> master
"requires": {
"@babel/runtime": "^7.10.2"
}
......@@ -31138,13 +31363,13 @@
"dev": true
},
"webpack": {
"version": "5.65.0",
"resolved": "https://g.civnet.cn:4873/webpack/-/webpack-5.65.0.tgz",
"integrity": "sha512-Q5or2o6EKs7+oKmJo7LaqZaMOlDWQse9Tm5l1WAfU/ujLGN5Pb0SqGeVkN/4bpPmEqEP5RnVhiqsOtWtUVwGRw==",
"version": "5.70.0",
"resolved": "https://g.civnet.cn:4873/webpack/-/webpack-5.70.0.tgz",
"integrity": "sha512-ZMWWy8CeuTTjCxbeaQI21xSswseF2oNOwc70QSKNePvmxE7XW36i7vpBMYZFAUHPwQiEbNGCEYIOOlyRbdGmxw==",
"dev": true,
"requires": {
"@types/eslint-scope": "^3.7.0",
"@types/estree": "^0.0.50",
"@types/eslint-scope": "^3.7.3",
"@types/estree": "^0.0.51",
"@webassemblyjs/ast": "1.11.1",
"@webassemblyjs/wasm-edit": "1.11.1",
"@webassemblyjs/wasm-parser": "1.11.1",
......@@ -31152,12 +31377,12 @@
"acorn-import-assertions": "^1.7.6",
"browserslist": "^4.14.5",
"chrome-trace-event": "^1.0.2",
"enhanced-resolve": "^5.8.3",
"enhanced-resolve": "^5.9.2",
"es-module-lexer": "^0.9.0",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.4",
"graceful-fs": "^4.2.9",
"json-parse-better-errors": "^1.0.2",
"loader-runner": "^4.2.0",
"mime-types": "^2.1.27",
......@@ -31166,31 +31391,33 @@
"tapable": "^2.1.1",
"terser-webpack-plugin": "^5.1.3",
"watchpack": "^2.3.1",
"webpack-sources": "^3.2.2"
"webpack-sources": "^3.2.3"
},
"dependencies": {
"@types/estree": {
"version": "0.0.51",
"resolved": "https://g.civnet.cn:4873/@types%2festree/-/estree-0.0.51.tgz",
"integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
"dev": true
},
"acorn": {
"version": "8.7.0",
"resolved": "https://g.civnet.cn:4873/acorn/-/acorn-8.7.0.tgz",
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
"dev": true
},
"enhanced-resolve": {
"version": "5.8.3",
"resolved": "https://g.civnet.cn:4873/enhanced-resolve/-/enhanced-resolve-5.8.3.tgz",
"integrity": "sha1-bVUtRlzOBCP1s9cYUR6lOCansvA=",
"dev": true,
"requires": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
}
},
"glob-to-regexp": {
"version": "0.4.1",
"resolved": "https://g.civnet.cn:4873/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
"integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
"dev": true
},
"graceful-fs": {
"version": "4.2.9",
"resolved": "https://g.civnet.cn:4873/graceful-fs/-/graceful-fs-4.2.9.tgz",
"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
"dev": true
},
"has-flag": {
"version": "4.0.0",
"resolved": "https://g.civnet.cn:4873/has-flag/-/has-flag-4.0.0.tgz",
......@@ -31198,9 +31425,9 @@
"dev": true
},
"jest-worker": {
"version": "27.4.5",
"resolved": "https://g.civnet.cn:4873/jest-worker/-/jest-worker-27.4.5.tgz",
"integrity": "sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg==",
"version": "27.5.1",
"resolved": "https://g.civnet.cn:4873/jest-worker/-/jest-worker-27.5.1.tgz",
"integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==",
"dev": true,
"requires": {
"@types/node": "*",
......@@ -31244,12 +31471,12 @@
}
},
"terser-webpack-plugin": {
"version": "5.3.0",
"resolved": "https://g.civnet.cn:4873/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz",
"integrity": "sha512-LPIisi3Ol4chwAaPP8toUJ3L4qCM1G0wao7L3qNv57Drezxj6+VEyySpPw4B1HSO2Eg/hDY/MNF5XihCAoqnsQ==",
"version": "5.3.1",
"resolved": "https://g.civnet.cn:4873/terser-webpack-plugin/-/terser-webpack-plugin-5.3.1.tgz",
"integrity": "sha512-GvlZdT6wPQKbDNW/GDQzZFg/j4vKU96yl2q6mcUkzKOgW4gwf1Z8cZToUCrz31XHlPWH8MVb1r2tFtdDtTGJ7g==",
"dev": true,
"requires": {
"jest-worker": "^27.4.1",
"jest-worker": "^27.4.5",
"schema-utils": "^3.1.1",
"serialize-javascript": "^6.0.0",
"source-map": "^0.6.1",
......@@ -31257,9 +31484,9 @@
}
},
"webpack-sources": {
"version": "3.2.2",
"resolved": "https://g.civnet.cn:4873/webpack-sources/-/webpack-sources-3.2.2.tgz",
"integrity": "sha1-2I43QYM+/sV8THibYBDbmXdUUmA=",
"version": "3.2.3",
"resolved": "https://g.civnet.cn:4873/webpack-sources/-/webpack-sources-3.2.3.tgz",
"integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
"dev": true
}
}
......@@ -32124,6 +32351,24 @@
"integrity": "sha1-6NV3TRwHOKR7z6hynzcS4t7d6yU=",
"dev": true
},
<<<<<<< HEAD
=======
"zrender": {
"version": "5.3.0",
"resolved": "https://g.civnet.cn:4873/zrender/-/zrender-5.3.0.tgz",
"integrity": "sha512-Ln2QB5uqI1ftNYMtCRxd+XDq6MOttLgam2tmhKAVA+j0ko47UT+VNlDvKTkqe4K2sJhBvB0EhYNLebqlCTjatQ==",
"requires": {
"tslib": "2.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://g.civnet.cn:4873/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha1-gDuM2rPhK6WBpMpByIObuw2ssJ4="
}
}
},
>>>>>>> master
"zwitch": {
"version": "1.0.5",
"resolved": "https://g.civnet.cn:4873/zwitch/-/zwitch-1.0.5.tgz",
......@@ -19,7 +19,7 @@
"analyze": "cross-env ANALYZE=1 npm run build",
"npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
"preinstall": "npm run npmcheckversion",
"build": "cross-env NODE_ENV=production node internals/webpack/build.js",
"build": "cross-env NODE_ENV=production node --max_old_space_size=4096 internals/webpack/build.js",
"build:clean": "rimraf ./build",
"openapi": "cross-env NODE_ENV=development node server/openapi/run.js",
"start": "cross-env REACT_APP_ENV=dev NODE_ENV=development node --max_old_space_size=8192 server --port=$port",
......@@ -90,6 +90,8 @@
"babel-core": "7.0.0-bridge.0"
},
"dependencies": {
"@esri/calcite-colors": "6.0.3",
"@esri/arcgis-html-sanitizer": "2.9.1",
"@amap/amap-jsapi-loader": "^1.0.1",
"@ant-design/colors": "^5.0.1",
"@ant-design/icons": "^4.0.0",
......@@ -100,9 +102,8 @@
"@ant-design/pro-utils": "^1.10.4",
"@babel/polyfill": "7.4.3",
"@babel/runtime": "^7.10.5",
"@esri/arcgis-html-sanitizer": "^2.9.1",
"@esri/calcite-colors": "^6.0.3",
"@wisdom-cesium/cesium": "^1.0.64",
"@wisdom-components/basictable": "^1.5.16",
"@wisdom-components/empty": "^1.4.1",
"@wisdom-map/arcgismap": "^1.0.75-0",
"@wisdom-map/util": "^1.0.27-0",
......@@ -113,6 +114,8 @@
"antd": "^4.17.4",
"compression": "1.7.4",
"connected-react-router": "6.4.0",
"echarts": "^5.3.0",
"echarts-for-react": "^3.0.2",
"fontfaceobserver": "2.1.0",
"history": "4.9.0",
"hoist-non-react-statics": "3.3.0",
......@@ -261,6 +264,7 @@
"prettier": "1.17.0",
"querystring-browser": "^1.0.4",
"raw-loader": "^4.0.2",
"react-activation": "^0.9.9",
"react-app-polyfill": "0.2.2",
"react-error-overlay": "6.0.8",
"react-inlinesvg": "^2.3.0",
......@@ -289,7 +293,7 @@
"traverse": "^0.6.6",
"umi-webpack-bundle-analyzer": "3.6.0",
"url-loader": "1.1.2",
"webpack": "^5.65.0",
"webpack": "^5.70.0",
"webpack-chain": "6.5.1",
"webpack-cli": "4.2.0",
"webpack-dev-middleware": "5.3.0",
......
// 主应用 和 子应用数据传递
import { initGlobalState } from 'qiankun';
export const initialState = {
globalConfig: {},
};
const actions = initGlobalState(initialState);
// action.setGlobalState({key: value}) 更新状态
// actions.onGlobalStateChange((newState, prevStaet) => {}) 监听状态
export default actions;
......@@ -5,6 +5,7 @@ import { event } from 'microser-data';
import { actionCreators } from '../containers/App/store';
import AppService from './service/base';
import notificationService from './service/notification';
import CloudService from './service/cloud';
const { warning } = Modal;
// eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true;
......@@ -74,4 +75,5 @@ instanceRequest.setErrorHandler(error => {
});
const appService = service(AppService);
const noticeService = service(notificationService);
export { appService, noticeService };
const cloudService = service(CloudService);
export { appService, noticeService, cloudService };
......@@ -3,11 +3,11 @@ import * as constants from '../../constants';
/**
* 兼容老接口
*/
const transformGateWay = (url) => {
if(!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '')
const transformGateWay = url => {
if (!/^(cityinterface|CityInterface|CityServer)/) {
return url.replace(/GeteWay/, '');
}
}
};
export const API = {
AUTHORIZATION_TOKEN: '/Identity/AuthorizationToken',
......@@ -28,7 +28,8 @@ export const API = {
process.env.NODE_ENV !== 'production'
? '/cityjson?ie=utf-8'
: 'https://pv.sohu.com',
GET_ALL_GROUPS_INFO_FORUSER: '/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_ALL_GROUPS_INFO_FORUSER:
'/CityInterface/rest/Services/Portal.svc/AuthorityManage/GetAllGroupsInfoForUser',
GET_WEATHER: '/CityInterface/rest/services/CountyProduct.svc/GetWeather',
SEND_MESSAGE_CODE:
'CityInterface/rest/services/portal.svc/SendMessVerificationCode',
......@@ -87,9 +88,10 @@ const services = {
},
getUserInfo: {
url: () => {
return window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
},
url: () =>
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
......@@ -218,30 +220,31 @@ export const searchAutoCity = keywords => {
return jsonp(url, params, options);
};
export const getUserInfo = (params) => {
const url = window.globalConfig && window.globalConfig.hasGateWay? API.GET_GATEWAY_USER_INFO: API.GET_USER_INFO
export const getUserInfo = params => {
const url =
window.globalConfig && window.globalConfig.hasGateWay
? API.GET_GATEWAY_USER_INFO
: API.GET_USER_INFO;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
export const getWebSiteConfig = (params) => {
const url = window.globalConfig &&
window.globalConfig &&
window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
export const getWebSiteConfig = params => {
const url =
window.globalConfig && window.globalConfig && window.globalConfig.hasGateWay
? API.GET_WEB_SITE_CONFIG_GEWAY
: API.GET_WEB_SITE_CONFIG;
return request({
url: url,
url,
method: constants.REQUEST_METHOD_GET,
params: params,
params,
// params: param.query,
});
}
};
// 更新常用页
export const savePagePartInfo = param =>
......@@ -252,5 +255,4 @@ export const savePagePartInfo = param =>
params: param.query,
});
export default services;
import { jsonp, request } from '@wisdom-utils/utils';
import * as constants from '../../constants';
const portalURL = 'CityInterface/rest/Services/Portal.svc';
export const API = {
GET_DATA_DICTIONARY_LIST:
'/CityInterface/Services/CityServer_WorkFlow/REST/WorkFlowREST.svc/GetDataDictionaryList',
GET_ACCOUNT_PAGELIST: `/CityInterface/Services/CityServer_CaseManage/REST/CaseManageREST.svc/GetAccountPageList`,
// 云平台使用分析
LOGIN_STATISTIC: `${portalURL}/OMManage/LoginStatisticServer`,
FUNCTIONS_STATISTIC: `${portalURL}/OMManage/FunctionStatisticServer`,
ENVIROMENT_STATISTIC: `${portalURL}/OMManage/EnviromentStatisticServer`,
USER_LOGIN_STATISTIC: `${portalURL}/OMManage/UserLoginStatisticServer`,
};
const services = {
getDataDictionaryList: {
url: API.GET_DATA_DICTIONARY_LIST,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getAccountPageList: {
url: API.GET_ACCOUNT_PAGELIST,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getLoginStatistic: {
url: API.LOGIN_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getFunctionsStatistic: {
url: API.FUNCTIONS_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getEnviromentStatistic: {
url: API.ENVIROMENT_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
getUserLoginStatistic: {
url: API.USER_LOGIN_STATISTIC,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
};
export default services;
This diff was suppressed by a .gitattributes entry.
......@@ -126,15 +126,15 @@ const GlobalHeaderRight = props => {
? props.global.get('homepage')
: props.global.get('homepage.url');
if(!props.global.get('home')) {
url = `civweb4/${url}`
url = `civweb4/${url.replace(/^\//, '').replace(/^civweb4\//, '')}`
}
window.share.event.emit('goHome', `/${url}`);
url ? (
window.share.event.emit('listenerMointer', {
label: '首页',
url: url,
})
) : null;
// url ? (
// window.share.event.emit('listenerMointer', {
// label: '首页',
// url: url.replace(/^civweb4\//, ''),
// })
// ) : null;
};
......@@ -224,10 +224,17 @@ const GlobalHeaderRight = props => {
<HomeIcon title={intl.formatMessage({id: 'component.header.icon.home'})} />
<span>首页</span>
</div>
<div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}>
<FavitorIcon></FavitorIcon>
<span>常用</span>
</div>
{
// 云平台去掉常用菜单
props.global && props.global.userInfo && props.global.userInfo.Groups && props.global.userInfo.Groups.length
? null
: (
<div className={classNames(styles.item)} onClick={handlerFavitor} ref={favitorRef}>
<FavitorIcon></FavitorIcon>
<span>常用</span>
</div>
)
}
{/*<div className={classNames(styles.item)} onClick={handlerTheme}>*/}
{/* <ThemeIcon/>*/}
{/* <span>主题</span>*/}
......
......@@ -36,6 +36,10 @@ class NoticeIconView extends Component {
videoMessage: {},
};
// this.renderPlatform
try {
window.share && window.share.event && window.share.event.removeAllListeners('reloadNotice');
} catch (error) {
}
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
......@@ -48,6 +52,24 @@ class NoticeIconView extends Component {
async componentDidMount() {
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
window.share && window.share.event && window.share.event.on('reloadNotice', () => {
try {
// eslint-disable-next-line no-unused-expressions
this.notifier && this.notifier.stop();
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
this.renderPlatform,
this.renderSysPlatform,
this.props,
);
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
}
});
}
componentWillUnmount() {
......@@ -57,6 +79,7 @@ class NoticeIconView extends Component {
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
window.share.event.removeAllListeners('reloadNotice');
}
}
......
@import '~antd/es/style/themes/default.less';
.view {
position: absolute;
top:0;
right: 0;
bottom: 0;
left: 0;
.loadingBox{
position: absolute;
left: calc(50% - 40px);
top: calc(50% - 23px);
color: @text-color;
}
.mapBox {
width: 100%;
height: 100%;
}
}
......@@ -23,7 +23,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW
PD_VIEW,
} from './constants';
export function getConfig(data) {
......@@ -174,8 +174,8 @@ export function updageMapView(data) {
export function updatePdCesiumView(data) {
return {
type: PD_VIEW,
data
}
data,
};
}
export function logout(data) {
......@@ -188,13 +188,12 @@ export function logout(data) {
window.globalConfig.token = null;
window.globalConfig.access_token = null;
window.globalConfig.apiGatewayDomain = window.location.origin;
window.globalConfig.baseURI = window.location.origin;
window.globalConfig.baseURI = window.location.origin;
window.globalConfig.hasGateWay = false;
window.globalConfig.userInfo = null;
// window.globalConfig.hasGateWay = ;
}
Cookies.set('token', '', {
path: '/',
});
......@@ -219,7 +218,7 @@ export function logout(data) {
data: {
currentMenuIndex: 0,
complexConfig: {},
globalConfig: window.globalConfig
globalConfig: window.globalConfig,
},
};
}
......@@ -20,4 +20,4 @@ export const COMPLEX_PATHNAME = 'App/COMPLEX_PATHNAME';
export const GET_MICRO_MOUNTED_STATUS = 'App/GET_MICRO_MOUNTED_STATUS';
export const LOGINOUT = 'App/LOGINOUT';
export const MAP_VIEW = 'App/MAP_VIEW';
export const PD_VIEW = "App/PD_VIEW"
export const PD_VIEW = 'App/PD_VIEW';
......@@ -6,8 +6,10 @@ import { store, event } from 'microser-data';
import { Storage } from '@wisdom-utils/utils';
import pkg from '../../../../package.json';
import defaultSetting from '../../../../config/defaultSetting';
import generRoutes, { generFlatRoutes } from '../../../utils/routes';
import { transformWidgets } from '../../../utils/routes';
import generRoutes, {
generFlatRoutes,
transformWidgets,
} from '../../../utils/routes';
import {
CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG,
......@@ -31,7 +33,7 @@ import {
SLIDER_MENU_MODE,
VALIDATE_AUTH,
MAP_VIEW,
PD_VIEW
PD_VIEW,
} from './constants';
const proxy = require('../../../../config/proxy');
......@@ -72,14 +74,12 @@ export const initialState = fromJS({
complexPathName: null,
microMounted: true,
mapView: null,
pdView: null
});
/* eslint-disable default-case, no-param-reassign */
const appReducer = (state = initialState, action) => {
switch (action.type) {
case GET_CONFIG:
// eslint-disable-next-line no-debugger
// eslint-disable-next-line no-underscore-dangle
window.__INITIAL_STATE__ = Object.assign(
......@@ -92,7 +92,9 @@ const appReducer = (state = initialState, action) => {
env: process.env.NODE_ENV === 'development' ? 'daily' : 'prod',
},
);
window.arcgisAssetsPath = `${window.location.origin}/${pkg.name.toLocaleLowerCase()}/assets`;
window.arcgisAssetsPath = `${
window.location.origin
}/${pkg.name.toLocaleLowerCase()}/assets`;
// eslint-disable-next-line global-require,no-underscore-dangle
window.__INITIAL_STATE__.mdi = 'SDI';
window.__INITIAL_STATE__.menu = 'banner-left';
......@@ -105,43 +107,50 @@ const appReducer = (state = initialState, action) => {
// eslint-disable-next-line no-case-declarations
const { homepage } = window.globalConfig;
const modulePkg = {};
window.globalConfig && window.globalConfig.products && Array.isArray(window.globalConfig.products) && window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
window.globalConfig &&
window.globalConfig.products &&
Array.isArray(window.globalConfig.products) &&
window.globalConfig.products.map(item => {
modulePkg[item.PackageName] = item;
});
config.widgets = transformWidgets(config.widgets);
const generMenu = generRoutes(config.widgets || [], null, 0, modulePkg);
let flatMenu = [];
if(generMenu) {
if (generMenu) {
flatMenu = generFlatRoutes(generMenu || [], null, null, modulePkg);
}
const home = flatMenu.find(item => {
let path = decodeURI(item.path).split("|");
const path = decodeURI(item.path).split('|');
let currentPath = path[0];
if(/^\//.test(currentPath)) {
if (/^\//.test(currentPath)) {
currentPath = currentPath.replace(/^\//, '');
}
return currentPath === decodeURI(homepage)
return currentPath === decodeURI(homepage);
});
let currentMenuIndex = 0;
if(home) {
const parent = home.level >= 2 ? home.parent.parent: home.level >= 3 ? home.parent.parent.parent: home.parent;
if(parent) {
currentMenuIndex = generMenu.findIndex(item => item.name === parent.label);
if (home) {
const parent =
home.level >= 2
? home.parent.parent
: home.level >= 3
? home.parent.parent.parent
: home.parent;
if (parent) {
currentMenuIndex = generMenu.findIndex(
item => item.name === parent.label,
);
currentProduct.set('currentMenuIndex', currentMenuIndex);
store.set('updateMenuIndex', currentMenuIndex)
store.set('updateMenuIndex', currentMenuIndex);
}
}
// eslint-disable-next-line no-case-declarations
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
// eslint-disable-next-line no-case-declarations
window.globalConfig.home = home;
Cookies.set('city', Cookies.get('city') || window.globalConfig.client);
window.globalConfig = config;
......@@ -239,7 +248,7 @@ const appReducer = (state = initialState, action) => {
return state.merge({
complexConfig: action.data.complexConfig,
currentMenuIndex: action.data.currentMenuIndex,
globalConfig: action.data.globalConfig
globalConfig: action.data.globalConfig,
});
case MAP_VIEW:
store.set('view', action.data);
......@@ -247,10 +256,11 @@ const appReducer = (state = initialState, action) => {
mapView: action.data,
});
case PD_VIEW:
store.set('pdView', action.data)
store.set('pdView', action.data);
return state.merge({
pdView : action.data
})
pdView: action.data,
});
default:
return state;
}
......
......@@ -60,10 +60,12 @@ export const initGlobalConfig = () => {
}
});
// eslint-disable-next-line react-hooks/rules-of-hooks
const client = params.getParams('client') || Cookies.get('city')
let client = params.getParams('client') || Cookies.get('city')
client = client && client !== 'undefined' ? client : 'city';
appService
.queryConfig({
client: client || 'city',
ignoreSite: true,
})
.then(res => {
if (res) {
......@@ -71,7 +73,7 @@ export const initGlobalConfig = () => {
store.dispatch(actionCreators.getConfig(Object.assign({})));
const data = res;
if (!data.client) {
data.client = params.getParams('client') || Cookies.get('city');
data.client = client;
}
// Cookies.set('city', data.client);
store.dispatch(
......
......@@ -35,9 +35,9 @@ import { ReactSVG } from 'react-svg';
import Cookies from 'js-cookie';
import { connect } from 'react-redux';
import { Router, Switch, useHistory } from '@wisdom-utils/runtime';
import keepAlive, { KeepAlive } from 'react-activation';
import RightContent from '@/components/GlobalHeader/ExtendRightContent';
import Panel from '@/components/SliderPanel/MinPanel';
import CesiumMap from '../pages/cesiumMap';
import { actionCreators } from '@/containers/App/store';
import CreateBaseMap from '@/pages/map';
import CesiumMap from '@/pages/cesiumMap';
......@@ -297,10 +297,18 @@ const BasicLayout = props => {
currentChildrenRoute && currentChildrenRoute.routes ? setChildrenRoutes(currentChildrenRoute.routes) : setChildrenRoutes([currentChildrenRoute]);
} else {
let url = props.global && props.global.hasOwnProperty('get') && props.global.get('homepage')
? _.isString(props.global.get('homepage'))
? props.global.get('homepage')
: props.global.get('homepage.url')
: '';
if(!props.global.get('home')) {
url = `civweb4/${url.replace(/^\//, '').replace(/^civweb4\//, '')}`
}
setChildrenRoutes([
{
icon: <HomeIcon />,
path: props.location && props.location.pathname,
icon: <HomeIcon/>,
path: `/${url}`,
name: '首页'
}
])
......@@ -310,27 +318,49 @@ const BasicLayout = props => {
useEffect(() => {
console.log(props.route.routes);
}, [props.currentMenuIndex]);
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({ currentPath, currentRoute, selectedIndex }) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes) : !currentRoute.parent ? setChildrenRoutes(currentRoute.routes) : setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
setTabActiveKey(currentPath)
});
window.share && window.share.event && window.share.event.on('event:favitor', ({ icon, name, path }) => {
setChildrenRoutes([
{
icon: <HomeIcon />,
path: path,
name: name
}
])
})
useEffect(() => {
window.share && window.share.event && window.share.event.on('event:updateCurrentChildrenRoutes', ({currentPath, currentRoute, selectedIndex}) => {
currentRoute && currentRoute.parent && currentRoute.parent.routes ? setChildrenRoutes(currentRoute.parent.routes): !currentRoute.parent ? setChildrenRoutes(currentRoute.routes): setChildrenRoutes([currentRoute]);
setSelectIndex(selectedIndex);
setTabActiveKey(currentPath)
});
window.share && window.share.event && window.share.event.on('event:favitor', ({icon, name, path}) => {
setChildrenRoutes([
{
icon: <HomeIcon/>,
path: path,
name: name
}
])
});
window.share && window.share.event && window.share.event.on('goHome', url => {
setChildrenRoutes([
{
icon: <HomeIcon/>,
path: url,
name: '首页'
}
]);
setTabActiveKey(url);
window.history.pushState(null, '', `/civbase${url}`);
});
return () => {
window.share && window.share.event && window.share.event.removeAllListeners('event:updateCurrentChildrenRoutes');
window.share && window.share.event && window.share.event.removeAllListeners('event:favitor');
window.share && window.share.event && window.share.event.removeAllListeners('goHome');
};
}, []);
useEffect(() => {
siteAction.setGlobalConfig(props.global);
if (!Cookies.get('token')) {
let client = props.global && props.global.client;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client : 'city';
let generateType = props.global && props.global.hasOwnProperty('get') && props.global.get('generateType');
let client = props.global && props.global.hasOwnProperty('client') ? props.global.get('client') : null;
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
let generateType = props.global && props.global.hasOwnProperty('get') ? props.global.get('generateType') : null;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
history.replace(`/user/login?client=${client}${generateType}`);
props.logout();
......@@ -350,21 +380,6 @@ const BasicLayout = props => {
}, [props.global]);
// setChildrenRoutes(currentChildrenRoute)
window.share.event.on('goHome', url => {
setChildrenRoutes([
{
icon: <HomeIcon />,
path: url,
name: '首页'
}
]);
setTabActiveKey(url);
window.history.pushState(null, '', `/civbase${url}`);
});
/**
* web4全屏退出,切换三级菜单高亮
*/
......@@ -514,7 +529,7 @@ const BasicLayout = props => {
setCollapse(!collapse);
}
const logo = props.global && props.global.get('bannerLogo') ? (props.global && _.isFunction(props.global.transformDevAssetsBaseURL) && props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))) : defaultSetting.logo;
const logo = props.global && _.isFunction(props.global.get) && props.global.get('bannerLogo')? (props.global && _.isFunction(props.global.transformDevAssetsBaseURL) && props.global.transformDevAssetsBaseURL(props.global.get('bannerLogo'))): defaultSetting.logo;
return (
<SecurityLayout loading>
......@@ -659,53 +674,52 @@ const BasicLayout = props => {
>
</TabPane>
</>
))}
</Tabs>
</div>
<PageContainer style={{ paddingTop: '0px', height: '100%' }}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
))}
</Tabs>
</div>
<PageContainer style={{paddingTop: '0px', height: '100%'}}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/* <CreateBaseMap/> */}
{props.children}
</div>
{props.children}
{props.children}
</div>
{props.children}
</PageContainer>
</div>
</div>
</div>
</div>
</div>) : (
<PageContainer style={{ paddingTop: '0px', height: '100%' }}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
</PageContainer>
)
}
</div>
</div>
</div>
): (
<PageContainer style={{paddingTop: '0px', height: '100%'}}>
{
renderRoutes(props.route.routes)
}
{
window.location.pathname.startsWith('/civbase/civ_3d') ? <KeepAlive><CesiumMap /></KeepAlive> : null
}
{
window.location.pathname.startsWith('/civbase/civ_webgis') ? <CreateBaseMap /> : null
}
<div id="micro-container" className="subapp-container">
{/*<CreateBaseMap/>*/}
{props.children}
</div>
</PageContainer>
)
}
</SecurityLayout>);
};
......
......@@ -5,8 +5,8 @@ import { Redirect } from '@wisdom-utils/runtime';
import { PageLoading } from '@ant-design/pro-layout';
import { event } from 'microser-data';
import { stringify } from 'querystring';
import _ from 'lodash';
import { getBaseName } from '../utils/utils';
import _ from 'lodash';
class SecurityLayout extends React.Component {
state = {
......@@ -27,19 +27,32 @@ class SecurityLayout extends React.Component {
// const queryString = stringify({
// redirect: window.location.href,
// });
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
if (
_.isNull(global.token) ||
(global.hasGateWay && _.isNull(global.access_token))
) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
let client = global.client || Cookies.get('city');
client = client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client) ? client: 'city';
client =
client !== 'undefined' && !_.isNull(client) && !_.isUndefined(client)
? client
: 'city';
// event.emit(?'event:initConfig');
let generateType = global.generateType;
generateType = !_.isNull(generateType) && !_.isUndefined(generateType) && generateType !== 'undefined' ? `&generateType=${generateType}` : '';
let { generateType } = global;
generateType =
!_.isNull(generateType) &&
!_.isUndefined(generateType) &&
generateType !== 'undefined'
? `&generateType=${generateType}`
: '';
return (
<Redirect to={`/user/login?client=${client}${generateType}`} render={() => window.location.reload()}/>
<Redirect
to={`/user/login?client=${client}${generateType}`}
render={() => window.location.reload()}
/>
);
}
if ((!isLogin && loading) || !isReady) {
return <PageLoading />;
}
......
......@@ -14,6 +14,8 @@ import { appService } from '../api';
import CitySelector from '../components/CitySelector';
import Login from '../pages/user/login/login';
import styles from './UserLayout.less';
import { initMicroApps } from '@/micro';
const { Link } = Anchor;
......@@ -169,7 +171,7 @@ class Site {
self.globalConfig.userInfo.groupType = allStation[0].groupType;
}
}
if (allStation.length > 1) {
if (allStation.length > 0) {
self.currentStationName = arr[arr.length - 1];
self.citySelector = self.AvailableofRegionName(projectStation);
self.siteCityList = self.buildCitySelectTemple(projectStation);
......@@ -342,11 +344,32 @@ class Site {
self.setLoading(false);
// eslint-disable-next-line no-unused-expressions
self.props.updateCurrentIndex && self.props.updateCurrentIndex(0);
window.history.replaceState(
'',
'',
`/${self.globalConfig.homepage}`,
);
initMicroApps();
// 切换站点后,重置掉三级菜单
const homeType = self.globalConfig.homeType || 'civweb4';
const homePath =
self.globalConfig.homepage
? self.globalConfig.homepage.startsWith(homeType)
? self.globalConfig.homepage
: `/${homeType}/${self.globalConfig.homepage}`
: `/${homeType}`;
window.share && window.share.event && window.share.event.emit('event:favitor', {
name: "首页",
path: homePath,
icon: null,
});
// 重新加载订阅消息铃铛
window.share && window.share.event && window.share.event.emit('reloadNotice');
// window.history.replaceState(
// '',
// '',
// `/${self.globalConfig.homepage}`,
// );
self.getCityStationsForUser().then(res => {
window.share.event.emit('updateSite', res);
});
......@@ -357,6 +380,7 @@ class Site {
self.props &&
self.props.updateComplexConfig &&
self.props.updateComplexConfig({});
self.props.history && self.props.history.push(self.globalConfig.homepage ? `/${self.globalConfig.homepage}` : `/?client=${self.globalConfig.client}`);
// window.location.reload();
window.share.event.emit('triggerMicro', this.props.global);
});
......
import React from 'react';
import {
Helmet,
HelmetProvider,
} from 'react-helmet-async';
import { Helmet, HelmetProvider } from 'react-helmet-async';
import { connect } from 'react-redux';
import { getMenuData, getPageTitle } from '@ant-design/pro-layout';
import { renderRoutes } from '../utils/routes';
import {
getMenuData,
getPageTitle,
} from '@ant-design/pro-layout';
import styles from './UserLayout.less';
const UserLayout = props => {
......
......@@ -3,7 +3,6 @@ import 'kit_logger';
import _ from 'lodash';
import {
addGlobalUncaughtErrorHandler,
initGlobalState,
registerMicroApps,
runAfterFirstMounted,
setDefaultMountApp,
......@@ -17,6 +16,7 @@ import { actionCreators } from './containers/App/store';
import { FILTER_FOLER_REG } from './utils/constants';
import loader from './render';
import store from './stores';
import actions from './actions';
// eslint-disable-next-line no-undef
const Logger = logger('micro');
......@@ -119,16 +119,9 @@ export const initMicroApps = () => {
},
);
const globalStore = store.getState().toJS();
const { setGlobalState } = initGlobalState({
// eslint-disable-next-line no-undef
globalConfig: window.globalConfig,
//createStoreage.get('globalConfig'),
global: globalStore.global
});
const globalConfig = window.globalConfig;
globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, '') : globalConfig.homepage;
console.log(globalConfig);
setGlobalState({
// globalConfig.homepage = globalConfig.homepage && /civweb4/.test(globalConfig.homepage) ? config.homepage.replace(/civweb4\//, ''): globalConfig.homepage;
actions.setGlobalState({
// eslint-disable-next-line no-undef
globalConfig: globalConfig,
//createStoreage.get('globalConfig'),
......@@ -228,7 +221,7 @@ export const defaultApp = () => {
// createStoreage.set('init_web4', true)
// }
// let homepage = config.homepage.replace('civweb4/', '');
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
const url = !config.home ? `/civbase/civweb4/${config.homepage.replace(/^\//, '').replace(/^civweb4\//, '')}` : `/civbase/${config.homepage.replace(/^\//, '')}`;
setDefaultMountApp(url);
// if(config.homepage.indexOf('civweb4') > -1) createStoreage.set('init_web4', true);
}
......@@ -490,6 +483,7 @@ window.app.define('@wisdom-map/arcgismap', require.context('../node_modules/@wis
window.app.define('@ant-design/pro-form', require.context('../node_modules/@ant-design/pro-form/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
window.app.define('classnames', require.context('classnames', true, /^.\/index\.js$/), 'index.js');
window.app.define('@ant-design/icons', require.context('../node_modules/@ant-design/icons/lib', true, /^.\/(lib\/)?[^\/]+\.js$/), 'index.js');
......
......@@ -12,6 +12,10 @@ import { actionCreators } from '../../containers/App/store';
import SecurityLayout from '../../layouts/SecurityLayout';
import LoginAction from '../user/login/login';
import styles from './index.less';
import { useHistory } from '@wisdom-utils/runtime';
import { initMicroApps } from '@/micro';
import usingIcon from '@/assets/bootPage/using-icon.png';
import { appService } from '@/api';
const industries = [
{ name: '供水', type: '供水', subTitle: 'WATER SUPPLY' },
......@@ -20,8 +24,8 @@ const industries = [
{ name: '能源', type: '能源', subTitle: 'ENERGY SOURCES' },
{ name: '直饮水', type: '直饮水', subTitle: 'DRINGKING WATER' },
// { name: '水资源', type: '水资源', subTitle: 'WATER RESOURCES' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '大数据', type: '大数据', subTitle: 'BIG DATA' },
{ name: '熊猫智能实验室', type: '实验室', subTitle: 'PANDA AI. LAB' },
{ name: '项目案例', type: '项目案例', subTitle: 'PROJECT CASE' },
];
const renderIndustries = (config, callback) =>
......@@ -54,10 +58,15 @@ const renderIndustries = (config, callback) =>
}
});
// let loginAction = null;
const BootPage = props => {
const [loadding, setLoadding] = useState(false);
const [hasRole, setHasRole] = useState(false);
const [scale, setScale] = useState(1);
const [loginAction, setAction] = useState(
() => new LoginAction(props),
);
const history = useHistory();
useDocumentTitle(
{ title: defaultSetting.title, id: '', pageName: '行业切换' },
props.global.title || defaultSetting.title,
......@@ -67,21 +76,13 @@ const BootPage = props => {
event.preventDefault();
setLoadding(true);
const config = props.global;
const loginAction = new LoginAction(props);
// const loginAction = new LoginAction(props);
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
props.instance && props.instance.updateConfig(config);
// props.instance && props.instance.getUserInfoAndConfig('', true, type);
loginAction.getUserInfoAndConfig('', true, type);
// eslint-disable-next-line no-shadow
loginAction.events.on('toggleIndustry', event => {
setLoadding(false);
props.history.push(`/?client=${props.global.client}`);
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
// window.location.reload();
});
loginAction && loginAction.getUserInfoAndConfig('', true, type);
}, []);
useEffect(() => {
// eslint-disable-next-line no-use-before-define
......@@ -96,15 +97,47 @@ const BootPage = props => {
};
useEffect(() => {
window.addEventListener('resize', handleResize);
const handleToggleIndustry = event => {
setLoadding(false);
props.history.push(`/?client=${props.global.client}`);
initMicroApps();
window.share.event.emit('triggerMicro', props.global);
props.updateCurrentIndex(0);
}
loginAction.events.on('toggleIndustry', handleToggleIndustry);
return () => {
window.removeEventListener('resize', handleResize);
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
};
});
}, []);
const renderIndustr = useMemo(
() => renderIndustries(props.global, handlePage),
[],
);
const intl = useIntl();
const toOMSUsingAnalysis = e => {
e && e.stopPropagation();
props.history.push(`/usingAnalysis`);
};
useEffect(() => {
appService.getUserInfo({
token: props.global.token,
subOID: 'subOID',
site: 'cloud',
ignoreSite: true,
})
.then(res => {
const roles = res && !res.errMsg ? res.roles : null;
const _hasRole = roles && Array.isArray(roles) && roles.filter(r => {
return r.name == '客户运维管理员';
}).length;
setHasRole(!!_hasRole);
});
}, []);
return (
<SecurityLayout>
<div className={styles.bootPage}>
......@@ -145,6 +178,14 @@ const BootPage = props => {
<Spin spinning={loadding} size="large" />
</Space>
</div>
{hasRole ? (
<div className={styles.cloudMonitorBtns}>
<div class="cloud-using-anaylysis-btn" onClick={toOMSUsingAnalysis}>
<img src={usingIcon} alt="" title="点击查看平台使用监控" />
<span>平台使用分析</span>
</div>
</div>
) : null}
</div>
</SecurityLayout>
);
......
......@@ -56,8 +56,8 @@
display: flex;
width: 1280px;
flex-wrap: wrap;
list-style: none;
justify-content: center;
list-style: none;
transition: all .5s ease-out;
overflow: hidden;
padding-top: 10px;
......@@ -126,6 +126,36 @@
left: 50%;
transform: translate(-50%, -50%);
}
.cloudMonitorBtns {
position: fixed;
height: 120px;
width: 100%;
bottom: 0px;
padding: 0 20px;
display: flex;
justify-content: end;
:global {
.cloud-using-anaylysis-btn {
cursor: pointer;
width: 100px;
display: flex;
flex-direction: column;
justify-content: center;
& > img {
width: 50px;
margin: 0 25px;
}
& > span {
color: #fff;
font-size: 14px;
width: 100%;
text-align: center;
}
}
}
}
}
@media screen and (max-width: 1440px) {
......
......@@ -6,9 +6,9 @@ const cesiumMap = props => {
const ref = useRef(null)
const storeRef = useRef(null)
useEffect(() => {
if(storeRef.current) return
if(!(props.globalConfig.mapsettings?.areasettings && globalConfig.mapsettings?.basemaps?.length > 0)) return
const mapConfig3d = props.globalConfig?.mapConfig3d
if(!(props.globalConfig.mapsettings?.areasettings && globalConfig.mapsettings?.basemaps?.length > 0)) return
if(storeRef.current) return
const {widgets} = mapConfig3d
const schemes = parseScheme.parseSchemes(mapConfig3d)
const schemeData = parseScheme.parseDatas(schemes)
......@@ -38,4 +38,4 @@ const mapDispatchToProps = dispatch => ({
}
})
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
\ No newline at end of file
export default connect(mapStateToProps, mapDispatchToProps)(cesiumMap)
/**
* 云平台使用分析
*/
import React, { useCallback, useEffect, useState, useRef } from 'react';
import { connect } from 'react-redux';
import {
Card,
DatePicker,
Radio,
Select,
Statistic,
Input,
Button,
Modal,
Form,
Space,
Spin,
ConfigProvider,
notification,
} from 'antd';
import ReactECharts from 'echarts-for-react';
import zhCN from 'antd/lib/locale/zh_CN';
import { LeftOutlined } from '@ant-design/icons';
import { cloudService } from '@/api';
import SecurityLayout from '../../../layouts/SecurityLayout';
import Basictable from '@wisdom-components/basictable';
import { actionCreators } from '../../../containers/App/store';
import styles from './index.less';
import _ from 'lodash';
import moment from 'moment';
const dateForModel = (model, date = moment()) => {
let result = { dateFrom: null, dateTo: null };
switch (model) {
case 'day':
result = {
dateFrom: date.clone().startOf('day'),
dateTo: date.clone().endOf('day'),
};
break;
case 'week':
result = {
dateFrom: date.clone().startOf('week'),
dateTo: date.clone().endOf('week'),
};
break;
case 'month':
result = {
dateFrom: date.clone().startOf('month'),
dateTo: date.clone().endOf('month'),
};
break;
case 'quarter':
result = {
dateFrom: date.clone().startOf('quarter'),
dateTo: date.clone().endOf('quarter'),
};
break;
case 'year':
result = {
dateFrom: date.clone().startOf('year'),
dateTo: date.clone().endOf('year'),
};
break;
case 'all':
default:
result = { dateFrom: null, dateTo: null };
break;
}
return result;
};
const textForModel = model => {
switch (model) {
case 'day':
return '天';
case 'week':
return '周';
case 'month':
return '月';
case 'quarter':
return '季度';
case 'year':
return '年';
case 'all':
return '全部';
case 'custom':
return '自定义';
default:
return model;
}
};
const defaultFormat = 'YYYY-MM-DD HH:mm:ss';
const defaultShowModels = ['all', 'week', 'month', 'quarter', 'year', 'custom'];
const DatePickerGroup = ({
onChange,
format = defaultFormat,
showModels = defaultShowModels,
defaultModel = 'all',
defaultDate,
value,
dateModel,
}) => {
const [model, setModel] = useState(defaultModel);
const [dateValue, setDateValue] = useState(() =>
dateForModel(defaultModel, defaultDate),
);
useEffect(() => {
if (value || dateModel) {
setModel(dateModel);
setDateValue(value);
}
}, [value, dateModel]);
// 切换类型
const changeModel = e => {
const _model = e.target.value;
const _dateValue = dateForModel(_model);
if (!value && !dateModel) {
setModel(_model);
setDateValue(_dateValue);
if (_model === 'custom') return;
}
const _dateFrom =
_dateValue && _dateValue.dateFrom
? _dateValue.dateFrom.format(format)
: '';
const _dateTo =
_dateValue && _dateValue.dateTo ? _dateValue.dateTo.format(format) : '';
onChange &&
onChange(
{
dateFrom: _dateFrom,
dateTo: _dateTo,
},
_model,
);
};
// 切换时间
const changeDate = (date, dateString) => {
const _dateValue = dateForModel(model, date);
const _dateFrom =
_dateValue && _dateValue.dateFrom
? _dateValue.dateFrom.format(format)
: '';
const _dateTo =
_dateValue && _dateValue.dateTo ? _dateValue.dateTo.format(format) : '';
if (!value && !dateModel) {
setDateValue(_dateValue);
}
onChange &&
onChange(
{
dateFrom: _dateFrom,
dateTo: _dateTo,
},
model,
);
};
// 切换范围时间
const changeRangeDate = (dates, dateStrings) => {
const _dateValue = { dateFrom: dates?.[0], dateTo: dates?.[1] };
const _dateFrom =
_dateValue && _dateValue.dateFrom
? _dateValue.dateFrom.format(format)
: '';
const _dateTo =
_dateValue && _dateValue.dateTo ? _dateValue.dateTo.format(format) : '';
if (!value && !dateModel) {
setDateValue(_dateValue);
}
onChange &&
onChange(
{
dateFrom: _dateFrom,
dateTo: _dateTo,
},
model,
);
};
// 渲染时间选择器
const renderDatePicker = () => {
let _result = null;
switch (model) {
case 'day':
_result = (
<DatePicker onChange={changeDate} value={dateValue.dateFrom} />
);
break;
case 'week':
_result = (
<DatePicker
picker="week"
onChange={changeDate}
value={dateValue.dateFrom}
/>
);
break;
case 'month':
_result = (
<DatePicker
picker="month"
onChange={changeDate}
value={dateValue.dateFrom}
/>
);
break;
case 'quarter':
_result = (
<DatePicker
picker="quarter"
onChange={changeDate}
value={dateValue.dateFrom}
/>
);
break;
case 'year':
_result = (
<DatePicker
picker="year"
onChange={changeDate}
value={dateValue.dateFrom}
/>
);
break;
case 'custom':
_result = (
<DatePicker.RangePicker
onChange={changeRangeDate}
value={[dateValue.dateFrom, dateValue.dateTo]}
/>
);
break;
case 'all':
default:
_result = null;
break;
}
return _result;
};
return (
<Space size={8}>
<Radio.Group
value={model}
onChange={changeModel}
style={{ whiteSpace: 'nowrap' }}
>
{showModels.map(item => (
<Radio.Button value={item} key={item}>
{textForModel(item)}
</Radio.Button>
))}
</Radio.Group>
{renderDatePicker()}
</Space>
);
};
const LoginStatisticModal = ({
visible,
setVisible,
date, // 查询日期,如:2021-11 2021-11-01
timeMode,
}) => {
const [pageIndex, setPageIndex] = useState(1);
const [pageSize, setPageSize] = useState(20);
const [totalNum, setTotalNum] = useState(0);
const [searchInfo, setSearchInfo] = useState('');
const [tableData, setTableData] = useState([]);
const [loading, setLoading] = useState(false);
const searchInput = useRef();
const getAccountData = () => {
let stime, etime, timeModeTemp;
if (timeMode === '月') {
timeModeTemp = 'month';
} else {
timeModeTemp = 'day';
}
stime = moment(new Date(date))
.startOf(timeModeTemp)
.format('YYYY-MM-DD HH:mm:ss');
etime = moment(new Date(date))
.endOf(timeModeTemp)
.format('YYYY-MM-DD HH:mm:ss');
setLoading(true);
cloudService
.getAccountPageList({
pageSize: pageSize,
pageIndex: pageIndex,
sortFields: '登录时间',
direction: 'desc',
accountName: '用户登录台账',
info: searchInfo,
queryWhere:
" and (登录时间 >= '" + stime + "' and 登录时间 <= '" + etime + "')",
ignoreSite: true,
})
.then(res => {
setLoading(false);
const data1 = JSON.parse(res?.jsonData ?? '[]');
const _tableData = data1.map((item, index) => ({
...item,
key: index,
}));
setTableData(_tableData);
setTotalNum(res?.totalRcdNum ?? 0);
})
.catch(err => {
setLoading(false);
notification.error({
message: err.message,
});
});
};
useEffect(() => {
if (visible) {
getAccountData();
}
}, [searchInfo, visible, date, pageIndex]);
const columns = [
{
title: '序号',
key: '序号',
render: (text, record, index) => (pageIndex - 1) * pageSize + index + 1,
align: 'center',
width: 80,
},
{
title: 'client',
key: 'client',
dataIndex: 'client',
align: 'center',
},
{
title: 'origin',
key: 'site',
dataIndex: 'site',
align: 'center',
},
{
title: '登录名',
key: '登录名',
dataIndex: '登录名',
align: 'center',
},
{
title: '登录时间',
key: '登录时间',
dataIndex: '登录时间',
align: 'center',
},
];
return (
<Modal
title={`用户登录台账${date}`}
visible={visible}
onCancel={() => setVisible(false)}
footer={null}
wrapClassName={styles['login-log-modal']}
width={'60%'}
>
<Spin spinning={loading}>
<div className="login-log-modal-header">
<Form.Item label="快速索引">
<Input.Search
ref={searchInput}
placeholder="请输入关键字"
style={{ width: 400 }}
onSearch={value => {
setSearchInfo(value);
setPageIndex(1);
}}
/>
</Form.Item>
<Button
onClick={e => {
setSearchInfo('');
searchInput.current.state.value = '';
searchInput.current.input.value = '';
setPageIndex(1);
}}
>
重置
</Button>
</div>
<div className="login-log-modal-content">
<Basictable
bordered
dataSource={tableData}
columns={columns}
pagination={{
showSizeChanger: true,
showQuickJumper: true,
total: totalNum,
pageSize: pageSize,
current: pageIndex,
onChange: (page, pageSize) => {
setPageIndex(page);
setPageSize(pageSize);
},
}}
/>
</div>
</Spin>
</Modal>
);
};
const initIndustries = [
'供水',
'排水',
'能源',
'农饮水',
'直饮水',
'大数据',
'实验室',
'项目案例',
];
const industryColors = {
供水: 'rgb(38,150,250)',
农饮水: 'rgb(23,198,149)',
排水: 'rgb(246,171,37)',
能源: 'rgb(113,183,62)',
直饮水: 'rgb(84,189,204)',
大数据: 'rgb(116,87,232)',
实验室: 'rgb(96,154,232)',
项目案例: 'rgb(141,74,210)',
设备管理: 'rgb(141,74,210)',
};
const myColor = [
'#008EFE',
'#39DDD1',
'#FF9700',
'#844BF0',
'#625ba1',
'#898989',
'#9c9800',
'#007f54',
'#a195c5',
'#103667',
'#f19272',
];
const initCounterData = [
{
title: '环境数量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '总功能数量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '常用功能数量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '新增功能数量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '总用户数',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '活跃用户数',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '当期访问量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
{
title: '当期点击量',
value: '--',
icon: '',
suffix: '',
prefix: '',
},
];
const defaultPickeDate = moment().add(-1, 'month');
const defaultPickModel = 'month';
const CloudUsingAnalysis = () => {
const [loading, setLoading] = useState(false);
const [industries, setIndustries] = useState(initIndustries); // 行业列表
const [industry, setindustry] = useState(); // 条件:行业类型
const [type, setType] = useState(''); // 条件:环境类型 1 -> 客户环境,2 -> 演示环境
const [dateFrom, setDateFrom] = useState(
defaultPickeDate.startOf(defaultPickModel).format(defaultFormat),
);
const [dateTo, setDateTo] = useState(
defaultPickeDate.endOf(defaultPickModel).format(defaultFormat),
);
const [timeMode, setTimeMode] = useState('日');
const [limitNum, steLimitNum] = useState(20);
const [countersData, setCountersData] = useState(initCounterData); // 统计总览数据
const [loginsOption, setLoginsOption] = useState(null); // loigns chart option
const [loginDate, setLoginDate] = useState('');
const [loginModalVisible, setLoginModalVisible] = useState(false);
const [industriesChartData, setIndustriesChartData] = useState([]);
const [levelType, setLevelType] = useState('all');
const [industryOption, setIndustryOption] = useState(null); // industry proportion chart option
const [hotsOption, setHotsOption] = useState(null); // hots enviroment chart option
const [productsOption, setProdutsOption] = useState(null);
const [cusViewData, setCusViewData] = useState([]);
const [cusViewTableData, setCusViewTableData] = useState([]); // 用户访问统计
const cusViewInput = useRef();
// 登录量统计,查看详情
const showLoginDetails = useCallback(event => {
setLoginDate(event.name);
setLoginModalVisible(true);
}, []);
// 行业占比分析,查看下一级
const showIndustryLevel = useCallback(event => {
const pieName = event.name;
const _chartData = industriesChartData.find(item => item.name === pieName);
if (!_chartData) return;
const _chartOption = buildIndustryOption(_chartData ? _chartData.data : []);
setLevelType(pieName);
setIndustryOption(_chartOption);
}, []);
const fetchIndustries = () => {
cloudService
.getDataDictionaryList({
nodeNameArr: '行业',
ignoreSite: true,
})
.then(res => {
if (res.data && res.data.length) {
const _industries = res.data[0].childList.map(item => item.NODEVALUE);
setIndustries(_industries);
}
});
};
const buildCounterOptions = (custResult, funcResult, loginResult) => {
const funcNum = funcResult.total || 0;
const usefuncNum = funcResult.currentNum || 0;
const usefuncPercent =
funcNum == 0 ? 0 : ((usefuncNum / funcNum) * 100).toFixed(0);
const _counterOptions = [
{
title: '环境数量',
value: custResult.total || 0,
icon: '',
suffix: '',
prefix: '',
},
{
title: '总功能数量',
value: funcNum,
icon: '',
suffix: '',
prefix: '',
},
{
title: '常用功能数量',
value: funcResult.currentNum || 0,
icon: '',
suffix: <span style={{ color: 'orange' }}>/ {usefuncPercent}%</span>,
prefix: '',
},
{
title: '新增功能数量',
value: funcResult.addNum || 0,
icon: '',
suffix: '',
prefix: '',
},
{
title: '总用户数',
value: loginResult.total || 0,
icon: '',
suffix: '',
prefix: '',
},
{
title: '活跃用户数',
value: loginResult.currentNum || 0,
icon: '',
suffix: '',
prefix: '',
},
{
title: '当期访问量',
value: loginResult.loginNum || 0,
icon: '',
suffix: '',
prefix: '',
},
{
title: '当期点击量',
value: funcResult.visitTotal || 0,
icon: '',
suffix: '',
prefix: '',
},
];
return _counterOptions;
};
// 登录量统计图表(统计:移动端、PC、全部登录人次)
const buildLoginsOption = (loginResult, mobilelogin) => {
const xCategories = [],
loginData = [],
mobileldata = [],
pcdata = [];
if (loginResult.datas && loginResult.datas.length) {
loginResult.datas.forEach(d => {
xCategories.push(d.time);
loginData.push(d.num);
const mData = mobilelogin.datas.find(m => {
return m.time == d.time;
});
if (mData && mData.num) {
mobileldata.push(mData.num);
pcdata.push(d.num - mData.num);
} else {
mobileldata.push(0);
pcdata.push(d.num);
}
});
}
return {
grid: {
top: 30,
bottom: 30,
left: 50,
right: 10,
},
legend: {
show: true,
top: -10,
padding: 20,
itemWidth: 14,
itemHeight: 6,
itemGap: 20,
textStyle: {
padding: [0, 0, 0, 8],
fontSize: 14,
color: '#00000065',
},
},
xAxis: {
type: 'category',
data: xCategories,
splitLine: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
},
},
axisTick: {
show: false,
},
axisLabel: {
color: '#808080',
},
},
yAxis: [
{
type: 'value',
minInterval: 1,
name: '登录人次',
nameGap: 10,
nameTextStyle: {
color: '#808080',
align: 'right',
padding: [0, 0, 0, 8],
},
splitLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
type: 'dashed',
},
},
axisLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
},
},
axisLabel: {
color: '#808080',
},
formatter: function(value, index) {
// value大于1000时除以1000并拼接k,小于1000按原格式显示
if (value >= 1000) {
value = value / 1000 + 'k';
} else if (value < 1000) {
value;
}
return value;
},
},
],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
series: [
{
name: '移动端',
type: 'bar',
stack: '客户端',
barMaxWidth: '40',
yAxisIndex: 0,
data: mobileldata,
itemStyle: {
color: '#39DDD1',
},
},
{
name: 'PC',
type: 'bar',
stack: '客户端',
barMaxWidth: '40',
yAxisIndex: 0,
data: pcdata,
itemStyle: {
color: '#008EFE',
},
},
{
name: '总登录人次',
type: 'line',
smooth: true,
yAxisIndex: 0,
data: loginData,
itemStyle: {
color: '#FFAE00',
},
},
],
};
};
// 行业占比分析图表(统计:行业点击量占比)
const buildIndustryOption = chartdata => {
return {
title: {
show: false,
text: '',
},
color: [
'#008EFE',
'#39DDD1',
'#FF9700',
'#844BF0',
'#625ba1',
'#898989',
'#9c9800',
'#007f54',
'#a195c5',
'#103667',
'#f19272',
],
tooltip: {
trigger: 'item',
animation: false,
formatter(params) {
return `<div style="display:inline-block;margin-right:7px;margin-bottom:2px;border-radius:5px;width:5px;height:5px;background-color:${
params.color.length > 7 ? params.color.slice(0, -2) : params.color
}"></div>${
params.name
}<div style="display:inline-block;">:</div><span style="color:${
params.color.length > 7 ? params.color.slice(0, -2) : params.color
};margin-left:10px">${params.value} </span>`;
},
},
legend: {
show: false,
top: 'bottom',
// right: '10%',
// left: '15%',
// borderColor: '#DBE8EF',
// borderWidth: 1,
// orient: 'horizontal',
padding: 20,
itemWidth: 14,
itemHeight: 6,
itemGap: 20,
textStyle: {
padding: [0, 0, 0, 8],
fontSize: 14,
color: '#00000065',
},
itemStyle: {},
},
series: [
{
name: '行业统计',
type: 'pie',
center: ['50%', '50%'],
// radius: ['55%', '70%'],
avoidLabelOverlap: false,
animation: true,
hoverAnimation: true,
itemStyle: {
opacity: 0.8,
},
label: {
normal: {
formatter(params) {
return `{name|${params.name}}:{value| ${
params.value
}}个 {value|${Number(params.percent).toFixed(1)}}{unit| %}`;
},
rich: {
name: {
fontSize: 14,
color: '#333333',
fontFamily: 'DINPro',
lineHeight: 20,
opacity: 0.85,
},
value: {
fontSize: 14,
// color: '#333333',
fontFamily: 'DINPro',
lineHeight: 20,
fontWeight: 'bold',
opacity: 0.85,
},
unit: {
color: '#333333',
},
},
},
},
emphasis: {
label: {
show: true,
},
},
labelLine: {
show: true,
lineStyle: {
cap: 'round',
},
// length: 10,
// length2: 40,
},
data: chartdata,
},
],
};
};
const buildIndustryData = datas => {
let industrydata = [],
moredata = [],
cIndex = 0;
datas.length &&
datas.forEach(d => {
industrydata.push({
name: d.aindustry,
value: d.count,
drilldown: d.aindustry,
color: industryColors[d.aindustry]
? industryColors[d.aindustry]
: myColor[cIndex++],
});
var mData = {
id: d.aindustry,
name: d.aindustry,
data: [],
};
d.details &&
d.details.length &&
d.details.forEach(i => {
mData.data.push({
name: i.environmentName,
value: i.num,
});
});
moredata.push(mData);
});
moredata.unshift({ id: 'all', name: 'all', data: industrydata });
return moredata;
};
// 环境热度分析图表(统计:环境功能点击量分布)
const buildHotsOption = datas => {
let chartDatas = [],
cIndex = 0;
chartDatas = datas.map(d => {
// 预处理,将d.enviromentTypes 下的 functionInfos 提取出来
const enterprises = [];
d.environmentTypes.forEach(e => {
e.functionInfos.forEach(f => {
// 所有的functionsInfo 根据 enterpriseName 分类
let enterprise = enterprises.find(
ent => ent.enterpriseName === f.enterpriseName,
);
let _functionInfos = [];
if (!enterprise) {
_functionInfos = [];
enterprises.push({
enterpriseName: f.enterpriseName,
functionInfos: _functionInfos,
});
} else {
_functionInfos = enterprise.functionInfos;
}
_functionInfos.push({ ...f });
});
});
// 对提取后的分类统计
const dChildren = enterprises.map(e => {
const eChildren = e.functionInfos.map(f => ({
name: f.functionName,
value: f.functionVisNum,
}));
return {
name: e.enterpriseName,
children: eChildren,
};
});
return {
name: d.aindustry,
children: dChildren,
};
});
return {
title: {
text: null,
},
tooltip: {},
series: [
{
name: '平台环境',
type: 'treemap',
// visibleMin: 300,
data: chartDatas,
leafDepth: 2,
levels: [
{
itemStyle: {
borderColor: '#555',
borderWidth: 4,
gapWidth: 4,
},
},
{
colorSaturation: [0.3, 0.6],
itemStyle: {
borderColorSaturation: 0.7,
gapWidth: 2,
borderWidth: 2,
},
},
{
colorSaturation: [0.3, 0.5],
itemStyle: {
borderColorSaturation: 0.6,
gapWidth: 1,
},
},
{
colorSaturation: [0.3, 0.5],
},
],
},
],
};
return {
title: {
text: null,
},
credits: { enabled: false },
series: [
{
type: 'treemap',
layoutAlgorithm: 'squarified',
allowDrillToNode: true,
dataLabels: {
enabled: false,
},
levelIsConstant: false,
levels: [
{
level: 1,
dataLabels: {
enabled: true,
},
borderWidth: 2,
},
],
data: chartDatas,
},
],
};
};
// 环境使用次数统计图表(统计:各环境下产品功能使用次数)
const buildProductsOption = funcResult => {
var funcs = [],
types = [];
funcResult.length &&
funcResult.forEach(i => {
if (!i.environmentTypes || !_.isArray(i.environmentTypes))
return void 0;
i.environmentTypes.forEach(e => {
if (!e.functionInfos || !e.functionInfos.length) return void 0;
e.functionInfos.forEach(f => {
if (!f.functionName || f.functionName == '') return void 0;
var funcItem = funcs.find(_f => {
return _f.fName == f.functionName;
});
if (!funcItem) {
funcItem = {
fName: f.functionName,
总和: f.functionVisNum,
};
funcItem[i.aindustry] = f.functionVisNum;
funcs.push(funcItem);
} else {
funcItem['总和'] += f.functionVisNum;
funcItem[i.aindustry] = f.functionVisNum;
}
});
});
if (types.indexOf(i.aindustry) < 0) types.push(i.aindustry);
});
funcs = funcs.sort(function(a, b) {
return b['总和'] - a['总和'];
});
var products = [],
totalData = [],
eData = [],
cIndex = 0;
types.forEach(t => {
eData.push({
name: t,
type: 'bar',
barMaxWidth: '40',
stack: '环境功能',
yAxisIndex: 0,
data: [],
itemStyle: {
color: industryColors[t.aindustry]
? industryColors[t.aindustry]
: myColor[cIndex++ % myColor.length],
},
});
});
funcs.forEach(funcItem => {
products.push(funcItem.fName);
totalData.push(funcItem['总和']);
eData.forEach(data => {
if (funcItem.hasOwnProperty(data.name)) {
data.data.push(funcItem[data.name]);
} else {
data.data.push(0);
}
});
});
return {
grid: {
top: 30,
bottom: 30,
left: 50,
right: 10,
},
legend: {
show: true,
top: -8,
padding: [20, 0, 20, 80],
itemWidth: 14,
itemHeight: 6,
itemGap: 10,
textStyle: {
padding: [0, 0, 0, 8],
fontSize: 14,
color: '#00000065',
},
},
xAxis: {
type: 'category',
data: products,
splitLine: {
show: false,
},
axisLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
},
},
axisTick: {
show: false,
},
axisLabel: {
color: '#808080',
},
},
yAxis: [
{
type: 'value',
minInterval: 1,
name: '访问量 (人·次)',
nameGap: 10,
nameTextStyle: {
color: '#808080',
align: 'middle',
padding: [0, -10, 0, 0],
},
splitLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
type: 'dashed',
},
},
axisLine: {
show: true,
lineStyle: {
color: '#DBE8EF',
},
},
axisLabel: {
color: '#808080',
formatter: function(value, index) {
// value大于1000时除以1000并拼接k,小于1000按原格式显示
if (value >= 1000) {
value = value / 1000 + 'k';
} else if (value < 1000) {
value;
}
return value;
},
},
},
],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
},
},
series: [
...eData,
{
name: '总访问量',
type: 'line',
stack: '环境功能',
smooth: true,
yAxisIndex: 0,
data: totalData,
itemStyle: {
color: '#FFAE00',
},
},
],
};
};
const buildCusViewsData = userTableData => {
let list = [],
datas = userTableData;
datas = datas.sort(function(a, b) {
return b.num - a.num;
});
datas.length &&
datas.forEach(d => {
const productData = {};
d.userLoginDetails.forEach(f => {
if (!productData.hasOwnProperty(f.projectName)) {
productData[f.projectName] = [];
}
if (f.projectNum >= limitNum)
productData[f.projectName].push(f.functionName);
});
list.push({
userName: d.userName,
count: d.num,
products: productData,
key: d.userName,
});
});
return list;
};
const getDatas = () => {
setLoading(true);
const req0 = cloudService.getLoginStatistic({
dateFrom: dateFrom,
dateTo: dateTo,
mode: timeMode,
industryType: industry,
enviromentType: type,
client: '',
ignoreSite: true,
});
const req1 = cloudService.getFunctionsStatistic({
dateFrom: dateFrom,
dateTo: dateTo,
industryType: industry,
enviromentType: type,
client: '',
visitNum: limitNum,
ignoreSite: true,
});
const req2 = cloudService.getEnviromentStatistic({
industryType: industry,
enviromentType: type,
ignoreSite: true,
});
const req3 = cloudService.getUserLoginStatistic({
dateFrom: dateFrom,
dateTo: dateTo,
industryType: industry,
enviromentType: type,
client: '',
visitNum: limitNum,
ignoreSite: true,
});
const req4 = cloudService.getLoginStatistic({
dateFrom: dateFrom,
dateTo: dateTo,
mode: timeMode,
industryType: industry,
enviromentType: type,
client: 'miniapp',
ignoreSite: true,
});
Promise.all([req0, req1, req2, req3, req4])
.then(results => {
setLoading(false);
const loginResult =
results &&
results[0] &&
results[0].say &&
results[0].say.statusCode == '0000' &&
results[0].getMe.length
? results[0].getMe[0]
: {};
const funcResult =
results &&
results[1] &&
results[1].say &&
results[1].say.statusCode == '0000' &&
results[1].getMe.length
? results[1].getMe[0]
: {};
const custResult =
results &&
results[2] &&
results[2].say &&
results[2].say.statusCode == '0000' &&
results[2].getMe.length
? results[2].getMe[0]
: {};
const viewResult =
results &&
results[3] &&
results[3].say &&
results[3].say.statusCode == '0000' &&
results[3].getMe.length
? results[3].getMe[0]
: {};
const mobilelogin =
results &&
results[4] &&
results[4].say &&
results[4].say.statusCode == '0000' &&
results[4].getMe.length
? results[4].getMe[0]
: {};
// build counters data
const _countersData = buildCounterOptions(
custResult,
funcResult,
loginResult,
);
setCountersData(_countersData);
// build logins chart option
const _loginsOption = buildLoginsOption(loginResult, mobilelogin);
setLoginsOption(_loginsOption);
// build industry chart option
const _industriesData = buildIndustryData(
custResult.environmentInfos && custResult.environmentInfos.length
? custResult.environmentInfos
: [],
);
const _chartData = _industriesData.find(item => item.id === levelType);
const _industryOption = buildIndustryOption(
_chartData ? _chartData.data : [],
);
setIndustriesChartData(_industriesData);
setIndustryOption(_industryOption);
// build hots enviroment chart option
const _hotsOption = buildHotsOption(
funcResult.datas && funcResult.datas.length ? funcResult.datas : [],
);
setHotsOption(_hotsOption);
const _productsOption = buildProductsOption(
funcResult.datas && funcResult.datas.length ? funcResult.datas : [],
);
setProdutsOption(_productsOption);
const _cusViewData = buildCusViewsData(
viewResult.userLoginStatistics &&
viewResult.userLoginStatistics.length
? viewResult.userLoginStatistics
: [],
);
setCusViewData(_cusViewData);
const _newData = _cusViewData.filter(
item =>
item.userName &&
item.userName.includes(cusViewInput?.current?.input?.value ?? ''),
);
setCusViewTableData(_newData);
})
.catch(err => {
setLoading(false);
notification.error({
message: err.message,
});
});
};
useEffect(() => {
fetchIndustries();
getDatas();
}, [dateFrom, dateTo, industry, type]);
const columns = [
{
title: '序号',
key: '序号',
render: (text, record, index) => index + 1,
align: 'center',
width: 100,
},
{
title: '账号名称',
key: '账号名称',
dataIndex: 'userName',
align: 'center',
width: 200,
},
{
title: '访问次数',
key: '访问次数',
dataIndex: 'count',
align: 'center',
width: 150,
},
{
title: '常用环境及功能',
key: '常用环境及功能',
render: (text, record, index) => {
let temp = [];
record.products &&
_.isObject(record.products) &&
Object.keys(record.products).forEach(key => {
temp.push(
<>
<span className="table-cell-bold">{key}</span>
<span>
{record.products[key] && _.isArray(record.products[key])
? record.products[key].join(',')
: ''}
</span>
<br />
</>,
);
});
return temp;
},
},
];
const dateChange = ({ dateFrom, dateTo }, model) => {
setDateFrom(dateFrom);
setDateTo(dateTo);
if (moment(dateTo).diff(moment(dateFrom), 'days') > 362) {
setTimeMode('月');
} else {
setTimeMode('日');
}
};
const onSearch = value => {
if (!cusViewData) return;
const _newData = cusViewData.filter(
item => item.userName && item.userName.includes(value),
);
setCusViewTableData(_newData);
};
const backToBootPage = e => {
window.history.back();
};
return (
<SecurityLayout>
<ConfigProvider locale={zhCN}>
<div className={styles.usingAnalysis}>
<Spin spinning={loading}>
<div className="cua-content">
<div className="cua-header">
<div className="back-btn" onClick={backToBootPage}>
<LeftOutlined />
返回
</div>
<div className="filter-item">
<span className="filter-item-label">统计时间:</span>
<DatePickerGroup
showModels={[
'day',
'week',
'month',
'quarter',
'year',
'custom',
]}
onChange={dateChange}
defaultModel="month"
defaultDate={moment().add(-1, 'month')}
/>
</div>
<div className="filter-item">
<span className="filter-item-label">行业切换:</span>
<Select
placeholder="请选择行业"
allowClear
value={industry}
onChange={value => setindustry(value)}
>
{industries.map(item => (
<Select.Option value={item} key={item}>
{item}
</Select.Option>
))}
</Select>
</div>
<div className="filter-item">
<span className="filter-item-label">环境类型:</span>
<Radio.Group
value={type}
onChange={e => setType(e.target.value)}
>
<Radio value="">全部</Radio>
<Radio value="2">演示环境</Radio>
<Radio value="1">客户环境</Radio>
</Radio.Group>
</div>
<div className="sub-title">数据来源: Panda-Water.cn</div>
</div>
<div className="counter-list">
{countersData &&
countersData.map((item, n) => (
<Card key={n} bordered={false}>
<Statistic
title={item.title}
value={item.value}
// precision={2}
// prefix={<ArrowUpOutlined />}
suffix={item.suffix}
/>
</Card>
))}
</div>
<div className="cua-main">
<div className="cua-main-middle">
<div className="cua-chart-box">
<div className="cua-chart-header">
<div className="cua-chart-title">登录量统计</div>
</div>
<div className="cua-chart-content">
{loginsOption ? (
<ReactECharts
className="po-type-hour-chart"
style={{ width: '100%', height: '100%' }}
opts={{ renderer: 'svg' }}
option={loginsOption}
onEvents={{
click: showLoginDetails,
}}
/>
) : null}
</div>
</div>
<div className="cua-chart-box">
<div className="cua-chart-header">
<div className="cua-chart-title">行业占比分析</div>
<div className="cua-chart-subtitle">
{levelType === 'all' ? null : (
<Button
onClick={e => {
const _industryData = industriesChartData.find(
item => item.name === 'all',
);
const _industryOption = buildIndustryOption(
_industryData ? _industryData.data : [],
);
setLevelType('all');
setIndustryOption(_industryOption);
}}
>
返回
</Button>
)}
</div>
</div>
<div className="cua-chart-content">
{industryOption ? (
<ReactECharts
className="po-type-hour-chart"
style={{ width: '100%', height: '100%' }}
opts={{ renderer: 'svg' }}
option={industryOption}
onEvents={{
click: showIndustryLevel,
}}
/>
) : null}
</div>
</div>
<div className="cua-chart-box">
<div className="cua-chart-header">
<div className="cua-chart-title">环境热度分析</div>
</div>
<div className="cua-chart-content">
{hotsOption ? (
<ReactECharts
className="po-type-hour-chart"
style={{ width: '100%', height: '100%' }}
opts={{ renderer: 'svg' }}
option={hotsOption}
/>
) : null}
</div>
</div>
</div>
<div className="cua-main-bottom">
<div className="cua-chart-box" style={{ overflow: 'hidden' }}>
<div className="cua-chart-header">
<div className="cua-chart-title">用户访问统计</div>
<div className="cua-chart-subtitle">
<Input.Search
ref={cusViewInput}
placeholder="搜索用户名称"
onSearch={onSearch}
style={{ width: 300 }}
/>
</div>
</div>
<div className="cua-chart-content cua-customer-view">
<Basictable
bordered
columns={columns}
dataSource={cusViewTableData}
pagination={false}
/>
</div>
</div>
<div className="cua-chart-box enviromentusing-chart-box">
<div className="cua-chart-header">
<div className="cua-chart-title">环境使用统计</div>
</div>
<div className="cua-chart-content">
{productsOption ? (
<ReactECharts
className="po-type-hour-chart"
style={{ width: '100%', height: '100%' }}
opts={{ renderer: 'svg' }}
option={productsOption}
/>
) : null}
</div>
</div>
</div>
</div>
</div>
{loginModalVisible ? (
<LoginStatisticModal
visible={loginModalVisible}
setVisible={setLoginModalVisible}
date={loginDate}
timeMode={timeMode}
/>
) : null}
</Spin>
</div>
</ConfigProvider>
</SecurityLayout>
);
};
const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
instance: state.getIn(['global', 'instance']),
});
const mapDispatchToProps = dispatch => ({
updateConfig(config) {
dispatch(actionCreators.getConfig(config));
},
createContext(data) {
dispatch(actionCreators.createContext(data));
},
updateCurrentIndex(index) {
dispatch(actionCreators.updateCurrentIndex(index));
},
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(CloudUsingAnalysis);
@import '~antd/es/style/themes/default.less';
@background-color-container: #f5f5f5;
@border-radius: 2px;
.usingAnalysis {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
background-color: @background-color-container;
:global {
.@{ant-prefix}-spin-nested-loading,
.@{ant-prefix}-spin-container {
height: 100%;
}
.anticon {
vertical-align: 0.125em;
}
.back-btn {
font-size: 16px;
opacity: 0.75;
cursor: pointer;
line-height: 32px;
user-select: none;
.anticon {
transform: translateX(0px);
transition: transform 0.3s;
}
&:hover {
.anticon {
transform: translateX(-4px);
}
}
}
.cua-content {
width: 100%;
height: 100%;
min-width: 1150px;
// padding: 5px 8px;
// 顶部筛选条件
.cua-header {
background-color: #FFF;
border-radius: @border-radius;
padding: 8px;
display: flex;
align-items: center;
gap: 20px;
.filter-item {
min-width: 220px;
.@{ant-prefix}-select {
width: 140px;
}
}
.sub-title {
margin-left: auto;
font-size: 12px;
color: #aaa;
}
}
.counter-list {
margin-top: 4px;
display: flex;
gap: 4px;
.@{ant-prefix}-card {
flex: 1 1;
.@{ant-prefix}-card-body {
padding: 8px;
}
}
}
.cua-main {
height: calc(100% - 136px);
margin-top: 4px;
display: flex;
flex-direction: column;
.cua-main-middle {
flex: 1;
overflow: hidden;
width: 100%;
min-height: 200px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
gap: 4px;
}
.cua-main-bottom {
flex: none;
height: 50%;
width: 100%;
min-height: 320px;
display: flex;
justify-content: space-between;
gap: 4px;
.cua-customer-view {
padding: 10px;
.table-cell-bold {
font-weight: bold;
}
.@{ant-prefix}-table-thead th {
text-align: center;
}
}
}
.cua-chart-box {
flex: 1;
background-color: #FFF;
padding: 4px 8px 8px 8px;
display: flex;
flex-direction: column;
.cua-chart-header {
flex: none;
display: flex;
align-items: center;
.cua-chart-title {
font-weight: bold;
line-height: 32px;
&::before {
content: "";
display: inline-block;
width: 3px;
height: 14px;
background-color: #1890ff;
vertical-align: -0.125em;
margin-right: 8px;
}
}
.cua-chart-subtitle {
margin-left: auto;
}
}
.cua-chart-content {
flex: 1;
overflow: hidden;
}
&.enviromentusing-chart-box {
.cua-chart-content {
overflow: visible;
}
}
}
}
}
}
}
.login-log-modal {
:global {
.login-log-modal-header {
display: flex;
margin-bottom: 16px;
.@{ant-prefix}-form-item {
margin-bottom: 0;
margin-right: 8px;
}
}
.login-log-modal-content {
height: 500px;
}
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ import Iframe from 'react-iframe';
import { connect } from 'react-redux';
const ShareFrame = props => {
const state = props.location.state || {};
debugger
if (!state.linkUrl) {
return null;
}
......
......@@ -223,11 +223,18 @@ class Login {
if (result && result.length > 0) {
const config = result.shift();
const homeType = config.productType || 'civweb4';
// 产品类型和首页路径同时有才行
const homepage =
homeType && (params.getParams('redirect') || config.homepage)
? homeType +
'/' +
(params.getParams('redirect') || config.homepage)
: '';
self.globalConfig = Object.assign(self.globalConfig, config, {
theme: self.globalConfig.theme,
menu: self.globalConfig.menu,
style: self.globalConfig.style,
homepage: homeType + '/' + (params.getParams('redirect') || self.globalConfig.homepage || config.homepage),
homepage: homepage,
});
if(self.globalConfig.hasOwnProperty('webConfig')) {
......@@ -255,6 +262,7 @@ class Login {
// this.events.removeAllListeners('toggleIndustry')
// window.share.event = this.events;
if (
self.globalConfig.userInfo &&
self.globalConfig.userInfo.site &&
self.globalConfig.userInfo.site.length > 0
) {
......@@ -317,7 +325,8 @@ class Login {
return false;
}
this.handleLoginError();
Logger.log('获取网络配置失败');
// Logger.log('获取网络配置失败');
console.log('获取网络配置失败');
}
})
.catch(error => {
......@@ -332,7 +341,8 @@ class Login {
let MAX_BOTTOM = 0;
let isScale = false;
let widgetIndex = -1;
this.globalConfig.uiwidgets && this.globalConfig.uiwidgets.map((item, index) => {
this.globalConfig.uiwidgets &&
this.globalConfig.uiwidgets.map((item, index) => {
// eslint-disable-next-line radix
if (parseInt(item.bottom) > MAX_BOTTOM) {
// eslint-disable-next-line radix
......@@ -347,7 +357,7 @@ class Login {
widgetIndex = index;
});
const { layers } = this.globalConfig.mapsettings;
const { layers = [] } = this.globalConfig.mapsettings || {};
if (layers.length === 0) {
widgetIndex !== -1 && this.globalConfig.uiwidgets.splice(widgetIndex, 1);
return Promise.resolve({});
......@@ -847,7 +857,6 @@ class Login {
}
login(usr, pwd, userPhone, isRememberPWD, mode = SERVICE_APP_LOGIN_MODE.password) {
this.events.removeAllListeners('loginError');
const self = this;
if(window.globalConfig && window.globalConfig.hasGateWay) {
usr = userPhone ? userPhone: usr;
......
......@@ -59,27 +59,14 @@ const Login = forwardRef((props, _ref) => {
setSubmitting(true);
props.updateCurrentIndex && props.updateCurrentIndex(-1);
action && action.events.on('loginSuccess', event => {
setSubmitting(false);
props.updateCurrentIndex && props.updateCurrentIndex(0);
props.history.push(`/`);
// debugger
// window.share.event.emit('triggerMicro', props.global);
initMicroApps();
});
action && action.events.on('loginError', event => {
setVisible(false);
setSubmitting(false);
});
action && action.events.on('loginVisible', status => {
setVisible(status);
});
};
useEffect(() => {
if (props.loginMode === LOGIN_WAY.WeChart) {
// if (props.loginMode === LOGIN_WAY.WeChart) {
action &&
action.events.on('loginSuccess', event => {
setSubmitting(false);
props.updateCurrentIndex && props.updateCurrentIndex(0);
props.history.push(`/?client=${props.global.client}`);
// window.share.event.emit('triggerMicro', props.global);
initMicroApps();
......@@ -89,6 +76,15 @@ const Login = forwardRef((props, _ref) => {
setVisible(false);
setSubmitting(false);
});
action &&
action.events.on('loginVisible', status => {
setVisible(status);
});
// }
return () => {
action && action.events && action.events.removeAllListeners('loginSuccess');
action && action.events && action.events.removeAllListeners('loginError');
action && action.events && action.events.removeAllListeners('loginVisible');
}
}, [props.loginMode]);
......
......@@ -8,6 +8,7 @@ import Iframe from '../pages/iframe';
import Login from '../pages/user/login';
import CommonMenu from '../pages/commonMenu';
import NoSecret from '../pages/user/login/noSecret';
import UsingAnalysis from '../pages/cloudOMS/usingAnalysis';
export const dyRoutes = (routes, layout) => {
// eslint-disable-next-line no-shadow
......@@ -34,6 +35,10 @@ export const dyRoutes = (routes, layout) => {
path: '/industry',
component: BootPage,
},
{
path: '/usingAnalysis',
component: UsingAnalysis,
},
{
path: '/',
component: BasicLayout,
......
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