From 0d8d3c7705758bb36f21596dd3e2641af99cd417 Mon Sep 17 00:00:00 2001
From: hxr <1490493387@qq.com>
Date: Fri, 13 Oct 2023 23:33:59 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=94=A8=E6=88=B7=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E4=BC=98=E5=8C=96=EF=BC=8C=E7=A7=BB=E9=99=A4=E7=8A=B6?=
=?UTF-8?q?=E6=80=81=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Former-commit-id: 9ffeddfe64cf0eb87c4c5e6b2d153daf4525cad0
---
src/api/user/index.ts | 14 ---------
src/views/system/user/index.vue | 52 +++++++++------------------------
2 files changed, 14 insertions(+), 52 deletions(-)
diff --git a/src/api/user/index.ts b/src/api/user/index.ts
index c84113d2..d6d8141d 100644
--- a/src/api/user/index.ts
+++ b/src/api/user/index.ts
@@ -66,20 +66,6 @@ export function updateUser(id: number, data: UserForm) {
});
}
-/**
- * 修改用户状态
- *
- * @param id
- * @param status
- */
-export function updateUserStatus(id: number, status: number) {
- return request({
- url: "/api/v1/users/" + id + "/status",
- method: "patch",
- params: { status: status },
- });
-}
-
/**
* 修改用户密码
*
diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue
index 899d1fdd..efa240b7 100644
--- a/src/views/system/user/index.vue
+++ b/src/views/system/user/index.vue
@@ -11,7 +11,6 @@ import {
deleteUsers,
addUser,
updateUser,
- updateUserStatus,
updateUserPassword,
downloadTemplateApi,
exportUser,
@@ -102,30 +101,12 @@ function resetQuery() {
handleQuery();
}
-/** 行选中事件 */
+/** 行选中 */
function handleSelectionChange(selection: any) {
removeIds.value = selection.map((item: any) => item.id);
}
-/** 用户状态 Change*/
-function changeUserStatus(row: { [key: string]: any }) {
- const text = row.status === 1 ? "启用" : "停用";
- ElMessageBox.confirm("确认要" + text + row.username + "用户吗?", "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- updateUserStatus(row.id, row.status)
- .then(() => {
- ElMessage.success(text + "成功");
- })
- .catch(() => {
- row.status = row.status === 1 ? 0 : 1;
- });
- });
-}
-
-/**重置密码 */
+/** 重置密码 */
function resetPassword(row: { [key: string]: any }) {
ElMessageBox.prompt(
"请输入用户「" + row.username + "」的新密码",
@@ -134,17 +115,15 @@ function resetPassword(row: { [key: string]: any }) {
confirmButtonText: "确定",
cancelButtonText: "取消",
}
- )
- .then(({ value }) => {
- if (!value) {
- ElMessage.warning("请输入新密码");
- return false;
- }
- updateUserPassword(row.id, value).then(() => {
- ElMessage.success("密码重置成功,新密码是:" + value);
- });
- })
- .catch(() => {});
+ ).then(({ value }) => {
+ if (!value) {
+ ElMessage.warning("请输入新密码");
+ return false;
+ }
+ updateUserPassword(row.id, value).then(() => {
+ ElMessage.success("密码重置成功,新密码是:" + value);
+ });
+ });
}
/** 加载角色下拉数据源 */
@@ -476,12 +455,9 @@ onMounted(() => {
-
+ {{
+ scope.row.status == 1 ? "启用" : "禁用"
+ }}