From e897fc3d35f8e5dfa56d5f0c80a655ccf99202cf Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期四, 09 五月 2024 11:06:43 +0800 Subject: [PATCH] 代码更新 --- src/views/Tools/layer.js | 8 src/assets/lang/zh.js | 2 src/components/chart/BaseBarChart.vue | 151 +++++----- src/components/chart/BaseLineChart.vue | 101 ++++--- src/views/Thematic/index.vue | 63 ++-- src/components/navMenu.vue | 332 +++++++++++------------ src/views/Tools/AddOnlineMap.vue | 146 ++++++---- 7 files changed, 417 insertions(+), 386 deletions(-) diff --git a/src/assets/lang/zh.js b/src/assets/lang/zh.js index 85636b9..9cf0258 100644 --- a/src/assets/lang/zh.js +++ b/src/assets/lang/zh.js @@ -943,7 +943,7 @@ valueexamine: "璇烽�夋嫨鐩綍鑺傜偣鎵�闇�鐨勬鏌ラ」", valuedirectory: "璇烽�夋嫨鎵�灞炵洰褰�", valuedescription: "璇疯緭鍏ユ弿杩颁俊鎭�", - valuesuffix: "璇疯緭鍏ョ洰褰曡妭鐐瑰彲瀛樺偍鏁版嵁绫诲瀷鍚庣紑锛屽锛�.zip,.doc,.xls,.dwg,.pdf", + valuesuffix: "璇疯緭鍏ョ洰褰曡妭鐐瑰彲瀛樺偍鏁版嵁绫诲瀷鍚庣紑锛屽锛�.zip,.doc,.xls, ,.pdf", label: '璇锋坊鍔犺鏌ヨ鐨勬潯浠�', queryContent: '璇疯緭鍏ユ煡璇㈠唴瀹�', geographicPosition: '璇峰湪鍦板浘涓婃坊鍔犲湴鐞嗕綅缃�', diff --git a/src/components/chart/BaseBarChart.vue b/src/components/chart/BaseBarChart.vue index ed0e9c4..86ecda3 100644 --- a/src/components/chart/BaseBarChart.vue +++ b/src/components/chart/BaseBarChart.vue @@ -1,5 +1,6 @@ <template> - <div class="barchar" ref="chart"></div> + <div class="barchar" + ref="chart"></div> </template> <script> @@ -40,15 +41,15 @@ default: "", }, }, - data() { + data () { return { chart: null, dataList: [], } }, computed: { - option() { - let data = [ + option () { + let data=[ { country: "鑻忎腹", count: 1, @@ -95,22 +96,22 @@ }, ] - let xAxisData = [] - let yAxisData = [] - if (this.dataList) { - data = this.dataList + let xAxisData=[] + let yAxisData=[] + if(this.dataList) { + data=this.dataList } - let count = 0 - let countVal = 0 + let count=0 + let countVal=0 - const title = this.title + const title=this.title data.forEach(item => { - let name = item.province || item.country || item.杈撻�佷粙璐� - let value = item.count || item.绔欏満鏁伴噺 - if (title == "绔欏満搴ф暟" && item.绠¢亾鏁伴噺) { - count += item.绠¢亾鏁伴噺 + let name=item.province||item.country||item.杈撻�佷粙璐� + let value=item.count||item.绔欏満鏁伴噺 + if(title=="绔欏満搴ф暟"&&item.绠¢亾鏁伴噺) { + count+=item.绠¢亾鏁伴噺 } else { - count += item.count || 0 + count+=item.count||0 } // switch (title) { @@ -125,12 +126,22 @@ xAxisData.push(name) yAxisData.push(value) }) - console.log("绠¢亾鏁伴噺", countVal) - if (typeof count === "number") { - this.$bus.$emit("changeCount", count) + var obj=[]; + for(var i in xAxisData) { + if(xAxisData[i]) { + obj.push(xAxisData[i]) + } else { + obj.push("鍏朵粬") + } } - let option = { + + xAxisData=obj + + if(typeof count==="number") { + this.$bus.$emit("changeCount",count) + } + let option={ backgroundColor: "transparent", tooltip: { trigger: "axis", @@ -161,24 +172,24 @@ textStyle: { fontSize: 11, }, - formatter: function (value) { + formatter: function(value) { // - var ret = "" //鎷兼帴鍔燶n杩斿洖鐨勭被鐩」 - var maxLength = 2 //姣忛」鏄剧ず鏂囧瓧涓暟 - var valLength = value.length //X杞寸被鐩」鐨勬枃瀛椾釜鏁� - var rowN = Math.ceil(valLength / maxLength) //绫荤洰椤归渶瑕佹崲琛岀殑琛屾暟 - if (xAxisData.length < 7) { + var ret="" //鎷兼帴鍔燶n杩斿洖鐨勭被鐩」 + var maxLength=2 //姣忛」鏄剧ず鏂囧瓧涓暟 + var valLength=value.length //X杞寸被鐩」鐨勬枃瀛椾釜鏁� + var rowN=Math.ceil(valLength/maxLength) //绫荤洰椤归渶瑕佹崲琛岀殑琛屾暟 + if(xAxisData.length<7) { return value } - if (rowN > 1) { + if(rowN>1) { //濡傛灉绫荤洰椤圭殑鏂囧瓧澶т簬3, - for (var i = 0; i < rowN; i++) { - var temp = "" //姣忔鎴彇鐨勫瓧绗︿覆 - var start = i * maxLength //寮�濮嬫埅鍙栫殑浣嶇疆 - var end = start + maxLength //缁撴潫鎴彇鐨勪綅缃� + for(var i=0;i<rowN;i++) { + var temp="" //姣忔鎴彇鐨勫瓧绗︿覆 + var start=i*maxLength //寮�濮嬫埅鍙栫殑浣嶇疆 + var end=start+maxLength //缁撴潫鎴彇鐨勪綅缃� //杩欓噷涔熷彲浠ュ姞涓�涓槸鍚︽槸鏈�鍚庝竴琛岀殑鍒ゆ柇锛屼絾鏄笉鍔犱篃娌℃湁褰卞搷锛岄偅灏变笉鍔犲惂 - temp = value.substring(start, end) + "\n" - ret += temp //鍑�熸渶缁堢殑瀛楃涓� + temp=value.substring(start,end)+"\n" + ret+=temp //鍑�熸渶缁堢殑瀛楃涓� } return ret } else { @@ -229,7 +240,7 @@ ], false ), - barBorderRadius: [20, 20, 0, 0], + barBorderRadius: [20,20,0,0], shadowColor: "rgba(0,160,221,1)", shadowBlur: 4, }, @@ -242,11 +253,11 @@ height: 14, backgroundColor: "rgba(0,160,221,0.1)", borderRadius: 200, - position: ["-8", "-20"], + position: ["-8","-20"], distance: 1, formatter: value => { // console.log(value); - if (value.name == "涓浗") { + if(value.name=="涓浗") { return [ ` {d|鈼弣", " {a|${value.value}} \n", " {b|}`, ].join(",") @@ -283,85 +294,85 @@ watch: { option: { deep: true, - handler(newVal) { + handler (newVal) { this.setOptions(newVal) }, }, project: { deep: true, immediate: true, - handler(newVal) { - let requsetFn = null - switch (newVal) { + handler (newVal) { + let requsetFn=null + switch(newVal) { case "鍏ㄧ悆椤圭洰": - requsetFn = countCountryDimension + requsetFn=countCountryDimension break case "鍏ㄥ浗椤圭洰": - requsetFn = countProvinceDimension + requsetFn=countProvinceDimension break case "鍏ㄧ悆绠$綉鍥�": - requsetFn = countZhPipeStations + requsetFn=countZhPipeStations break case "鍏ㄥ浗绠$綉鍥�": - requsetFn = countZhPipeStations + requsetFn=countZhPipeStations break default: break } - requsetFn && this.initData(requsetFn) + requsetFn&&this.initData(requsetFn) this.setOptions(this.option) }, }, }, - mounted() { + mounted () { // this.initData() this.initChart() - if (this.autoResize) { - window.addEventListener("resize", this.resizeHandler) + if(this.autoResize) { + window.addEventListener("resize",this.resizeHandler) } }, - beforeDestroy() { - if (!this.chart) { + beforeDestroy () { + if(!this.chart) { return } - if (this.autoResize) { - window.removeEventListener("resize", this.resizeHandler) + if(this.autoResize) { + window.removeEventListener("resize",this.resizeHandler) } this.chart.dispose() - this.chart = null + this.chart=null }, methods: { - resizeHandler() { - this.chart && this.chart.resize() + resizeHandler () { + this.chart&&this.chart.resize() }, - initChart() { - this.chart = echarts.init(this.$refs.chart, "", { + initChart () { + this.chart=echarts.init(this.$refs.chart,"",{ renderer: this.type, }) this.chart.setOption(this.option) - this.chart.on("click", this.handleClick) + this.chart.on("click",this.handleClick) }, - handleClick(params) { - this.$emit("click", params) + handleClick (params) { + this.$emit("click",params) }, - setOptions(option) { + setOptions (option) { this.clearChart() this.resizeHandler() - if (this.chart) { + if(this.chart) { this.chart.setOption(option) } }, - refresh() { + refresh () { this.setOptions(this.option) }, - clearChart() { - this.chart && this.chart.clear() + clearChart () { + this.chart&&this.chart.clear() }, - async initData(requsetFn = countCountryDimension) { - const res = await requsetFn() - if (res.code == 200) { - this.dataList = res.result - console.log("requsetFn", res) + async initData (requsetFn=countCountryDimension) { + const res=await requsetFn() + if(res.code==200) { + this.dataList=res.result + console.log("requsetFn",res) } }, }, diff --git a/src/components/chart/BaseLineChart.vue b/src/components/chart/BaseLineChart.vue index 6cf4063..de73b0b 100644 --- a/src/components/chart/BaseLineChart.vue +++ b/src/components/chart/BaseLineChart.vue @@ -1,5 +1,6 @@ <template> - <div class="linechar" ref="chart"></div> + <div class="linechar" + ref="chart"></div> </template> <script> @@ -54,27 +55,27 @@ default: "", }, }, - data() { + data () { return { chart: null, dataList: [], } }, computed: { - option() { - let xAxis = [] - let yAxis = [] - const proObj = this.dataList.find(item => item.椤圭洰鍚嶇О == this.project) - if (proObj) { + option () { + let xAxis=[] + let yAxis=[] + const proObj=this.dataList.find(item => item.椤圭洰鍚嶇О==this.project) + if(proObj) { Object.keys(proObj).forEach(item => { - if (item.toString() != '椤圭洰鍚嶇О') { + if(item.toString()!='椤圭洰鍚嶇О') { xAxis.push(item) yAxis.push(proObj[item]) } }) } else { this.dataList.forEach(item => { - let type = item.type || item.projtype + let type=item.type||item.projtype xAxis.push(type) yAxis.push(item.count) }) @@ -88,7 +89,17 @@ // } // }) - let option = { + var obj=[]; + for(var i in xAxis) { + if(xAxis[i]) { + obj.push(xAxis[i]) + } else { + obj.push("鍏朵粬") + } + } + + xAxis=obj + let option={ tooltip: { trigger: "axis", }, @@ -165,88 +176,88 @@ watch: { option: { deep: true, - handler(newVal) { + handler (newVal) { this.setOptions(newVal) }, }, project: { deep: true, immediate: true, - handler(newVal) { - let requsetFn = null - switch (newVal) { + handler (newVal) { + let requsetFn=null + switch(newVal) { case "鍏ㄧ悆椤圭洰": - requsetFn = countProjectTypeNumber + requsetFn=countProjectTypeNumber break case "鍏ㄥ浗椤圭洰": - requsetFn = countProjectTypeNumber + requsetFn=countProjectTypeNumber break case "鍏ㄧ悆绠$綉鍥�": - requsetFn = countZhPipeMapLength + requsetFn=countZhPipeMapLength break case "鍏ㄥ浗绠$綉鍥�": - requsetFn = countZhPipeMapLength + requsetFn=countZhPipeMapLength break default: - requsetFn = countStorageByProject + requsetFn=countStorageByProject break } - requsetFn && this.initData(requsetFn) + requsetFn&&this.initData(requsetFn) this.setOptions(this.option) }, }, }, - mounted() { + mounted () { // this.initData() this.initChart() - if (this.autoResize) { - window.addEventListener("resize", this.resizeHandler) + if(this.autoResize) { + window.addEventListener("resize",this.resizeHandler) } }, - beforeDestroy() { - if (!this.chart) { + beforeDestroy () { + if(!this.chart) { return } - if (this.autoResize) { - window.removeEventListener("resize", this.resizeHandler) + if(this.autoResize) { + window.removeEventListener("resize",this.resizeHandler) } this.chart.dispose() - this.chart = null + this.chart=null }, methods: { - resizeHandler() { - this.chart && this.chart.resize() + resizeHandler () { + this.chart&&this.chart.resize() }, - initChart() { - this.chart = echarts.init(this.$refs.chart, "", { + initChart () { + this.chart=echarts.init(this.$refs.chart,"",{ renderer: this.type, }) this.chart.setOption(this.option) - this.chart.on("click", this.handleClick) + this.chart.on("click",this.handleClick) }, - handleClick(params) { - this.$emit("click", params) + handleClick (params) { + this.$emit("click",params) }, - setOptions(option) { + setOptions (option) { this.clearChart() this.resizeHandler() - if (this.chart) { + if(this.chart) { this.chart.setOption(option) } }, - refresh() { + refresh () { this.setOptions(this.option) }, - clearChart() { - this.chart && this.chart.clear() + clearChart () { + this.chart&&this.chart.clear() }, - async initData(requsetFn = GetServicesVisitsCount) { - const res = await requsetFn(this.params) - if (res.code == 200) { - this.dataList = res.result - console.log("requsetFn", res) + async initData (requsetFn=GetServicesVisitsCount) { + const res=await requsetFn(this.params) + if(res.code==200) { + this.dataList=res.result + console.log("requsetFn",res) } }, }, diff --git a/src/components/navMenu.vue b/src/components/navMenu.vue index 57b86e2..508537a 100644 --- a/src/components/navMenu.vue +++ b/src/components/navMenu.vue @@ -1,40 +1,28 @@ <template> - <div - class="NavBox" - @click.stop - > + <div class="NavBox" + @click.stop> <div class="topBox"> <div class="topTitle"></div> <div class="topMenu"> <div class="menuContent"> - <div - class="contentDiv" - @click="setMenuMove(index, item)" - v-for="(item, index) in listMenu" - > + <div class="contentDiv" + @click="setMenuMove(index, item)" + v-for="(item, index) in listMenu"> <div style="display: flex;align-items: center"> <div class="ImgMenu"> - <div - class="menuImage" - :class="changeSelectStyle == index ? item.checkClass : item.css" - ></div> + <div class="menuImage" + :class="changeSelectStyle == index ? item.checkClass : item.css"></div> </div> - <div - class="menulabel" - :class="{ changeStyle: changeSelectStyle == index }" - > + <div class="menulabel" + :class="{ changeStyle: changeSelectStyle == index }"> <span v-show="language"> {{ item.cnName }}</span> <span v-show="!language"> {{ item.enName }}</span> </div> </div> - <div - class="secondMenuDiv subpage_Div" - v-show="index == showFlag ? true :false" - > - <div - v-for="res in item.children" - @click="setLiClick(res,index)" - :class="{ changeLiStyle: changeliSelect == res.cnName }" - > + <div class="secondMenuDiv subpage_Div" + v-show="index == showFlag ? true :false"> + <div v-for="res in item.children" + @click="setLiClick(res,index)" + :class="{ changeLiStyle: changeliSelect == res.cnName }"> <span v-show="language"> {{ res.cnName }}</span> <span v-show="!language"> {{ res.enName }}</span> </div> </div> @@ -43,25 +31,19 @@ </div> <div class="topUser"> <div class="userLanguage"> - <div - class="userImage theme" - @click="themeChange" - ></div> - <div - class="userImage user2" - @click="switchLang" - ></div> + <div class="userImage theme" + @click="themeChange"></div> + <div class="userImage user2" + @click="switchLang"></div> </div> <div class="userName"> <div class="userImage user1"></div> <div class="userText"> <span>{{ this.$store.state.uname }}</span> - <el-link - @click="logOut" - :underline="false" - class="elLink" - >{{ $t('common.logout') }}</el-link> + <el-link @click="logOut" + :underline="false" + class="elLink">{{ $t('common.logout') }}</el-link> </div> </div> </div> @@ -71,13 +53,13 @@ </template> <script> -import { logout, selectMenuRecursive, sign_insertOpLog } from '@/api/api'; -import { removeToken, getToken } from '@/utils/auth'; +import { logout,selectMenuRecursive,sign_insertOpLog } from '@/api/api'; +import { removeToken,getToken } from '@/utils/auth'; import customElMenu from '../components/customElMenu.vue'; -import { queryMenuTree, getPerms } from '../api/api'; +import { queryMenuTree,getPerms } from '../api/api'; import colorChange from '../views/maintenance/colorChange.vue'; import { containsCoordinate } from 'ol/extent'; -import Vue from 'vue'; +import Vue,{ nextTick } from 'vue'; import $ from 'jquery' export default { name: 'navMenu', @@ -86,7 +68,7 @@ customElMenu, colorChange, }, - data() { + data () { return { themeColor: true, @@ -140,34 +122,34 @@ ] }; }, - created() { }, - mounted() { - this.$store.state.themeflag = false; + created () { }, + mounted () { + this.$store.state.themeflag=false; $("#app").removeClass("Black_theme"); this.getMenuTree(); - if (sessionStorage.getItem('changeliSelect')) { - this.$set(this, 'changeliSelect', sessionStorage.getItem('changeliSelect')) + if(sessionStorage.getItem('changeliSelect')) { + this.$set(this,'changeliSelect',sessionStorage.getItem('changeliSelect')) // this.changeliSelect = sessionStorage.getItem('changeliSelect') } - document.body.addEventListener('click', () => { - this.showFlag = null; - }, false); + document.body.addEventListener('click',() => { + this.showFlag=null; + },false); // this.$bus.$on('closeMenuSecond', res => { // this.showFlag = null; // }) - window.addEventListener('message', (e) => { + window.addEventListener('message',(e) => { - this.showFlag = null; + this.showFlag=null; }) }, computed: {}, methods: { - closeSecondMenu() { - this.showFlag = null + closeSecondMenu () { + this.showFlag=null }, - themeChange() { - this.$store.state.themeflag = !this.$store.state.themeflag; - if (this.$store.state.themeflag == true) { + themeChange () { + this.$store.state.themeflag=!this.$store.state.themeflag; + if(this.$store.state.themeflag==true) { $("#app").addClass("Black_theme"); } else { @@ -175,32 +157,32 @@ } }, - async getCookies() { - var boolean = this.getTimeCookies(); - if (boolean != true) { + async getCookies () { + var boolean=this.getTimeCookies(); + if(boolean!=true) { this.$router.push('/login'); return; } - if (this.$store.state.permsEntity.length == 0) { - const data = await getPerms(); - this.$store.state.permsEntity = data.result; + if(this.$store.state.permsEntity.length==0) { + const data=await getPerms(); + this.$store.state.permsEntity=data.result; } - this.$store.state.uname = JSON.parse( + this.$store.state.uname=JSON.parse( localStorage.getItem('LFToken') ).uname; - this.$store.state.unid = JSON.parse( + this.$store.state.unid=JSON.parse( localStorage.getItem('LFToken') ).userid; this.$router.push('/'); }, - getTimeCookies() { - if (!localStorage.getItem('LFToken')) { + getTimeCookies () { + if(!localStorage.getItem('LFToken')) { return false } - var time1 = new Date(JSON.parse(localStorage.getItem('LFToken')).time); - var time2 = new Date(); - if (time2 > time1) { + var time1=new Date(JSON.parse(localStorage.getItem('LFToken')).time); + var time2=new Date(); + if(time2>time1) { return false; } else { return true; @@ -208,77 +190,81 @@ }, //涓婚鍒囨崲 - setThemeColors() { }, - async signInsertOpLog(m1, m2) { - var obj = { + setThemeColors () { }, + async signInsertOpLog (m1,m2) { + var obj={ m1: m1, m2: m2, } - const data = await sign_insertOpLog(obj); + const data=await sign_insertOpLog(obj); }, //榧犳爣绉诲叆鑿滃崟浜嬩欢 - setMenuMove(index, item) { + setMenuMove (index,item) { - if (item.perms != null && item.perms != "") { + if(item.perms!=null&&item.perms!="") { this.$router.push(item.url); - if (this.showFlag != null) { + if(this.showFlag!=null) { - this.changeliSelect = '%%'; - this.showFlag = null; + this.changeliSelect='%%'; + this.showFlag=null; } - if (item.url == "Thematic") { - this.signInsertOpLog("缁煎悎灞曠ず", item.cnName) + if(item.url=="Thematic") { + this.signInsertOpLog("缁煎悎灞曠ず",item.cnName) + this.$nextTick(function() { + location.reload(); + }) + } - this.changeSelectStyle = index; - sessionStorage.setItem('changeSelectStyle', index) + this.changeSelectStyle=index; + sessionStorage.setItem('changeSelectStyle',index) } else { - if (this.showFlag != index) { - this.showFlag = index; + if(this.showFlag!=index) { + this.showFlag=index; } else { - this.showFlag = null; + this.showFlag=null; } } // - if (index === 4 || index === 5 || index === 6) { + if(index===4||index===5||index===6) { sessionStorage.removeItem('changeliSelect') - this.$set(this, 'changeliSelect', null) + this.$set(this,'changeliSelect',null) } }, - closeAllChildren() { - var val = this.listMenu - for (var i = 0; i < val.length; i++) { - let newItem = val[i]; - newItem.show = false; + closeAllChildren () { + var val=this.listMenu + for(var i=0;i<val.length;i++) { + let newItem=val[i]; + newItem.show=false; - Vue.set(val, i, newItem); + Vue.set(val,i,newItem); } }, - setShowFalseDiv(bolean) { - var index = this.showFlag; - if (index != null) { - let newItem = this.listMenu[index]; + setShowFalseDiv (bolean) { + var index=this.showFlag; + if(index!=null) { + let newItem=this.listMenu[index]; - newItem.show = bolean; - Vue.set(this.listMenu, index, newItem); + newItem.show=bolean; + Vue.set(this.listMenu,index,newItem); } }, - setLiClick(res, index) { - this.changeSelectStyle = index; - sessionStorage.setItem('changeSelectStyle', index) + setLiClick (res,index) { + this.changeSelectStyle=index; + sessionStorage.setItem('changeSelectStyle',index) sessionStorage.removeItem('hanleselectmochaitmo') sessionStorage.removeItem('hanleselectindex') // this.signInsertOpLog(this.listMenu[index].cnName, res.cnName) setTimeout(() => { - this.changeliSelect = res.cnName; - sessionStorage.setItem('changeliSelect', res.cnName) - if (res.url.indexOf('{fmeHost}') != -1) { - this.$store.reporturl = res.url; - sessionStorage.setItem('iframehttpurl', this.$store.reporturl) + this.changeliSelect=res.cnName; + sessionStorage.setItem('changeliSelect',res.cnName) + if(res.url.indexOf('{fmeHost}')!=-1) { + this.$store.reporturl=res.url; + sessionStorage.setItem('iframehttpurl',this.$store.reporturl) this.$router.push('/QualityInspection'); // if (location.href.indexOf('/WareInspection') == -1) { // this.$store.reporturl = res.url; @@ -287,29 +273,29 @@ // this.$bus.$emit('changeNaveUrl', res.url); // } } else { - this.$store.reporturl = null; - sessionStorage.setItem('iframehttpurl', null) + this.$store.reporturl=null; + sessionStorage.setItem('iframehttpurl',null) // sessionStorage.setItem('changeliSelect', null) this.$router.push(res.url); - this.$store.commit('currentPerms', res.perms); + this.$store.commit('currentPerms',res.perms); } this.setShowFalseDiv(false) - }, 100) + },100) }, - async getMenuTree() { + async getMenuTree () { this.getCookies(); - const data = await queryMenuTree(); + const data=await queryMenuTree(); - var that = this; - if (data.code == 200) { + var that=this; + if(data.code==200) { - if (data.result.length != 0) { - let menuLists = data.result.filter((value) => { - return value.pid == 1; + if(data.result.length!=0) { + let menuLists=data.result.filter((value) => { + return value.pid==1; }); - that.menuList = menuLists; + that.menuList=menuLists; that.setMenuTree(menuLists); } else { @@ -320,22 +306,22 @@ } } }, - async setMenuTree(res) { + async setMenuTree (res) { - for (var i in res) { - res[i].checkClass = res[i].css + '1'; - res[i].show = false; //鎺у埗鏄鹃殣 + for(var i in res) { + res[i].checkClass=res[i].css+'1'; + res[i].show=false; //鎺у埗鏄鹃殣 - if (res[i].perms == null || res[i].perms == "") { - const result = await selectMenuRecursive({ id: res[i].id }); + if(res[i].perms==null||res[i].perms=="") { + const result=await selectMenuRecursive({ id: res[i].id }); - if (result.code == 200) { + if(result.code==200) { - res[i].children = result.result.filter((value) => { - return value.isShow == 1; + res[i].children=result.result.filter((value) => { + return value.isShow==1; }) .filter((value) => { - return value.pid == res[i].id; + return value.pid==res[i].id; }); } @@ -353,7 +339,7 @@ // this.changeSelectStyle = this.listMenu.length - 1; // } - this.changeSelectStyle = sessionStorage.getItem('changeSelectStyle') + this.changeSelectStyle=sessionStorage.getItem('changeSelectStyle') // var strartMneu = res[i].children[0]; // this.$store.commit('currentPerms', strartMneu.perms); // this.changeliSelect = strartMneu.cnName; @@ -363,17 +349,17 @@ } } }, - treeData(source) { - let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 + treeData (source) { + let cloneData=JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 // console.log(cloneData); - if (cloneData.length != 0) { + if(cloneData.length!=0) { return cloneData.filter((father) => { // 寰幆鎵�鏈夐」 - let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 - branchArr.length > 0 ? (father.children = branchArr) : ''; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� + let branchArr=cloneData.filter((child) => father.id==child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + branchArr.length>0? (father.children=branchArr):''; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛� // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋� - return father.pid == 1; // 杩斿洖涓�绾ц彍鍗� + return father.pid==1; // 杩斿洖涓�绾ц彍鍗� }); } else { this.$message({ @@ -382,16 +368,16 @@ }); } }, - logOut() { - this.$confirm('纭鏄惁閫�鍑虹櫥褰�?', '鎻愮ず', { + logOut () { + this.$confirm('纭鏄惁閫�鍑虹櫥褰�?','鎻愮ず',{ confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', type: 'warning', }) .then(async () => { - const data = await logout({ token: getToken() }); + const data=await logout({ token: getToken() }); // console.log(data); - if (data.code != 200) { + if(data.code!=200) { return this.$message.error('閫�鍑虹櫥褰曞け璐�'); } removeToken(); @@ -408,59 +394,59 @@ }); }); }, - switchLang() { + switchLang () { //褰撳墠en - if (this.lang == 'en') { + if(this.lang=='en') { //璇█鎹㈡垚zh - this.lang = 'zh'; - this.language = true; - this.$store.state.language = true; + this.lang='zh'; + this.language=true; + this.$store.state.language=true; //鑿滃崟鎹负zh - this.$store.commit('changeLang', 'zh'); + this.$store.commit('changeLang','zh'); //i18鎹㈡垚zh - this.$i18n.locale = this.lang; + this.$i18n.locale=this.lang; } //褰撳墠zh else { - this.lang = 'en'; - this.language = false; - this.$store.state.language = false; - this.$i18n.locale = this.lang; - this.$store.commit('changeLang', 'en'); //浼犻�掔偣鍑荤殑鑺傜偣 + this.lang='en'; + this.language=false; + this.$store.state.language=false; + this.$i18n.locale=this.lang; + this.$store.commit('changeLang','en'); //浼犻�掔偣鍑荤殑鑺傜偣 } }, - handleselect(index, indexPath, e) { + handleselect (index,indexPath,e) { // console.log(e.$attrs.perms); - this.$store.commit('currentPerms', e.$attrs.perms.perms); - if (Window.ws != null) { + this.$store.commit('currentPerms',e.$attrs.perms.perms); + if(Window.ws!=null) { Window.ws.close(); - Window.ws.onclose = () => { + Window.ws.onclose=() => { console.log('鏈嶅姟鍣ㄥ叧闂�'); }; - Window.ws = null; + Window.ws=null; } -debugger - if (index.indexOf('{fmeHost}') != -1) { + debugger + if(index.indexOf('{fmeHost}')!=-1) { this.$router.push('/databaseMonitoring'); - this.$store.commit('getIframe', index); - } else if (isNaN(Number(index))) { + this.$store.commit('getIframe',index); + } else if(isNaN(Number(index))) { this.$router.push(index); } }, }, watch: { - $route() { - let str = this.$route.path; - if (str[0] == '/') { - this.activeIndex = str.slice(1); + $route () { + let str=this.$route.path; + if(str[0]=='/') { + this.activeIndex=str.slice(1); } }, }, - created() { - this.$store.reporturl = null; - let str = this.$route.path; - if (str[0] == '/') { - this.activeIndex = str.slice(1); + created () { + this.$store.reporturl=null; + let str=this.$route.path; + if(str[0]=='/') { + this.activeIndex=str.slice(1); } }, }; diff --git a/src/views/Thematic/index.vue b/src/views/Thematic/index.vue index bb68212..eddd7a6 100644 --- a/src/views/Thematic/index.vue +++ b/src/views/Thematic/index.vue @@ -1,21 +1,20 @@ <template> <div class="themaic"> <mapsdk></mapsdk> - <top class="title" ref="title"></top> - <left - class="mapleft" - :style="{ width: leftWidth, left: leftWidth == '22%' ? '-19px' : '0' }" - ref="mapleft" - ></left> + <top class="title" + ref="title"></top> + <left class="mapleft" + :style="{ width: leftWidth, left: leftWidth == '22%' ? '-19px' : '0' }" + ref="mapleft"></left> - <project-tree class="project-tree" v-show="ProjectreeDisplay"></project-tree> + <project-tree class="project-tree" + v-show="ProjectreeDisplay"></project-tree> - <right - class="mapright" - :style="{ width: rightWidth }" - ref="mapright" - ></right> - <bottom class="mapbottom" ref="mapbottom"></bottom> + <right class="mapright" + :style="{ width: rightWidth }" + ref="mapright"></right> + <bottom class="mapbottom" + ref="mapbottom"></bottom> </div> </template> @@ -28,8 +27,8 @@ import ProjectTree from "../../components/Screen/ProjectTree.vue" import axios from "axios" export default { - components: { mapsdk, top, left, right, bottom, ProjectTree }, - data() { + components: { mapsdk,top,left,right,bottom,ProjectTree }, + data () { return { leftWidth: "22%", rightWidth: "22%", @@ -38,26 +37,28 @@ ProjectreeDisplay: false, } }, - mounted() {}, - created() { - this.$bus.$on("changeTree", key => { - this.ProjectreeDisplay = key + mounted () { + + }, + created () { + this.$bus.$on("changeTree",key => { + this.ProjectreeDisplay=key }) }, methods: { //淇敼宸︿晶瀹藉害 - ChangeWidth(parm) { - if (parm == "left") { - if (this.leftWidth == "22%") { - this.leftWidth = "8px" + ChangeWidth (parm) { + if(parm=="left") { + if(this.leftWidth=="22%") { + this.leftWidth="8px" } else { - this.leftWidth = "22%" + this.leftWidth="22%" } } - if (parm == "leftView" || parm == "leftTree") { - this.leftWidth = "22%" - this.rightWidth = "22%" + if(parm=="leftView"||parm=="leftTree") { + this.leftWidth="22%" + this.rightWidth="22%" } // if (parm == "leftView") { // this.leftTree = false @@ -66,11 +67,11 @@ // this.leftTree = true // } - if (parm == "right") { - if (this.rightWidth == "22%") { - this.rightWidth = "45px" + if(parm=="right") { + if(this.rightWidth=="22%") { + this.rightWidth="45px" } else { - this.rightWidth = "22%" + this.rightWidth="22%" } } }, diff --git a/src/views/Tools/AddOnlineMap.vue b/src/views/Tools/AddOnlineMap.vue index e5ee2cc..0a9e932 100644 --- a/src/views/Tools/AddOnlineMap.vue +++ b/src/views/Tools/AddOnlineMap.vue @@ -1,26 +1,47 @@ <template> - <Popup ref="pop" :title="title" @close="close(true)" width="400px" @yes="addData" @cancel="close(false)"> + <Popup ref="pop" + :title="title" + @close="close(true)" + width="400px" + @yes="addData" + @cancel="close(false)"> - <div id="archTopBox" class="archTopBox"> + <div id="archTopBox" + class="archTopBox"> - <div class="boxCard" v-for="(item, index) in mapList"> + <div class="boxCard" + v-for="(item, index) in mapList"> <el-card class="box-card"> - <div slot="header" class="clearfix"> + <div slot="header" + class="clearfix"> <span style="font-size:14px">{{ item.name }}</span> <div style="float: right; padding: 3px 0"> - <i v-show="!item.isShow" style="margin-left:10px" class="el-icon-arrow-up" :title="$t('archiveObj.fold')" - @click="setCardChange(item)"></i> - <i v-show="item.isShow" style="margin-left:10px" class="el-icon-arrow-down" - :title="$t('archiveObj.develop')" @click="setCardChange(item)"></i> + <i v-show="!item.isShow" + style="margin-left:10px" + class="el-icon-arrow-up" + :title="$t('archiveObj.fold')" + @click="setCardChange(item)"></i> + <i v-show="item.isShow" + style="margin-left:10px" + class="el-icon-arrow-down" + :title="$t('archiveObj.develop')" + @click="setCardChange(item)"></i> </div> </div> - <div :id="item.id" style="margin:5px 1px" v-show="!item.isShow"> + <div :id="item.id" + style="margin:5px 1px" + v-show="!item.isShow"> <div style="margin:10px;width:380px"> - <div class="map" v-for="(map, mapIndex) in item.list" @click="addImageLayer(map, item)"> - <img style="width: 60px; height: 60px" :src="map.image"></img> - <div> <el-link :underline="false"> + <div class="map" + v-for="(map, mapIndex) in item.list" + @click="addImageLayer(map, item)"> + <img style="width: 60px; height: 60px" + :src="map.image"></img> + <div> + <el-link :underline="false"> {{ map.name }} - </el-link></div> + </el-link> + </div> </div> </div> </div> @@ -44,7 +65,7 @@ Popup, }, mixins: [], - data() { + data () { return { title: "3D鍦ㄧ嚎鍦板浘", left: undefined, @@ -64,122 +85,123 @@ }; }, computed: { - activeNames() { + activeNames () { return this.mapList.map((item) => { return item.name; }); }, }, methods: { - setCardChange(res) { - res.isShow = !res.isShow + setCardChange (res) { + res.isShow=!res.isShow }, // 鍏抽棴寮圭獥 - close(isCloseBtn, removeLayer = true) { + close (isCloseBtn,removeLayer=true) { // removeLayer && this.removeImageLayer(); // 閲嶇疆data鍊� - Object.assign(this.$data, this.$options.data()); - !isCloseBtn && this.$refs.pop.close(); + Object.assign(this.$data,this.$options.data()); + !isCloseBtn&&this.$refs.pop.close(); }, // 鎵撳紑寮圭獥 - open() { + open () { this.close(true); this.$refs.pop.open(); }, - changeToken(token) { - this.mapCollection.tokne = token; + changeToken (token) { + this.mapCollection.tokne=token; }, - removeImageLayer() { + removeImageLayer () { // window.BaseMapLayer && window.BaseMapLayer.deleteObject(); // window.BaseMapLayer = undefined; window.Viewer.imageryLayers.remove( window.BaseMapLayer ); - - }, - addImageLayer(map, mapCollection) { - if ( - this.data.name === map.name && - (this.data.urls === map.urls || this.data.urls === mapCollection.urls) + }, + addImageLayer (map,mapCollection) { + + if( + this.data.name===map.name&& + (this.data.urls===map.urls||this.data.urls===mapCollection.urls) ) { return; } this.removeImageLayer(); - this.mapCollection = mapCollection; - if (mapCollection.sourceType === "cesium") { - - return; - } else if (mapCollection.sourceType === "tdmap") { + this.mapCollection=mapCollection; + if(mapCollection.sourceType==="cesium") { - var tokne = mapCollection.tokne; + return; + } else if(mapCollection.sourceType==="tdmap") { + + var tokne=mapCollection.tokne; //娣诲姞澶╁湴鍥惧奖鍍� - window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ - url: map.urls + tokne, + window.BaseMapLayer=Viewer.imageryLayers.addImageryProvider(new Cesium.WebMapTileServiceImageryProvider({ + url: map.urls+tokne, layer: "tdtImgLayer", style: "default", format: "image/jpeg", tileMatrixSetID: "GoogleMapsCompatible", })) - - } else if (mapCollection.sourceType === "gdmap") { - window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider( + } else if(mapCollection.sourceType==="gdmap") { + + window.BaseMapLayer=Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ url: map.urls, maximumLevel: 22, }) ); - - } else if (mapCollection.sourceType === "localmap") { - var ulr = map.urls; - ulr = ulr.replace("{host}", iisHost) - window.BaseMapLayer = Viewer.imageryLayers.addImageryProvider( + } else if(mapCollection.sourceType==="localmap") { + var ulr=map.urls; + console.log(iisHost) + ulr=ulr.replace("{host}",iisHost) + + window.BaseMapLayer=Viewer.imageryLayers.addImageryProvider( new Cesium.UrlTemplateImageryProvider({ url: ulr, maximumLevel: 22, }) ); - + } Viewer.imageryLayers.lowerToBottom(window.BaseMapLayer);//灏嗗浘灞傜Щ鍒版渶搴曞眰 Viewer.imageryLayers.raise(window.BaseMapLayer);//灏嗗浘灞傜Щ鍒版渶搴曞眰 - if (is_production) { + if(is_production) { Viewer.imageryLayers.raise(window.BaseMapLayer);//灏嗗浘灞備笂绉讳竴灞� } }, // 娣诲姞鏁版嵁 - addData() { - if (this.data.urls && this.data.sourceType) { - let data = { + addData () { + if(this.data.urls&&this.data.sourceType) { + let data={ id: window.sgworld.Core.getuid(), ...this.data, - Level: [0, 26], + Level: [0,26], }; - if (data.sourceType === "tdmap") { - data.urls += "&tk=" + this.tokne; - } else if (data.sourceType === "bdmap") { - data.style = this.mapCollection.style; + if(data.sourceType==="tdmap") { + data.urls+="&tk="+this.tokne; + } else if(data.sourceType==="bdmap") { + data.style=this.mapCollection.style; } - if (this.mapCollection.GCJ02) { - data.GCJ02 = true; + if(this.mapCollection.GCJ02) { + data.GCJ02=true; } - data.item = window.BaseMapLayer; - window.BaseMapLayer = undefined; + data.item=window.BaseMapLayer; + window.BaseMapLayer=undefined; - this.$emit("success", data); - this.close(false, false); + this.$emit("success",data); + this.close(false,false); } else { this.$message("璇烽�夋嫨鍦板浘"); } diff --git a/src/views/Tools/layer.js b/src/views/Tools/layer.js index 4be8fd7..5e22940 100644 --- a/src/views/Tools/layer.js +++ b/src/views/Tools/layer.js @@ -69,22 +69,22 @@ { name: "鍦板浘", image: require("../../assets/img/imageLayer/gdmap_map.jpg"), - urls: "http://{host}/LFData/2d/tiles/vec/{z}/{x}/{y}.png", + urls: "{host}/LFData/2d/tiles/vec/{z}/{x}/{y}.png", }, { name: "褰卞儚", image: require("../../assets/img/imageLayer/gdmap_image.jpg"), - urls: "http://{host}/LFData/2d/tiles/img/{z}/{x}/{y}.png", + urls: "{host}/LFData/2d/tiles/img/{z}/{x}/{y}.png", }, { name: "鍦板舰", image: require("../../assets/img/imageLayer/dixing.png"), - urls: "http://{host}/LFData/2d/tiles/ter/{z}/{x}/{y}.png", + urls: "{host}/LFData/2d/tiles/ter/{z}/{x}/{y}.png", }, { name: "1:20涓囧尯鍩熷湴璐ㄥ浘", image: require("../../assets/img/imageLayer/25dizhi.png"), - urls: "http://{host}/LFData/2d/tiles/20w_qydz/{z}/{x}/{y}.png", + urls: "{host}/LFData/2d/tiles/20w_qydz/{z}/{x}/{y}.png", }, ], } -- Gitblit v1.9.3