From 6f1ac1da6b6cba5c74f2fb6be82f7e472c4116ee Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期一, 03 六月 2024 22:46:19 +0800
Subject: [PATCH] 班制日历

---
 src/views/console/system/user.vue |   95 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 79 insertions(+), 16 deletions(-)

diff --git a/src/views/console/system/user.vue b/src/views/console/system/user.vue
index 49ca78a..82171a3 100644
--- a/src/views/console/system/user.vue
+++ b/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>纭畾灏嗛�夋嫨璐﹀彿瑙i攣?</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('纭畾灏嗛�夋嫨璐﹀彿瑙i攣?锛�','鎻愮ず', {
+					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;
 			},

--
Gitblit v1.9.3