nav
lxl
2022-11-08 02c0fe95de11fe9e692144a9a15b6d96bb991b66
src/views/datamanage/metadataManage.vue
@@ -1,47 +1,64 @@
<template>
  <div class="authorityManagement_box">
    <My-bread :list="['数据管理', '元数据管理']"></My-bread>
    <My-bread
      :list="[
        `${$t('dataManage.dataManage')}`,
        `${$t('dataManage.metadataManage')}`,
      ]"
    ></My-bread>
    <el-divider />
    <div class="searchComp">
      <el-form ref="ruleForm" :model="ruleForm" :inline="true">
    <div class="inquire">
      <el-form ref="queryForm" :model="queryForm" :inline="true">
        <el-form-item label="关键字" prop="name">
          <el-input v-model="ruleForm.name" placeholder="请输入" />
          <el-input
            v-model="queryForm.name"
            :placeholder="$t('common.pleaseInput')"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            @click="submitForm('ruleForm')"
            @click="queryInfo()"
            icon="el-icon-search"
            type="primary"
            size="small"
            >查询</el-button
          >
        </el-form-item>
        <el-form-item>
          <el-button
            @click="resetForm('ruleForm')"
            @click="resetInfo('queryForm')"
            icon="el-icon-refresh"
            type="info"
            size="small"
            >重置</el-button
          >
        </el-form-item>
        <el-form-item v-if="btnStatus.insert">
          <el-button
            @click="downFormData"
            icon="el-icon-download"
            type="success"
            size="small"
            >下载</el-button
            @click="showAddDialog"
            icon="el-icon-plus"
            >{{ $t("common.append") }}</el-button
          >
          <!-- <el-button
            @click="downFormData"
            icon="el-icon-download"
            type="success"
            size="small"
            >下载</el-button
          > -->
        </el-form-item>
        <el-form-item v-if="btnStatus.delete">
          <el-button
            @click="DelFormData"
            icon="el-icon-delete"
            type="danger"
            size="small"
            >删除</el-button
            @click="deleteMetaInfo"
            icon="el-icon-delete"
            >{{ $t("common.delete") }}</el-button
          >
        </el-form-item>
        <el-form-item v-if="btnStatus.download">
          <el-button
            @click="downFormData"
            icon="el-icon-download"
            type="success"
            size="small"
            >下载</el-button
          >
        </el-form-item>
      </el-form>
@@ -58,61 +75,29 @@
            height="99%"
          >
            <el-table-column type="selection" width="55" />
            <el-table-column min-width="150" prop="name" label="数据名称" />
            <el-table-column min-width="150" prop="name" label="名称" />
            <el-table-column min-width="100" prop="format" label="格式" />
            <el-table-column min-width="100" prop="sizes" label="大小" />
            <el-table-column
              min-width="100"
              prop="create_user"
              prop="createUser"
              label="创建人员"
            />
            <el-table-column
              min-width="100"
              prop="create_time"
              prop="createTime"
              label="创建时间"
            />
            <el-table-column min-width="100" prop="coor_sys" label="坐标系统" />
            <el-table-column
              min-width="100"
              prop="accuracy"
              label="比例尺/分辨率"
            />
            <el-table-column min-width="100" prop="format" label="存储格式" />
            <el-table-column min-width="100" prop="version" label="数据版本" />
            <el-table-column prop="status" label="发布" width="70%">
              <template slot-scope="scope">
                <span
                  slot="reference"
                  v-if="scope.row.s_url === '' || scope.row.s_url === null"
                >
                  <i class="dotClass" style="background-color: gray"></i>
                </span>
                <span slot="reference" v-else>
                  <i class="dotClass" style="background-color: springgreen"></i>
                </span>
              </template>
            </el-table-column>
            <el-table-column min-width="100" prop="cs" label="坐标系统" />
            <el-table-column min-width="100" prop="scale" label="比例尺" />
            <el-table-column min-width="100" prop="resolution" label="分辨率" />
            <el-table-column min-width="100" prop="descr" label="描述" />
            <el-table-column min-width="100" label="操作">
              <template slot-scope="scope">
                <el-link @click="showDetail(scope.$index, scope.row)"
                  >查看</el-link
                >
                <el-link
                  @click="handleEdit(scope.$index, scope.row)"
                  style="margin-left: 10px"
                <el-link @click="showDetail(scope.row)">查看</el-link>
                <el-link @click="editInfo(scope.row)" style="margin-left: 10px"
                  >修改</el-link
                >
                <el-link
                  v-if="scope.row.s_url === '' || scope.row.s_url === null"
                  @click="handleStart(scope.row)"
                  style="margin-left: 10px"
                  >发布</el-link
                >
                <el-link
                  v-else
                  @click="handleStop(scope.row)"
                  style="margin-left: 10px"
                  >停止</el-link
                >
              </template>
            </el-table-column>
