nav
lxl
2022-11-08 02c0fe95de11fe9e692144a9a15b6d96bb991b66
src/views/datamanage/domainManage.vue
@@ -2,7 +2,7 @@
  <div class="authorityManagement_box">
    <My-bread :list="[`${$t('dataManage.dataManage')}`, `值域管理`]"></My-bread>
    <el-divider />
    <div class="contentBox">
    <div class="mainBox">
      <div class="leftTree">
        <el-tree
          :data="domainData"
@@ -16,7 +16,7 @@
          <el-form ref="queryForm" :model="queryForm" :inline="true">
            <el-form-item :label="$t('dataManage.vmobj.keyword')" prop="name">
              <el-input
                v-model="queryForm.name"
                v-model="queryForm.code"
                :placeholder="$t('common.pleaseInput')"
              />
            </el-form-item>
@@ -42,9 +42,9 @@
              >
              <el-button
                v-if="btnStatus.delete"
                @click="deleteInfo"
                type="danger"
                size="small"
                @click="handleDelete"
                icon="el-icon-delete"
                >{{ $t("common.delete") }}</el-button
              >
@@ -52,7 +52,14 @@
          </el-form>
        </div>
        <div class="table_box">
          <el-table :data="tableData" stripe style="width: 100%" height="99%">
          <el-table
            :data="tableData"
            border
            style="width: 100%"
            fit
            @selection-change="handleSelectionChange"
            height="99%"
          >
            <el-table-column type="selection" width="50" />
            <el-table-column
              align="center"
@@ -102,20 +109,15 @@
            />
            <el-table-column min-width="150" :label="$t('common.operate')">
              <template slot-scope="scope">
              <template slot-scope="scope"
                ><el-button @click="showDetail(scope.row)" size="small"
                  >查看</el-button
                >
                <el-button
                  v-if="btnStatus.update"
                  @click="handleEdit(scope.$index, scope.row)"
                  type="warning"
                  size="small"
                  >{{ $t("common.update") }}</el-button
                >
                <el-button
                  v-if="btnStatus.delete"
                  @click="handleDelete(scope.$index, scope.row)"
                  type="danger"
                  size="small"
                  >{{ $t("common.delete") }}</el-button
                >
              </template>
            </el-table-column>
@@ -142,7 +144,7 @@
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>详细信息</span>
          <div style="float: right; cursor: pointer">
          <div style="float: right; cursor: pointer" @click="closeDetial">
            <i class="el-icon-close"></i>
          </div>
        </div>
@@ -225,7 +227,7 @@
        <el-button
          size="medium"
          type="primary"
          @click="sendEdit()"
          @click="sendEdit('editForm')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >{{ $t("common.confirm") }}</el-button
        >
