月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-10-10 616b8ab8998bfbec69929152612dc94d3112c2a9
src/views/plotting/plottingInquire.vue
@@ -1,8 +1,28 @@
<template>
  <div class="plottingInquire" v-if="isShow">
    <div class="InquireHeader">标绘查询</div>
  <div
    class="plottingInquire"
    v-if="isShow"
    v-drag="true"
  >
    <div class="InquireHeader">
      <div>标绘查询</div>
      <div>
        <el-icon
          @click="isShow = false"
          :size="20"
          style="cursor: pointer"
        >
          <Close />
        </el-icon>
      </div>
    </div>
    <div class="inquireContent">
      <div class="inquireContent_title">用户新建要素</div>
      <div class="inquireContent_title">
        <div>用户新建要素</div>
      </div>
      <div class="inquireContent_name">
        <div class="plotting_list_tr_name">
          <img
@@ -11,9 +31,19 @@
            alt=""
          /><span>{{ inquireData.name }}</span>
        </div>
        <div
          class="plotting_list_tr_wkt"
          v-show="geoWktFlag"
        >{{ geoWkt }}</div>
        <div class="plotting_list_tr_btn">
          <div class="tr_btn dw" @click="setLayerLocation()"></div>
          <div class="tr_btn sc" @click="setLayerRemove()"></div>
          <div
            class="tr_btn dw"
            @click="setLayerLocation()"
          ></div>
          <div
            class="tr_btn sc"
            @click="setLayerRemove()"
          ></div>
        </div>
      </div>
      <div class="tab_box">
@@ -23,8 +53,14 @@
          @tab-click="handleClick"
        >
          <!-- <el-tab-pane label="图层属性" name="first">User</el-tab-pane> -->
          <el-tab-pane label="查询结果" name="second">
            <div class="inquireContent_input" v-show="pixelIsShow">
          <el-tab-pane
            label="查询结果"
            name="second"
          >
            <div
              class="inquireContent_input"
              v-show="pixelIsShow"
            >
              <!-- <div class="inquireContent_input_left">
                <div class="label">范围框</div>
                <el-input
@@ -35,7 +71,10 @@
                  <template #append>km</template>
                </el-input>
              </div> -->
              <div class="inquireContent_input_right" v-show="!chartIsshow">
              <div
                class="inquireContent_input_right"
                v-show="!chartIsshow"
              >
                <div class="label">范围框内最大像素值</div>
                <el-select
                  v-model="ScopeBox.pixel"
@@ -52,7 +91,10 @@
                  />
                </el-select>
              </div>
              <div class="inquireContent_input_right" v-show="chartIsshow">
              <div
                class="inquireContent_input_right"
                v-show="chartIsshow"
              >
                <div class="label">节点数</div>
                <el-select
                  v-model="ScopeBox.nodes"
@@ -70,7 +112,10 @@
                </el-select>
              </div>
            </div>
            <div class="chart" v-if="chartIsshow">
            <div
              class="chart"
              v-if="chartIsshow"
            >
              <div class="chart_box">
                <div class="chart_btn">
                  <el-button
@@ -98,7 +143,6 @@
                  :width="'100%'"
                  :height="'260px'"
                  :layerData="layerData"
                  :chartsId="0"
                ></Bar-graph>
                <div class="select">
                  <el-select
@@ -127,20 +171,27 @@
              </div>
            </div>
            <div class="inquireContent_msg" v-if="!chartIsshow">
            <!-- <div
              class="inquireContent_msg"
              v-if="!chartIsshow"
              v-show="pixelIsShow"
            >
              <div class="inquireContent_msg_k">
                <span>提取的边界框</span>
                <span>{{ ScopeBox.pixel }}×{{ ScopeBox.pixel }}</span>
              </div>
              <!-- <div class="inquireContent_msg_k">
              <div class="inquireContent_msg_k">
                <span>使用</span>
                <span
                  >{{ ScopeBox.Scop * 1000 }}.00,{{ ScopeBox.Scop * 1000 }}.00
                  m/px</span
                >
              </div> -->
            </div>
            <div class="inquireContent_table" v-if="!chartIsshow">
              </div>
            </div> -->
            <div
              class="inquireContent_table"
              v-if="!chartIsshow"
            >
              <div class="table">
                <div class="table_head">
                  <div class="table_head_td">序号</div>
@@ -150,7 +201,11 @@
                  </div>
                </div>
                <div class="table_content">
                  <div class="table_tr" v-for="(e, i) in resultList" :key="i">
                  <div
                    class="table_tr"
                    v-for="(e, i) in resultList"
                    :key="i"
                  >
                    <div class="table_td">{{ i + 1 }}</div>
                    <div class="table_td">
                      <span> {{ e.layerName }}</span>
