roleslistdiglog.vue 4.49 KB
<template>
  <Dialog
    :title="title"
    class="tableClass"
    :show.sync="visible"
    :width="'715px'"
    @close="close()"
  >
    <template slot="content">
      <lb-table
        ref="multipleTable"
        :pagination="false"
        :column="tableData.column"
        :data="tableData.data"
        @selection-change="handleSelectionChange"
      >
      </lb-table>
    </template>
    <template slot="footer">
      <el-button type="primary" class="save" @click="handleSaveMember()"
        >保存</el-button
      >
      <el-button class="cancel-button" @click="close()">取消</el-button>
    </template>
  </Dialog>
</template>

<script>
import Dialog from "@/components/Dialog/";
export default {
  name: "",
  components: { Dialog },
  props: {},
  data() {
    return {
      title: "人员配置",
      visible: false,

      hasSelectList: [
        {
          name: "管理员",
          loginName: "admin1",
          departmentName: "研发部",
          jobLevel: null,
        },
        {
          name: "测试账号",
          loginName: "admin2",
          departmentName: "研发部",
          jobLevel: null,
        },
      ], //已经选择的id组成的数组
      tableData: {
        column: [
          {
            type: "selection",
          },
          {
            prop: "name",
            label: "姓名",
          },
          {
            prop: "loginName",
            label: "用户名",
          },
          {
            prop: "departmentName",
            label: "部门",
          },
          {
            prop: "jobLevel",
            label: "职务",
          },
        ],
        data: [
          {
            id: "3127e455-43ba-45ff-9326-0e02ef89485e",
            createdAt: null,
            updatedAt: "2022-08-04T03:38:27.626+0000",
            createdBy: null,
            updatedBy: "3127e455-43ba-45ff-9326-0e02ef89485e",
            sort: 1,
            name: "超级管理员",
            loginName: "admin",
            password: "05eb15777e8fd1d61c840472e7267f61d432f63340d86b59",
            passwordSalt: "5178114777136485",
            email: null,
            lastLoginTime: null,
            mobilePhone: "18291003568",
            status: "ACTIVE",
            passwordChangeTime: "2021-12-10T08:01:01.569+0000",
            idCard: "612725202111021521",
            departmentId: "2eae5304-544f-4f5b-b354-8f5d47433c9b",
            organizationId: "0bca67ae-1d9e-4b41-b057-f165586d24aa",
            sex: "0",
            isDuty: true,
            code: "123324",
            jobLevel: null,
            telephone: "028-87720898",
            address: "办公地点修改测试",
            isLocked: false,
            departmentName: "研发部",
            _X_ROW_KEY: "row_276",
          },
          {
            name: "管理员",
            loginName: "admin1",
            departmentName: "研发部",
            jobLevel: null,
            selectStatus: 0,
          },
          {
            name: "测试账号",
            loginName: "admin2",
            departmentName: "研发部",
            jobLevel: null,
            selectStatus: 0,
          },
        ],
      },
      multipleSelection: [],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    adds() {
      this.visible = true;
      this.tableData.data.forEach((item, index) => {
        if (item.selectStatus === 0) {
          this.$nextTick(() => {
            this.$refs.multipleTable.toggleRowSelection(
              this.tableData.data[index],
              true
            );
          });
        }
      });
    },
    close() {
      this.visible = false;
    },
    // 保存事件
    handleSaveMember() {
      // if (this.memberList.length === 0) {
      //   this.$message.warning("请添加待选人员");
      //   return false;
      // }
      // const idList = this.memberList.map(item => item.id)
      // updateUser(this.roleId, idList).then(res => {
      //   if (res.status === 1) {
      //     this.$message.success({ message: '保存成功', showClose: true })
      //     this.showMemberConfigDialog = false
      //     this.$emit('setUsers', this.roleId)
      //     this.resetMemberConfig()
      //   } else this.$message.error({ message: res.message, showClose: true })
      // })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
  },
};
</script>
<style scoped lang="scss">
/deep/.el-dialog__header{
   text-align: center;
   margin-bottom: 10px;
.el-dialog__title{
  color: white;
}
}

</style>