管道基础大数据平台系统开发-【前端】-新系統界面
TreeWish
2023-03-03 b6c8e7c61f0270598ba7fdbc44f79512e010d0fe
src/views/userManage/authorityManage.vue
@@ -1,50 +1,72 @@
<template>
  <div class="power_box">
    <My-bread
      :list="[
    <My-bread :list="[
  `${$t('operatManage.operatManage')}`,
        `${$t('userManage.authorityManage')}`,
      ]"
    ></My-bread>
      ]"></My-bread>
    <el-divider />
    <div class="power_quire">
      <el-form ref="form" :model="ruleForm" label-width="100px" :inline="true">
        <el-form-item :label="$t('common.username')">
          <el-input v-model="ruleForm.name"></el-input>
    <div class="power_quire subpage_Div" ref="container">
      <el-form
        ref="form"
        :model="ruleForm"
        :inline="true"
      >
       <div class="flex_box">
        <div style="margin-right: auto">
         <el-form-item :label="$t('userManage.authorityM.name')">
          <el-input v-model="ruleForm.name" style="width:200px" size="small" :placeholder="$t('userManage.authorityM.nameHolder')">
            <i slot="suffix" class="el-icon-search" @click="submitForm"></i>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button  @click="submitForm('ruleForm')"  icon="el-icon-search" type="primary">{{
            $t('common.iquery')
          }}</el-button>
        </div>
        <div>
          <el-form-item>
          <el-button
            v-if="menuStatus.insert"
            @click="InsertFormdialog = true"
            icon="el-icon-edit"
            type="success" size="small"
          >{{ $t('common.append') }}</el-button>
          <el-button
            v-if="menuStatus.delete"
            @click="DelFromData"
            icon="el-icon-delete"
            type="danger" size="small"
          >{{ $t('common.delete') }}</el-button>
<!--          <el-button-->
<!--            @click="submitForm('ruleForm')"-->
<!--            icon="el-icon-search" size="small"-->
<!--            type="primary"-->
<!--          >{{-->
<!--            $t('common.iquery')-->
<!--          }}</el-button>-->
          <el-button
            @click="resetForm('ruleForm')"
            icon="el-icon-refresh"
            type="info"
            >{{ $t('common.empty') }}</el-button
          >
          <el-button v-if="menuStatus.insert"
            @click="InsertFormdialog = true"
            icon="el-icon-edit"
            type="success"
            >{{ $t('common.append') }}</el-button
          >
          <el-button v-if="menuStatus.delete"
            @click="DelFromData"
            icon="el-icon-delete"
            type="danger"
            >{{ $t('common.delete') }}</el-button
          >
            type="info" size="small"
          >{{ $t('common.empty') }}</el-button>
        </el-form-item>
        </div>
        </div>
      </el-form>
    </div>
    <div class="table_box">
    <div class="dividing-line"></div>
    <div class="table_box subpage_Div" :style="styleVar">
      <el-table
        :data="tableData"
        style="width: 100%"
        fit
        border
        height="calc(100% - 45px)"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column
          type="selection"
          width="55"
        />
        <el-table-column
          align="center"
          type="index"
@@ -96,7 +118,7 @@
        >
        </el-table-column>
        <el-table-column
          fixed="right"
          :label="$t('common.operate')"
          width="170px"
        >
