From dc5c7404f42781ccd5ab54e6d620d22f13cf8310 Mon Sep 17 00:00:00 2001 From: TreeWish <1131093754@qq.com> Date: 星期二, 21 二月 2023 17:15:18 +0800 Subject: [PATCH] 工程搜索&工程展示跳转 --- src/components/Screen/bottom.vue | 174 ++++++++++++++++++++++++++++++++----------- package.json | 1 src/api/screen.js | 45 +++++++++++ 3 files changed, 176 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 1a729a1..f123eab 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "fix-memory-limit": "cross-env LIMIT=4096 increase-memory-limit" }, "dependencies": { + "@terraformer/wkt": "^2.1.2", "@turf/turf": "^6.5.0", "animate.css": "^4.1.1", "aws-sdk": "^2.963.0", diff --git a/src/api/screen.js b/src/api/screen.js new file mode 100644 index 0000000..5e00108 --- /dev/null +++ b/src/api/screen.js @@ -0,0 +1,45 @@ +import request from "@/utils/request" + +// 涓�寮犲浘鏁版嵁鎺ュ彛 + +// 鏁版嵁鐢宠 +export function countDataApply(params) { + return request.get("/oneMap/countDataApply", { params: params }) +} +// 鏁版嵁瀛樺偍缁熻 +export function countDataStorage(params) { + return request.get("/oneMap/countDataStorage", { params: params }) +} +// 璁块棶娆℃暟 +export function countDataVisit(params) { + return request.get("/oneMap/countDataVisit", { params: params }) +} +// 鏂囦欢鏍煎紡缁村害-鏂囦欢涓暟 +export function countFileFormat(params) { + return request.get("/oneMap/countFileFormat", { params: params }) +} +// 椤圭洰绫诲埆 +export function countProjectCategory(params) { + return request.get("/oneMap/countProjectCategory", { params: params }) +} +// 椤圭洰宸ョ▼灞曠ず +export function countProjectDisplay(params) { + return request.get("/oneMap/countProjectDisplay", { params: params }) +} +// 椤圭洰浣嶇疆鍒嗗竷 +export function countProjectLocation(params) { + return request.get("/oneMap/countProjectLocation", { params: params }) +} +// 椤圭洰宸ョ▼宸¤ +export function countProjectTour(params) { + return request.get("/oneMap/countProjectTour", { params: params }) +} +// 椤圭洰鏁伴噺缁熻-鈥斺�旂渷缁村害 +export function countProvinceDimension(params) { + return request.get("/oneMap/countProvinceDimension", { params: params }) +} + +// 鍥藉缁村害-鏁伴噺缁熻 +export function countCountryDimension(params) { + return request.get("/oneMap/countCountryDimension", { params: params }) +} \ No newline at end of file diff --git a/src/components/Screen/bottom.vue b/src/components/Screen/bottom.vue index 91ee1b4..7de4602 100644 --- a/src/components/Screen/bottom.vue +++ b/src/components/Screen/bottom.vue @@ -20,19 +20,22 @@ <span slot="reference">{{ item.menuName }}</span> <div class="popover-content"> <div class="popover-content__header">椤圭洰淇℃伅</div> - <div class="popover-content__list"> + + <div class="popover-content__search"> <el-input - v-if="item.children.length > 4" size="mini" placeholder="璇疯緭鍏ュ唴瀹�" v-model="searchName" + @change="handleSearchChange(item)" > <el-button slot="append" icon="el-icon-search"></el-button> </el-input> + </div> + <div class="popover-content__list"> <div class="popover-content__list__item" - v-for="child in item.children" - :key="child.id" + v-for="(child, i) in currMenuList" + :key="child.id + i" :class="currProject == child.name ? 'active' : ''" @click="handlePopoverClick(child)" :title="child.name" @@ -55,6 +58,13 @@ </template> <script> import PipeLine from "@/assets/json/pipeline.json" +import { + countProjectTour, + countProjectDisplay, + countProjectLocation, +} from "@/api/screen.js" +import { wktToGeoJSON } from "@terraformer/wkt" + export default { data() { return { @@ -146,6 +156,22 @@ ], } }, + computed: { + currMenuList() { + const menu = this.menuList.find(item => item.menuName == this.currMenu) + const filterChildren = [] + const value = this.searchName + menu.children.forEach(item => { + if (item.name && item.name.includes(value)) { + filterChildren.push(item) + } + }) + return filterChildren + }, + }, + created() { + this.getCountProjectDisplay() + }, methods: { ChangeBaseLayer() { if (this.YXState) { @@ -170,14 +196,25 @@ const currMenu = this.currMenu switch (currMenu) { case "宸ョ▼宸¤": - this.showPathLine() + this.showPathLine(child) break - + case "宸ョ▼灞曠ず": + this.DisplayCurrentProject(child) + break default: break } }, - showPathLine(res) { + async showPathLine(params) { + const line = wktToGeoJSON(params.wkt) + const position = line.coordinates[0] + const result = [] + position.forEach(pos => { + pos.push(50) + result.push(...pos) + }) + // + console.log("line", position) // 瑗挎皵涓滆緭浜岀嚎瑗挎骞茬嚎 // console.log("PipeLine", PipeLine) const features = PipeLine.features @@ -185,16 +222,16 @@ // const name = item.properties.pipename // const rawArr = item.geometry.coordinates // }) - const pipeline = features.find( - item => item.properties.pipename == "瑗挎皵涓滆緭涓�绾�" - ) - const name = pipeline.properties.pipename - const rawArr = pipeline.geometry.coordinates[0] - const result = [] - rawArr.forEach(pos => { - pos.push(50) - result.push(...pos) - }) + // const pipeline = features.find( + // item => item.properties.pipename == "瑗挎皵涓滆緭涓�绾�" + // ) + // const name = pipeline.properties.pipename + // const rawArr = pipeline.geometry.coordinates[0] + // const result = [] + // rawArr.forEach(pos => { + // pos.push(50) + // result.push(...pos) + // }) // console.log("result", result); // sgworld.Command.execute(2, 3, "", data => { // data.showPoint = false @@ -217,6 +254,7 @@ // }, // }) // }) + window.sgworld.Creator.getFlyData(result, data => { data.showPoint = false data.showLine = true @@ -243,23 +281,64 @@ }, //椤圭洰灞曠ず - DisplayCurrentProject(parm) { - console.log(parm) + DisplayCurrentProject(params) { + console.log(params) + //鎵撳紑鎴栬�呭姞杞藉浘灞� //椋炲埌鎸囧畾浣嶇疆 + const point = wktToGeoJSON(params.wkt) + const position = point.coordinates + + Viewer.camera.flyTo({ + destination: Cesium.Cartesian3.fromDegrees(...position, 7000), + }) }, //宸ョ▼婕父椋炶 - FlyCurrentProject(parm) { - console.log(parm) + FlyCurrentProject(prams) { + console.log(prams) //鎵撳紑鎴栬�呭姞杞藉浘灞� //寮�濮嬮琛� }, - filterNode(value, data) { - if (!value) return true - return children.name.indexOf(value) !== -1 + filterChildList(menuName) { + const menuList = this.menuList + const searchName = this.searchName + + // console.log(menuList.find(item => item.menuName == menuName)); + const menu = menuList.find(item => item.menuName == menuName) + return menu.children + // return menu.children.filter(item => item.name.indexOf(searchName) > -1) + }, + handleSearchChange(currMenu) {}, + async getCountProjectDisplay() { + const res = await countProjectLocation() + if (res.code === 200) { + const menu = this.menuList.find(item => item.menuName == "宸ョ▼灞曠ず") + menu.children = res.result.map(item => { + return { + name: item.projname, + id: item.projname, + wkt: item.st_astext, + } + }) + console.log(menu.children.length) + } + }, + async getCountProjectTour() { + const res = await countProjectTour() + if (res.code === 200) { + const menu = this.menuList.find(item => item.menuName == "宸ョ▼宸¤") + menu.children = res.result.map(item => { + return { + name: item.projname, + id: item.projname, + wkt: item.wkt, + } + }) + console.log(menu.children.length) + } }, }, } @@ -371,39 +450,46 @@ height: 8px; } } - .el-input { - width: 119px; - height: 21.5px; - background: rgba(0, 48, 111, 0.2); - border: 0.25px solid #2a80a9; - &__inner { + &__search { + margin-top: 8px; + width: 145px; + text-align: center; + .el-input { + width: 125px; + height: 21px; background: rgba(0, 48, 111, 0.2); - border-radius: inherit; border: 0.25px solid #2a80a9; - } - .el-input-group__append { - width: 32px; - border: none; - border-radius: inherit; - height: 20px; - padding: 0; - text-align: center; - background: #3a93c7; - color: #fff; + &__inner { + background: rgba(0, 48, 111, 0.2); + border-radius: inherit; + border: 0.25px solid #2a80a9; + padding: 0 5px; + color: #fff; + } + .el-input-group__append { + width: 32px; + border: none; + border-radius: inherit; + height: 20px; + padding: 0; + text-align: center; + background: #3a93c7; + color: #fff; + } } } + &__list { - margin-top: 10px; display: flex; flex-direction: column; // justify-content: space-evenly; align-items: center; width: 145px; - height: 180px; + height: 155px; overflow-x: hidden; &__item { - margin-top: 10px; + margin-top: 8px; color: #fff; width: 130px; height: 30px; -- Gitblit v1.9.3