王旭
2022-10-13 17b2681fbd5029ddf65e7c1fe30a49a9ff8479ac
src/views/userManage/roleManage.vue
@@ -34,7 +34,7 @@
          >
        </el-form-item>
        <el-form-item>
          <el-button
          <el-button @click="onSubmit('ruleForm')"
            ><i class="el-icon-search"></i> &nbsp;{{
              $t('userManage.RM.query')
            }}</el-button
@@ -47,10 +47,24 @@
            }}</el-button
          >
        </el-form-item>
        <el-form-item>
          <el-button @click="handleDelete()"
            ><i class="el-icon-delete"></i>&nbsp;{{
              $t('common.delete')
            }}</el-button
          >
        </el-form-item>
      </el-form>
    </div>
    <div class="table_box">
      <el-table :data="tableData" stripe style="width: 100%" height="99%">
      <el-table
        :data="tableData"
        stripe
        style="width: 100%"
        @selection-change="handleSelectionChange"
        height="99%"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column
          align="center"
          type="index"
@@ -66,7 +80,7 @@
        <el-table-column
          align="center"
          prop="depid"
          prop="depName"
          :label="$t('userManage.RM.ownedSystem')"
        />
        <el-table-column
@@ -75,7 +89,7 @@
          :label="$t('userManage.RM.describe')"
        />
        <el-table-column
        <!-- <el-table-column
          align="center"
          prop="createUser"
          :label="$t('userManage.RM.creationuser')"
@@ -84,6 +98,7 @@
          align="center"
          prop="createTime"
          :label="$t('userManage.RM.creationtime')"
          :formatter="formatTime"
        />
        <el-table-column
          align="center"
@@ -94,12 +109,13 @@
          align="center"
          prop="updateTime"
          :label="$t('userManage.RM.updateontime')"
          :formatter="formatTime"
        />
        <el-table-column
          align="center"
          prop="bak"
          :label="$t('userManage.RM.remarks')"
        />
        /> -->
        <el-table-column
          fixed="right"
          :label="$t('common.operate')"
@@ -112,12 +128,9 @@
              size="small"
              >{{ $t('common.update') }}</el-button
            >
            <el-button
              type="danger"
              @click="handleDelete(scope.$index, scope.row)"
              size="small"
              >{{ $t('common.delete') }}</el-button
            >
            <el-button  @click="showDetail(scope.$index, scope.row)" type="primary" size="small">{{
              $t('common.see')
            }}</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -134,6 +147,7 @@
        </el-pagination>
      </div>
    </div>
    <el-dialog
      :title="$t('userManage.RM.insertRole')"
      top="15vh"
