gaoshp
2024-11-19 f29900986f01cf5d39b5755cec674825cef27961
src/views/console/system/user.vue
@@ -11,8 +11,8 @@
      <div class="user-top">
         <div class="right-bottom"> 
            <el-button type="primary" @click="addPerson">新建</el-button>
            <el-button type="primary" @click="addPerson">密码重置</el-button>
            <el-button type="danger" plain @click="delPerson">删除</el-button>
            <el-button type="primary" @click="resetPerson">密码重置</el-button>
            <el-button type="danger" plain @click="delData">删除</el-button>
         </div>
         <div>
            <el-input v-model="searchData.account" placeholder="账号" style="width: 180px;margin-right: 8px;" clearable></el-input>
@@ -70,15 +70,6 @@
      </template>
   </el-dialog>
   <el-dialog v-model="dialogVisible" width="500" :before-close="handleClose">
      <span>确定将选择账号解锁?</span>
      <template #footer>
      <div class="dialog-footer">
         <el-button @click="dialogVisible = false">取消</el-button>
         <el-button type="primary" @click="dialogVisible = false">确定</el-button>
      </div>
      </template>
   </el-dialog>
   <save-dialog v-if="dialog.save" ref="saveDialog" @success="addUserSuccess" @closed="dialog.save=false"></save-dialog>
</template>
<script>
@@ -87,6 +78,7 @@
      name: "bakalaka",
      data(){
         return {
            selection: [],
            searchData: {
               account: "",
               realName: "",
@@ -94,7 +86,6 @@
               size: "15"
            },
            total: 0,
            dialogVisible: false,
            isSaveing: false,
            groups: [],
            departmentFrom: {
@@ -164,8 +155,21 @@
               //取消
            })
         },
         table_unlock() {
            this.dialogVisible = true;
         table_unlock(row) {
            this.$confirm('确定将选择账号解锁??','提示', {
               type: 'warning',
            }).then(() => {
               this.$HTTP.post("/api/blade-user/unlock?userId="+row.id).then(res=> {
                  if(res.code == 200) {
                     this.searchclick();
                     this.$message.success("操作成功");
                  }else {
                     this.$alert(res.message, "提示", {type: 'error'});
                  }
               })
            }).catch(() => {
               //取消
            })
         },
         searchclick() {
            this.searchData.current = "1";
@@ -211,8 +215,67 @@
               this.$refs.saveDialog.open('show').setData(row)
            })
         },
         handleSelectionChange() {},
         delPerson() {},
         handleSelectionChange(selection) {
            this.selection = selection;
         },
         resetPerson() {
            if(this.selection.length == 0) {
               this.$message({
                   message: '请选择至少一条数据',
                   type: 'warning'
                 });
                 return;
            }
            var selStr = "";
            this.selection.map(item=> {
               selStr += item.id + ","
            })
            selStr = selStr.replace(/,$/, '');
            var that = this;
            this.$confirm('是否确认删除选中账号?','提示', {
               type: 'warning',
            }).then(() => {
               that.$HTTP.post("/api/blade-user/reset-password?userIds="+selStr).then(res=> {
                  if(res.code == 200) {
                     that.$message.success("操作成功");
                     that.searchUser();
                  }
               })
            }).catch(() => {
               //取消
            })
         },
         delData() {
            if(this.selection.length == 0) {
               this.$message({
                   message: '请选择至少一条数据',
                   type: 'warning'
                 });
                 return;
            }
            var selStr = "";
            this.selection.map(item=> {
               selStr += item.id + ","
            })
            selStr = selStr.replace(/,$/, '');
            var that = this;
            this.$HTTP.get("/api/blade-user/check-user-is-bind-employee?userIds="+selStr).then(res=> {
               if(res.code == 200) {
                  this.$confirm('是否确认删除选中账号?','提示', {
                     type: 'warning',
                  }).then(() => {
                     that.$HTTP.post("/api/blade-user/remove?ids="+selStr).then(res=> {
                        if(res.code == 200) {
                           that.$message.success("操作成功");
                           that.searchUser();
                        }
                     })
                  }).catch(() => {
                     //取消
                  })
               }
            })
         },
         changeDepartment() {
            this.departmentVisible = true;
         },