From e7eb78c74a233f665a24e99d5a3bd847c46feee7 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 03 四月 2024 18:23:15 +0800
Subject: [PATCH] 1

---
 src/views/console/system/user.vue |  133 +++++++++++++++++++++++++++++--------------
 1 files changed, 89 insertions(+), 44 deletions(-)

diff --git a/src/views/console/system/user.vue b/src/views/console/system/user.vue
index fa33479..49ca78a 100644
--- a/src/views/console/system/user.vue
+++ b/src/views/console/system/user.vue
@@ -2,7 +2,7 @@
  * @Author: lzhe lzhe@example.com
  * @Date: 2024-03-26 10:28:33
  * @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-03-29 16:20:06
+ * @LastEditTime: 2024-04-03 18:22:26
  * @FilePath: /smart-web/src/views/master/person/main/index.vue
  * @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 -->
@@ -11,22 +11,27 @@
 		<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>
 			</div>
 			<div>
-				<el-input v-model="input" placeholder="璇疯緭鍏ュ唴瀹�" style="width: 180px;margin-right: 8px;"></el-input>
-				<el-input v-model="input" placeholder="璇疯緭鍏ュ唴瀹�" style="width: 180px;margin-right: 8px;"></el-input>
-				<el-button type="primary" @click="searchUser">鎼滅储</el-button>
+				<el-input v-model="searchData.account" placeholder="璐﹀彿" style="width: 180px;margin-right: 8px;" clearable></el-input>
+				<el-input v-model="searchData.realName" placeholder="璐﹀彿鏄电О" style="width: 180px;margin-right: 8px;" clearable></el-input>
+				<el-button type="primary" @click="searchclick">鎼滅储</el-button>
 			</div>
 		</div>
 		<div class="user-table">
 			<el-table ref="multipleTableRef" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange">
 				<el-table-column type="selection" width="55" />
-				<el-table-column prop="date" label="璐﹀彿"></el-table-column>
-				<el-table-column prop="name" label="璐﹀彿鏄电О"></el-table-column>
-				<el-table-column prop="name" label="鎵�灞炶鑹�"></el-table-column>
-				<el-table-column prop="name" label="鏁版嵁鏉冮檺"></el-table-column>
-				<el-table-column prop="name" label="璐﹀彿鐘舵��"></el-table-column>
+				<el-table-column prop="account" label="璐﹀彿"></el-table-column>
+				<el-table-column prop="realName" label="璐﹀彿鏄电О"></el-table-column>
+				<el-table-column prop="roleName" label="鎵�灞炶鑹�"></el-table-column>
+				<el-table-column prop="deptName" label="鏁版嵁鏉冮檺"></el-table-column>
+				<el-table-column prop="name" label="璐﹀彿鐘舵��">
+					<template #default="scope">
+						<el-switch v-model="scope.row.status" @click="changeStatus(scope.row)" />
+					</template>
+				</el-table-column>
 				<el-table-column fixed="right" label="鎿嶄綔">
 					<template #default="scope">
 						<el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button>
@@ -35,13 +40,14 @@
 				</el-table-column>
 			</el-table>
 			<el-pagination
+				style="margin-top: 12px;"
 				@size-change="handleSizeChange"
 				@current-change="handleCurrentChange"
 				:current-page="currentPage4"
-				:page-sizes="[100, 200, 300, 400]"
-				:page-size="100"
+				:page-sizes="[15, 50, 100]"
+				:page-size="15"
 				layout="total, sizes, prev, pager, next, jumper"
-				:total="400">
+				:total="total">
 			</el-pagination>
 		</div>
 	</div>
@@ -73,7 +79,7 @@
 		</div>
 		</template>
 	</el-dialog>
-	<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
+	<save-dialog v-if="dialog.save" ref="saveDialog" @success="addUserSuccess" @closed="dialog.save=false"></save-dialog>
 </template>
 <script>
 	import saveDialog from './addUser'
