月球大数据地理空间分析展示平台-【前端】-月球2期前端
WX
2023-09-13 3ac241dca10f0dc85b6a3291a8339f1b1765491f
src/views/layer/attributeList.vue
@@ -5,7 +5,7 @@
  >
    <!--     v-resizable="'right, bottom'" -->
    <div class="spatialTitle">
      <label>属性</label>
      <label>{{store.state.spatialTitle }}</label>
      <el-icon
        @click="setSpatialClose"
        :size="20"
@@ -57,7 +57,7 @@
          >
            <template #default="scope">
              <el-button
                :icon="Location"
                class="el-icon-map"
                size="small"
                @click.prevent="spaceLocation(scope.$index, scope.row)"
              >
@@ -161,7 +161,7 @@
  nextTick,
  watch,
} from "vue";
import config from "@/assets/js/Map/config";
// import config from "../../../public/config/config.js";
import { User, Lock, Plus, Location } from "@element-plus/icons-vue";
import { dataQuery_selectByPage, dataQuery_selectFields } from "@/api/api";
import { ElMessage } from "element-plus";
@@ -227,12 +227,40 @@
  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 + "-" + add0(m) + "-" + add0(d) + " " + h + ":" + mm + ":" + s;
};
//格式化时间
const add0 = (m) => {
  return m < 10 ? "0" + m : m;
};
const setQueySpatialFields = async () => {
  const data = await dataQuery_selectFields({
    ns: "mn",
@@ -246,8 +274,17 @@
      return res;
    }
  });
  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();
};
@@ -304,7 +341,6 @@
      value: std[i],
    });
  }
  debugger;
  condOption.value = str;
  formSql.value.type = std[0];
};
@@ -323,7 +359,6 @@
watch(
  () => props.layerData,
  (nVal, oVal) => {
    // console.log("值发生了变更", nVal, oVal);
    startQueryData();
  },
  { deep: true }
@@ -420,7 +455,16 @@
    padding: 10px;
    height: 40px;
  }
  .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;
  }
  /deep/.el-pagination button {
    background: transparent;
    color: #d6e4ff;