From 193c02587585f85853352f5553a0f068d078696c Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期三, 22 三月 2023 08:18:50 +0800 Subject: [PATCH] 发布管理修改预览效果,一张图修改 --- src/views/datamanage/uploadmanage.vue | 164 ++++++++++-- src/components/Screen/top.vue | 14 src/assets/css/configure.css | 8 src/components/Screen/left.vue | 87 +++++- src/components/Screen/right.vue | 39 ++ src/components/Screen/bottom.vue | 33 ++ src/utils/diaLog.js | 174 +++++++++++++ src/api/api.js | 16 src/views/Tools/LayerTree.vue | 27 ++ src/assets/css/config.css | 8 src/main.js | 3 src/utils/service.js | 111 ++++++++ src/components/preview_map.vue | 4 src/views/datamanage/dialogHeader.vue | 59 ++++ 14 files changed, 674 insertions(+), 73 deletions(-) diff --git a/src/api/api.js b/src/api/api.js index bb0e11c..7bfb41c 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -8,14 +8,14 @@ */ import request from '@/utils/request'; import axios from 'axios'; - +import service from '@/utils/service'; //鍏徃鍚庡彴 -const service = axios.create({ - // baseURL: '/api', // api鐨刡ase_url - //baseURL: 'http://192.168.20.106/', // api鐨刡ase_url - baseURL: 'http://192.168.20.39/', // api鐨刡ase_url - timeout: 35000, -}); +// const service = axios.create({ +// // baseURL: '/api', // api鐨刡ase_url +// //baseURL: 'http://192.168.20.106/', // api鐨刡ase_url +// baseURL: BASE_URL, // api鐨刡ase_url + +// }); //瀛楀吀绠$悊鍒楄〃 export function selectByPageAndCount(params) { //璇锋眰鍦板潃 @@ -1103,7 +1103,7 @@ } //鏁版嵁鍙戝竷 => 鏁版嵁鎻掑叆 export function publish_insert(params) { - return request.post('/publish/insertForPub', params); + return service.post('/publish/insertForPub', params); } diff --git a/src/assets/css/config.css b/src/assets/css/config.css index 2c9a420..219b050 100644 --- a/src/assets/css/config.css +++ b/src/assets/css/config.css @@ -517,4 +517,12 @@ .Black_theme .tabsSpan { color: #fff; +} + +.Black_theme .el-icon-full-screen { + color: #fff !important; +} + +.Black_theme .el-icon-crop { + color: #fff !important; } \ No newline at end of file diff --git a/src/assets/css/configure.css b/src/assets/css/configure.css index fc6cefe..de28fb6 100644 --- a/src/assets/css/configure.css +++ b/src/assets/css/configure.css @@ -401,4 +401,12 @@ .tabsSpan { color: #000; +} + +.el-icon-full-screen { + color: #000 !important; +} + +.el-icon-crop { + color: #000 !important; } \ No newline at end of file diff --git a/src/components/Screen/bottom.vue b/src/components/Screen/bottom.vue index ce01b0c..49c00c2 100644 --- a/src/components/Screen/bottom.vue +++ b/src/components/Screen/bottom.vue @@ -281,6 +281,7 @@ } }, handleMenuClick(menu) { + this.currMenu = menu.menuName }, handlePopoverClick(child) { @@ -307,6 +308,9 @@ //宸ョ▼宸¤ async showPathLine(params) { + + this.$bus.$emit("closeLeftAndRightMenu", true) + const line = wktToGeoJSON(params.wkt) const position = line.coordinates[0] const result = [] @@ -315,7 +319,7 @@ pos.push(1000) result.push(...pos) }) - // console.log("line", position) + window.sgworld.Creator.getFlyData(result, data => { data.showPoint = false @@ -327,6 +331,7 @@ window.PathAnimationData = { flyData: data, } + var that = this window.PathAnimationData.winIndex = layer.open({ type: 2, title: "宸ョ▼宸¤", @@ -337,6 +342,7 @@ content: SmartEarthRootUrl + "Workers/path/ProjectPath.html", end: function () { PathAnimationData.fly && PathAnimationData.fly.exit() + that.$bus.$emit("closeLeftAndRightMenu", false) }, }) }) @@ -413,6 +419,31 @@ //涓撻灞曠ず changeProject(params) { this.$bus.$emit("changeProject", params.name) + var lon, lat, height; + if (params.name.indexOf("鍏ㄥ浗") != -1) { + height = 20000000; + lon = 110; + lat = 32; + window.viewer.camera.flyTo({ + destination: new Cesium.Cartesian3.fromDegrees(lon, lat, height), + orientation: { + heading: Cesium.Math.toRadians(0), + pitch: Cesium.Math.toRadians(-90), + }, + }) + } else if (params.name.indexOf("鍏ㄧ悆") != -1) { + lon = 85; + lat = 25; + height = 30000000; + window.viewer.camera.flyTo({ + destination: new Cesium.Cartesian3.fromDegrees(lon, lat, height), + orientation: { + heading: Cesium.Math.toRadians(0), + pitch: Cesium.Math.toRadians(-90), + }, + }) + } + }, handleTree(params) { this.showTree = !this.showTree diff --git a/src/components/Screen/left.vue b/src/components/Screen/left.vue index 2f30e4b..a1643d0 100644 --- a/src/components/Screen/left.vue +++ b/src/components/Screen/left.vue @@ -1,32 +1,59 @@ <template> <div class="current"> <div class="leftarrow"> - <img :src="leftImg" @click="ChangeLeft" /> + <img + :src="leftImg" + @click="ChangeLeft" + /> </div> - <div class="leftContainer" v-if="currentDisplay == '澶у睆' && ChartDisplay"> - <div class="current1" id="leftCurrent1"> + <div + class="leftContainer" + v-if="currentDisplay == '澶у睆' && ChartDisplay" + > + <div + class="current1" + id="leftCurrent1" + > <div class="aside-title">鏁版嵁鐢宠娆℃暟</div> <count-data-apply></count-data-apply> </div> - <div class="current1" id="leftCurrent2"> + <div + class="current1" + id="leftCurrent2" + > <div class="aside-title">鐢ㄦ埛璁块棶閲�</div> <service-type></service-type> </div> - <div class="current1" id="leftCurrent3"> + <div + class="current1" + id="leftCurrent3" + > <div class="aside-title">椤圭洰瀛樺偍淇℃伅</div> <data-storage></data-storage> </div> </div> <!-- 鍏ㄧ悆銆佸叏鍥界粺璁℃鏁� --> - <div class="leftContainer" v-if="currentDisplay == '椤圭洰'"> - <div class="current1" id="leftCurrent1"> + <div + class="leftContainer" + v-if="currentDisplay == '椤圭洰'" + > + <div + class="current1" + id="leftCurrent1" + > <div class="aside-title">鏁版嵁鎬昏</div> <div class="wrapper"> <div class="title">{{ currentProject }}</div> - <dv-digital-flop style="height: 40px" :config="xmCountConfig" /> + <dv-digital-flop + style="height: 40px" + :config="xmCountConfig" + /> </div> </div> - <div class="current1" id="leftCurrent2"> + <div + class="current1" + id="leftCurrent2" + > <div class="aside-title">瀛樺偍淇℃伅</div> <base-line-chart :requsetFn="requsetFn" @@ -34,21 +61,36 @@ title="鏁版嵁瀛樺偍閲�" ></base-line-chart> </div> - <div class="current1" id="leftCurrent3"> + <div + class="current1" + id="leftCurrent3" + > <div class="aside-title">鏁版嵁瀛樺偍閲�</div> <data-storage-type></data-storage-type> </div> </div> <!-- 鍏ㄧ悆銆佸叏鍥界缃戝浘 --> - <div class="leftContainer" v-if="currentDisplay == '绠$綉'"> - <div class="current1" id="leftCurrent1"> + <div + class="leftContainer" + v-if="currentDisplay == '绠$綉'" + > + <div + class="current1" + id="leftCurrent1" + > <div class="aside-title">鏁版嵁鎬昏</div> <div class="wrapper"> <div class="title">{{ currentProject }}</div> - <dv-digital-flop style="height: 40px" :config="xmCountConfig" /> + <dv-digital-flop + style="height: 40px" + :config="xmCountConfig" + /> </div> </div> - <div class="current1" id="leftCurrent2"> + <div + class="current1" + id="leftCurrent2" + > <div class="aside-title">绠$綉闀垮害</div> <base-line-chart :requsetFn="requsetFn" @@ -58,13 +100,19 @@ <!-- <base-pie-chart :project="currentProject"></base-pie-chart> --> <!-- <service-type></service-type> --> </div> - <div class="current1" id="leftCurrent3"> + <div + class="current1" + id="leftCurrent3" + > <div class="aside-title">鏁版嵁瀛樺偍閲�</div> <data-storage-type></data-storage-type> </div> </div> <!-- 鍗曚釜宸ョ▼灞曠ず --> - <div class="leftContainer" v-if="currentDisplay == '宸ョ▼'"> + <div + class="leftContainer" + v-if="currentDisplay == '宸ョ▼'" + > <div class="current1"> <div class="aside-title">宸ョ▼绠�浠�</div> <projectintroduction></projectintroduction> @@ -161,6 +209,11 @@ ...this.xmCountConfig, } } + }) + this.$bus.$on("closeLeftAndRightMenu", (res) => { + this.ChartDisplay = res; + this.ProjectreeDisplay = res; + this.ChangeLeft(); }) }, methods: { @@ -448,7 +501,7 @@ startValue: dataAxis[Math.max(params.dataIndex - zoomSize / 2, 0)], endValue: dataAxis[ - Math.min(params.dataIndex + zoomSize / 2, data.length - 1) + Math.min(params.dataIndex + zoomSize / 2, data.length - 1) ], }) }) diff --git a/src/components/Screen/right.vue b/src/components/Screen/right.vue index 4ecbb25..48007ed 100644 --- a/src/components/Screen/right.vue +++ b/src/components/Screen/right.vue @@ -1,6 +1,9 @@ <template> <div class="current"> - <div class="rightContainer" v-if="currentDisplay == '澶у睆' && ChartDisplay"> + <div + class="rightContainer" + v-if="currentDisplay == '澶у睆' && ChartDisplay" + > <div class="current1"> <div class="aside-title">椤圭洰缁熻</div> <project-category></project-category> @@ -15,7 +18,10 @@ </div> </div> <!-- 鍏ㄧ悆銆佸叏鍥介」鐩� --> - <div class="rightContainer" v-if="currentDisplay == '椤圭洰'"> + <div + class="rightContainer" + v-if="currentDisplay == '椤圭洰'" + > <div class="current1"> <div class="aside-title"></div> <!-- <country-dimension-bar ref="barRef"></country-dimension-bar> --> @@ -31,7 +37,10 @@ v-if="currentProject == '鍏ㄧ悆椤圭洰'" ref="pieRef" ></country-dimension-pie> - <province-dimension-pie v-else ref="pieRef"></province-dimension-pie> + <province-dimension-pie + v-else + ref="pieRef" + ></province-dimension-pie> </div> <div class="current1"> <div class="aside-title">鏁版嵁浣跨敤鎯呭喌</div> @@ -42,7 +51,10 @@ </div> </div> <!-- 鍏ㄥ浗銆佸叏鐞冪缃� --> - <div class="rightContainer" v-if="currentDisplay == '绠$綉'"> + <div + class="rightContainer" + v-if="currentDisplay == '绠$綉'" + > <div class="current1"> <div class="aside-title">绔欏満搴ф暟</div> <!-- <country-dimension-bar ref="barRef"></country-dimension-bar> --> @@ -67,7 +79,10 @@ </div> </div> <!-- 鍗曚釜宸ョ▼ --> - <div class="rightContainer" v-if="currentDisplay == '宸ョ▼'"> + <div + class="rightContainer" + v-if="currentDisplay == '宸ョ▼'" + > <div class="current1"> <div class="aside-title">鏁版嵁瀛樺偍閲�</div> <base-line-chart @@ -86,7 +101,10 @@ </div> <div class="current1"> <div class="aside-title">绠¢亾鏉℃暟</div> - <div class="content" style="height: 30px"> + <div + class="content" + style="height: 30px" + > <div class="header"> <div>鏍煎紡</div> <div>鏁伴噺</div> @@ -97,7 +115,10 @@ </div> <div class="rightarrow"> - <img :src="RightImg" @click="ChangeRight" /> + <img + :src="RightImg" + @click="ChangeRight" + /> </div> </div> </template> @@ -251,6 +272,10 @@ projectCode: code, } }) + this.$bus.$on("closeLeftAndRightMenu", (res) => { + this.ChartDisplay = res + this.ChangeRight(); + }) }, methods: { diff --git a/src/components/Screen/top.vue b/src/components/Screen/top.vue index 8412b39..e473e93 100644 --- a/src/components/Screen/top.vue +++ b/src/components/Screen/top.vue @@ -17,7 +17,10 @@ <img src="../../assets/img/Screen/ptree.png" /> <span>宸ョ▼椤圭洰</span> </div> --> - <div class="topleft__curr"> + <div + class="topleft__curr" + @click="setMapViewStart()" + > <img src="../../assets/img/Screen/ptree.png" /> <span :title="currentProject">{{ currentProject }}</span> </div> @@ -34,7 +37,10 @@ <img src="../../assets/img/Screen/bigST.png" /> <span>杩斿洖澶у睆</span> </div> - <div class="topright1 toprightC" @click="ReturnLast"> + <div + class="topright1 toprightC" + @click="ReturnLast" + > <img src="../../assets/img/Screen/return.png" /> <span>杩斿洖涓婄骇</span> </div> @@ -74,6 +80,9 @@ this.$parent.$refs.mapright.OpenLeftInit() this.currentProject = "澶у睆瑙嗗浘" // 鍥炲埌鍒濆鍖栬瑙� + this.setMapViewStart(); + }, + setMapViewStart() { window.viewer.camera.flyTo({ destination: new Cesium.Cartesian3.fromDegrees(110, 32, 20000000), orientation: { @@ -82,7 +91,6 @@ }, }) }, - //鎵撳紑宸ョ▼鏍� OpenProjectree() { this.screen = false diff --git a/src/components/preview_map.vue b/src/components/preview_map.vue index 63f0449..58d953d 100644 --- a/src/components/preview_map.vue +++ b/src/components/preview_map.vue @@ -39,9 +39,9 @@ //鏄剧ずfps Viewer.scene.debugShowFramesPerSecond = false; //瀵艰埅鎺т欢 - window.sgworld.navControl("nav", false); + // window.sgworld.navControl("nav", false); //姣斾緥灏� - window.sgworld.navControl("scale", false); + // window.sgworld.navControl("scale", false); //寮�鍚繁搴︽娴� // sg.Analysis.depthTestAgainstTerrain(true) Viewer.scene.globe.depthTestAgainstTerrain = true; diff --git a/src/main.js b/src/main.js index 04ba251..d2a3bd6 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,9 @@ import dataV from '@jiaminghi/data-view' import directive from '@/directive/index.js' // directive import drag from '@/assets/js/drag.js' +import elDragDialog from './utils/diaLog.js' +Vue.directive('el-drag-dialog', elDragDialog); +ElementUI.Dialog.props.closeOnClickModal.default = false; Vue.use(directive) Vue.use(dataV) Vue.use(VueParticles) diff --git a/src/utils/diaLog.js b/src/utils/diaLog.js new file mode 100644 index 0000000..695f011 --- /dev/null +++ b/src/utils/diaLog.js @@ -0,0 +1,174 @@ +export default { + bind(el, binding, vnode, oldVnode) { + const resizeEvent = new CustomEvent('drag-resize', { + detail: '灏哄鍙樺寲', + bubbles: false + }) + // 鍒濆鍖栦笉鏈�澶у寲 + el.fullscreen = false + // 寮规鍙媺浼告渶灏忓楂� + const minWidth = 1100 + const minHeight = 570 + // 褰撳墠瀹介珮 + let nowWidth = minWidth + // eslint-disable-next-line no-unused-vars + let nowHight = minHeight + // 褰撳墠椤堕儴楂樺害 + let nowMarginTop = 0 + // 鑾峰彇寮规澶撮儴锛堣繖閮ㄥ垎鍙弻鍑诲叏灞忥級 + const dialogHeaderEl = el.querySelector('.el-dialog__header') + let hasSetBodyHight = false + // 寮圭獥 + const dragDom = el.querySelector('.el-dialog') + el.style.overflow = 'initial' + dragDom.className += ' el-drag-dialog' + + // 缁欏脊绐楀姞涓妎verflow auto锛涗笉鐒剁缉灏忔椂妗嗗唴鐨勬爣绛惧彲鑳借秴鍑篸ialog锛� + dragDom.style.overflow = 'auto' + // 娓呴櫎閫夋嫨澶撮儴鏂囧瓧鏁堟灉 + // eslint-disable-next-line no-new-func + dialogHeaderEl.onselectstart = new Function('return false') + // 澶撮儴鍔犱笂鍙嫋鍔╟ursor + dialogHeaderEl.style.cursor = 'move' + + // 鑾峰彇鍘熸湁灞炴�� ie dom鍏冪礌.currentStyle 鐏嫄璋锋瓕 window.getComputedStyle(dom鍏冪礌, null); + const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null) + + // 澶撮儴鎻掑叆鏈�澶у寲鏈�灏忓寲鍏冪礌 + const maxMin = document.createElement('button') + maxMin.className += ' el-dialog__headerbtn el-dialog__minmax' + maxMin.style.right = '40px' + maxMin.style.color = '#ffffff' + maxMin.title = el.fullscreen ? '杩樺師' : '鏈�澶у寲' + maxMin.innerHTML = '<i class=' + (el.fullscreen ? '"el-icon-crop"' : '"el-icon-full-screen"') + ' onMouseOver="this.style.color=\'#409EFF\'" onMouseOut="this.style.color=\'inherit\'"></i>' + dialogHeaderEl.insertBefore(maxMin, dialogHeaderEl.childNodes[1]) + const moveDown = (e) => { + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX - dialogHeaderEl.offsetLeft + const disY = e.clientY - dialogHeaderEl.offsetTop + + // 鑾峰彇鍒扮殑鍊煎甫px 姝e垯鍖归厤鏇挎崲 + let styL, styT + + // 娉ㄦ剰鍦╥e涓� 绗竴娆¤幏鍙栧埌鐨勫�间负缁勪欢鑷甫50% 绉诲姩涔嬪悗璧嬪�间负px + if (sty.left.includes('%')) { + styL = +document.body.clientWidth * (+sty.left.replace(/\\%/g, '') / 100) + styT = +document.body.clientHeight * (+sty.top.replace(/\\%/g, '') / 100) + } else { + styL = +sty.left.replace(/\px/g, '') + styT = +sty.top.replace(/\px/g, '') + } + + document.onmousemove = function (e) { + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const l = e.clientX - disX + const t = e.clientY - disY + + // 绉诲姩褰撳墠鍏冪礌 + dragDom.style.left = `${l + styL}px` + dragDom.style.top = `${t + styT}px` + + // 灏嗘鏃剁殑浣嶇疆浼犲嚭鍘� + // binding.value({x:e.pageX,y:e.pageY}) + } + + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + } + } + dialogHeaderEl.onmousedown = moveDown + let bodyHeight = 'auto' + + function setMaxMin() { + if (el.fullscreen) { + let i = maxMin.querySelector('.el-icon-crop'); + i.classList.remove('el-icon-crop'); + i.classList.add('el-icon-full-screen'); + maxMin.innerHTML = '<i class="el-icon-full-screen"></i>'; + maxMin.title = '鏈�澶у寲'; + dragDom.style.height = nowHight + 'px'; + dragDom.style.width = nowWidth + 'px'; + dragDom.style.marginTop = window.innerHeight * 0.07 + 'px'; + el.fullscreen = false; + dialogHeaderEl.style.cursor = 'move'; + dialogHeaderEl.onmousedown = moveDown; + // dragDom.querySelector('.el-dialog__body').style.height = bodyHeight; + hasSetBodyHight = false; + } else { + const i = maxMin.querySelector('.el-icon-full-screen') + i.classList.remove('el-icon-full-screen') + i.classList.add('el-icon-crop') + maxMin.title = '杩樺師' + bodyHeight = dragDom.querySelector('.el-dialog__body').offsetHeight + 'px' + nowHight = dragDom.clientHeight + nowWidth = dragDom.clientWidth + nowMarginTop = dragDom.style.marginTop + dragDom.style.left = 0 + dragDom.style.top = 0 + dragDom.style.height = window.innerHeight + 'px' + dragDom.style.width = '100VW' + dragDom.style.marginTop = 0 + el.fullscreen = true + dialogHeaderEl.style.cursor = 'initial' + dialogHeaderEl.onmousedown = null + if (!hasSetBodyHight) { + const footerHeight = dragDom.querySelector('.el-dialog__footer') && dragDom.querySelector('.el-dialog__footer').offsetHeight + // dragDom.querySelector('.el-dialog__body').style.height = + // 'calc(90% - ' + (dialogHeaderEl.offsetHeight + footerHeight) + 'px)' + dragDom.querySelector('.el-dialog__body').style.height = + 'calc(90% - ' + (dialogHeaderEl.offsetHeight + footerHeight) + 'px)' + /* dragDom.querySelector('.el-dialog__body').style.height = + window.innerHeight*0.9 + - (dialogHeaderEl.offsetHeight + footerHeight) + 'px'*/ + hasSetBodyHight = true + } + } + el.dispatchEvent(resizeEvent) + } + + // 鐐瑰嚮鏀惧ぇ缂╁皬鏁堟灉 + maxMin.onclick = setMaxMin + // 鍙屽嚮澶撮儴鏁堟灉 + dialogHeaderEl.ondblclick = setMaxMin + // 鎷変几 + const resizeEl = document.createElement('div') + dragDom.appendChild(resizeEl) + // 鍦ㄥ脊绐楀彸涓嬭鍔犱笂涓�涓�10-10px鐨勬帶鍒跺潡 + resizeEl.style.cursor = 'se-resize' + resizeEl.style.position = 'absolute' + resizeEl.style.height = '10px' + resizeEl.style.width = '10px' + resizeEl.style.right = '0px' + resizeEl.style.bottom = '0px' + resizeEl.style.zIndex = '99'; + // 榧犳爣鎷変几寮圭獥 + resizeEl.onmousedown = (e) => { + // 璁板綍鍒濆x浣嶇疆 + const clientX = e.clientX + // 榧犳爣鎸変笅锛岃绠楀綋鍓嶅厓绱犺窛绂诲彲瑙嗗尯鐨勮窛绂� + const disX = e.clientX - resizeEl.offsetLeft + const disY = e.clientY - resizeEl.offsetTop + document.onmousemove = function (e) { + e.preventDefault() // 绉诲姩鏃剁鐢ㄩ粯璁や簨浠� + // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 + const x = e.clientX - disX + (e.clientX - clientX)// 杩欓噷 鐢变簬elementUI鐨刣ialog鎺у埗灞呬腑鐨勶紝鎵�浠ユ按骞虫媺浼告晥鏋滄槸鍙屽�� + const y = e.clientY - disY + // 姣旇緝鏄惁灏忎簬鏈�灏忓楂� + dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px' + dragDom.style.height = y > minHeight ? `${y}px` : minHeight + 'px' + if (!hasSetBodyHight) { + const footerHeight = dragDom.querySelector('.el-dialog__footer') && dragDom.querySelector('.el-dialog__footer').offsetHeight + dragDom.querySelector('.el-dialog__body').style.height = 'calc(90% - ' + (dialogHeaderEl.offsetHeight + footerHeight) + 'px)' + hasSetBodyHight = true + } + } + // 鎷変几缁撴潫 + document.onmouseup = function (e) { + document.onmousemove = null + document.onmouseup = null + el.dispatchEvent(resizeEvent) + } + } + } +} diff --git a/src/utils/service.js b/src/utils/service.js new file mode 100644 index 0000000..93ca1de --- /dev/null +++ b/src/utils/service.js @@ -0,0 +1,111 @@ +/* + * @Description: + * @Author: 鐜嬫棴 + * @Date: 2022-03-03 15:10:54 + * @LastEditTime: 2022-03-08 17:40:02 + * @LastEditors: 鐜嬫棴 + */ +import axios from "axios"; +import { Message } from "element-ui"; +import store from "@/store"; +import { getToken } from "@/utils/auth"; +import router from "../router" +// create an axios instance +const service = axios.create({ + baseURL: BASE_URL, // api鐨刡ase_url + timeout: -1, // 璇锋眰瓒呮椂鏃堕棿 + headers: { + "content-type": "application/json;charset=UTF-8", + }, + // withCredentials: true, +}); + +// request interceptor +service.interceptors.request.use( + (config) => { + // 璇锋眰鎼哄甫token + let token = getToken(); + if (token) { + config.headers["token"] = token; + } + //鍔犺浇loading + store.commit("UPDATE_API_COUNT", "add"); + return config; + }, + (error) => { + //鍑忓幓loading + store.commit("UPDATE_API_COUNT", "sub"); + console.log(error); // for debug + return Promise.reject(error); + } +); service.interceptors.response.use( + (response) => { + if (window.localStorage.getItem("LFToken") != null) { + var expire = JSON.parse(window.localStorage.getItem("LFToken")).expire; + var timeire = new Date().getTime(); + if (timeire >= expire) { + + router.push('/login') + localStorage.removeItem("LFToken"); + } + } + + store.commit("UPDATE_API_COUNT", "sub"); + //console.log(response) + //杩斿洖鍥犳湁ResponeType===Blob ,鍒嗗紑澶勭悊 + if (Object.prototype.toString.call(response.data).indexOf("Blob") > -1) { + let reader = new FileReader() + reader.onload = function (e) { + { + try { + let str = this.result.toString(); + let res = JSON.parse(str); + if (res.code != null) { + if (res.code !== 200) { + Message.error(res.msg); + } + } + + } catch { } + } + } + reader.readAsText(response.data, "utf-8"); + } else { + if (response.data.code !== 200) { + // Message.error(response.data.msg); + } + }// 鎶ラ敊鎻愮ず + return response.data; + }, + (error) => { + store.commit("UPDATE_API_COUNT", "sub"); + const { status, data } = error.response; + //杩斿洖鍥犳湁ResponeType===Blob ,鍒嗗紑澶勭悊 + if (Object.prototype.toString.call(data).indexOf("Blob") > -1) { + let reader = new FileReader() + reader.onload = function (e) { + { + let str = this.result.toString(); + let res = JSON.parse(str); + + Message({ + message: res.message, + type: "error", + duration: 5 * 1000, + }); + } + } + reader.readAsText(data, "utf-8"); + } else { + Message({ + message: data.message, + type: "error", + duration: 5 * 1000, + }); + } + return Promise.reject(error); + } +); + + +export default service; diff --git a/src/views/Tools/LayerTree.vue b/src/views/Tools/LayerTree.vue index 1647116..f69ce25 100644 --- a/src/views/Tools/LayerTree.vue +++ b/src/views/Tools/LayerTree.vue @@ -544,6 +544,25 @@ } }); } + } else if (data.serveType == "TMS") { + debugger + if (data.pubid) { + debugger + } else { + var res; + if (data.url.indexOf("{host}") != -1) { + res = data.url.replace("{host}", iisHost); + } else { + res = data.url + } + var url = res.split(';') + debugger + window.sgworld.Creator.createImageryProvider('mpt褰卞儚', "wms", { + url: url[0], + layers: url[1] + }, "0", undefined, true, ""); + } + } @@ -635,10 +654,16 @@ }); window.map.addLayer(vectorLayer); } else if (res.serveType == "Tileset") { + var url; + if (res.url.indexOf("{host}") != -1) { + url = res.url.replace("{host}", iisHost); + } else { + url = modelUrl + "/" + res.url + } var tileset = Viewer.scene.primitives.add( new Cesium.Cesium3DTileset({ name: res.cnName, - url: modelUrl + "/" + res.url, //192.168.20.106,to4 + url: url, //192.168.20.106,to4 maximumScreenSpaceError: 64, // 鏈�澶у睆骞曠┖闂撮敊璇細16 maximumMemoryUsage: 768, // 鏈�澶у唴瀛橈細512 dynamicScreenSpaceError: true, // 鍑忓皯绂荤浉鏈鸿緝杩滅殑灞忓箷绌洪棿閿欒锛歠alse diff --git a/src/views/datamanage/dialogHeader.vue b/src/views/datamanage/dialogHeader.vue new file mode 100644 index 0000000..79f9ae0 --- /dev/null +++ b/src/views/datamanage/dialogHeader.vue @@ -0,0 +1,59 @@ +<!--鏈�澶у寲鏈�灏忓寲缁勪欢灏佽--> +<template> + <div class="header-title"> + <span class="title-name">{{ dialogTittle }}</span> + <span + style="float: right; color: #909399; cursor: pointer;" + class="el-icon-close" + @click="() => closed" + ></span> + <span + style="float: right; margin-right: 10px; color:#909399; cursor: pointer;" + :class="flodIconClass" + @click="() => isFullscreen" + ></span> + </div> +</template> + +<script> +export default { + props: { + dialogTittle: { + type: String, + default: () => '' + }, + fullscreen: { + type: Boolean, + default: () => false + } + }, + data() { + return { + header_box: { + 'display': 'flex', + 'align-items': 'center' + } + } + }, + computed: { + flodIconClass() { + return this.fullscreen ? 'el-icon-full-screen' : 'el-icon-copy-document'; + }, + isFullscreen() { + this.$emit('is-fullscreen', !this.fullscreen); + }, + closed() { + this.$emit('handle-closed', 2) + } + }, + created() { + + }, + methods: { + + }, + mounted() { + + }, +} +</script> \ No newline at end of file diff --git a/src/views/datamanage/uploadmanage.vue b/src/views/datamanage/uploadmanage.vue index 37c5a5b..69cb4da 100644 --- a/src/views/datamanage/uploadmanage.vue +++ b/src/views/datamanage/uploadmanage.vue @@ -284,15 +284,44 @@ <!-- 鍦板潃棰勮 --> <el-dialog :title="$t('common.preview')" + :class="isFullscreen ? '' : 'dialogClass_his'" + custom-class="handleDialogClass" + width="73.4%" + :fullscreen="isFullscreen" + v-if="dialogVisible" + :visible.sync="dialogVisible" + :show-close="false" + :close-on-click-modal="false" + :close-on-press-escape="false" + > + <dialog-header + slot="title" + :dialog-tittle="$t('common.preview')" + :fullscreen="isFullscreen" + @handle-closed="handleClose" + @is-fullscreen="onFullscreen" + ></dialog-header> + <div :class="{'fullscreen1':isFullscreen}"> + <mapview v-if="showMapView"></mapview> + </div> + </el-dialog> + <!-- <el-dialog + :title="$t('common.preview')" :visible.sync="dialogVisible" width="70%" :before-close="handleClose" top="13vh" + :lock-scroll="false" + :close-on-press-escape="false" + :close-on-click-modal="false" + v-el-drag-dialog > - <div style="width:100%;height:65vh"> - <mapview v-if="showMapView"></mapview> - </div> - </el-dialog> + <div + id="MapDiv" + style="background:red;widht:100%;height:calc(100% - 10px)" + ></div> + <!-- + </el-dialog> --> <!-- 淇敼鏁版嵁 --> <el-dialog :title="$t('common.update')" @@ -389,6 +418,7 @@ :visible.sync="insertDialogVisible" width="40%" :close-on-click-modal="false" + :show-close="false" > <div style="width:100%;height:30vh"> <el-form @@ -409,16 +439,42 @@ ></el-input> </el-form-item> <el-form-item :label="$t('dataManage.vmobj.minLevel')"> - <el-input + <!-- <el-input v-model="insertLayer.min" :placeholder="$t('dataManage.vmobj.labe11')" - ></el-input> + ></el-input> --> + <el-select + style="width:100%" + v-model="insertLayer.min" + :placeholder="$t('dataManage.vmobj.labe11')" + > + <el-option + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> </el-form-item> <el-form-item :label="$t('dataManage.vmobj.maxLevel')"> - <el-input + <!-- <el-input v-model="insertLayer.max" :placeholder="$t('dataManage.vmobj.labe12')" - ></el-input> + ></el-input> --> + <el-select + style="width:100%" + v-model="insertLayer.max" + :placeholder="$t('dataManage.vmobj.labe12')" + > + <el-option + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> </el-form-item> <el-form-item> <el-button @@ -454,7 +510,6 @@ element-loading-text="鏁版嵁鍙戝竷涓�" style="margin: 0px 20px;widht:100%;height:calc(100% - 80px); " > - </div> </div> </div> @@ -462,6 +517,8 @@ </template> <script> +import axios from 'axios'; +import dialogHeader from './dialogHeader.vue' import mapview from '../../components/preview_map.vue' import MyBread from "../../components/MyBread.vue" import { @@ -476,7 +533,10 @@ } from '../../api/api.js' export default { - components: { MyBread, mapview }, + components: { + MyBread, mapview, + 'dialog-header': dialogHeader, + }, data() { return { active: 'first', @@ -528,17 +588,29 @@ detailsDialogVisible: false, itemdetail: {}, insertDialogVisible: false, - insertLayer: { name: '', number: null, min: 4, max: 8 }, - loadDialogVisible: false + insertLayer: { name: '', number: null, min: 4, max: 18 }, + loadDialogVisible: false, + options: [], + isFullscreen: false, } }, methods: { + setOptions() { + var std = []; + for (var i = 0; i < 21; i++) { + std.push({ + value: i, + label: i + }) + } + this.options = std; + }, setloadDialogVisible() { this.loadDialogVisible = false }, setinsertLayerCancel() { this.insertDialogVisible = false; - this.insertLayer = { name: '', number: null, min: 4, max: 8 }; + this.insertLayer = { name: '', number: null, min: 4, max: 18 }; }, //鍙戝竷鎻愪氦 async setinsertLayerSubmit() { @@ -574,7 +646,7 @@ } var std = []; for (var i in this.multipleSelection) { - std.push(this.multipleSelection[i]) + std.push(this.multipleSelection[i].id) } var obj = { dircode: this.formInline.dirid, @@ -582,14 +654,14 @@ min: min, max: max, name: name, - ids: std.toString(), + ids: std, type: this.formInline.type } this.loadDialogVisible = true this.insertDialogVisible = false; const data = await publish_insert(obj); - if (data.code != 200) { + if (data.code != 200 || data.count > 0) { this.$message.error("鏁版嵁鍙戝竷澶辫触") } else { @@ -615,13 +687,13 @@ } else { var std = []; for (var i in this.multipleSelection) { - std.push(this.multipleSelection[i]) + std.push(this.multipleSelection[i].id) } var obj = { dircode: this.formInline.dirid, depcode: this.formInline.depid, - ids: std.toString(), + ids: std, type: this.formInline.type } this.loadDialogVisible = true @@ -682,33 +754,46 @@ this.editDialogVisible = true; }, //鍒犻櫎 - async setPageDelete() { + setPageDelete() { if (this.multipleSelection.length == 0) { return this.$message.error("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁") } else { - var std = []; - for (var i in this.multipleSelection) { - std.push(this.multipleSelection[i].id); - } - const data = await publish_deletes({ ids: std.toString() }); - if (data.code != 200) { - this.$message.error("鍗曚綅鍒楄〃鑾峰彇澶辫触") - return - } else { - this.$message({ - message: '鍒犻櫎鎴愬姛', - type: 'success' + var that = this + this.$confirm('纭畾鏄惁鍒犻櫎鎵�閫夊唴瀹�?') + .then(_ => { + done(); + }) + .catch(_ => { + that.deletePage() }); - this.getTableData(); - } } - + }, + async deletePage() { + var std = []; + for (var i in this.multipleSelection) { + std.push(this.multipleSelection[i].id); + } + const data = await publish_deletes({ ids: std.toString() }); + if (data.code != 200) { + this.$message.error("鍗曚綅鍒楄〃鑾峰彇澶辫触") + return + } else { + this.$message({ + message: '鍒犻櫎鎴愬姛', + type: 'success' + }); + this.getTableData(); + } }, //棰勮寮圭獥鎵撳紑 setPreviewLayer(res) { this.$store.state.previewLayer = res; this.dialogVisible = true; this.showMapView = true; + }, + //鏄惁涓哄叏灞忓嚱鏁� + onFullscreen(fullscreen) { + this.isFullscreen = fullscreen; }, //棰勮寮圭獥鍏抽棴 handleClose() { @@ -961,6 +1046,7 @@ mounted() { this.active = 'first'; this.setPageStart(); + this.setOptions(); } } </script> @@ -1024,5 +1110,15 @@ background: transparent !important; } } + .fullscreen1 { + width: 100%; + height: 92vh; + } + /deep/.el-dialog__body { + padding: 10px !important; + } + /deep/.el-dialog__header { + padding: 10px !important; + } } </style> \ No newline at end of file -- Gitblit v1.9.3