管道基础大数据平台系统开发-【前端】-新系統界面
TreeWish
2023-03-03 b6c8e7c61f0270598ba7fdbc44f79512e010d0fe
src/views/userManage/authorityManage.vue
@@ -5,17 +5,22 @@
        `${$t('userManage.authorityManage')}`,
      ]"></My-bread>
    <el-divider />
    <div class="power_quire subpage_Div">
    <div class="power_quire subpage_Div" ref="container">
      <el-form
        ref="form"
        :model="ruleForm"
        label-width="100px"
        :inline="true"
      >
        <el-form-item  >
          <el-input v-model="ruleForm.name"></el-input>
       <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 style="float: right;">
        </div>
        <div>
          <el-form-item>
          <el-button
            v-if="menuStatus.insert"
            @click="InsertFormdialog = true"
@@ -28,27 +33,34 @@
            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="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" size="small"
          >{{ $t('common.empty') }}</el-button>
        </el-form-item>
        </div>
        </div>
      </el-form>
    </div>
    <div class="table_box subpage_Div">
    <div class="dividing-line"></div>
    <div class="table_box subpage_Div" :style="styleVar">
      <el-table
        :data="tableData"
        style="width: 100%"
        fit
        height="85%"
        border
        height="calc(100% - 45px)"
        @selection-change="handleSelectionChange"
      >
        <el-table-column
@@ -106,7 +118,7 @@
        >
        </el-table-column>
        <el-table-column
          fixed="right"
          :label="$t('common.operate')"
          width="170px"
        >
@@ -127,7 +139,7 @@
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination_box">
      <div class="pagination_box" style="margin-top: 10px">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
@@ -140,10 +152,10 @@
        </el-pagination>
      </div>
    </div>
<div class="infoBox_box" v-show="showinfoBox">
    <div
      class="infoBox subpage_Div box_div"
      v-show="showinfoBox"
    >
      <el-card class="box-card">
        <div
@@ -199,6 +211,7 @@
        </div>
      </el-card>
    </div>
</div>
    <el-dialog
      :title="dialogTitle"
      :visible.sync="isTransfer"
@@ -229,9 +242,10 @@
      :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"
@@ -239,6 +253,7 @@
          <el-input
            v-model="insertform.name"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
        <el-form-item
@@ -248,6 +263,7 @@
          <el-input
            v-model="insertform.tag"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
        <el-form-item
@@ -257,9 +273,11 @@
          <el-input
            v-model="insertform.bak"
            autocomplete="off"
            style="width:85%"
          ></el-input>
        </el-form-item>
      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
@@ -277,29 +295,27 @@
    </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
@@ -321,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() {
@@ -333,10 +354,10 @@
        insert: false,
        update: false,
      },
      formLabelWidth: '100px',
      formLabelWidth: "100px",
      ruleForm: {},
      isTransfer: false,
      dialogTitle: '',
      dialogTitle: "",
      data: [],
      InsertFormdialog: false,
      showinfoBox: false,
@@ -354,8 +375,13 @@
        pageSize: 10,
      },
      defaultProps: {
        children: 'children',
        label: 'label',
        children: "children",
        label: "label",
      },
      tableHeight: 0,
      timer: 0,
      styleVar: {
        height: "calc(100% - 109px)",
      },
    };
  },
@@ -366,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;
      }
@@ -390,32 +437,34 @@
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      this.$confirm('此操作将永久删除该权限, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async () => {
        const data = await deleteAuths({ ids: std.toString() });
      this.$confirm("此操作将永久删除该权限, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          const data = await deleteAuths({ ids: std.toString() });
        if (data.code == 200) {
          this.InsertFormdialog = false;
          if (data.code == 200) {
            this.InsertFormdialog = false;
            this.$message({
              message: "删除成功!",
              type: "success",
            });
            this.getRoleTabelData();
          } else {
            this.$message({
              message: "删除失败!",
              type: "warning",
            });
          }
        })
        .catch(() => {
          this.$message({
            message: '删除成功!',
            type: 'success',
            type: "info",
            message: "已取消删除",
          });
          this.getRoleTabelData();
        } else {
          this.$message({
            message: '删除失败!',
            type: 'warning',
          });
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
      // const data = await deleteAuths({ ids: std.toString() });
      // if (data.code == 200) {
      //   this.$message({
@@ -434,16 +483,20 @@
      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);
@@ -451,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;
@@ -484,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);
@@ -493,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;
@@ -525,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((_) => { });
    },
  },
};
@@ -539,29 +602,21 @@
.power_box {
  height: 98%;
  width: 98%;
  padding: 1%;
  padding: 0.5%;
  .el-input {
    width: 300px;
  }
  .power_quire {
    overflow: auto;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
  }
  .table_box {
    height: 72%;
    padding: 10px;
    //padding: 10px;
    //margin-top: 20px;
    border-radius: 5px;
    //margin-bottom: 20px;
    .el-form-item {
      margin: 5px;
    }
  }
}
</style>