@@ -146,95 +131,81 @@
        <div class="contentBox">
          <p>数据名称:{{ itemdetail.name }}</p>
          <el-divider></el-divider>
          <p>
            数据范围:
            {{ itemdetail.x_min }}, {{ itemdetail.y_min }};
            {{ itemdetail.x_max }}, {{ itemdetail.y_max }}
          </p>
          <el-divider></el-divider>
          <p>创建时间:{{ itemdetail.create_time }}</p>
          <el-divider></el-divider>
          <p>创建人员:{{ itemdetail.create_user }}</p>
          <el-divider></el-divider>
          <p>更新时间:{{ itemdetail.up_time }}</p>
          <el-divider></el-divider>
          <p>更新人员:{{ itemdetail.up_user }}</p>
          <el-divider></el-divider>
          <p>上传单位:{{ itemdetail.up_unit }}</p>
          <el-divider></el-divider>
          <p>数据状态:{{ itemdetail.status }}</p>
          <el-divider></el-divider>
          <p>坐标系统:{{ itemdetail.coor_sys }}</p>
          <el-divider></el-divider>
          <p>比例尺/分辨率:{{ itemdetail.accuracy }}</p>
          <el-divider></el-divider>
          <p>发布地址:{{ itemdetail.s_url }}
           <el-link
              @click="ShowWindowFly(itemdetail.s_url)"
              :underline="false"
              type="primary"
              >详情</el-link
            ></p>
          <el-divider></el-divider>
          <p>数据版本:{{ itemdetail.version }}</p>
          <el-divider></el-divider>
          <p>数据类型:{{ itemdetail.type }}</p>
          <el-divider></el-divider>
          <p>数据格式:{{ itemdetail.format }}</p>
          <el-divider></el-divider>
          <p>创建时间:{{ itemdetail.createTime }}</p>
          <el-divider></el-divider>
          <p>创建人员:{{ itemdetail.createUser }}</p>
          <el-divider></el-divider>
          <p>更新时间:{{ itemdetail.updateTime }}</p>
          <el-divider></el-divider>
          <p>更新人员:{{ itemdetail.updateUser }}</p>
          <el-divider></el-divider>
          <p>坐标系统:{{ itemdetail.cs }}</p>
          <el-divider></el-divider>
          <p>比例尺{{ itemdetail.scale }}</p>
          <el-divider></el-divider>
          <p>分辨率{{ itemdetail.resolution }}</p>
          <el-divider></el-divider>
          <p>描述:{{ itemdetail.descr }}</p>
        </div>
      </el-card>
    </div>
    <el-dialog title="修改详情" :visible.sync="dialogFormVisible">
      <el-form :model="upform">
    <el-dialog
      width="510px"
      top="5vh"
      :title="behavior"
      :visible.sync="dialogFormVisible"
      :before-close="handleClose"
    >
      <el-form :model="editForm" ref="editForm">
        <el-form-item label="数据名称" :label-width="formLabelWidth">
          <el-input v-model="upform.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围x_min" :label-width="formLabelWidth">
          <el-input v-model="upform.x_min" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围x_max" :label-width="formLabelWidth">
          <el-input v-model="upform.x_max" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围y_min" :label-width="formLabelWidth">
          <el-input v-model="upform.y_min" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据范围y_max" :label-width="formLabelWidth">
          <el-input v-model="upform.y_max" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="创建时间" :label-width="formLabelWidth">
          <el-date-picker
            v-model="upform.create_time"
            value-format="yyyy-MM-dd"
            type="date"
            placeholder="选择日期"
            style="width: 100%"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="坐标系统" :label-width="formLabelWidth">
          <el-input v-model="upform.coor_sys" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="比例尺/分辨率" :label-width="formLabelWidth">
          <el-input v-model="upform.accuracy" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据格式" :label-width="formLabelWidth">
          <el-input v-model="upform.format" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据版本" :label-width="formLabelWidth">
          <el-input v-model="upform.version" autocomplete="off"></el-input>
          <el-input v-model="editForm.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据类型" :label-width="formLabelWidth">
          <el-input v-model="upform.type" autocomplete="off"></el-input>
          <el-input v-model="editForm.type" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="数据格式" :label-width="formLabelWidth">
          <el-input v-model="editForm.format" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="坐标系统" :label-width="formLabelWidth">
          <el-input v-model="editForm.cs" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="比例尺" :label-width="formLabelWidth">
          <el-input v-model="editForm.scale" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="分辨率" :label-width="formLabelWidth">
          <el-input v-model="editForm.resolution" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="描述" :label-width="formLabelWidth">
          <el-input v-model="editForm.descr" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="updateForm">确 定</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      <div v-if="behavior == '修改信息'" slot="footer" class="dialog-footer">
        <el-button size="medium" @click="cancelEdit()">重置</el-button>
        <el-button
          size="medium"
          type="primary"
          @click="sendEdit('editForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >提交</el-button
        >
      </div>
      <div v-else slot="footer" class="dialog-footer">
        <el-button size="medium" @click="cancelAdd('editForm')">重置</el-button>
        <el-button
          size="medium"
          type="primary"
          @click="sendAdd('editForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >提交</el-button
        >
      </div>
    </el-dialog>
    <div class="downloadBox" v-if="showCodeBox">
      <h4 style="padding: 20px">请输入下载包密码</h4>
      <el-form
        :model="codeForm"
        :rules="rules"
