From 703703929e97b94ca1c1c5e35a578e5fe9d4cfea Mon Sep 17 00:00:00 2001 From: suerprisePlus <15810472099@163.com> Date: 星期一, 30 九月 2024 09:58:04 +0800 Subject: [PATCH] 代码修改 --- src/views/visualization/data.js | 184 +++++ vue.config.js | 2 src/views/visualization/rightMenu.vue | 309 ++++---- src/layout/components/Navbar.vue | 2 src/assets/js/mapSdk/index.js | 198 +++-- .env.staging | 2 src/assets/logo/logo2.png | 0 src/layout/components/Sidebar/Logo.vue | 2 public/config/config.js | 7 src/views/visualization/list/chartList.vue | 103 +++ src/assets/logo/sdw.png | 0 src/views/login copy.vue | 403 +++++++++++ public/index.html | 2 src/store/modules/permission.js | 3 src/assets/js/mapSdk/mapServe.js | 20 src/router/index.js | 5 public/config/config.js.gz | 0 .env.development | 2 src/views/visual/mapView/index.vue | 116 ++- src/views/login.vue | 231 +++-- src/assets/logo/background.png | 0 src/views/visualization/list/chartList1.vue | 107 +++ src/views/visualization/leftMenu.vue | 118 -- .env.production | 2 src/views/visualization/index.vue | 1 src/views/visualization/list/chart.vue | 201 +++++ 26 files changed, 1,545 insertions(+), 475 deletions(-) diff --git a/.env.development b/.env.development index effc560..ffb5e2a 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 娉扮憺宸ヤ笟鏁板瓧瀛敓绠$悊骞冲彴 +VUE_APP_TITLE = 灞辫タ閰嶇綉 # 寮�鍙戠幆澧冮厤缃� ENV = 'development' diff --git a/.env.production b/.env.production index 425ab61..2364eea 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = FastBee鐗╄仈缃� +VUE_APP_TITLE = 灞辫タ閰嶇綉 # 鐢熶骇鐜閰嶇疆 ENV = 'production' diff --git a/.env.staging b/.env.staging index 43f1d14..0d879bb 100644 --- a/.env.staging +++ b/.env.staging @@ -1,5 +1,5 @@ # 椤甸潰鏍囬 -VUE_APP_TITLE = 娉扮憺宸ヤ笟鏁板瓧瀛敓绠$悊骞冲彴 +VUE_APP_TITLE = 灞辫タ閰嶇綉 NODE_ENV = production diff --git a/public/config/config.js b/public/config/config.js index d44b3fb..74f1134 100644 --- a/public/config/config.js +++ b/public/config/config.js @@ -15,9 +15,9 @@ // 鏁版嵁鍒嗘瀽绔彛 const pyHost = isWeb ? isUrl + ":9036" : isUrl + ":8000"; //rag绔彛 -const ragHost = isWeb ? isUrl + ":9036" : "192.168.11.95:8080"; +const ragHost = isWeb ? isUrl + ":9036" : "192.168.11.24:8103"; // 鏈湴鏁版嵁鍦板潃 -const pwythHost = "http://localhost/pwyth"; +const pwythHost = "http://192.168.11.95:8888/pwyth"; //閰嶇疆 const config = { // server鏈嶅姟 @@ -29,7 +29,8 @@ //鏁版嵁鍒嗘瀽鎺ュ彛 pyServices: "http://" + pyHost + "/py", //rag鏈嶅姟鍦板潃 - ragServices: "http://" + ragHost+ "/api/vi", + // ragServices: "http://" + ragHost+ "/api/vi", + ragServices: "http://" + ragHost+ "/rag_sxdw/api/vi", imageUrl: "", // sdk鏄剧ず sdkImg: host + "/CimSDK/", diff --git a/public/config/config.js.gz b/public/config/config.js.gz new file mode 100644 index 0000000..ecabfb7 --- /dev/null +++ b/public/config/config.js.gz Binary files differ diff --git a/public/index.html b/public/index.html index 110f3a4..857561f 100644 --- a/public/index.html +++ b/public/index.html @@ -7,7 +7,7 @@ <meta name="renderer" content="webkit"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link rel="icon" href="<%= BASE_URL %>logo.png"> - <script src="./config/config.js"></script> + <script src="/config/config.js"></script> <script src="./CimSDK/Workers/jquery-3.5.0.min.js"></script> <script src="./CimSDK/Workers/layui/layui.js"></script> <script src="./CimSDK/CimSDK.min.js"></script> diff --git a/src/assets/js/mapSdk/index.js b/src/assets/js/mapSdk/index.js index e1610a9..48cf46c 100644 --- a/src/assets/js/mapSdk/index.js +++ b/src/assets/js/mapSdk/index.js @@ -1,87 +1,121 @@ -import mapConfig from './mapConfig'; -import mapData from './mapData'; -import mapServer from './mapServe'; -import * as turf from '@turf/turf'; -import store from '@/store'; +import mapConfig from "./mapConfig"; +import mapData from "./mapData"; +import mapServer from "./mapServe.js"; +import * as turf from "@turf/turf"; +import store from "@/store"; const mapInit = { - async Init() { - window.earthCtrl = new SmartEarth.EarthCtrl('sdkContainer', { - // 闅愯棌榛樿搴曞浘 - defaultImagery: false, - // 闅愯棌logo - printLog: false, - // sceneMode: SmartEarth.Cesium.SceneMode.SCENE2D - StaticFileBaseUrl: '/CimSDK/', - }); - // 鍒濆鍖朇esium - window.Cesium = SmartEarth.Cesium; - // 鍒濆鍖朧iewer - window.Viewer = earthCtrl.viewer; - //璁剧疆鍦扮悆棰滆壊 - Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#A9A9A9'); - Viewer.imageryLayers.removeAll() - // 鍦板舰鍔犺浇 - const terrain = config.terrain; - if (terrain.isShow && terrain.isUrl) { - const terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl(terrain.isUrl, { - requestWaterMask: true, - requestVertexNormals: true, + async Init() { + // 榛樿璁剧疆搴曞浘 + this.addImageLayer(); + // 娣诲姞榧犳爣鐐瑰嚮浜嬩欢 + this.addMapClick(); + + // window.earthCtrl = new SmartEarth.EarthCtrl( + // 'sdkContainer', + // { + // // 闅愯棌榛樿搴曞浘 + // defaultImagery: false, + // // 闅愯棌logo + // printLog: false, + // // sceneMode: SmartEarth.Cesium.SceneMode.SCENE2D + // StaticFileBaseUrl: '/CimSDK/', + // }, + // {}, + // {}, + // () => { + // debugger + // // 鍒濆鍖朇esium + // window.Cesium = SmartEarth.Cesium; + // // 鍒濆鍖朧iewer + // window.Viewer = window.earthCtrl.Viewer; + // //璁剧疆鍦扮悆棰滆壊 + // window.Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#A9A9A9'); + // window.earthCtrl.Viewer.imageryLayers.removeAll(); + // // // 鍦板舰鍔犺浇 + // // const terrain = config.terrain; + // // if (terrain.isShow && terrain.isUrl) { + // // const terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl(terrain.isUrl, { + // // requestWaterMask: true, + // // requestVertexNormals: true, + // // }); + + // // window.Viewer.terrainProvider = terrainProvider; + // // } + // this.setStartViwer(); + // } + // ); + }, + // async setStartViwer() { + // // Viewer.scene.screenSpaceCameraController.maximumZoomDistance =50000 + // // 榛樿璁剧疆搴曞浘 + // this.addImageLayer(); + // // 娣诲姞榧犳爣鐐瑰嚮浜嬩欢 + // this.addMapClick(); + // }, + addImageLayer() { + const baseLayer = mapData.baseLayer; + // 娣诲姞澶╁湴鍥惧簳鍥� + // mapServer.addLayer({ + // serveType: 'tdMap', + // url: baseLayer.sUrl + baseLayer.vecLayer + baseLayer.lUrl, + // }); + console.log(config.geoServer); + // console.log(mapServer); + // mapServer.addLayer({ + // serveType: "WMS", + // url: + // }); + const serverUrl = config.geoServer; + const layer = new Cesium.WebMapServiceImageryProvider({ + url:serverUrl.url + serverUrl.wms, + layers: serverUrl.layers[1], + parameters: { + transparent: true, + format: 'image/png', + srs: 'EPSG:4490', + styles: '', + cql_filter: '', + }, + tileWidth: 512, + tileHeight: 512, + }); + + window.Viewer.imageryLayers.addImageryProvider(layer); + // 娣诲姞澶╁湴鍥炬爣娉� + // mapServer.addLayer({ + // serveType: 'tdMap', + // url: baseLayer.sUrl + baseLayer.cvaLayer + baseLayer.lUrl, + // }); + + // 鍒濆鍖栬瑙� + this.setdefaultPerspective(); + }, + setdefaultPerspective() { + mapConfig.sertCameraTo(mapData.defaultPerspective); + }, + addMapClick() { + // 涓簐iewer娣诲姞榧犳爣鐐瑰嚮浜嬩欢鐩戝惉 + window.Viewer.screenSpaceEventHandler.setInputAction(event => { + // 鑾峰彇鐐瑰嚮浣嶇疆鐨勪笘鐣屽潗鏍� + var pickedFeature = window.Viewer.scene.pick(event.position); + if (Cesium.defined(pickedFeature)) { + console.log(pickedFeature); + if (pickedFeature.id) { + const obj = pickedFeature.id; + var arr = []; + for (var key in obj) { + arr.push({ + name: key, + val: obj[key] }); - - Viewer.terrainProvider = terrainProvider; - } - // Viewer.scene.screenSpaceCameraController.maximumZoomDistance =50000 - // 榛樿璁剧疆搴曞浘 - this.addImageLayer(); - // 娣诲姞榧犳爣鐐瑰嚮浜嬩欢 - this.addMapClick(); - }, - addImageLayer() { - const baseLayer = mapData.baseLayer; - // 娣诲姞澶╁湴鍥惧簳鍥� - // mapServer.addLayer({ - // serveType: 'tdMap', - // url: baseLayer.sUrl + baseLayer.vecLayer + baseLayer.lUrl, - // }); - - mapServer.addLayer({ - serveType: 'WMS', - url: config.geoServer.layers[1], - }); - // 娣诲姞澶╁湴鍥炬爣娉� - // mapServer.addLayer({ - // serveType: 'tdMap', - // url: baseLayer.sUrl + baseLayer.cvaLayer + baseLayer.lUrl, - // }); - // 鍒濆鍖栬瑙� - this.setdefaultPerspective(); - }, - setdefaultPerspective() { - mapConfig.sertCameraTo(mapData.defaultPerspective); - }, - addMapClick() { - // 涓簐iewer娣诲姞榧犳爣鐐瑰嚮浜嬩欢鐩戝惉 - Viewer.screenSpaceEventHandler.setInputAction((event) => { - // 鑾峰彇鐐瑰嚮浣嶇疆鐨勪笘鐣屽潗鏍� - var pickedFeature = Viewer.scene.pick(event.position); - if (Cesium.defined(pickedFeature)) { - console.log(pickedFeature); - if (pickedFeature.id) { - const obj = pickedFeature.id; - var arr=[]; - for(var key in obj){ - arr.push({ - name: key, - val: obj[key], - }); - store.dispatch('mapLayers/changeMapInfo', []); - if (arr.length > 0) { - store.dispatch('mapLayers/changeMapInfo', arr); - } - } - } + store.dispatch("mapLayers/changeMapInfo", []); + if (arr.length > 0) { + store.dispatch("mapLayers/changeMapInfo", arr); } - }, Cesium.ScreenSpaceEventType.LEFT_CLICK); - }, + } + } + } + }, Cesium.ScreenSpaceEventType.LEFT_CLICK); + } }; export default mapInit; diff --git a/src/assets/js/mapSdk/mapServe.js b/src/assets/js/mapSdk/mapServe.js index 80221cb..8a2dc92 100644 --- a/src/assets/js/mapSdk/mapServe.js +++ b/src/assets/js/mapSdk/mapServe.js @@ -1,12 +1,14 @@ -import mapConfig from './mapConfig'; +import mapConfig from './mapConfig.js'; import { zhangzitou_selectAll } from '@/api/mapView/map.js'; import WKT from 'terraformer-wkt-parser'; import store from '@/store'; + // 鏈嶅姟鍔犺浇 const mapServer = { serveType: null, layerList: [], addLayer(res) { + const obj = this.getLayerChecked(res); if (obj) return; this.serveType = res.serveType; @@ -35,7 +37,7 @@ const cnName = res.cnName + '_' + res.id; const modelLayer = new Cesium.PrimitiveCollection(); modelLayer.name = cnName; - Viewer.scene.primitives.add(modelLayer); + window.Viewer.scene.primitives.add(modelLayer); pois.map((item) => { var geom = WKT.parse(item.geom).coordinates; const terrain = config.terrain; @@ -55,7 +57,7 @@ }, addTerrainGLB(item, geom, modelLayer) { var positions = [Cesium.Cartographic.fromDegrees(geom[0], geom[1])]; - var promise = Cesium.sampleTerrainMostDetailed(Viewer.terrainProvider, positions); + var promise = Cesium.sampleTerrainMostDetailed(window.Viewer.terrainProvider, positions); promise.then((updatedPositions) => { var terrainHeight = updatedPositions[0].height; var style = { @@ -107,7 +109,7 @@ addTdLayer(res) { const url = res.url + config.tdToken; - Viewer.imageryLayers.addImageryProvider( + window.Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ url: url, }) @@ -124,7 +126,7 @@ }, addWMSLayer(res) { const serverUrl = config.geoServer; - const that = this; + const that = this; var getFeatureInfoFormat = new Cesium.GetFeatureInfoFormat('html', null, function (html) { that.getFeatureInfo(html); }); @@ -146,7 +148,7 @@ tileHeight: 512, }); - const imageLayer = Viewer.imageryLayers.addImageryProvider(layer); + const imageLayer = window.Viewer.imageryLayers.addImageryProvider(layer); const cnName = res.cnName + '_' + res.id; imageLayer.name = cnName; imageLayer.id = res.id; @@ -163,7 +165,7 @@ if (res.bak) { height = JSON.parse(res.bak).height; } - var model = earthCtrl.factory.create3DTilesets({ + var model = window.earthCtrl.factory.create3DTilesets({ url: url, option: { height: height, @@ -188,13 +190,13 @@ this.layerList.map((item, index) => { if (cnName == item.name && res.id == item.id) { if (item.serveType == 'WMS') { - Viewer.imageryLayers.remove(item.layer); + window.Viewer.imageryLayers.remove(item.layer); this.layerList.splice(index, 1); } else if (item.serveType == 'Tileset') { item.layer.deleteObject(); this.layerList.splice(index, 1); } else if (item.serveType == 'WFS') { - Viewer.scene.primitives.remove(item.layer); + window.Viewer.scene.primitives.remove(item.layer); this.layerList.splice(index, 1); } } diff --git a/src/assets/logo/background.png b/src/assets/logo/background.png new file mode 100644 index 0000000..f3d6530 --- /dev/null +++ b/src/assets/logo/background.png Binary files differ diff --git a/src/assets/logo/logo2.png b/src/assets/logo/logo2.png new file mode 100644 index 0000000..7521712 --- /dev/null +++ b/src/assets/logo/logo2.png Binary files differ diff --git a/src/assets/logo/sdw.png b/src/assets/logo/sdw.png new file mode 100644 index 0000000..e3bfe33 --- /dev/null +++ b/src/assets/logo/sdw.png Binary files differ diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index ac5a934..ef80dbc 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -106,7 +106,7 @@ type: 'warning' }).then(() => { this.$store.dispatch('LogOut').then(() => { - location.href = '/index'; + location.href = '/'; }) }).catch(() => { }); } diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 880bddb..ff2c0a1 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -35,7 +35,7 @@ }, data() { return { - title: 'TerraDT', + title: '灞辫タ閰嶇綉', logo: logoImg } } diff --git a/src/router/index.js b/src/router/index.js index 634b04e..80ba5bd 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -79,7 +79,8 @@ children: [ { path: 'index', - component: () => import('@/views/index'), + // component: () => import('@/views/index'), + component: () => import('@/views/visual/mapView/index.vue'), name: 'Index', meta: { title: '棣栭〉', icon: 'dashboard', affix: true }, }, @@ -202,7 +203,7 @@ }; export default new Router({ - mode: 'history', // 鍘绘帀url涓殑# + // mode: 'history', // 鍘绘帀url涓殑# scrollBehavior: () => ({ y: 0 }), routes: constantRoutes, }); diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 2287665..09bc6c6 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -126,7 +126,8 @@ return (resolve) => require([`@/views/${view}`], resolve) } else { // 浣跨敤 import 瀹炵幇鐢熶骇鐜鐨勮矾鐢辨噿鍔犺浇 - return () => import(`@/views/${view}`) + // return () => import(`@/views/${view}`) + return (resolve) => require([`@/views/${view}`], resolve) } } diff --git a/src/views/login copy.vue b/src/views/login copy.vue new file mode 100644 index 0000000..ae3ae09 --- /dev/null +++ b/src/views/login copy.vue @@ -0,0 +1,403 @@ +<template> + <div class="login"> + <el-row> + <el-col :xs="24"> + <div style="color: #fff; background-color: #0f73ee; width: 100%; height: 200px; text-align: center; padding: 15px; font-family: '寰蒋闆呴粦'"> + <div style="font-size: 42px; padding-top: 40px; width: 400px; margin: 0 auto"> + <div class="logoImg"></div> + <!-- <img :src="logo" alt="logo" style="width: 100px; height: 100px; float: left" /> --> + <div style="float: left; margin-top: 13px; width: 300px; text-align: left"> + <div>灞辫タ閰嶇綉</div> + <div style="letter-spacing: 1.5px; font-size: 20px; font-weight: 600; margin-top: -8px; margin-left: 3px">灞辫タ閰嶇綉</div> + </div> + </div> + </div> + + <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> + <!-- <div style="margin-bottom: 10px; font-size: 14px; font-family: '寰蒋闆呴粦'; color: #f78e21">婕旂ず璐﹀彿锛歠astbee 123456</div> --> + <el-form-item prop="username" > + <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="璐﹀彿"> + <svg-icon slot="prefix" icon-class="user" class="input-icon" /> + </el-input> + </el-form-item> + <el-form-item prop="password"> + <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="瀵嗙爜" @keyup.enter.native="handleLogin"> + <svg-icon slot="prefix" icon-class="password" class="input-icon" /> + </el-input> + </el-form-item> + <el-form-item v-if="captchaOnOff" prop="code"> + <el-input v-model="loginForm.code" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" @keyup.enter.native="handleLogin"> + <svg-icon slot="prefix" icon-class="validCode" class="input-icon" /> + </el-input> + + <div class="login-code"> + <img :src="codeUrl" @click="getCode" /> + </div> + </el-form-item> + <el-checkbox v-model="loginForm.rememberMe" style="margin: 0px 0px 25px 0px; color: #000">璁颁綇瀵嗙爜</el-checkbox> + + <el-form-item style="width: 100%"> + <div style="margin-bottom: 10px"> + <el-button v-if="!bindAccount" :loading="loading" type="primary" style="width: 100%" @click.native.prevent="handleLogin"> + <span v-if="!loading">鐧� 褰�</span> + <span v-else>鐧� 褰� 涓�...</span> + </el-button> + <el-button v-else :loading="loading" type="primary" style="width: 100%" @click.native.prevent="handleBind"> + <span v-if="!loading">缁� 瀹�</span> + <span v-else>缁� 瀹� 涓�...</span> + </el-button> + </div> + </el-form-item> + </el-form> + </el-col> + </el-row> + <!-- 搴曢儴 --> + <div class="el-login-footer"> + <span> + Copyright 漏 2004锛�2023 + <a target="_blank" href="https://www.smartearth.cn/">SmartEarth</a> + All Rights Reserved. + </span> + </div> + </div> +</template> + +<script> +import 'element-ui/lib/theme-chalk/display.css'; +import logo from '@/assets/logo/logo.png'; +import { getCodeImg, checkBindId, getErrorMsg, socialLogin, bindLogin } from '@/api/login'; +import Cookies from 'js-cookie'; +import { encrypt, decrypt } from '@/utils/jsencrypt'; +import { setToken } from '@/utils/auth'; + +export default { + name: 'Login', + data() { + return { + logo, + codeUrl: '', + loginForm: { + username: '', + password: '', + rememberMe: false, + code: '', + uuid: '', + bindId: '', + // loginId: '', + }, + loginRules: { + username: [ + { + required: true, + trigger: 'blur', + message: '璇疯緭鍏ユ偍鐨勮处鍙�', + }, + ], + password: [ + { + required: true, + trigger: 'blur', + message: '璇疯緭鍏ユ偍鐨勫瘑鐮�', + }, + ], + code: [ + { + required: true, + trigger: 'change', + message: '璇疯緭鍏ラ獙璇佺爜', + }, + ], + }, + loading: false, + // 楠岃瘉鐮佸紑鍏� + captchaOnOff: true, + bindAccount: false, + // 娉ㄥ唽寮�鍏� + register: true, + redirect: undefined, + }; + }, + watch: { + $route: { + handler: function (route) { + this.redirect = route.query && route.query.redirect; + }, + immediate: true, + }, + }, + created() { + const loginId = this.$route.query.loginId; + if (loginId === undefined || loginId === null) { + this.checkBind(); + this.getCode(); + this.checkErrorMsg(); + this.getCookie(); + } else { + this.redirectSocialLogin(loginId); + } + }, + methods: { + redirectLogin(loginId) { + this.loading = true; + this.$store + .dispatch('RedirectLogin', loginId) + .then(() => { + this.$router + .push({ + path: this.redirect || '/', + }) + .catch(() => {}); + }) + .catch(() => { + this.loading = false; + if (this.captchaOnOff) { + this.getCode(); + } + this.$router.push({ + query: {}, + }); + }); + }, + redirectSocialLogin() { + const query = this.$route.query; + const loginId = query.loginId; + socialLogin(loginId).then((res) => { + // 淇濆瓨token + this.loading = true; + setToken(res.token); + this.$router + .push({ + path: this.redirect || '/', + }) + .catch(() => {}); + if (this.captchaOnOff) { + this.getCode(); + this.loading = false; + } + }); + }, + checkBind() { + const query = this.$route.query; + const bindId = query.bindId; + if (bindId === undefined || bindId === null) { + this.bindAccount = false; + } else { + this.bindAccount = true; + checkBindId(bindId).then((res) => { + this.bindAccount = res.bindAccount === undefined ? true : res.bindAccount; + if (this.bindAccount) { + this.loginForm.bindId = bindId; + } else { + this.loginForm.bindId = ''; + this.$router.push({ + query: {}, + }); + } + }); + } + }, + checkErrorMsg() { + const errorId = this.$route.query.errorId; + if (errorId !== undefined && errorId !== null) { + getErrorMsg(errorId) + .then((res) => {}) + .catch((err) => { + this.$router.push({ query: {} }); + console.log(err); + }); + } + }, + getCode() { + getCodeImg().then((res) => { + this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff; + if (this.captchaOnOff) { + this.codeUrl = 'data:image/gif;base64,' + res.img; + this.loginForm.uuid = res.uuid; + } + }); + }, + getCookie() { + const username = Cookies.get('username'); + const password = Cookies.get('password'); + const rememberMe = Cookies.get('rememberMe'); + const loginId = Cookies.get('loginId'); + this.loginForm = { + username: username === undefined ? this.loginForm.username : username, + password: password === undefined ? this.loginForm.password : decrypt(password), + rememberMe: rememberMe === undefined ? false : Boolean(rememberMe), + loginId: loginId === undefined ? this.loginForm.loginId : loginId, + }; + }, + qqLogin() { + window.location.href = 'http://localhost:8080/auth/render/qq'; + }, + weChatLogin() { + const baseURL = process.env.VUE_APP_BASE_API; + window.location.href = baseURL + '/auth/render/wechat_open_web'; + }, + authLogin() { + this.$alert('绗笁鏂圭櫥褰曟鍦ㄩ泦鎴愪腑...', '鎻愮ず娑堟伅', { + confirmButtonText: '纭畾', + callback: (action) => { + this.$message({ + type: 'info', + message: `action: ${action}`, + }); + }, + }); + }, + handleBind() { + this.$refs.loginForm.validate((valid) => { + if (valid) { + this.loading = true; + if (this.loginForm.rememberMe) { + Cookies.set('username', this.loginForm.username, { + expires: 30, + }); + Cookies.set('password', encrypt(this.loginForm.password), { + expires: 30, + }); + Cookies.set('rememberMe', this.loginForm.rememberMe, { + expires: 30, + }); + } else { + Cookies.remove('username'); + Cookies.remove('password'); + Cookies.remove('rememberMe'); + } + this.loginForm.bindId = this.$route.query.bindId; + bindLogin(this.loginForm) + .then((res) => { + // 淇濆瓨token + setToken(res.token); + this.$router + .push({ + path: '/', + }) + .catch(() => {}); + }) + .catch(() => { + this.loading = false; + if (this.captchaOnOff) { + this.loading = false; + this.getCode(); + } + }); + } + }); + }, + handleLogin() { + this.$refs.loginForm.validate((valid) => { + if (valid) { + this.loading = true; + if (this.loginForm.rememberMe) { + Cookies.set('username', this.loginForm.username, { + expires: 30, + }); + Cookies.set('password', encrypt(this.loginForm.password), { + expires: 30, + }); + Cookies.set('rememberMe', this.loginForm.rememberMe, { + expires: 30, + }); + } else { + Cookies.remove('username'); + Cookies.remove('password'); + Cookies.remove('rememberMe'); + } + this.$store + .dispatch('Login', this.loginForm) + .then(() => { + this.$router + .push({ + path: this.redirect || '/', + }) + .catch(() => {}); + }) + .catch(() => { + this.loading = false; + if (this.captchaOnOff) { + this.getCode(); + } + }); + } + }); + }, + }, +}; +</script> + +<style lang="scss"> +.login { + height: 100%; + overflow: auto; +} +.logoImg { + width: 100px; + height: 100px; + background: url('../assets/logo/logo.png') no-repeat; + background-size: 100% 100%; + float: left; +} +.bindAccountTitle { + margin: 0px auto 30px auto; + text-align: center; + color: #333; + font-size: 24px; +} + +.login-form { + margin: 30px auto 0 auto; + padding: 15px; + z-index: 1000; + max-width: 350px; + + input { + height: 38px; + background-color: #f1f1f1; + color: #666; + } + + .input-icon { + height: 39px; + width: 14px; + margin-left: 2px; + } +} + +.login-code { + width: 33%; + float: right; + + img { + cursor: pointer; + vertical-align: middle; + border-radius: 3px; + height: 38px; + } +} + +.el-login-footer { + height: 40px; + line-height: 40px; + position: fixed; + bottom: 0; + width: 100%; + text-align: center; + color: #333; + font-family: Arial; + font-size: 12px; + letter-spacing: 1px; +} + +.alert-box-wrap { + border: 1px solid #f78e21; + + .alert-message-wrap { + font-size: 14px; + font-family: '寰蒋闆呴粦'; + color: rgba(197, 41, 41, 0.856); + margin-left: 10px; + } +} +</style> diff --git a/src/views/login.vue b/src/views/login.vue index 2581b09..a5d3ec0 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -1,32 +1,32 @@ <template> <div class="login"> - <el-row> - <el-col :xs="24"> - <div style="color: #fff; background-color: #0f73ee; width: 100%; height: 200px; text-align: center; padding: 15px; font-family: '寰蒋闆呴粦'"> - <div style="font-size: 42px; padding-top: 40px; width: 400px; margin: 0 auto"> - <div class="logoImg"></div> - <!-- <img :src="logo" alt="logo" style="width: 100px; height: 100px; float: left" /> --> - <div style="float: left; margin-top: 13px; width: 300px; text-align: left"> - <div>TerraDT</div> - <div style="letter-spacing: 1.5px; font-size: 20px; font-weight: 600; margin-top: -8px; margin-left: 3px">娉扮憺宸ヤ笟鏁板瓧瀛敓绠$悊骞冲彴</div> - </div> - </div> - </div> + <div class="logoTitle"> + <div class="titleItem"> + <div class="logImg"></div> + </div> + <div class="titleItem"> + <div class="logText">鏁板瓧瀛敓鏅鸿兘閰嶇綉宸℃绯荤粺</div> + </div> + </div> + <div class="logContent"> + <div class="contFrom"> <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form"> <!-- <div style="margin-bottom: 10px; font-size: 14px; font-family: '寰蒋闆呴粦'; color: #f78e21">婕旂ず璐﹀彿锛歠astbee 123456</div> --> - <el-form-item prop="username"> + <el-form-item prop="username" > <el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="璐﹀彿"> <svg-icon slot="prefix" icon-class="user" class="input-icon" /> </el-input> </el-form-item> <el-form-item prop="password"> - <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="瀵嗙爜" @keyup.enter.native="handleLogin"> + <el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="瀵嗙爜" + @keyup.enter.native="handleLogin"> <svg-icon slot="prefix" icon-class="password" class="input-icon" /> </el-input> </el-form-item> <el-form-item v-if="captchaOnOff" prop="code"> - <el-input v-model="loginForm.code" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" @keyup.enter.native="handleLogin"> + <el-input v-model="loginForm.code" auto-complete="off" placeholder="楠岃瘉鐮�" style="width: 63%" + @keyup.enter.native="handleLogin"> <svg-icon slot="prefix" icon-class="validCode" class="input-icon" /> </el-input> @@ -34,31 +34,34 @@ <img :src="codeUrl" @click="getCode" /> </div> </el-form-item> - <el-checkbox v-model="loginForm.rememberMe" style="margin: 0px 0px 25px 0px; color: #000">璁颁綇瀵嗙爜</el-checkbox> + <el-checkbox v-model="loginForm.rememberMe" + style="margin: 0px 0px 25px 0px; color: #000">璁颁綇瀵嗙爜</el-checkbox> <el-form-item style="width: 100%"> <div style="margin-bottom: 10px"> - <el-button v-if="!bindAccount" :loading="loading" type="primary" style="width: 100%" @click.native.prevent="handleLogin"> + <el-button v-if="!bindAccount" :loading="loading" type="primary" style="width: 100%" + @click.native.prevent="handleLogin"> <span v-if="!loading">鐧� 褰�</span> <span v-else>鐧� 褰� 涓�...</span> </el-button> - <el-button v-else :loading="loading" type="primary" style="width: 100%" @click.native.prevent="handleBind"> + <el-button v-else :loading="loading" type="primary" style="width: 100%" + @click.native.prevent="handleBind"> <span v-if="!loading">缁� 瀹�</span> <span v-else>缁� 瀹� 涓�...</span> </el-button> </div> </el-form-item> </el-form> - </el-col> - </el-row> - <!-- 搴曢儴 --> - <div class="el-login-footer"> - <span> - Copyright 漏 2004锛�2023 - <a target="_blank" href="https://www.smartearth.cn/">SmartEarth</a> - All Rights Reserved. - </span> + </div> + <div class="contMessage"> + <span> + Copyright 漏 2004锛�2023 + <a target="_blank" href="https://www.smartearth.cn/">SmartEarth</a> + All Rights Reserved. + </span> + </div> </div> + </div> </template> @@ -146,7 +149,7 @@ .push({ path: this.redirect || '/', }) - .catch(() => {}); + .catch(() => { }); }) .catch(() => { this.loading = false; @@ -169,7 +172,7 @@ .push({ path: this.redirect || '/', }) - .catch(() => {}); + .catch(() => { }); if (this.captchaOnOff) { this.getCode(); this.loading = false; @@ -200,7 +203,7 @@ const errorId = this.$route.query.errorId; if (errorId !== undefined && errorId !== null) { getErrorMsg(errorId) - .then((res) => {}) + .then((res) => { }) .catch((err) => { this.$router.push({ query: {} }); console.log(err); @@ -274,7 +277,7 @@ .push({ path: '/', }) - .catch(() => {}); + .catch(() => { }); }) .catch(() => { this.loading = false; @@ -312,7 +315,7 @@ .push({ path: this.redirect || '/', }) - .catch(() => {}); + .catch(() => { }); }) .catch(() => { this.loading = false; @@ -327,77 +330,109 @@ }; </script> -<style lang="scss"> +<style scoped lang="scss"> .login { height: 100%; - overflow: auto; -} -.logoImg { - width: 100px; - height: 100px; - background: url('../assets/logo/logo.png') no-repeat; - background-size: 100% 100%; - float: left; -} -.bindAccountTitle { - margin: 0px auto 30px auto; - text-align: center; - color: #333; - font-size: 24px; -} - -.login-form { - margin: 30px auto 0 auto; - padding: 15px; - z-index: 1000; - max-width: 350px; - - input { - height: 38px; - background-color: #f1f1f1; - color: #666; - } - - .input-icon { - height: 39px; - width: 14px; - margin-left: 2px; - } -} - -.login-code { - width: 33%; - float: right; - - img { - cursor: pointer; - vertical-align: middle; - border-radius: 3px; - height: 38px; - } -} - -.el-login-footer { - height: 40px; - line-height: 40px; - position: fixed; - bottom: 0; + // overflow: auto; width: 100%; - text-align: center; - color: #333; - font-family: Arial; - font-size: 12px; - letter-spacing: 1px; -} + position: absolute; + background: url('../assets/logo/sdw.png') no-repeat; + background-size: 100% 100%; -.alert-box-wrap { - border: 1px solid #f78e21; - .alert-message-wrap { - font-size: 14px; - font-family: '寰蒋闆呴粦'; - color: rgba(197, 41, 41, 0.856); - margin-left: 10px; + .logoTitle { + height: 266px; + background: rgba(51, 132, 198, 1); + width: 100%; + z-index: -1; + position: absolute; + display: flex; + justify-content: center; + + .titleItem { + height: 100%; + display: flex; + align-items: center; + } + + .logImg { + width: 89px; + height: 89px; + background: url('../assets/logo/logo2.png') no-repeat; + background-size: 100% 100%; + } + + .logText { + font-family: SourceHanSansSC-Bold; + font-size: 36px; + font-weight: bold; + color: #ffffff; + margin-left: 19px; + } } + + .logContent { + width: 100%; + height: calc(100% - 266px); + bottom: 0px; + position: absolute; + display: flex; + flex-direction: column; + + .contFrom { + flex: 1; + } + + .contMessage { + width: 100%; + display: flex; + justify-content: center; + line-height: 40px; + } + + } + + .login-form { + margin: 30px auto 0 auto; + padding: 15px; + z-index: 1000; + max-width: 350px; + + input { + height: 38px; + background-color: #f1f1f1; + color: #666; + } + + .input-icon { + height: 39px; + width: 14px; + margin-left: 2px; + } + } + + .login-code { + width: 33%; + float: right; + + img { + cursor: pointer; + vertical-align: middle; + border-radius: 3px; + height: 38px; + } + } + + .alert-box-wrap { + border: 1px solid #f78e21; + + .alert-message-wrap { + font-size: 14px; + font-family: '寰蒋闆呴粦'; + color: rgba(197, 41, 41, 0.856); + margin-left: 10px; + } + } + } </style> diff --git a/src/views/visual/mapView/index.vue b/src/views/visual/mapView/index.vue index d019da3..4cecfec 100644 --- a/src/views/visual/mapView/index.vue +++ b/src/views/visual/mapView/index.vue @@ -51,20 +51,20 @@ </template> <script> -import mapInit from '@/assets/js/mapSdk/index.js'; +import mapInit from '../../../assets/js/mapSdk/index.js'; import mapData from '@/assets/js/mapSdk/mapData.js'; import layerManager from './layerManager.vue'; import menuManager from '@/assets/js/mapSdk/menuManager.js'; import location from './location.vue'; import knowledge from './knowledge.vue'; import lineRoaming from './lineRoaming.vue'; -import { layer_selectAll } from "@/api/mapView/map.js"; +import { layer_selectAll } from '@/api/mapView/map.js'; import configTools from '@/assets/js/configTools'; -import store from "@/store"; +import store from '@/store'; import mapServer from '@/assets/js/mapSdk/mapServe'; import undergroundMode from './undergroundMode.vue'; import dataAnalysis from './dataAnalysis.vue'; -import dataStatistics from './dataStatistics.vue' +import dataStatistics from './dataStatistics.vue'; import attributeInfo from './attributeInfo.vue'; import mapInfo from './mapInfo.vue'; export default { @@ -77,22 +77,26 @@ childMenuIsShow: true, childMenuOption: [], childObj: [], + showEarth: false, }; }, + created() { + console.log('created'); + }, mounted() { + this.showEarth = true; this.mapViewStart(); - this.$busEvent.$on('CHANGE_MAPINFO', res => { - - this.setMapInfo(res) - + this.$busEvent.$on('CHANGE_MAPINFO', (res) => { + this.setMapInfo(res); }); - + }, + beforeCreate() { + console.log('beforeCreate'); }, beforeDestroy() { - this.$store.dispatch('mapLayers/changeLayerTree', []) - this.$store.dispatch('mapLayers/changeDefaultLayer', []) + this.$store.dispatch('mapLayers/changeLayerTree', []); + this.$store.dispatch('mapLayers/changeDefaultLayer', []); }, - methods: { setMapInfo(res) { @@ -102,41 +106,85 @@ setTimeout(() => { this.$refs && this.$refs.mapInfo && this.$refs.mapInfo.open(); }, 200); - - } - }, mapViewStart() { this.menuOption = mapData.menuData; - this.$nextTick(() => { - mapInit.Init(); - setTimeout(() => { - if(config.baseModel.url){ - mapServer.addLayer(config.baseModel); - } - this.getSelectLayers(); - }, 500); - }); + window.earthCtrl = new SmartEarth.EarthCtrl( + 'sdkContainer', + { + // 闅愯棌榛樿搴曞浘 + defaultImagery: false, + // 闅愯棌logo + printLog: false, + // sceneMode: SmartEarth.Cesium.SceneMode.SCENE2D + StaticFileBaseUrl: '/CimSDK/', + }, + {}, + {}, + () => { + setTimeout(() => { + mapServer.layerList = []; + //鍒濆鍖朇esium + window.Cesium = SmartEarth.Cesium; + // 鍒濆鍖朧iewer + window.Viewer = window.earthCtrl.viewer; + //璁剧疆鍦扮悆棰滆壊 + window.Viewer.scene.globe.baseColor = Cesium.Color.fromCssColorString('#A9A9A9'); + window.Viewer.imageryLayers.removeAll(); + const serverUrl = config.geoServer; + const layer = new Cesium.WebMapServiceImageryProvider({ + url: serverUrl.url + serverUrl.wms, + layers: serverUrl.layers[1], + parameters: { + transparent: true, + format: 'image/png', + srs: 'EPSG:4490', + styles: '', + cql_filter: '', + }, + tileWidth: 512, + tileHeight: 512, + }); + + window.Viewer.imageryLayers.addImageryProvider(layer); + this.setStart(); + + }, 500); + } + ); }, + setStart() { + mapInit.Init(); + setTimeout(() => { + if (config.baseModel.url) { + var model = window.earthCtrl.factory.create3DTilesets({ + url: config.baseModel.url + + }); + } + this.getSelectLayers(); + }, 500); + }, + getSelectLayers() { - layer_selectAll().then(response => { - if (response.data.code != 200) return + layer_selectAll().then((response) => { + if (response.data.code != 200) return; const defaultLayer = []; - const val = response.data.result.filter(item => { + const val = response.data.result.filter((item) => { item.checked = false; if (item.type == 2 && item.isShow == 1) { item.checked = true; - mapServer.addLayer(item) - defaultLayer.push(item.id) + mapServer.addLayer(item); + defaultLayer.push(item.id); } return item; - }) - this.$store.dispatch('mapLayers/changeDefaultLayer', defaultLayer) - var obj = configTools.getTreeData(val) - this.$store.dispatch('mapLayers/changeLayerTree', obj) - }) + }); + this.$store.dispatch('mapLayers/changeDefaultLayer', defaultLayer); + var obj = configTools.getTreeData(val); + this.$store.dispatch('mapLayers/changeLayerTree', obj); + }); }, setMenuClose() { this.menuIsShow = !this.menuIsShowx; diff --git a/src/views/visualization/data.js b/src/views/visualization/data.js new file mode 100644 index 0000000..960c9d1 --- /dev/null +++ b/src/views/visualization/data.js @@ -0,0 +1,184 @@ +const data = [ + { + title: '鎬昏', + + val: [ + { + name: '浜嬩欢', + t1: '宸插鐢�', + t2: '鏈鐢�', + v1: 318, + v2: 43, + }, + { + name: '瀹㈡埛', + v1: 618, + v2: 60, + t1: '宸插鐢�', + t2: '鏈鐢�', + }, + { + name: '鎶曡瘔', + v1: 18, + v2: 3, + t1: '宸茬瓟澶�', + t2: '鏈瓟澶�', + }, + { + name: '鐭俊', + v1: 1218, + v2: 122, + t1: '宸查�氱煡', + t2: '鏈�氱煡', + }, + ], + }, + { + title: '褰卞搷瀹㈡埛鎯呭喌', + val: [ + { + name: '涓撳彉瀹㈡埛', + v1: 12, + v2: 2, + count: 14, + }, + { + name: '鍏彉瀹㈡埛', + v1: 270, + v2: 70, + count: 340, + }, + { + name: '淇濅緵瀹㈡埛', + v1: 30, + v2: 2, + count: 32, + }, + { + name: '閲嶈瀹㈡埛', + v1: 513, + v2: 20, + count: 533, + }, + { + name: '鐗圭骇瀹㈡埛', + v1: 7, + v2: 1, + count: 8, + }, + { + name: '涓�绾у鎴�', + v1: 105, + v2: 21, + count: 126, + }, + { + name: '浜岀骇瀹㈡埛', + v1: 407, + v2: 11, + count: 417, + }, + ], + }, + { + title: '褰卞搷璁惧', + val: [ + { + name: '鍙樼數绔�', + v1: 7, + v2: 1, + count: 8, + }, + { + name: '棣堢嚎', + v1: 12, + v2: 2, + count: 14, + }, + { + name: '姣嶇嚎', + v1: 22, + v2: 7, + count: 29, + }, + { + name: '杈撶數绾胯矾', + v1: 54, + v2: 3, + count: 57, + }, + { + name: '鍏彉', + v1: 65, + v2: 3, + count: 68, + }, + { + name: '涓撳彉', + v1: 107, + v2: 11, + count: 1187, + }, + { + name: '鎹熷け璐熻嵎', + v1: 47, + v2: 9, + count: 56, + }, + ], + }, + { + title: '闆�', + val: [ + { + point: '112.56978672907,37.8558881392881', + line: '妗冪幆鍗楃嚎', + address: '骞垮満鍙樼數绔�', + type: 'rain', + data: [ + 23.97957226, 23.67522328, 23.64627646, 23.98678133, 23.7049411, 23.90907715, 23.97135417, 23.93937771, 24.7313574, 23.78658559, 23.86060646, 23.93976822, 23.77442911, 23.70706984, 23.97513076, + 24.00566013, 23.68618352, 23.62046202, 23.94578353, 23.667424, 23.89900528, 23.84667184, 23.79052521, 23.54961054, + ], + source: '灞辫タ鐪佹皵璞″眬', + time: '2024 -09 - 26 10:06: 40', + level: '鐗瑰ぇ鏆撮洦', + }, + ], + }, + + { + title: '闆�', + val: [ + { + point: '112.54236790420437.8448783429948', + line: '娌欏寳绾�', + address: '澶師甯傚競鏀垮缓璁惧紑鍙戝绠卞彉', + type: 'snow', + data: [ + 0.9637209, 0.9645375, 0.973203, 0.95669932, 0.96515904, 0.96456309, 0.96226909, 0.95940984, 0.97185096, 0.95898406, 0.96430508, 0.96534445, 0.96647128, 0.95301892, 0.96867214, 0.9640161, 0.95022946, + 0.96365523, 0.96611146, 0.97417531, 0.96427799, 0.96411997, 0.96401091, 0.96554052, + ], + source: '灞辫タ鐪佹皵璞″眬', + time: '2024-09-26 10:06:40', + level: '鐗瑰ぇ鏆撮洩', + }, + ], + }, + { + val: [ + { + point: '112.542367904204 37.839565698022', + line: '涓堝瓧澶�', + address: '鑰佸啗钀ュ紑闂墍', + type: 'fire', + data: '', + source: '灞辫タ鐪佸簲鎬ユ寚鎸ヤ腑蹇�', + time: '2024-09-26 10:06:40', + level: '鐏伨', + }, + ], + + title: '鐏�', + }, +]; +export default data; diff --git a/src/views/visualization/index.vue b/src/views/visualization/index.vue index 2fe2f99..6a77f43 100644 --- a/src/views/visualization/index.vue +++ b/src/views/visualization/index.vue @@ -42,7 +42,6 @@ import analysis from '@/views/visual/analysis/index.vue' import lineLoss from './lineLoss.vue'; import statistics from '@/views/visual/statistics/index.vue' -import { type } from 'jquery'; export default { components: { mapView, leftMenu, diff --git a/src/views/visualization/leftMenu.vue b/src/views/visualization/leftMenu.vue index 8c3d8c2..311369e 100644 --- a/src/views/visualization/leftMenu.vue +++ b/src/views/visualization/leftMenu.vue @@ -1,23 +1,25 @@ <template> <div class="leftMnu"> <div class="menuBox"> - <div class="aside-title">{{ title.t1 }}</div> - <div class="echartBox"> - <div id="letftEchart1" class="chartBox"></div> - </div> + <chart-vue :childData="childData"></chart-vue> </div> <div class="menuBox"> - <div class="aside-title">{{ title.t2 }}</div> + <chart-vue :childData="childData1"></chart-vue> </div> <div class="menuBox"> - <div class="aside-title">{{ title.t3 }}</div> + <chart-vue :childData="childData2"></chart-vue> </div> </div> </template> <script> import * as echarts from 'echarts'; +import chartVue from './list/chart.vue'; +import data from './data.js'; export default { + components: { + chartVue + }, props: { leftChartData: { type: Object, @@ -26,94 +28,36 @@ }, data() { return { - title: { - t1: 'xxx', - t2: 'XXXX', - t3: 'xxxxx' - }, - myLeftChart1: null, - leftChartOption: { - lenData: [], - xData: [], - serData: [], - }, + childData: null, + childData1: null, + childData2: null, } }, watch: { - leftChartData: { - deep: true, - handler(res) { - if (res) { - if (res.type == "left1") { - this.setLeftChart1(res.val) - } - } - } - } + }, + mounted() { + this.initEchart(); }, methods: { - setLeftChart1(res) { - console.log(res); - - if (!this.myLeftChart1) { - this.myLeftChart1 = echarts.init(document.getElementById('letftEchart1')); - } - if (this.leftChartOption.lenData.length == 0) { - this.title.t1 = res.head[1] - this.leftChartOption.lenData.push(res.head[0]) - const colors=['#67C23A','#E6A23C','#F56C6C'] - for (var i = 0; i < 3; i++) { - this.leftChartOption.serData.push({ - name: res.head[i+1], - type: 'line', - stack: 'Total', - data: [], - lineStyle: { - color: colors[i], // 鎶樼嚎棰滆壊 - - } - }) - } - } - var option = this.getChartOption(res) - this.myLeftChart1 && this.myLeftChart1.setOption(option); + initEchart() { + this.initEchart1(); + this.initEchart2(); + this.initEchart3(); }, - getChartOption(res) { - for(var i = 0;i<3;i++){ - this.leftChartOption.serData[i].data.push(res.data[i+1]) - } - - - this.leftChartOption.xData.push(res.data[0]) - return { - legend: { - show: false - }, - - tooltip: { - trigger: 'axis' - }, - xAxis: { - type: 'category', - boundaryGap: false, - data: this.leftChartOption.xData, - axisLine: { - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - } - }, - yAxis: { - type: 'value', - axisLine: { - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - } - }, - series: this.leftChartOption.serData - } + initEchart1() { + var chart1= data[3]; + chart1.id = "myChart01"; + this.childData =chart1 + }, + initEchart2() { + var chart2= data[4]; + chart2.id = "myChart02"; + this.childData1 = chart2 + }, initEchart3() { + var chart3= data[5]; + chart3.id = "myChart03"; + this.childData2 = chart3 } } } diff --git a/src/views/visualization/list/chart.vue b/src/views/visualization/list/chart.vue new file mode 100644 index 0000000..214e717 --- /dev/null +++ b/src/views/visualization/list/chart.vue @@ -0,0 +1,201 @@ +<template> + <div class="chartListBox" :childData="childData"> + <div class="aside-title">{{ childData.title }}</div> + <div class="echartBox"> + <table class="chartTable"> + <tr> + <th></th> + <th> + 绾胯矾 + </th> + <th> + 绫诲瀷 + </th> + + <th> + 鎿嶄綔 + </th> + </tr> + <tr> + <td class="chartTd" colspan="4"> + <div class=" elDriver"> + </div> + </td> + </tr> + <tr v-for="(item, i) in childData.val"> + <td>{{ item.address }}</td> + <td>{{ item.line }}</td> + <td style="color:#f56c6c">{{ item.level }}</td> + <td style="color:#409eff"> + <el-button v-show="flagData != item.address" class="elButton" type="primary" plain size="mini" + @click="setChangeItem(item)">璇︽儏</el-button> + <el-button v-show="flagData == item.address" class="elButton" type="danger" plain size="mini" + @click="setCannelItem(item)">閲嶇疆</el-button> + </td> + </tr> + </table> + </div> + </div> +</template> + +<script> +import * as echarts from 'echarts'; + +export default { + props: { + childData: { + type: Object, + default: null + } + }, + watch: { + childData(newValue, oldValue) { + if (newValue) { + this.chartId = newValue.id; + this.title = newValue.title; + setTimeout(() => { + this.setEchartChange(newValue) + }, 1000); + } + } + }, + data() { + return { + chartId: "", + title: "", + flagData: null, + } + }, + methods: { + setCannelItem() { + this.flagData = null; + }, + setChangeItem(res) { + this.flagData = res.address; + }, + + setEchartChange(res) { + if (!res.data) return; + const data = res.data; + const id = document.getElementById(this.chartId) + var std = []; + for (var i = 0; i < data.length; i++) { + var h = i + 1 + var t = h > 10 ? h : "0" + h; + std.push(t + ":00:00") + } + const myChart = echarts.init(id); + var option = { + title: { + text: res.address, + textStyle: { + color: "white" + } + }, + xAxis: { + type: 'category', + data: std, + axisLabel: { + textStyle: { + color: 'WHITE' // 璁剧疆瀛椾綋棰滆壊涓虹孩鑹� + } + } + }, + yAxis: { + type: 'value', + axisLabel: { + textStyle: { + color: 'WHITE' // 璁剧疆瀛椾綋棰滆壊涓虹孩鑹� + } + } + }, + tooltip: { + trigger: 'axis' + }, + series: [ + { + data: data, + type: 'line', + smooth: true, + // itemStyle: { + // normal: { + + // lineStyle: { + // color: ""// 绾跨殑棰滆壊 + // } + // } + // } + } + ] + }; + + + option && myChart.setOption(option); + } + } +} +</script> + +<style lang="scss" scoped> +.chartListBox { + width: 100%; + height: 100%; + position: relative; + display: flex; + flex-direction: column; + + .aside-title { + box-sizing: border-box; + padding-left: 30px; + font-size: 15px; + font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular; + color: #fff; + width: 100%; + height: 45px; + line-height: 45px; + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .echartBox { + flex: 1; + padding: 5px; + position: relative; + color: white; + display: flex; + flex-direction: column; + // justify-content: space-around; + + .myChart { + width: 100%; + height: 100%; + } + + .chartTd { + width: 100%; + padding: 0px !important; + } + + .elDriver { + width: 100%; + height: 2px; + background: #409EFF; + margin: 10px 0px; + + } + + .chartTable { + width: 100%; + + td { + text-align: center; + + .elButton { + padding: 5px 10px; + } + } + } + + } +} +</style> \ No newline at end of file diff --git a/src/views/visualization/list/chartList.vue b/src/views/visualization/list/chartList.vue new file mode 100644 index 0000000..e62d2c5 --- /dev/null +++ b/src/views/visualization/list/chartList.vue @@ -0,0 +1,103 @@ +<template> + <div class="chartListBox" :childData="childData"> + <div class="aside-title">{{ childData.title }}</div> + <div class="echartBox"> + <div class="chartMenu" v-for="(item, key) in childData.val" :key="key"> + <table class="chartTable"> + <tr> + <td></td> + <td>{{ item.t1 }}</td> + <td>{{ item.t2 }}</td> + </tr> + + <tr> + <td class="chartTd" colspan="3"> + <div class="elDriver"> + </div> + </td> + </tr> + <tr> + <td>{{ item.name }}</td> + <td style="color:#67c23a">{{ item.v1 }}</td> + <td style="color:#f56c6c"> {{ item.v2 }}</td> + </tr> + </table> + + </div> + + </div> + </div> +</template> + +<script> + + +export default { + props: { + childData: { + type: Object, + default: null + } + }, + data() { + return { + // childData:null, + } + } +} +</script> + +<style lang="scss" scoped> +.chartListBox { + width: 100%; + height: 100%; + position: relative; + display: flex; + flex-direction: column; + + .aside-title { + box-sizing: border-box; + padding-left: 30px; + font-size: 15px; + font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular; + color: #fff; + width: 100%; + height: 45px; + line-height: 45px; + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .echartBox { + flex: 1; + padding: 5px; + position: relative; + color: white; + display: flex; + flex-direction: column; + justify-content: space-around; + + .chartTd { + width: 100%; + padding: 0px !important; + } + + .elDriver { + width: 100%; + height: 2px; + background: #409EFF; + margin: 10px 0px; + + } + + .chartTable { + width: 100%; + + td { + text-align: center; + } + } + + } +} +</style> \ No newline at end of file diff --git a/src/views/visualization/list/chartList1.vue b/src/views/visualization/list/chartList1.vue new file mode 100644 index 0000000..9cb4eb4 --- /dev/null +++ b/src/views/visualization/list/chartList1.vue @@ -0,0 +1,107 @@ +<template> + <div class="chartListBox" :childData="childData"> + <div class="aside-title">{{ childData.title }}</div> + <div class="echartBox"> + <table class="chartTable"> + <tr> + <th></th> + <th> + 宸插鐢� + </th> + <th> + 鏈鐢� + </th> + <th> + 鎬绘暟 + </th> + </tr> + <tr> + <td class="chartTd" colspan="4"> + <div class=" elDriver"> + </div> + </td> + </tr> + <tr v-for="(item,i) in childData.val"> + <td>{{ item.name }}</td> + <td style="color:#67c23a">{{ item.v1 }}</td> + <td style="color:#f56c6c"> {{ item.v2 }}</td> + <td style="color:#409eff">{{ item.count }}</td> + </tr> + </table> + </div> + </div> +</template> + +<script> + + +export default { + props: { + childData: { + type: Object, + default: null + } + }, + data() { + return { + // childData:null, + } + } +} +</script> + +<style lang="scss" scoped> +.chartListBox { + width: 100%; + height: 100%; + position: relative; + display: flex; + flex-direction: column; + + .aside-title { + box-sizing: border-box; + padding-left: 30px; + font-size: 15px; + font-family: YouSheBiaoTiHei, YouSheBiaoTiHei-Regular; + color: #fff; + width: 100%; + height: 45px; + line-height: 45px; + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .echartBox { + flex: 1; + padding: 5px; + position: relative; + color: white; + display: flex; + + + .chartTd { + width: 100%; + padding: 0px !important; + } + + .elDriver { + width: 100%; + height: 2px; + background: #409EFF; + margin: 0px 0px; + + } + + .chartTable { + width: 100%; +th{ + text-align: center; +} + td { + text-align: center; + } + } + + } +} +</style> \ No newline at end of file diff --git a/src/views/visualization/rightMenu.vue b/src/views/visualization/rightMenu.vue index c2fa490..bf00213 100644 --- a/src/views/visualization/rightMenu.vue +++ b/src/views/visualization/rightMenu.vue @@ -1,30 +1,30 @@ <template> <div class="rightMnu"> <div class="menuBox"> - <div class="aside-title">{{ title.t1 }}</div> + <!-- <div class="aside-title">{{ title.t1 }}</div> <div class="echartBox"> <div id="rightEchart1" class="chartBox"></div> - </div> + </div> --> + <chart-list :childData="childData"></chart-list> </div> <div class="menuBox"> - <div class="aside-title">{{ title.t2 }}</div> - <div class="echartBox"> - <div id="rightEchart2" class="chartBox"></div> - </div> + <chart-list1 :childData="childData1"></chart-list1> </div> <div class="menuBox"> - <div class="aside-title">{{ title.t3 }}</div> - <div class="echartBox"> - <div id="rightEchart3" class="chartBox"></div> - </div> + <chart-list1 :childData="childData2"></chart-list1> </div> </div> </template> <script> import * as echarts from 'echarts'; - +import chartList from './list/chartList.vue'; +import chartList1 from './list/chartList1.vue'; +import data from './data.js'; export default { + components:{ + chartList,chartList1 + }, props: { rightChartData: { type: Object, @@ -36,8 +36,12 @@ title: { t1: 'xxx', t2: 'XXXX', - t3: 'xxxxx' - } + t3: 'xxxxx', + + }, + childData:null, + childData1:null, + childData2:null, } }, watch: { @@ -63,155 +67,158 @@ this.initEchart3(); }, initEchart1() { - var myChart = echarts.init(document.getElementById('rightEchart1')); - var option = { - xAxis: { - type: 'category', - data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], - axisLine: { - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - } - }, - yAxis: { - type: 'value', - axisLine: { - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - } - }, - series: [ - { - data: [820, 932, 901, 934, 1290, 1330, 1320], - type: 'line', - smooth: true, - lineStyle: { - color: '#409EFF', // 鎶樼嚎棰滆壊 + this.childData= data[0]; + // var myChart = echarts.init(document.getElementById('rightEchart1')); + // var option = { + // xAxis: { + // type: 'category', + // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + // axisLine: { + // lineStyle: { + // color: 'white' // 璁剧疆涓虹孩鑹� + // } + // } + // }, + // yAxis: { + // type: 'value', + // axisLine: { + // lineStyle: { + // color: 'white' // 璁剧疆涓虹孩鑹� + // } + // } + // }, + // series: [ + // { + // data: [820, 932, 901, 934, 1290, 1330, 1320], + // type: 'line', + // smooth: true, + // lineStyle: { + // color: '#409EFF', // 鎶樼嚎棰滆壊 - } - } - ] - }; + // } + // } + // ] + // }; - option && myChart.setOption(option); + // option && myChart.setOption(option); }, initEchart2() { - var myChart1 = echarts.init(document.getElementById('rightEchart2')); - var option1 = { - title: { + this.childData1=data[1]; + // var myChart1 = echarts.init(document.getElementById('rightEchart2')); + // var option1 = { + // title: { - subtext: 'Fake Data', - left: 'center' - }, - tooltip: { - trigger: 'item' - }, - legend: { - orient: 'vertical', - left: 'left', - show: false - }, - series: [ - { - name: 'Access From', - type: 'pie', - radius: '50%', - data: [ - { value: 1048, name: 'Search Engine' }, - { value: 735, name: 'Direct' }, - { value: 580, name: 'Email' }, - { value: 484, name: 'Union Ads' }, - { value: 300, name: 'Video Ads' } - ], - emphasis: { - itemStyle: { - shadowBlur: 10, - shadowOffsetX: 0, - shadowColor: 'rgba(0, 0, 0, 0.5)' - } - } - } - ] - }; - option1 && myChart1.setOption(option1); + // subtext: 'Fake Data', + // left: 'center' + // }, + // tooltip: { + // trigger: 'item' + // }, + // legend: { + // orient: 'vertical', + // left: 'left', + // show: false + // }, + // series: [ + // { + // name: 'Access From', + // type: 'pie', + // radius: '50%', + // data: [ + // { value: 1048, name: 'Search Engine' }, + // { value: 735, name: 'Direct' }, + // { value: 580, name: 'Email' }, + // { value: 484, name: 'Union Ads' }, + // { value: 300, name: 'Video Ads' } + // ], + // emphasis: { + // itemStyle: { + // shadowBlur: 10, + // shadowOffsetX: 0, + // shadowColor: 'rgba(0, 0, 0, 0.5)' + // } + // } + // } + // ] + // }; + // option1 && myChart1.setOption(option1); }, initEchart3() { - var myChart2 = echarts.init(document.getElementById('rightEchart3')); - // prettier-ignore - let dataAxis = ['鐐�', '鍑�', '鏌�', '瀛�',]; - // prettier-ignore - let data = [220, 182, 191, 234, 290]; - let yMax = 500; - let dataShadow = []; - for (let i = 0; i < data.length; i++) { - dataShadow.push(yMax); - } - var option2 = { - title: { + this.childData2=data[2]; + // var myChart2 = echarts.init(document.getElementById('rightEchart3')); + // // prettier-ignore + // let dataAxis = ['鐐�', '鍑�', '鏌�', '瀛�',]; + // // prettier-ignore + // let data = [220, 182, 191, 234, 290]; + // let yMax = 500; + // let dataShadow = []; + // for (let i = 0; i < data.length; i++) { + // dataShadow.push(yMax); + // } + // var option2 = { + // title: { - }, - xAxis: { - data: dataAxis, - axisTick: { - show: false - }, - axisLine: { - show: false, - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - }, - z: 10 - }, - yAxis: { - axisLine: { - show: false, - lineStyle: { - color: 'white' // 璁剧疆涓虹孩鑹� - } - }, - axisTick: { - show: false - }, - axisLabel: { - color: '#fff' - }, + // }, + // xAxis: { + // data: dataAxis, + // axisTick: { + // show: false + // }, + // axisLine: { + // show: false, + // lineStyle: { + // color: 'white' // 璁剧疆涓虹孩鑹� + // } + // }, + // z: 10 + // }, + // yAxis: { + // axisLine: { + // show: false, + // lineStyle: { + // color: 'white' // 璁剧疆涓虹孩鑹� + // } + // }, + // axisTick: { + // show: false + // }, + // axisLabel: { + // color: '#fff' + // }, - }, - dataZoom: [ - { - type: 'inside' - } - ], - series: [ - { - type: 'bar', - showBackground: true, - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#83bff6' }, - { offset: 0.5, color: '#188df0' }, - { offset: 1, color: '#188df0' } - ]) - }, - emphasis: { - itemStyle: { - color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ - { offset: 0, color: '#2378f7' }, - { offset: 0.7, color: '#2378f7' }, - { offset: 1, color: '#83bff6' } - ]) - } - }, - data: data - } - ] - }; - option2 && myChart2.setOption(option2); + // }, + // dataZoom: [ + // { + // type: 'inside' + // } + // ], + // series: [ + // { + // type: 'bar', + // showBackground: true, + // itemStyle: { + // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + // { offset: 0, color: '#83bff6' }, + // { offset: 0.5, color: '#188df0' }, + // { offset: 1, color: '#188df0' } + // ]) + // }, + // emphasis: { + // itemStyle: { + // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + // { offset: 0, color: '#2378f7' }, + // { offset: 0.7, color: '#2378f7' }, + // { offset: 1, color: '#83bff6' } + // ]) + // } + // }, + // data: data + // } + // ] + // }; + // option2 && myChart2.setOption(option2); } diff --git a/vue.config.js b/vue.config.js index 38204b0..8f7f3ee 100644 --- a/vue.config.js +++ b/vue.config.js @@ -8,7 +8,7 @@ const CompressionPlugin = require('compression-webpack-plugin'); const { log } = require('console'); -const name = process.env.VUE_APP_TITLE || '娉扮憺宸ヤ笟鏁板瓧瀛敓绠$悊骞冲彴'; // 缃戦〉鏍囬 +const name = process.env.VUE_APP_TITLE || '灞辫タ閰嶇綉'; // 缃戦〉鏍囬 const port = process.env.port || process.env.npm_config_port || 80; // 绔彛 console.log( "123",process.env.VUE_APP_SERVER_API_URL); -- Gitblit v1.9.3