diff --git a/src/api/v1/system/adminUser.ts b/src/api/v1/system/adminUser.ts index ad08dd8..26edce3 100644 --- a/src/api/v1/system/adminUser.ts +++ b/src/api/v1/system/adminUser.ts @@ -114,6 +114,16 @@ export const fetchUploadAvatarByAdmin = (data: any) => { return http.request>('put', 'user/uploadAvatarByAdmin', { data }, { headers: { 'Content-Type': 'multipart/form-data' } }); }; +/** 用户管理---更新用户账单是否启用 */ +export const fetchUpdateUserBillReportByLocalUser = (data: any) => { + return http.request>( + 'put', + 'user/noManage/updateUserBillReportByLocalUser', + { data }, + { headers: { 'Content-Type': 'multipart/form-data' } }, + ); +}; + /** 用户管理---强制用户下线 */ export const fetchForcedOffline = (data: any) => { return http.request>('put', 'user/forcedOffline', { data }); diff --git a/src/store/system/adminUser.ts b/src/store/system/adminUser.ts index 7bfc291..cf17040 100644 --- a/src/store/system/adminUser.ts +++ b/src/store/system/adminUser.ts @@ -10,6 +10,7 @@ import { fetchQueryUser, fetchUpdateAdminUser, fetchUpdateAdminUserByLocalUser, + fetchUpdateUserBillReportByLocalUser, fetchUpdateUserPasswordByAdmin, fetchUpdateUserPasswordByLocalUser, fetchUpdateUserStatusByAdmin, @@ -125,5 +126,11 @@ export const useAdminUserStore = defineStore('adminUserStore', { const result = await fetchForcedOffline(data); return storeMessage(result); }, + + /** 更新用户周账单是否启用 */ + async updateUserBillReportByLocalUser(data: any) { + const result = await fetchUpdateUserBillReportByLocalUser(data); + return storeMessage(result); + }, }, }); diff --git a/src/views/account-settings/account-management.vue b/src/views/account-settings/account-management.vue index 49ce532..75d0504 100644 --- a/src/views/account-settings/account-management.vue +++ b/src/views/account-settings/account-management.vue @@ -7,26 +7,16 @@ import { useAdminUserStore } from '@/store/system/adminUser'; import ResetPasswordDialog from '@/components/Table/ResetPasswords.vue'; import { removeToken } from '@/utils/auth'; import { useRouter } from 'vue-router'; -import { switchLoadMapControl, usePublicHooks } from '@/views/hooks'; -import { messageBox } from '@/utils/message'; +import { usePublicHooks } from '@/views/hooks'; +import { switchLoadMap, updateUserReportStatusByMouth, updateUserReportStatusByWeek, userInfos } from '@/views/account-settings/utils/hooks'; -// 用户是否停用样式 -const { switchStyle } = usePublicHooks(); -// 用户是否停用加载集合 -const switchLoadMap = ref({}); -// 重置密码表单校验Ref -const ruleFormByRestPasswordRef = ref(); const router = useRouter(); const adminUserStore = useAdminUserStore(); -// 重置密码表单 +const { switchStyle } = usePublicHooks(); +const ruleFormByRestPasswordRef = ref(); const restPasswordForm = reactive({ password: '', }); -// 提醒状态 -const reminderStatus = reactive({ - week: false, // 周账单状态 - mouth: false, // 月账单状态 -}); /** 重置密码 */ const onResetPassword = () => { @@ -55,74 +45,6 @@ const onResetPassword = () => { }, }); }; - -/** 更新用户周账单提醒是否开启 */ -const updateUserReportStatusByWeek = async (index: number) => { - // 点击时开始loading加载 - switchLoadMapControl(switchLoadMap, index, true); - - // 是否确认修改弹窗内容 - const confirm = await messageBox({ - title: $t('confirm_update_status'), - showMessage: false, - confirmMessage: undefined, - cancelMessage: $t('cancel'), - }); - - // 如果不修改将值恢复到之前状态 - if (!confirm) { - reminderStatus.week = !reminderStatus.week; - switchLoadMapControl(switchLoadMap, index, false); - return; - } - - // 修改用户状态 - // const data = { userId: row.id, status: row.status }; - // const result = await adminUserStore.updateUserStatusByAdmin(data); - // if (!result) { - // row.status = !row.status; - // switchLoadMap.value[index] = Object.assign({}, switchLoadMap.value[index], { - // loading: false, - // }); - // return; - // } - // await onSearch(); - switchLoadMapControl(switchLoadMap, index, false); -}; - -/** 更新用户周账单提醒是否开启 */ -const updateUserReportStatusByMouth = async (index: number) => { - // 点击时开始loading加载 - switchLoadMapControl(switchLoadMap, index, true); - - // 是否确认修改弹窗内容 - const confirm = await messageBox({ - title: $t('confirm_update_status'), - showMessage: false, - confirmMessage: undefined, - cancelMessage: $t('cancel'), - }); - - // 如果不修改将值恢复到之前状态 - if (!confirm) { - reminderStatus.week = !reminderStatus.week; - switchLoadMapControl(switchLoadMap, index, false); - return; - } - - // 修改用户状态 - // const data = { userId: row.id, status: row.status }; - // const result = await adminUserStore.updateUserStatusByAdmin(data); - // if (!result) { - // row.status = !row.status; - // switchLoadMap.value[index] = Object.assign({}, switchLoadMap.value[index], { - // loading: false, - // }); - // return; - // } - // await onSearch(); - switchLoadMapControl(switchLoadMap, index, false); -};