月球大数据地理空间分析展示平台-【中台】
Surpriseplus
2023-10-10 7a83906e6714edea1568d10acb4eb0bc1aae81c6
src/views/datamanage/resourceManagement.vue
@@ -24,10 +24,78 @@
            > <i
                :title="$t('common.iquery')"
                slot="suffix"
                @click="setListDataStart"
                @click="getResTableData"
                class="el-icon-search"
                style="padding-right: 8px"
              ></i></el-input>
          </el-form-item>
          <!-- 服务类别 -->
          <el-form-item>
            <el-select
              size="small"
              v-model="formInline.category"
              :placeholder="$t('dataManage.layerObj.prompt18')"
              @change="getResTableData"
            >
              <el-option
                v-for="item in serviceType"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 数据类型 -->
          <el-form-item>
            <el-select
              size="small"
              v-model="formInline.data"
              :placeholder="$t('dataManage.layerObj.prompt8')"
              @change="getResTableData"
            >
              <el-option
                v-for="item in dataType"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 服务类别 -->
          <el-form-item>
            <el-select
              size="small"
              v-model="formInline.type"
              :placeholder="$t('dataManage.layerObj.prompt3')"
              @change="getResTableData"
            >
              <el-option
                v-for="item in dataTypes"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 状态 -->
          <el-form-item>
            <el-select
              size="small"
              v-model="formInline.status"
              :placeholder="$t('dataManage.layerObj.prompt19')"
              @change="getResTableData"
            >
              <el-option
                v-for="item in statusType"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item style="float: right;">
            <el-button
@@ -190,7 +258,7 @@
          />
          <el-table-column
            :label="$t('common.operate')"
            width="150"
            width="200"
          >
            <template slot-scope="scope">
              <el-button
@@ -199,6 +267,12 @@
                type="warning"
                plain
              >{{ $t('common.update') }}</el-button>
              <el-button
                size="small"
                v-show="scope.row.status != 0"
                plain
                @click="setScopePreview(scope.row)"
              >{{ $t('common.preview') }}</el-button>
            </template>
          </el-table-column>
@@ -519,10 +593,37 @@
        </span>
      </div>
    </el-dialog>
    <!-- 地址预览 -->
    <el-dialog
      :title="$t('common.preview')"
      :class="isFullscreen ? '' : 'dialogClass_his'"
      custom-class="handleDialogClass"
      width="73.4%"
      :fullscreen="isFullscreen"
      v-if="prevDialog"
      :visible.sync="prevDialog"
      :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>
  </div>