@@ -81,6 +87,13 @@
 		name: "bakalaka",
 		data(){
 			return {
+				searchData: {
+					account: "",
+					realName: "",
+					current: "1",
+					size: "15"
+				},
+				total: 0,
 				dialogVisible: false,
 				isSaveing: false,
 				groups: [],
@@ -103,51 +116,78 @@
 					label: '榛勯噾绯�'
 				}],
 				input3: '',
-				tableData: [{
-					date: '2016-05-02',
-					name: '鐜嬪皬铏�',
-					province: '涓婃捣',
-					city: '鏅檧鍖�',
-					address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1518 寮�',
-					zip: 200333
-					}, {
-					date: '2016-05-04',
-					name: '鐜嬪皬铏�',
-					province: '涓婃捣',
-					city: '鏅檧鍖�',
-					address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1517 寮�',
-					zip: 200333
-					}, {
-					date: '2016-05-01',
-					name: '鐜嬪皬铏�',
-					province: '涓婃捣',
-					city: '鏅檧鍖�',
-					address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1519 寮�',
-					zip: 200333
-					}, {
-					date: '2016-05-03',
-					name: '鐜嬪皬铏�',
-					province: '涓婃捣',
-					city: '鏅檧鍖�',
-					address: '涓婃捣甯傛櫘闄�鍖洪噾娌欐睙璺� 1516 寮�',
-					zip: 200333
-				}]
+				tableData: []
 			}
 		},
 		created(){
 			
 		},
 		mounted(){
-			
+			this.searchUser();
 		},
 		components: {
 			saveDialog
 		},
 		methods: {
+			addUserSuccess() {
+				this.searchclick();
+			},
+			changeStatus(row) {
+				row.status = !row.status;
+				var obj = {
+					enable: true,
+					id: row.id
+				}
+				var str = "";
+				if(row.status) {
+					obj.enable = false;
+					str = "鍋滅敤";
+				}else {
+					obj.status = true;
+					str = "鍚敤";
+				}
+				this.$confirm('纭畾瑕�'+str+row.account+'锛�','鎻愮ず', {
+					type: 'warning',
+				}).then(() => {
+					//const loading = this.$loading()
+					//loading.close()
+					this.$HTTP.post("/api/blade-user/changeStatus?"+this.$TOOL.qsStringify(obj)).then(res=> {
+						this.isSaveing = false;
+						if(res.code == 200) {
+							this.searchclick();
+							this.$message.success("鎿嶄綔鎴愬姛");
+						}else {
+							this.$alert(res.message, "鎻愮ず", {type: 'error'});
+						}
+					})
+				}).catch(() => {
+					//鍙栨秷
+				})
+			},
 			table_unlock() {
 				this.dialogVisible = true;
 			},
-			searchUser() {},
+			searchclick() {
+				this.searchData.current = "1";
+				this.searchData.size = "15";
+				this.searchUser();
+			},
+			searchUser() {
+				this.$HTTP.get("/api/blade-user/page",this.searchData).then(res=> {
+					if(res.code == 200) {
+						res.data.records.forEach(item=> {
+							if(item.status == "1") {
+								item.status = true;
+							}else {
+								item.status = false;
+							}
+						})
+						this.tableData = res.data.records;
+						this.total = res.data.total;
+						console.log(this.tableData)
+					}
+				})
+			},
 			departmentSubmit() {
 				this.departmentVisible=false;  //閮ㄩ棬璋冩暣
 			},
@@ -185,9 +225,14 @@
 			},
 			handleSizeChange(val) {
 				console.log(`姣忛〉 ${val} 鏉);
+				this.searchData.current = "1";
+				this.searchData.size = val;
+				this.searchUser();
 			},
 			handleCurrentChange(val) {
 				console.log(`褰撳墠椤�: ${val}`);
+				this.searchData.current = val;
+				this.searchUser();
 			}
 		}
 	}

--
Gitblit v1.9.3