@@ -263,12 +234,11 @@
<script>
import {
  queryMetaData,
  queryDataCount,
  updateMetaData,
  dltMetaDatas,
  publishMeta,
  unpublishMeta,
  select_meta_ByPageAndCount,
  // queryDataCount,
  updateMeta,
  deleteMeta,
  insertMeta,
} from "../../api/api";
import MyBread from "../../components/MyBread.vue";
export default {
@@ -290,14 +260,15 @@
      multipleSelection: [],
      formLabelWidth: "120px",
      dialogFormVisible: false,
      InsertFormdialog: false,
      insertform: {},
      upform: {},
      editForm: {},
      showinfoBox: false,
      fullscreenLoading: false,
      itemdetail: {},
      ruleForm: {
      queryForm: {
        name: "",
      },
      behavior: "",
      initialForm: "",
      codeForm: {
        password: "",
        repassword: "",
@@ -313,16 +284,34 @@
      count: 0,
      currentPage: 1,
      pageSize: 10,
      pageNum: 1,
      searchName: "",
      pageIndex: 1,
      btnStatus: {
        select: false,
        delete: false,
        upload: false,
        download: false,
        insert: false,
        update: false,
      },
    };
  },
  created() {
    this.getMetaData(10, 1, "");
    this.getMetaCount("");
    this.getMetaData({
      pageIndex: 1,
      pageSize: 10,
    });
    this.showPermsBtn();
  },
  methods: {
     ShowWindowFly(res) {
    //显示权限按钮
    showPermsBtn() {
      let currentPerms = this.$store.state.currentPerms;
      let permsEntity = this.$store.state.permsEntity;
      permsEntity
        .filter((item) => item.perms == currentPerms)
        .map((item) => (this.btnStatus[item.tag.substr(1)] = true));
    },
    ShowWindowFly(res) {
      console.log(res);
      if (res == "") return;
      if (res.indexOf(".xls") != -1) {
@@ -355,44 +344,113 @@
      );
    },
    // 请求数据内容
    getMetaData(size, num, name) {
      queryMetaData(size, num, name).then((res) => {
        this.tableData = res.data;
    getMetaData(params) {
      select_meta_ByPageAndCount(params).then((res) => {
        this.tableData = res.result;
        this.count = res.count;
      });
    },
    // 请求数据数量
    getMetaCount(name) {
      queryDataCount(name).then((res) => {
        this.count = res.data;
    // 查询
    queryInfo() {
      let searchData = {
        name: this.queryForm.name.trim(),
        pageIndex: this.pageIndex,
        pageSize: this.pageSize,
      };
      select_meta_ByPageAndCount(searchData).then((res) => {
        if (res.code == 200) {
          this.tableData = res.result;
          this.count = res.count;
        } else {
          console.log("查询接口报错");
          this.$notify.error({
            title: res.code,
            message: res.result,
          });
        }
      });
    },
    // 关键字查询
    submitForm(formName) {
    // 重置查询
    resetInfo(formName) {
      this.$refs[formName].resetFields();
    },
    //新增按钮
    showAddDialog() {
      this.behavior = "新增用户";
      this.editForm = {};
      this.dialogFormVisible = true;
    },
    cancelAdd(formName) {
      this.editForm = {};
      this.$refs[formName].resetFields();
    },
    sendAdd(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.searchName = this.ruleForm.name.trim();
          this.getMetaData(10, 1, this.searchName);
          this.getMetaCount(this.searchName);
          console.log(this.editForm);
          this.fullscreenLoading = true;
          insertMeta(this.editForm)
            .then((res) => {
              setTimeout(() => {
                this.fullscreenLoading = false;
                if (res.code == 200) {
                  this.getMetaData({ pageIndex: 1, pageSize: 10 });
                  this.$message({
                    message: "添加成功",
                    type: "success",
                  });
                  this.editForm = {};
                  this.dialogFormVisible = false;
                }
              }, 500);
            })
            .catch((res) => {
              alert("修改失败,请重试!");
              this.fullscreenLoading = false;
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 重置查询
    resetForm(formName) {
      this.getMetaData(10, 1, "");
      this.getMetaCount("");
      this.searchName = "";
      this.$refs[formName].resetFields();
    },
    // 获取多选选中的对象
    handleSelectionChange(val) {
      this.multipleSelection = val;
      // console.log(val);
    },
    // 删除多条
    deleteMetaInfo() {
      this.$confirm("确定是否删除所选内容?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var std = [];
          for (var i in this.multipleSelection) {
            std.push(this.multipleSelection[i].id);
          }
          deleteMeta({ ids: std.toString() }).then((res) => {
            if (res.code == 200) {
              this.$message({
                type: "success",
                message: "删除成功!",
              });
              this.multipleSelection = [];
              this.getMetaData({ pageIndex: 1, pageSize: 10 });
            } else {
              this.$message.error("删除失败");
              this.multipleSelection = [];
            }
          });
        })
        .catch(() => {
          this.$message("已取消删除");
        });
    },
    // 查看界面
    showDetail(index, row) {
    showDetail(row) {
      // console.log(index, row);
      this.showinfoBox = true;
      this.itemdetail = row;
@@ -403,12 +461,28 @@
      this.itemdetail = {};
    },
    // 修改界面
    handleEdit(index, row) {
    editInfo(row) {
      // console.log(row);
      delete row.createTime;
      delete row.createUser;
      delete row.updateUser;
      delete row.updateUser;
      this.initialForm = JSON.stringify(row); //备份
      this.behavior = "修改信息";
      this.editForm = JSON.parse(JSON.stringify(row));
      this.dialogFormVisible = true;
      this.upform = JSON.parse(JSON.stringify(row));
    },
    handleClose(done) {
      this.$confirm("确认关闭?")
        .then((_) => {
          this.editForm = {};
          done();
        })
        .catch((_) => {});
    },
    // 提交修改
    updateForm() {
    sendEdit() {
      this.$confirm("是否确定编辑?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
@@ -416,72 +490,38 @@
      })
        .then(() => {
          this.dialogFormVisible = false;
          updateMetaData(this.upform).then((res) => {
            if (res.data == 1) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
            }
            this.getMetaData(10, 1, "");
            this.getMetaCount("");
          updateMeta(this.editForm).then((res) => {
            setTimeout(() => {
              this.fullscreenLoading = false;
              if (res.code == 200) {
                this.getMetaData({ pageIndex: 1, pageSize: 10 });
                this.$message({
                  message: "修改成功",
                  type: "success",
                });
                this.editForm = {};
                this.dialogFormVisible = false;
              }
            }, 500);
          });
        })
        .catch(() => {});
        .catch(() => {
          alert("修改失败,请重试!");
          this.fullscreenLoading = false;
        });
    },
    // 删除多条
    DelFormData() {
      var std = [];
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      this.$confirm("确定是否删除所选内容?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          dltMetaDatas(std).then((res) => {
            this.getMetaData(10, 1, "");
            this.getMetaCount("");
            this.$message({
              type: "success",
              message: "删除成功!",
            });
          });
        })
        .catch(() => {});
    },
    download(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          let ids = "";
          this.multipleSelection.forEach((e) => {
            ids += `id=${e.id}&`;
          });
          let res = ids.substring(0, ids.length - 1);
          // console.log(res);
          let url = "http://192.168.20.106/LFServer/Meta/Downloads?" + res;
          window.open(url);
          this.closeDown();
        } else {
          console.log("下载失败");
          this.closeDown();
          return false;
        }
    cancelEdit() {
      this.$nextTick(() => {
        this.editForm = JSON.parse(this.initialForm);
      });
    },
    download() {},
    closeDown() {
      this.showCodeBox = false;
      this.codeForm.password = "";
      this.codeForm.repassword = "";
    },
    downFormData() {
      // var std = [];
      // for (var i in this.multipleSelection) {
      //   std.push(this.multipleSelection[i].id);
      // }
      if (this.multipleSelection.length == 0) {
        alert("请先选择要下载的文件");
        return;
@@ -506,32 +546,15 @@
      //   })
      //   .catch(() => {});
    },
    handleStart(row) {
      publishMeta(row.id).then((res) => {
        console.log(res);
        this.getMetaData(10, 1, "");
        this.getMetaCount("");
      });
    },
    handleStop(row) {
      console.log(row.id);
      unpublishMeta(row.id).then((res) => {
        console.log(res);
        this.getMetaData(10, 1, "");
        this.getMetaCount("");
      });
    },
    // 条数修改
    handleSizeChange(val) {
      this.pageSize = val;
      this.getMetaData(this.pageSize, 1, this.searchName);
      this.getMetaCount(this.searchName);
      this.queryInfo();
    },
    // 页数修改
    handleCurrentChange(val) {
      this.pageNum = val;
      this.getMetaData(this.pageSize, this.pageNum, this.searchName);
      this.getMetaCount(this.searchName);
      this.pageIndex = val;
      this.currentPage = val;
      this.queryInfo();
    },
  },
};
@@ -544,21 +567,23 @@
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  .searchComp {
    margin: 10px auto;
  .inquire {
    position: relative;
    height: 50px;
    overflow: auto;
    padding: 8px;
    margin-top: 20px;
    background: #fff;
    border-radius: 5px;
    border: 1px solid rgb(202, 201, 204);
    margin-bottom: 20px;
    .el-form-item {
      margin: 5px;
    }
    .el-input {
      width: 467px;
    }
  }
  .bottom {
    width: 100%;
    height: 85%;
    height: 83%;
    .rightTable {
      height: 100%;
      width: 100%;
@@ -623,7 +648,6 @@
  }
  .infoBox {
    width: 500px;
    border: 1px solid #eee;
    position: absolute;
    z-index: 100;
@@ -649,8 +673,8 @@
    }
  }
  /deep/ .el-dialog {
    width: 500px !important;
    margin-top: 10vh !important;
    // width: 500px !important;
    // margin-top: 10vh !important;
  }
  /deep/.el-dialog .el-input__inner {