mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 07:03:53 +08:00
@@ -625,7 +625,6 @@ export default {
|
||||
'common.confirm': 'Confirm',
|
||||
'common.cancel': 'Cancel',
|
||||
'common.sensitive': 'Sensitive',
|
||||
'common.success': 'Operation Successful',
|
||||
'user.userid': 'User ID',
|
||||
'user.deviceCount': 'Device Count',
|
||||
'user.createDate': 'Registration Time',
|
||||
@@ -651,7 +650,6 @@ export default {
|
||||
'user.deleteCancelled': 'Deletion cancelled',
|
||||
'user.confirmResetPassword': 'A new password will be generated after reset. Continue?',
|
||||
'user.resetPasswordSuccess': 'Password has been reset, please notify the user to log in with the new password',
|
||||
'user.generatedPassword': 'Generated Default Password',
|
||||
'user.confirmDeleteUser': 'Are you sure you want to delete this user?',
|
||||
'user.deleteUserSuccess': 'Deletion successful',
|
||||
'user.operationFailed': 'Operation failed, please try again',
|
||||
|
||||
@@ -625,7 +625,6 @@ export default {
|
||||
'common.confirm': '确定',
|
||||
'common.cancel': '取消',
|
||||
'common.sensitive': '敏感',
|
||||
'common.success': '操作成功',
|
||||
'user.userid': '用户Id',
|
||||
'user.deviceCount': '设备数量',
|
||||
'user.createDate': '注册时间',
|
||||
@@ -651,7 +650,6 @@ export default {
|
||||
'user.deleteCancelled': '已取消删除',
|
||||
'user.confirmResetPassword': '重置后将会生成新密码,是否继续?',
|
||||
'user.resetPasswordSuccess': '密码已重置,请通知用户使用新密码登录',
|
||||
'user.generatedPassword': '生成的默认密码',
|
||||
'user.confirmDeleteUser': '确定要删除该用户吗?',
|
||||
'user.deleteUserSuccess': '删除成功',
|
||||
'user.operationFailed': '操作失败,请重试',
|
||||
|
||||
@@ -577,7 +577,6 @@ export default {
|
||||
'user.deleteCancelled': '已取消刪除',
|
||||
'user.confirmResetPassword': '重置後將會生成新密碼,是否繼續?',
|
||||
'user.resetPasswordSuccess': '密碼已重置,請通知用戶使用新密碼登錄',
|
||||
'user.generatedPassword': '生成的默認密碼',
|
||||
'user.confirmDeleteUser': '確定要刪除該用戶嗎?',
|
||||
'user.deleteUserSuccess': '刪除成功',
|
||||
'user.operationFailed': '操作失敗,請重試',
|
||||
@@ -662,7 +661,6 @@ export default {
|
||||
'common.confirm': '確定',
|
||||
'common.cancel': '取消',
|
||||
'common.sensitive': '敏感',
|
||||
'common.success': '操作成功',
|
||||
'paramManagement.totalRecords': '共{total}條記錄',
|
||||
'paramManagement.addParam': '新增參數',
|
||||
'paramManagement.editParam': '編輯參數',
|
||||
|
||||
@@ -257,17 +257,11 @@ export default {
|
||||
cancelButtonText: this.$t('common.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Api.admin.resetUserPassword(row.userid, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
// 显示生成的默认密码
|
||||
this.$alert(this.$t('user.resetPasswordSuccess') + '\n\n' + this.$t('user.generatedPassword') + ': ' + data.data, this.$t('common.success'), {
|
||||
confirmButtonText: this.$t('common.confirm'),
|
||||
dangerouslyUseHTMLString: true
|
||||
});
|
||||
this.fetchUsers();
|
||||
} else {
|
||||
this.$message.error(data.msg || this.$t('user.operationFailed'));
|
||||
}
|
||||
resetPassword(row.userId).then(() => {
|
||||
this.$message.success(this.$t('user.resetPasswordSuccess'));
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('user.operationFailed'));
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message.info(this.$t('common.deleteCancelled'));
|
||||
@@ -279,13 +273,11 @@ export default {
|
||||
cancelButtonText: this.$t('common.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
Api.admin.deleteUser(row.userid, ({ data }) => {
|
||||
if (data.code === 0) {
|
||||
this.$message.success(this.$t('user.deleteUserSuccess'));
|
||||
this.fetchUsers();
|
||||
} else {
|
||||
this.$message.error(data.msg || this.$t('user.operationFailed'));
|
||||
}
|
||||
deleteUser(row.userId).then(() => {
|
||||
this.$message.success(this.$t('user.deleteUserSuccess'));
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
this.$message.error(this.$t('user.operationFailed'));
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message.info(this.$t('common.deleteCancelled'));
|
||||
@@ -346,20 +338,67 @@ export default {
|
||||
// 用户取消操作
|
||||
});
|
||||
},
|
||||
// 这个方法已被batchDelete替代,保留用于向后兼容
|
||||
handleBatchDelete() {
|
||||
this.batchDelete();
|
||||
},
|
||||
// This method has been fixed to use existing functionality
|
||||
handleBatchStatusChange(status) {
|
||||
const selectedUsers = this.userList.filter(user => user.selected);
|
||||
if (selectedUsers.length === 0) {
|
||||
if (!this.selection || this.selection.length === 0) {
|
||||
this.$message.warning(this.$t('user.selectUsersFirst'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Call the existing handleChangeStatus method which already handles both single and multiple users
|
||||
this.handleChangeStatus(selectedUsers, status);
|
||||
|
||||
const userIds = this.selection.map(item => item.userId);
|
||||
this.$confirm(this.$t('user.confirmDeleteSelected', { count: this.selection.length }), this.$t('common.warning'), {
|
||||
confirmButtonText: this.$t('common.confirm'),
|
||||
cancelButtonText: this.$t('common.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
batchDeleteUsers(userIds).then(res => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.selection = [];
|
||||
if (res.successCount === userIds.length) {
|
||||
this.$message.success(this.$t('user.deleteSuccess', { count: res.successCount }));
|
||||
} else if (res.successCount === 0) {
|
||||
this.$message.error(this.$t('user.deleteFailed'));
|
||||
} else {
|
||||
this.$message.warning(this.$t('user.partialDelete', { successCount: res.successCount, failCount: res.failCount }));
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message.error(this.$t('user.deleteError'));
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message.info(this.$t('user.deleteCancelled'));
|
||||
});
|
||||
},
|
||||
handleBatchStatusChange(status) {
|
||||
if (!this.selection || this.selection.length === 0) {
|
||||
this.$message.warning(this.$t('user.selectUsersFirst'));
|
||||
return;
|
||||
}
|
||||
|
||||
const actionText = status === 1 ? this.$t('user.enable') : this.$t('user.disable');
|
||||
const userIds = this.selection.map(item => item.userId);
|
||||
|
||||
this.$confirm(this.$t('user.confirmStatusChange', { action: actionText, count: this.selection.length }), this.$t('common.warning'), {
|
||||
confirmButtonText: this.$t('common.confirm'),
|
||||
cancelButtonText: this.$t('common.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
updateUserStatus(userIds, status).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.selection = [];
|
||||
this.$message.success(this.$t('user.statusChangeSuccess', { action: actionText, count: userIds.length }));
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message.error(this.$t('user.operationFailed'));
|
||||
});
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.$message.info(this.$t('common.deleteCancelled'));
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user