@@ -160,19 +215,29 @@
                </div>
              </div>
            </div>
            <div class="download" v-if="!chartIsshow">
              <el-button link @click="download">下载分析结果</el-button>
            <div
              class="download"
              v-if="!chartIsshow"
            >
              <el-button
                link
                @click="download"
              >下载分析结果</el-button>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </div>
  </div>
  <div class="dialog" v-if="dialogShow" @click.self="dialogShow = false">
  <div
    class="dialog"
    v-if="dialogShow"
    @click.self="dialogShow = false"
  >
    <div class="chart">
      <i @click.capture="closeDialog"
        ><el-icon><Close /></el-icon
      ></i>
      <i @click.capture="closeDialog"><el-icon>
          <Close />
        </el-icon></i>
      <BarGraphAxisLine
        :width="'856px'"
        :height="'636px'"
@@ -203,7 +268,9 @@
} from "@/utils/downloadCSV.js";
import { selectByPoint, selectByPolygon, selectByPolyline } from "@/api/api";
import { ElMessage } from "element-plus";
import { Search, Delete, Download } from "@element-plus/icons-vue";
import { Search, Delete, Download, Close } from "@element-plus/icons-vue";
import WKT from "terraformer-wkt-parser";
import * as turf from "@turf/turf";
const store = useStore(); // 该方法用于返回store 实例
const emits = defineEmits(["setCloseplotting"]);
let isShow = ref(false);
@@ -309,6 +376,8 @@
let layerArr = ref([]);
let dialogShow = ref(false);
let layerNameNum = 0;
let geoWkt = ref(null);
let geoWktFlag = ref(false);
//新增图表
const addCharts = () => {
  layerArr.value.push({ layerName: `null${layerNameNum}`, points: [] });
@@ -392,7 +461,7 @@
  if (dt.code !== 200) {
    return ElMessage.error("查询错误");
  }
  console.log(dt);
  dt.result.forEach((e) => {
    if (e.code != 200) {
      e.avg = "-";
@@ -426,12 +495,37 @@
    resultList.value.push(e);
  });
};
//保留三位小数
const keepThreeNum = (value) => {
  let resValue = 0;
  //小数点的位置
  let index = value && value.toString().indexOf(".") + 1;
  //小数的位数
  let num = value && Math.abs(Number(value)).toString().length - index;
  if (index && num > 3) {
    resValue = value && Number(value).toFixed(3);
  } else {
    resValue = value;
  }
  return resValue;
};
//线查询接口
const selectPolyline = async (res) => {
  layerArr.value = [];
  const dt = await selectByPolyline(res);
  console.log(dt);
  dt.result.forEach((e) => {
    e.points.forEach((element) => {
      element.vals.forEach((v) => {
        v = keepThreeNum(v);
      });
    });
  });
  layeroptions.value = dt.result;
  layerValue.value = layeroptions.value[0].layerName;
  layerArr.value.push(dt.result[0]);
  chartIsshow.value = true;
  layerData.value = dt.result[0];
@@ -475,9 +569,7 @@
    }
  }
};
const handleClick = (tab: TabsPaneContext, event: Event) => {
  console.log(tab, event);
};
const handleClick = (tab: TabsPaneContext, event: Event) => {};
//   const setCloseplotting = () => {
//     emits("setCloseplotting", false);
//   };
@@ -487,7 +579,28 @@
  (nVal, oVal) => {
    isShow.value = nVal.isshow;
    inquireData.value = nVal.entitiesData;
    geoWktFlag.value = false;
    if (inquireData.value.wkt) {
      var wkt = WKT.parse(inquireData.value.wkt);
      if (wkt.type == "Point") {
        geoWkt.value =
          wkt.coordinates[0].toFixed(6) + " " + wkt.coordinates[1].toFixed(6);
        geoWktFlag.value = true;
      }
      if (wkt.type == "Polygon") {
        var Polygon = turf.multiPolygon([wkt.coordinates]);
        var center = turf.center(Polygon);
        geoWkt.value =
          center.geometry.coordinates[0].toFixed(6) +
          " " +
          center.geometry.coordinates[1].toFixed(6);
        geoWktFlag.value = true;
      }
    }
    if (nVal.entitiesData.icon == "x.png") {
      pixelIsShow.value = true;
      selectPolyline({
        nodes: ScopeBox.value.nodes,
        wkt: nVal.entitiesData.wkt,
@@ -503,6 +616,7 @@
    }
    if (nVal && nVal.entitiesData.icon == "d.png") {
      chartIsshow.value = false;
      pixelIsShow.value = true;
      selectPoint({
        pixel: ScopeBox.value.pixel,
        wkt: nVal.entitiesData.wkt,
@@ -532,6 +646,8 @@
    color: #d6e4ff;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
  }
  .inquireContent {
    .inquireContent_title {
@@ -563,6 +679,13 @@
          margin-left: 10px;
        }
      }
      .plotting_list_tr_wkt {
        font-size: 12px;
        font-weight: 300;
        color: #ffffff;
        margin-left: 10px;
        flex: 1;
      }
      .plotting_list_tr_btn {
        display: flex;
        align-items: center;