</template>
<script>
import MyBread from "../../components/MyBread.vue";
import dialogHeader from './dialogHeader.vue'
import server from '../../components/js/server.js'
import {
  getPerms,
  select_Res_ByPageAndCount,
@@ -530,23 +631,28 @@
  res_deletes,
  res_updates,
  res_update,
  token_insertNewToken
} from "../../api/api";
import $ from 'jquery'
import { getToken } from '../../utils/auth';
import { serve_type, data_type, category_type } from './js/layerManage.js'
import { json } from "body-parser";
import { flatten } from '@turf/turf';
import mapview from '../../components/MapView/moonMap.vue'
export default {
  name: "catalogueManage",
  components: {
    MyBread,
    MyBread, mapview, 'dialog-header': dialogHeader,
  },
  data() {
    return {
      formInline: {
        name: null
        name: null,
        type: null,
        data: null,
        category: null,
        status: null
      },
      menuStatus: {
        delete: false,
@@ -576,10 +682,24 @@
      editDialog: false,
      insertDialog: false,
      dataType: [],
      dataTypes: [],
      serviceType: [],
      categoryType: [],
      insertDisabled: false,
      editDisabled: false,
      isFullscreen: false,
      prevDialog: false,
      showMapView: false,
      statusType: [
        {
          label: '禁用', value: 0
        },
        {
          label: '启用原始地址', value: 1
        }, {
          label: '启用代理地址', value: 2
        }
      ], resToken: null,
    };
  },
  watch: {
@@ -590,7 +710,37 @@
    window.removeEventListener("resize", this.onResize);
  },
  methods: {
    async getResToken() {
      if (this.$store.state.resToken) {
        this.resToken = this.$store.state.resToken
      } else {
        const data = await token_insertNewToken({
          type: 1,
          min: 43200
        });
        if (data.code == 200) {
          this.$store.state.resToken = data.result.token;
          this.resToken = data.result.token;
        }
      }
    },
    //是否为全屏函数
    onFullscreen(fullscreen) {
      this.isFullscreen = fullscreen;
    },
    //预览弹窗关闭
    handleClose() {
      this.prevDialog = false
      this.showMapView = false;
    },
    async setEditConfirm() {
      if (this.editData.url.indexOf('?') > -1) {
        var val = this.editData.url.split("?");
        this.editData.url = val[0];
        this.editData.args = this.editData.args + val[1];
      }
      const data = await res_update(this.editData);
      if (data.code == 200) {
        this.$message({
@@ -621,7 +771,13 @@
        .catch(_ => { });
    },
    setEmptyData() {
      this.formInline.name = ""
      this.formInline = {
        name: null,
        type: null,
        data: null,
        category: null,
        status: null
      }
      this.setListDataStart()
    },
    setInsertTableData() {
@@ -716,6 +872,12 @@
        .catch(_ => { });
    },
    async setInsertConfirm() {
      if (this.insertData.url.indexOf('?') > -1) {
        var val = this.insertData.url.split("?");
        this.insertData.url = val[0];
        this.insertData.args = val[1] + this.insertData.args;
      }
      this.insertData.status = parseInt(this.insertData.status)
      const data = await res_insert(this.insertData);
      if (data.code == 200) {
@@ -752,7 +914,13 @@
        })
      }
      this.dataType = str;
      for (var i in serve_type) {
        std.push({
          value: serve_type[i].value,
          label: serve_type[i].name,
        })
      }
      this.dataTypes = std;
    },
    setScopeEdit(row) {
      this.copyData = JSON.parse(JSON.stringify(row));
@@ -765,8 +933,15 @@
      }
      this.editDialog = true
    },
    setScopePreview(row) {
      this.prevDialog = true;
      this.showMapView = true;
      setTimeout(() => {
        server.addLayer(row)
      }, 1000);
    },
    formatProxy(row, column) {
      var token = getToken()
      var token = this.resToken
      if (row.proxy && row.proxy.indexOf('{token}') > -1) {
        var val = row.proxy.replaceAll('{token}', token)
        return BASE_URL + val
@@ -912,7 +1087,11 @@
      }
    },
    async getResTableData() {
      this.listData.name = this.formInline.name
      this.listData.name = this.formInline.name;
      this.listData.data = this.formInline.data;
      this.listData.type = this.formInline.type;
      this.listData.category = this.formInline.category;
      this.listData.status = this.formInline.status;
      const data = await select_Res_ByPageAndCount(this.listData);
      if (data.code != 200) {
        return this.$message({
@@ -993,10 +1172,12 @@
  },
  mounted() {
    window.addEventListener("resize", this.onResize);
    this.getResToken();
    this.calHeight();
    this.getPerms();
    this.setListDataStart();
    this.optionsStart();
  },
};
@@ -1024,6 +1205,10 @@
    }
  }
}
.fullscreen1 {
  width: 100%;
  height: 94vh;
}
/deep/ .el-input__suffix {
  top: 50%;
  transform: translateY(-50%);
@@ -1031,6 +1216,12 @@
.insertWidth {
  width: calc(100% - 200px);
}
/deep/.el-dialog__body {
  padding: 10px !important;
}
/deep/.el-dialog__header {
  padding: 10px !important;
}
</style>
<style >
.el-message-box {