wangting
2024-10-22 0f0d9178eb886612e2310514383d2b057779042b
Source/plt-web/plt-web-ui/src/views/system/user/index.vue
@@ -53,7 +53,7 @@
        <el-button icon="el-icon-delete" size="small" type="text" @click.stop="rowDeleteHandler(row)">删除</el-button>
        <el-button size="small" type="text" @click.stop="stopUserHandler(row)">
          <span v-if="row.status === 0" style="color: #fa3434"><i class="el-icon-video-pause"></i> 停用</span>
          <span v-if="row.status === 1" style="color: #55b61d"><i class="el-icon-video-pause"></i> 启用</span>
          <span v-if="row.status === 1" style="color: #55b61d"><i class="el-icon-video-play"></i> 启用</span>
        </el-button>
      </template>
@@ -62,7 +62,7 @@
        <el-button icon="el-icon-user" plain size="small" type="primary" @click="roleHandler">分配角色</el-button>
        <el-button icon="el-icon-school" plain size="small" type="primary" @click="departmentHandler">分配部门</el-button>
        <el-button icon="el-icon-key" plain size="small" type="success" @click="setPwsHandler">设置密码策略</el-button>
        <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadRole">导入人员</el-button>
        <el-button icon="el-icon-upload2" plain size="small" type="primary" @click="uploadUser">导入人员</el-button>
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadHandler">下载导入模板</el-button>
      </template>
    </avue-crud>
@@ -77,7 +77,6 @@
    <el-dialog
      v-dialogDrag
      v-loading="pwdLoading"
      :destroy-on-close="true"
      :visible.sync="pwdVisible"
      append-to-body="true"
      class="avue-dialog"
@@ -100,13 +99,12 @@
    </el-dialog>
    <!-- 导入人员   -->
    <upload-file ref="upload" :fileType="upFileType" :fileUrl="fileUrl" title="导入人员"></upload-file>
    <upload-file ref="upload" :tipList="tipList" :fileType="upFileType" :fileUrl="fileUrl" title="导入人员" @updata="getTableList"></upload-file>
    <!-- 分配部门对话框    -->
    <el-dialog
      v-dialogDrag
      v-loading="departLoading"
      :destroy-on-close="true"
      :visible.sync="departVisible"
      append-to-body="true"
      class="avue-dialog"
@@ -161,6 +159,7 @@
      departCurrenRow: {},
      departOption: {
        ...basicOption,
        addBtn:false,
        rowKey: 'oid',
        rowParentKey: 'parentId',
        selection: false,
@@ -173,6 +172,7 @@
          {
            label: '名称',
            prop: 'name',
            align:'left'
          },
          {
            label: '编号',
@@ -213,7 +213,9 @@
      selectList: [],
      leftRoleData: [],  // 分配角色穿梭框左侧初始数据
      rightRoleData: [], // 分配角色穿梭框右侧初始数据
      transferTitle: ['现有角色', '拥有角色']
      transferTitle: ['现有角色', '拥有角色'],
      tipList:["导入模板中标明红色字体的为必输项","部门列上下级关系必须按照反斜杠隔开(/)"],
      lastIndex:null,
    }
  },
  created() {
@@ -227,6 +229,7 @@
      }
      done();
    },
    // 表格请求
    getTableList() {
      this.tableLoading = true;
@@ -235,9 +238,7 @@
        this.tableData = data;
        this.page.total = res.data.total;
        this.tableLoading = false;
      }).catch(err => {
        this.$message.error(err)
      });
      })
    },
    // 表格右侧刷新图标
@@ -310,7 +311,13 @@
    // 点击行
    rowClickHandler(row) {
      this.$refs.userCrud.toggleRowSelection(row);
      func.rowClickHandler(
        row,
        this.$refs.userCrud,
        this.lastIndex,
        (newIndex) => { this.lastIndex = newIndex; },
        () => { this.selectList = []; }
      );
    },
    // 分配角色
@@ -387,7 +394,7 @@
    },
    // 新增
    rowSaveHandler(row, done) {
    rowSaveHandler(row, done,loading) {
      if (row.password != row.confirmPassword) {
        this.$message.error('请检查两次密码是否输入一致!')
        return this.$refs.userCrud.$refs.dialogForm.$refs.tableForm.allDisabled = false;
@@ -397,11 +404,12 @@
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
          done();
        }
      }).catch(err => {
        loading()
        console.log(err);
      })
      done()
    },
    // 操作栏编辑
@@ -417,7 +425,7 @@
    },
    // 编辑
    rowUpdateHandler(row, index, done) {
    rowUpdateHandler(row, index, done,loading) {
      if (row.password != row.confirmPassword) {
        this.$message.error('请检查两次密码是否输入一致!')
        return this.$refs.userCrud.$refs.dialogForm.$refs.tableForm.allDisabled = false;
@@ -427,11 +435,12 @@
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
          done()
        }
      }).catch(err => {
        loading()
        console.log(err);
      });
      done()
    },
    // 删除
@@ -439,14 +448,24 @@
      let params = {
        ids: row.oid
      }
      deleteUser(params).then(res => {
        if (res.data.code === 200) {
          this.$message.success(res.data.obj);
          this.getTableList();
        }
      }).catch(err => {
        console.log(err);
      })
      this.$confirm('您确定要删除当前的成员吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        deleteUser(params).then(res => {
          if (res.data.code === 200) {
            this.$message.success(res.data.obj);
            this.getTableList();
          }
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 多选删除
@@ -482,21 +501,21 @@
      download().then(res => {
        console.log(res);
        func.downloadFileByBlobHandler(res);
        this.$message.success('下载成功')
        this.$message.success('下载成功');
      }).catch(err => {
        this.$message.error(err);
      })
    },
    // 导入人员
    uploadRole() {
    uploadUser() {
      this.$refs.upload.visible = true;
    },
    // 分配部门
    departmentHandler() {
      if (this.selectList.length <= 0) {
        this.$message.warning('清先选择人员再进行操作!')
        this.$message.warning('清先选择人员再进行操作!');
        return;
      }
      this.departStatus = 'default'; // 区分不同方式打开部门对话框