月球大数据地理空间分析展示平台-【前端】-月球2期前端
Surpriseplus
2023-10-10 616b8ab8998bfbec69929152612dc94d3112c2a9
src/views/query/SpatialQuery.vue
@@ -77,7 +77,7 @@
            >
              <template #default="scope">
                <el-button
                  :icon="Location"
                  class="el-icon-map"
                  size="small"
                  @click.prevent="spaceLocation(scope.$index, scope.row)"
                >
@@ -176,6 +176,7 @@
      v-model="downloaVisible"
      title="下载"
      width="30%"
      :show-close="false"
    >
      <div
        class="spatialTable"
@@ -184,7 +185,7 @@
        <el-table
          :data="downTable"
          @selection-change="handleSelectionChange"
          style="width: 100%; height: 73%;"
          style="width: 100%; height: 28vh;"
        >
          <el-table-column
            type="selection"
@@ -239,7 +240,10 @@
              size="small"
              @click="submitForm(downFormRef)"
            >提交</el-button>
            <el-button size="small">取消</el-button>
            <el-button
              size="small"
              @click="setCloseSpatialDownload"
            >取消</el-button>
          </el-form-item>
        </el-form>
      </div>
@@ -264,7 +268,7 @@
  nextTick,
} from "vue";
import menuTool from "@/assets/js/Map/menuTool";
import config from "@/assets/js/Map/config";
// import config from "../../../public/config/config.js";
import { User, Lock, Plus, Refresh, Location } from "@element-plus/icons-vue";
import {
  dataQuery_selectByPage,
@@ -280,6 +284,7 @@
import JSEncrypt from "jsencrypt";
const emits = defineEmits(["SETspatialClose"]);
const setSpatialClose = () => {
  menuTool.setClearLocation("空间查询_标绘");
  menuTool.setClearLocation("空间查询");
  emits("SETspatialClose", false);
};
@@ -345,14 +350,12 @@
  if (!formEl) return;
  formEl.validate((valid) => {
    if (valid) {
      console.log("submit!");
      if (multipleSelection.value.length <= 0) {
        ElMessage.error("请选择要下载的表");
      } else {
        setDownLoadFrom();
      }
    } else {
      console.log("erro submit!");
      return false;
    }
  });
@@ -422,6 +425,10 @@
const setSpatialDownload = () => {
  downTable.value = menuList.value;
  downloaVisible.value = true;
};
const setCloseSpatialDownload = () => {
  downloaVisible.value = false;
  setClearDownload();
};
//定位显示
const spaceLocation = (index, row) => {
@@ -504,12 +511,39 @@
  listData.value.name = listData.value.name.replaceAll("_", "");
  const data = await dataQuery_selectByPage(listData.value);
  if (data.code != 200) {
    return ElMessage.error("空间查询失败");
    return ElMessage.error(data.msg);
  }
  listData.value.count = data.count;
  tableData.value = data.result;
  var val = data.result.filter((res) => {
    if (res.apprTime) {
      res.apprTime = format(res.apprTime);
    }
    if (res.createtime) {
      res.apprTime = format(res.createtime);
    }
    if (res.updatetime) {
      res.apprTime = format(res.updatetime);
    }
    return res;
  });
  tableData.value = val;
};
//格式化时间
const format = (shijianchuo) => {
  //shijianchuo是整数,否则要parseInt转换
  var time = new Date(shijianchuo);
  var y = time.getFullYear();
  var m = time.getMonth() + 1;
  var d = time.getDate();
  var h = time.getHours();
  var mm = time.getMinutes();
  var s = time.getSeconds();
  return y + "-" + add01(m) + "-" + add01(d) + " " + h + ":" + mm + ":" + s;
};
//格式化时间
const add01 = (m) => {
  return m < 10 ? "0" + m : m;
};
const setQueySpatialFields = async () => {
  const data = await dataQuery_selectFields({
    ns: "mn",
@@ -525,8 +559,17 @@
    }
  });
  attributeData.value = std;
  fieldOption.value = std;
  var val = std.filter((res) => {
    if (res.field.indexOf("_") > -1) {
      var str = res.field.split("_");
      res.field = str[0] + str[1][0].toUpperCase() + str[1].slice(1);
      return res;
    } else {
      return res;
    }
  });
  attributeData.value = val;
  fieldOption.value = val;
  conditionChange(data.result[0]);
  setQueySpatialData();
};
@@ -579,7 +622,11 @@
      return res;
    }
  });
  if (str.length <= 0) {
    ElMessage.error("请选择要查询的图层");
    setSpatialClose();
    return;
  }
  menuList.value = str;
  listData.value.wkt = store.state.spatialQueryData.wkt;
  listData.value.name = menuList.value[0].tab.replaceAll("moon:", "");
@@ -780,6 +827,16 @@
      color: #d6e4ff !important;
    }
  }
  .el-icon-map {
    background: url("../../assets/img/location.png") center no-repeat;
    background-size: 100% 100%;
    border: transparent;
  }
  .el-icon-map:before {
    content: "定位";
    font-size: 0;
    visibility: hidden;
  }
}
</style> 
<style lang="less"  >