@@ -106,47 +128,56 @@
              type="primary"
              plain
              size="small"
              >{{ $t('common.see') }}</el-button
            >
            <el-button v-if="menuStatus.update"
            >{{ $t('common.see') }}</el-button>
            <el-button
              v-if="menuStatus.update"
              @click="handleEdit(scope.$index, scope.row)"
              type="warning"
              size="small"
              plain
              >{{ $t('common.edit') }}</el-button
            >
            >{{ $t('common.edit') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination_box" style="margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="listData.pageIndex"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="listData.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="count"
        >
        </el-pagination>
      </div>
    </div>
    <div class="pagination_box">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="listData.pageIndex"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="listData.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="count"
      >
      </el-pagination>
    </div>
    <div class="infoBox" v-show="showinfoBox">
<div class="infoBox_box" v-show="showinfoBox">
    <div
      class="infoBox subpage_Div box_div"
    >
      <el-card class="box-card">
        <div slot="header" class="clearfix">
        <div
          slot="header"
          class="clearfix"
        >
          <span>{{ $t('dataManage.styleObj.deInformation') }}</span>
          <div style="float: right; cursor: pointer"  @click="closeDetial" >
          <div
            style="float: right; cursor: pointer"
            @click="closeDetial"
          >
            <i class="el-icon-close"></i>
          </div>
        </div>
               <div class="contentBox">
        <div class="contentBox">
          <p>
            <label> {{ $t('userManage.userInfoObj.name') }}:</label>
            <label class="boxlabel">{{ itemdetail.name }}</label>
          </p>
          <el-divider></el-divider>
          <p>
           <p>
          <p>
            <label> {{ $t('userManage.userInfoObj.tag') }}:</label>
            <label class="boxlabel">{{ itemdetail.tag }}</label>
          </p>
@@ -157,7 +188,7 @@
            <label class="boxlabel">{{ itemdetail.createUser }}</label>
          </p>
          <el-divider></el-divider>
           <p>
          <p>
            <label> {{ $t('userManage.userInfoObj.createTime') }}:</label>
            <label class="boxlabel">{{ itemdetail.createTime }}</label>
          </p>
@@ -171,15 +202,16 @@
            <label> {{ $t('userManage.userInfoObj.updateTime') }}:</label>
            <label class="boxlabel">{{ itemdetail.updateTime }}</label>
          </p>
 <el-divider></el-divider>
          <el-divider></el-divider>
          <p>
            <label> {{ $t('userManage.userInfoObj.bak') }}:</label>
            <label class="boxlabel">{{ itemdetail.bak }}</label>
          </p>
           <el-divider></el-divider>
          <el-divider></el-divider>
        </div>
      </el-card>
    </div>
</div>
    <el-dialog
      :title="dialogTitle"
      :visible.sync="isTransfer"
@@ -195,78 +227,108 @@
        :props="defaultProps"
      >
      </el-tree>
      <el-button type="primary" size="small">{{
      <el-button
        type="primary"
        size="small"
      >{{
        $t('common.confirm')
      }}</el-button>
      <el-button type="info" size="small">{{ $t('common.close') }}</el-button>
      <el-button
        type="info"
        size="small"
      >{{ $t('common.close') }}</el-button>
    </el-dialog>
    <el-dialog
      :title="$t('userManage.userInfoObj.addPermission')"
      style="overflow: hidden"
      :visible.sync="InsertFormdialog"
      width="30%"
      :before-close="handleClose"
    >
      <el-form :model="insertform">
      <el-form :model="insertform" label-position="top">
        <el-form-item
          :label="$t('userManage.userInfoObj.name')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="insertform.name" autocomplete="off"></el-input>
          <el-input
            v-model="insertform.name"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('userManage.userInfoObj.tag')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="insertform.tag" autocomplete="off"></el-input>
          <el-input
            v-model="insertform.tag"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('userManage.userInfoObj.bak')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="insertform.bak" autocomplete="off"></el-input>
          <el-input
            v-model="insertform.bak"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="insertFromDataClose">{{
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button size="small" @click="insertFromDataClose">{{
          $t('common.close')
        }}</el-button>
        <el-button type="primary" @click="insertFromData">{{
        <el-button
         size="small"  type="primary"
          @click="insertFromData"
        >{{
          $t('common.confirm')
        }}</el-button>
      </div>
    </el-dialog>
      <el-dialog
    <el-dialog
      :title="$t('userManage.userInfoObj.editPermission')"
      style="overflow: hidden"
      :visible.sync="EditFormdialog"
      :before-close="EditFromDataClose"
      width="30%"
    >
      <el-form :model="upform">
      <el-form :model="upform" label-position="top">
        <el-form-item
          :label="$t('userManage.userInfoObj.name')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="upform.name"  ></el-input>
          <el-input v-model="upform.name" style="width:85%"></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('userManage.userInfoObj.tag')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="upform.tag"  ></el-input>
          <el-input v-model="upform.tag" style="width:85%"></el-input>
        </el-form-item>
        <el-form-item
          :label="$t('userManage.userInfoObj.bak')"
          :label-width="formLabelWidth"
        >
          <el-input v-model="upform.bak" ></el-input>
          <el-input v-model="upform.bak" style="width:85%"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button  @click="EditFromDataClose" >{{
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button size="small" @click="EditFromDataClose">{{
          $t('common.close')
        }}</el-button>
        <el-button  @click="EditFromData" type="primary"  >{{
        <el-button
          @click="EditFromData"
       size="small"  type="primary"
        >{{
          $t('common.confirm')
        }}</el-button>
      </div>
@@ -275,9 +337,14 @@
</template>
<script>
import moment from 'moment';
import MyBread from '../../components/MyBread.vue';
import { select_Auth_ByPageAndCount, insertAuth, updateAuth, deleteAuths } from '../../api/api.js';
import moment from "moment";
import MyBread from "../../components/MyBread.vue";
import {
  select_Auth_ByPageAndCount,
  insertAuth,
  updateAuth,
  deleteAuths,
} from "../../api/api.js";
export default {
  components: { MyBread },
  data() {
@@ -287,10 +354,10 @@
        insert: false,
        update: false,
      },
      formLabelWidth: '100px',
      formLabelWidth: "100px",
      ruleForm: {},
      isTransfer: false,
      dialogTitle: '',
      dialogTitle: "",
      data: [],
      InsertFormdialog: false,
      showinfoBox: false,
@@ -308,8 +375,13 @@
        pageSize: 10,
      },
      defaultProps: {
        children: 'children',
        label: 'label',
        children: "children",
        label: "label",
      },
      tableHeight: 0,
      timer: 0,
      styleVar: {
        height: "calc(100% - 109px)",
      },
    };
  },
@@ -320,21 +392,42 @@
    for (var i = 0; i < permsEntity.length; i++) {
      if (permsEntity[i].perms == val) {
        this.showPermsMenu(permsEntity[i]);
      }
    }
    this.getRoleTabelData();
  },
  mounted() {
    window.addEventListener("resize", this.onResize);
    this.calHeight();
  },
  beforeDestroy() {
    this.timer && clearTimeout(this.timer);
    window.removeEventListener("resize", this.onResize);
  },
  methods: {
    onResize() {
      this.timer && clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        this.calHeight();
      }, 500);
    },
    calHeight() {
      this.$nextTick(() => {
        const rect = this.$refs.container.getBoundingClientRect();
        this.tableHeight = `${rect.height + 97}px`;
        // this.styleVar["height"] = `calc(100% - ${rect.height + 97}px)`;
        this.styleVar["height"] = `calc(100% - ${rect.height + 30}px)`;
      });
    },
    showPermsMenu(res) {
      switch (res.tag) {
        case '/delete':
        case "/delete":
          this.menuStatus.delete = true;
          break;
        case '/insert':
        case "/insert":
          this.menuStatus.insert = true;
          break;
        case '/update':
        case "/update":
          this.menuStatus.update = true;
          break;
      }
@@ -344,34 +437,66 @@
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      const data = await deleteAuths({ ids: std.toString() });
      if (data.code == 200) {
        this.$message({
          message: '删除成功!',
          type: 'success',
      this.$confirm("此操作将永久删除该权限, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const data = await deleteAuths({ ids: std.toString() });
          if (data.code == 200) {
            this.InsertFormdialog = false;
            this.$message({
              message: "删除成功!",
              type: "success",
            });
            this.getRoleTabelData();
          } else {
            this.$message({
              message: "删除失败!",
              type: "warning",
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
        this.getRoleTabelData();
      } else {
        this.$message({
          message: '删除失败!',
          type: 'warning',
        });
      }
      // const data = await deleteAuths({ ids: std.toString() });
      // if (data.code == 200) {
      //   this.$message({
      //     message: '删除成功!',
      //     type: 'success',
      //   });
      //   this.getRoleTabelData();
      // } else {
      //   this.$message({
      //     message: '删除失败!',
      //     type: 'warning',
      //   });
      // }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    submitForm(formName) {
      this.getRoleTabelData()
      this.getRoleTabelData();
    },
    resetForm(formName) {
      this.ruleForm = {}
      this.ruleForm = {};
      this.getRoleTabelData();
    },
    EditFromDataClose() {
      this.EditFormdialog = false;
      this.upform = {};
      this.$confirm("关闭后无法保存,是否关闭?")
        .then((_) => {
          this.EditFormdialog = false;
          this.upform = {};
          this.getRoleTabelData();
        })
        .catch((_) => { });
    },
    async EditFromData() {
      const data = await updateAuth(this.upform);
@@ -379,17 +504,16 @@
        this.EditFormdialog = false;
        this.upform = {};
        this.$message({
          message: '修改成功!',
          type: 'success',
          message: "修改成功!",
          type: "success",
        });
        this.getRoleTabelData();
      } else {
        this.$message({
          message: '修改失败!',
          type: 'warning',
          message: "修改失败!",
          type: "warning",
        });
      }
    },
    showDetail(index, row) {
      this.showinfoBox = true;
@@ -412,8 +536,12 @@
      this.getRoleTabelData();
    },
    insertFromDataClose() {
      this.InsertFormdialog = false;
      this.insertform = {};
      this.$confirm("关闭后无法保存,是否关闭?")
        .then((_) => {
          this.InsertFormdialog = false;
          this.insertform = {};
        })
        .catch((_) => { });
    },
    async insertFromData() {
      const data = await insertAuth(this.insertform);
@@ -421,25 +549,25 @@
        this.InsertFormdialog = false;
        this.insertform = {};
        this.$message({
          message: '添加成功!',
          type: 'success',
          message: "添加成功!",
          type: "success",
        });
        this.getRoleTabelData();
      } else {
        this.$message({
          message: '添加失败!',
          type: 'warning',
          message: "添加失败!",
          type: "warning",
        });
      }
    },
    async getRoleTabelData() {
      if (this.listData.tab == '') {
      if (this.listData.tab == "") {
        delete this.listData.tab;
      }
      this.listData.name = this.ruleForm.name;
      const data = await select_Auth_ByPageAndCount(this.listData);
      if (data.code != 200) {
        this.$message.error('列表调用失败');
        this.$message.error("列表调用失败");
      }
      console.log(data.result);
      this.tableData = data.result;
@@ -453,11 +581,18 @@
      if (date === undefined || date === null) {
        return;
      }
      return moment(parseInt(date)).format('YYYY-MM-DD HH:mm:ss');
      return moment(parseInt(date)).format("YYYY-MM-DD HH:mm:ss");
    },
    handleClick(row) {
      this.dialogTitle = row.name;
      this.isTransfer = true;
    },
    handleClose() {
      this.$confirm("关闭后无法保存,是否关闭?")
        .then((_) => {
          this.InsertFormdialog = false
        })
        .catch((_) => { });
    },
  },
};
@@ -465,211 +600,23 @@
<style lang="less" scoped>
.power_box {
  border-radius: 10px;
  height: 100%;
  height: 98%;
  width: 98%;
  padding: 0.5%;
  box-sizing: border-box;
  .el-input {
    width: 300px;
  }
  .power_quire {
    overflow: auto;
    padding: 8px;
    margin-top: 20px;
    /deep/ .el-input__inner {
      background-color: transparent !important;
      border: 1px solid;
      color: white;
    }
    border-radius: 5px;
    border: 1px solid rgb(202, 201, 204);
    padding-top: 25px;
    margin-bottom: 20px;
  }
  .table_box {
    height: 68%;
    padding: 10px;
    //padding: 10px;
    //margin-top: 20px;
    border-radius: 5px;
    border: 1px solid rgb(202, 201, 204);
    /*修改table 表体的背景颜色和文字颜色*/
    /deep/ .el-table {
      background-color: transparent;
      th,
      td {
        background-color: transparent;
      }
      .el-table__expanded-cell {
        background-color: transparent !important;
      }
      // 表头背景色
      th.el-table__cell {
        background-color: #303030;
        color: #fff;
      }
      tr > td {
        background-color: #303030;
        color: #fff;
      }
      // hover效果
      tr:hover > td {
        background-color: rgba(255, 255, 255, 0.3) !important;
      }
      tbody tr:hover {
        background-color: rgba(255, 255, 255, 0.3) !important;
        // text-align: center;
      }
      // 滚动条宽高
      .el-table__body-wrapper::-webkit-scrollbar {
        width: 5px;
        height: 5px;
      }
      .el-table__body-wrapper::-webkit-scrollbar {
        width: 5px;
        /*滚动条宽度*/
        height: 10px;
        /*滚动条高度*/
      }
      /*定义滚动条轨道 内阴影+圆角*/
      .el-table__body-wrapper::-webkit-scrollbar-track {
        box-shadow: 0px 1px 3px #216fe6 inset;
        /*滚动条的背景区域的内阴影*/
        border-radius: 10px;
      }
      /*定义滑块 内阴影+圆角*/
      .el-table__body-wrapper::-webkit-scrollbar-thumb {
        box-shadow: 0px 1px 3px #216fe6 inset;
        border-radius: 6px;
        background-color: #216fe6;
      }
    //margin-bottom: 20px;
    .el-form-item {
      margin: 5px;
    }
  }
  .pagination_box {
    margin-top: 20px;
    /deep/.el-input__inner {
      background-color: transparent !important;
      border: 1px solid;
      color: white;
    }
    /deep/.el-pagination__total {
      color: white;
    }
    /deep/.el-pagination__jump {
      color: white;
    }
    /deep/.el-pager li.active {
      color: #1890ff;
    }
    /deep/.el-pager li {
      color: white;
      background: transparent;
    }
    /deep/.el-pager li {
      color: white;
    }
    /deep/.btn-prev {
      background: transparent;
    }
    /deep/.btn-next {
      background: transparent;
    }
  }
  .infoBox {
    width: 500px;
    border: 1px solid #eee;
    position: absolute;
    z-index: 100;
    top: 25%;
    right: 12%;
    background-color: #fff;
    .el-card {
      background-color: transparent;
      span {
        font-size: 16px;
        font-weight: 600;
      }
    }
    .contentBox {
      margin: 0 aotu 10px;
      height: 485px;
      overflow: auto;
      p {
        // background-color: #bfa;
        // margin-bottom: 10px;
        font-size: 14px;
      }
      .boxlabel {
        margin-left: 10px;
      }
    }
    /* 整体样式 */
    .contentBox::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }
    /* 滚动条 */
    .contentBox::-webkit-scrollbar-thumb {
      background-color: #b3d8ff;
      border-radius: 6px;
    }
    /* 滚动条鼠标经过样式 */
    .contentBox::-webkit-scrollbar-thumb:hover {
      background-color: #b3d8ff;
      border-radius: 6px;
    }
    /* 滚动条轨道 */
    .contentBox::-webkit-scrollbar-track-piece {
      -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
      border-radius: 10px;
      background: #ededed;
    }
  }
    /deep/ .el-input__inner {
    background-color: transparent !important;
    border: 1px solid;
    color: white;
  }
  /deep/ .el-dialog {
    background: #303030;
  }
  /deep/.el-range-editor.is-active,
  .el-range-editor.is-active:hover,
  .el-select .el-input.is-focus .el-input__inner {
    border: 1px solid;
  }
  /deep/.el-dialog__title {
    color: white;
  }
  /deep/.el-form-item__label {
    color: white;
  }
}
</style>
<style>
.el-select-dropdown {
  background: #303030;
  border-color: 1px solid;
}
.el-scrollbar__wrap {
  margin-bottom: -20px !important;
  margin-right: -20px !important;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  background: rgba(255, 255, 255, 0.3);
}
.el-select-dropdown__item {
  color: white !important;
}
</style>