@@ -245,17 +259,74 @@
        >
      </div>
    </div>
     <div class="infoBox" v-show="showinfoBox">
      <el-card>
        <div slot="header" class="clearfix">
          <span>{{ $t('dataManage.styleObj.deInformation') }}</span>
          <div style="float: right; cursor: pointer" @click="closeDetial"   >
            <i class="el-icon-close"></i>
          </div>
        </div>
               <div class="contentBox">
          <p>
            <label> {{ $t('userManage.RM.roleName') }}:</label>
            <label class="boxlabel">{{ itemdetail.name }}</label>
          </p>
          <el-divider></el-divider>
          <p>
           <p>
            <label> {{ $t('userManage.RM.ownedSystem') }}:</label>
            <label class="boxlabel">{{ itemdetail.depName }}</label>
          </p>
          </p>
          <el-divider></el-divider>
          <p>
            <label> {{ $t('userManage.RM.describe') }}:</label>
            <label class="boxlabel">{{ itemdetail.descr }}</label>
          </p>
          <el-divider></el-divider>
           <p>
            <label> {{ $t('userManage.RM.creationuser') }}:</label>
            <label class="boxlabel">{{ itemdetail.createUser }}</label>
          </p>
          <el-divider></el-divider>
          <p>
            <label> {{ $t('userManage.RM.creationtime') }}:</label>
            <label class="boxlabel">{{ itemdetail.createTime }}</label>
          </p>
          <el-divider></el-divider>
          <p>
            <label> {{ $t('userManage.RM.updateonuser') }}:</label>
            <label class="boxlabel">{{ itemdetail.UpdateUser }}</label>
          </p>
          <el-divider></el-divider>
             <p>
            <label> {{ $t('userManage.RM.updateontime') }}:</label>
            <label class="boxlabel">{{ itemdetail.updateTime }}</label>
          </p>
           <el-divider></el-divider>
             <p>
            <label> {{ $t('userManage.RM.remarks') }}:</label>
            <label class="boxlabel">{{ itemdetail.bak }}</label>
          </p>
           <el-divider></el-divider>
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>
import moment from 'moment';
import MyBread from '../../components/MyBread.vue';
import roleDepTree from './roleDepTree.vue';
import {
  select_Role_ByPageAndCount,
  selectdepTab,
  insertRole,
  deleteRole,
  deleteRoles,
  selectDep,
  updateRole,
} from '../../api/api';
@@ -267,6 +338,7 @@
  },
  data() {
    return {
      showinfoBox: false,
      showCata: false,
      formLabelWidth: '120px',
      InsertFormdialog: false,
@@ -281,13 +353,42 @@
      updateform: {},
      count: 0,
      selData: [],
      itemdetail: {},
      multipleSelection: [],
      listData: {
        name: null,
        depName: null,
        pageIndex: 1,
        pageSize: 10,
      },
    };
  },
  methods: {
        closeDetial() {
      this.showinfoBox = false;
      this.itemdetail = {};
    },
      showDetail(index, row) {
      this.showinfoBox = true;
      this.itemdetail = row;
      this.itemdetail.createTime = this.formomentTime(this.itemdetail.createTime);
      this.itemdetail.updateTime = this.formomentTime(this.itemdetail.updateTime);
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    formatTime(row, column) {
      let date = row[column.property];
      return this.formomentTime(date);
    },
    formomentTime(date) {
      if (date === undefined || date === null) {
        return;
      }
      return moment(parseInt(date)).format('YYYY-MM-DD HH:mm:ss');
    },
    showDepTree(res) {
      this.showCata = true;
      this.elTreeFlag = res;
@@ -308,7 +409,7 @@
      switch (this.elTreeFlag) {
        case 1:
          this.roleForm.value = value;
          this.roleForm.depid = this.path_id;
          break;
        case 2:
          this.insertform.depid = this.path_id;
@@ -324,6 +425,8 @@
      if (this.listData.tab == '') {
        delete this.listData.tab;
      }
      this.listData.name = this.roleForm.username;
      this.listData.depName = this.roleForm.value;
      const data = await select_Role_ByPageAndCount(this.listData);
      if (data.code != 200) {
        this.$message.error('列表调用失败');
@@ -402,8 +505,13 @@
        });
      }
    },
    async handleDelete(index, row) {
      const data = await deleteRole({ id: row.id.toString() });
    async handleDelete() {
      var std = [];
      for (var i in this.multipleSelection) {
        std.push(this.multipleSelection[i].id);
      }
      const data = await deleteRoles({ ids: std.toString() });
      if (data.code == 200) {
        this.InsertFormdialog = false;
        this.$message({
@@ -423,7 +531,6 @@
      this.getRoleTabelData();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.listData.pageIndex = val;
      this.getRoleTabelData();
    },
@@ -434,10 +541,12 @@
      this.UpdateFormdialog = true;
    },
    onSubmit() {
      console.log('submit!');
      this.getRoleTabelData();
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.roleForm = {};
      this.getRoleTabelData();
    },
  },
  created() {
@@ -502,5 +611,58 @@
  .text-center {
    text-align: center;
  }
  .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;
    }
  }
}
</style>