@@ -249,8 +251,8 @@
  getDomainTabs,
  getSingleTab,
  insertDomain,
  // deleteDomain,
  // updateDomain,
  deleteDomain,
  updateDomain,
} from "../../api/api";
import MyBread from "../../components/MyBread.vue";
export default {
@@ -266,7 +268,9 @@
      fullscreenLoading: false,
      itemdetail: {},
      editForm: {},
      queryForm: {},
      queryForm: {
        code: "",
      },
      insertform: {},
      initialForm: "",
@@ -340,16 +344,20 @@
        this.domainData[1].children = bsres;
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    queryInfo() {
      alert("缺少查询条件接口");
      return;
      // let searchData = {
      //   name: this.queryForm.name.trim(),
      //   pageIndex: this.pageIndex,
      //   pageSize: this.pageSize,
      // };
      XXX(searchData).then((res) => {
      let searchData = {
        code: this.queryForm.code,
        ns: this.listData.ns,
        tab: this.listData.tab,
        pageIndex: this.listData.pageIndex,
        pageSize: this.listData.pageSize,
      };
      // console.log(searchData);
      getSingleTab(searchData).then((res) => {
        if (res.code == 200) {
          this.tableData = res.result;
          this.count = res.count;
@@ -368,6 +376,48 @@
      this.$bus.$emit("clearTressLabel", true);
      this.getAllTabelData();
    },
    // 删除多条
    deleteInfo() {
      this.$confirm("确定是否删除所选内容?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          if (this.multipleSelection.length == 0) {
            alert("请选择要删除的对象");
            return;
          } else {
            var std = [];
            for (var i in this.multipleSelection) {
              std.push(this.multipleSelection[i].id);
            }
            deleteDomain({ ids: std.toString() }).then((res) => {
              console.log(res);
              if (res.code == 200) {
                this.$message({
                  type: "success",
                  message: "删除成功!",
                });
                this.multipleSelection = [];
                getSingleTab(this.listData).then((res) => {
                  setTimeout(() => {
                    this.tableData = res.result;
                    this.count = res.count;
                    this.fullscreenLoading = false;
                  }, 500);
                });
              } else {
                this.$message.error("删除失败");
                this.multipleSelection = [];
              }
            });
          }
        })
        .catch(() => {
          this.$message("已取消删除");
        });
    },
    showAddDialog() {
      this.behavior = "新增用户";
      this.editForm = {};
@@ -377,21 +427,26 @@
      this.editForm = {};
      this.$refs[formName].resetFields();
    },
    sendAdd() {
    sendAdd(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          return;
          console.log(this.editForm);
          // console.log(this.editForm);
          this.fullscreenLoading = true;
          insertDomain(this.editForm)
            .then((res) => {
              setTimeout(() => {
                this.fullscreenLoading = false;
                if (res.code == 200) {
                  this.getMetaData({ pageIndex: 1, pageSize: 10 });
                  this.$message({
                    message: "添加成功",
                    type: "success",
                  });
                  getSingleTab(this.listData).then((res) => {
                    setTimeout(() => {
                      this.tableData = res.result;
                      this.count = res.count;
                      this.fullscreenLoading = false;
                    }, 500);
                  });
                  this.editForm = {};
                  this.dialogFormVisible = false;
@@ -416,20 +471,73 @@
        })
        .catch((_) => {});
    },
    // 查看界面
    showDetail(row) {
      // console.log(index, row);
      this.showinfoBox = true;
      this.itemdetail = row;
    },
    // 关闭查看
    closeDetial() {
      this.showinfoBox = false;
      this.itemdetail = {};
    },
    handleEdit(index, row) {
      this.dialogFormVisible = true;
      this.initialForm = JSON.stringify(row); //备份
      this.editForm = row;
      this.behavior = "属性修改";
      this.behavior = "修改信息";
    },
    editFromDataClose() {
      this.dialogFormVisible = false;
      this.editForm = {};
    },
    editFromData() {
      // this.editForm = {};
      console.log(this.editForm);
    // 提交修改
    sendEdit() {
      this.$confirm("是否确定编辑?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.dialogFormVisible = false;
          this.fullscreenLoading = true;
          updateDomain(this.editForm)
            .then((res) => {
              if (res.code == 200) {
                getSingleTab(this.listData).then((res) => {
                  setTimeout(() => {
                    this.tableData = res.result;
                    this.count = res.count;
                    this.fullscreenLoading = false;
                  }, 500);
                });
                this.$message({
                  message: "修改成功",
                  type: "success",
                });
                this.editForm = {};
              } else {
                alert("修改失败,请重试!");
                this.fullscreenLoading = false;
              }
            })
            .catch(() => {
              alert("修改失败,请重试!");
              this.fullscreenLoading = false;
            });
        })
        .catch(() => {
          alert("修改失败,请重试!");
          this.fullscreenLoading = false;
        });
    },
    handleDelete(index, row) {},
    cancelEdit() {
      this.$nextTick(() => {
        this.editForm = JSON.parse(this.initialForm);
      });
    },
    handleSizeChange(val) {
      this.listData.pageSize = val;
      // console.log(this.listData);
@@ -471,7 +579,7 @@
  .el-input {
    width: 300px !important;
  }
  .contentBox {
  .mainBox {
    display: flex;
    justify-content: space-between;
    .leftTree {
@@ -572,6 +680,8 @@
    }
    .contentBox {
      margin: 0 aotu 10px;
      height: 600px;
      overflow: auto;
      p {
        // background-color: #bfa;
        // margin-bottom: 10px;