diff --git a/.env b/.env index 627c936c1c7515fd7b56cacaab60c9d3195d4fe7..c120eb20af285115baede05f681f32059a6f3c77 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_API_URL=https://tshotel-api.oscode.top/api \ No newline at end of file +VITE_API_URL=https://tshotel.oscode.top/api \ No newline at end of file diff --git a/.env.production b/.env.production index 627c936c1c7515fd7b56cacaab60c9d3195d4fe7..c120eb20af285115baede05f681f32059a6f3c77 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VITE_API_URL=https://tshotel-api.oscode.top/api \ No newline at end of file +VITE_API_URL=https://tshotel.oscode.top/api \ No newline at end of file diff --git a/src/api/administratorapi.js b/src/api/administratorapi.js index b5f2a6dcda2b5c226bd782503bd7dc1c05dab9c2..f11c67bbe7e754d4ad1827e88553d59fae1fc9c9 100644 --- a/src/api/administratorapi.js +++ b/src/api/administratorapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchAdmins = async (params) => { try { const response = await api.get('/Admin/GetAllAdminList', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/administratortypeapi.js b/src/api/administratortypeapi.js index 06e1bd01c940c3596232b985d1d5edbab0663a7b..ac8946d43d7cdcb7d622353940b551c3fa41320f 100644 --- a/src/api/administratortypeapi.js +++ b/src/api/administratortypeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchAdminTypes = async (params) => { try { const response = await api.get('/Admin/GetAllAdminTypes', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/basicapi.js b/src/api/basicapi.js index aae0d4e33fa1dc7d49a7ba12d232b88ec4dd64e8..9cce1be00acc34ed7043f2fc40d9e374be8b5987 100644 --- a/src/api/basicapi.js +++ b/src/api/basicapi.js @@ -5,7 +5,7 @@ export const signIn = async (data) => { try { const response = await api.post('/Admin/Login', data); const resData = response.data; - if (resData.StatusCode === 200) { + if (resData.Success) { return resData; } else { throw new Error(`Login failed with status code: ${response.status}`); diff --git a/src/api/customerapi.js b/src/api/customerapi.js index e8bff38a4f4de22f4c22a608878672504c4e3a84..de546126a6472e7640e3b4dd67525110649374fe 100644 --- a/src/api/customerapi.js +++ b/src/api/customerapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchCustomers = async (params) => { try { const response = await api.get('/Customer/SelectCustomers', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/customertypeapi.js b/src/api/customertypeapi.js index 97e972c11a6dc67d5539cb3700a79e3d013507a4..d509b63522c6de71f9d5af726b7ce1e8b1d1b3f5 100644 --- a/src/api/customertypeapi.js +++ b/src/api/customertypeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchCustomerTypes = async (params) => { try { const response = await api.get('/Base/SelectCustoTypeAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/custotypeapi.js b/src/api/custotypeapi.js index 7d31605393eee60885950033066f114fb1d4deb3..c9aa37c682cf965ada1c688f2a7d9d0654a6ee2f 100644 --- a/src/api/custotypeapi.js +++ b/src/api/custotypeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchCustomerTypes = async (params) => { try { const response = await api.get('/Base/SelectCustoTypeAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -14,7 +14,7 @@ export const fetchCustomerTypes = async (params) => { export const fetchCanUseCustomerTypes = async (params) => { try { const response = await api.get('/Base/SelectCustoTypeAllCanUse', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/departmentapi.js b/src/api/departmentapi.js index d2fe3e17e44c3324a546b896e538966301987711..9cd70cc64bf522195ecfee9f1e0398447f5742c4 100644 --- a/src/api/departmentapi.js +++ b/src/api/departmentapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchDepartments = async (params) => { try { const response = await api.get('/Base/SelectDeptAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -24,6 +24,7 @@ export const addDepartment = async (data) => { export const updateDepartment = async (data) => { try { const response = await api.post(`/Base/UpdDept`, data); + console.log(response.data); return response.data; } catch (error) { throw error; diff --git a/src/api/employeeapi.js b/src/api/employeeapi.js index 8842dc3f2df6f08bd622e5943843c29e79b3ad9e..041ec3733d9c7404afb93d48a3001019501579ea 100644 --- a/src/api/employeeapi.js +++ b/src/api/employeeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchEmployees = async (params) => { try { const response = await api.get('/Employee/SelectEmployeeAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -24,7 +24,7 @@ export const fetchEmployeeDetail = async (params) => { export const fetchEmployeeResume = async (params) => { try { const response = await api.get('/EmployeeHistory/SelectHistoryByEmployeeId', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -65,7 +65,7 @@ export const managerEmployeeAccount = async (data) => { export const fetchEmployeeRewardPunishment = async (params) => { try { const response = await api.get('/RewardPunishment/SelectAllRewardPunishmentByEmployeeId', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -75,7 +75,7 @@ export const fetchEmployeeRewardPunishment = async (params) => { export const fetchEmployeeAttendance = async (params) => { try { const response = await api.get('/EmployeeCheck/SelectCheckInfoByEmployeeId', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/goodsapi.js b/src/api/goodsapi.js index 51a1c44d439fccfd4938e620a37f52ef24aec575..c3a2bc834e2bc0af9aa2e720b15d545c543f9445 100644 --- a/src/api/goodsapi.js +++ b/src/api/goodsapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchGoodss = async (params) => { try { const response = await api.get('/Sellthing/SelectSellthingAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/hydroelectricityapi.js b/src/api/hydroelectricityapi.js index 54d5a626eebefd04dc791baf16544b4968b063c0..ad36835ef9163e19e94c2e4eda176217d13c5323 100644 --- a/src/api/hydroelectricityapi.js +++ b/src/api/hydroelectricityapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchHydroelectricitys = async (params) => { try { const response = await api.get('/EnergyManagement/SelectEnergyManagementInfo', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/index.js b/src/api/index.js index fede6d63189b902084ae8304975dce083512096b..5aedb66a9dcfc788ce43c08e606607ff7aa633da 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,7 +1,6 @@ import axios from 'axios'; import router from '../router'; -import dayjs from 'dayjs'; -import { BaseFields } from '../entities/common.entity'; +import { showErrorNotification } from '@/utils/index'; const api = axios.create({ baseURL: import.meta.env.VITE_API_URL, @@ -11,24 +10,11 @@ const api = axios.create({ api.interceptors.request.use( (config) => { const token = localStorage.getItem('token'); - const account = localStorage.getItem('account'); if (token) { config.headers.Authorization = `Bearer ${token}`; } - - if (account && config.data) { - let url = config.url.toLowerCase(); - url = url.replace(config.baseURL.toLowerCase(), ''); - if (url.includes('/add') || url.includes('/insert')) { - config.data[BaseFields.DATA_INS_USER] = account; - config.data[BaseFields.DATA_INS_DATE] = dayjs().format('YYYY-MM-DD HH:mm:ss'); - } else if (url.includes('/upd') || url.includes('/update')) { - config.data[BaseFields.DATA_CHG_USER] = account; - config.data[BaseFields.DATA_CHG_DATE] = dayjs().format('YYYY-MM-DD HH:mm:ss'); - } - config.data[BaseFields.USER_TOKEN] = token; - } + return config; }, (error) => { @@ -38,18 +24,51 @@ api.interceptors.request.use( api.interceptors.response.use( (response) => { + const resData = response.data; + if (resData.Success === undefined || resData.Code === undefined) { + console.warn('非标准API响应结构', response.config.url, resData); + } + if (!resData.Success) { + let errorMessage = resData.Message || '请求失败'; + + if (resData.Code === 4401) { + router.push('/signin'); + errorMessage = '登录已过期,请重新登录'; + } + + showErrorNotification(errorMessage); + return Promise.reject(new Error(errorMessage)); + } + return response; }, (error) => { - if (error.response && error.response.status === 401) { - localStorage.removeItem('token'); - localStorage.removeItem('username'); - localStorage.removeItem('account'); - window.$notification('error', '登录过期', '请重新登录'); - router.push('/signin'); - return Promise.reject(error); - } - return Promise.reject(error); + if (error.response) { + const customError = { + success: false, + code: error.response.status, + message: `服务器错误 (${error.response.status})`, + data: { + url: error.config.url, + method: error.config.method + } + }; + + showErrorNotification(customError.message); + return Promise.reject(customError); + } + localStorage.removeItem('token'); + localStorage.removeItem('username'); + localStorage.removeItem('account'); + showErrorNotification('error', '登录过期', '请重新登录'); + router.push('/signin'); + + showErrorNotification('网络连接异常'); + return Promise.reject({ + success: false, + code: 9001, + message: '网络连接错误' + }); } ); diff --git a/src/api/internalfinanceapi.js b/src/api/internalfinanceapi.js index 348e41f275bce81136cd18f103eae5c77b53dde6..cced9c73b8cbd67146f84f79cc5d243aada53981 100644 --- a/src/api/internalfinanceapi.js +++ b/src/api/internalfinanceapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchInternalFinances = async (params) => { try { const response = await api.get('/Asset/SelectAssetInfoAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/menuapi.js b/src/api/menuapi.js index 70568d916a21ff8112ca5ac9ede7e4c00c6fb4df..82c90d63ec0de4a154adc3dac3185f27a029dfab 100644 --- a/src/api/menuapi.js +++ b/src/api/menuapi.js @@ -3,8 +3,12 @@ import api from '../api'; // 获取菜单树 export const fetchMenusTree = async (menu) => { try { - const response = await api.post('/Menu/BuildMenuAll',menu); - return response.data; + const response = await api.post('/Menu/BuildMenuAll', menu); + + if (!response.data.Success) { + throw new Error(response.data.message || '获取菜单失败'); + } + return response.data.Data; } catch (error) { throw error; } @@ -14,7 +18,7 @@ export const fetchMenusTree = async (menu) => { export const fetchMenus = async (params) => { try { const response = await api.get('/Menu/SelectMenuAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/nationapi.js b/src/api/nationapi.js index 65bfdd4d6e7d8e107e9434fac81189b48d83aa71..6502fff5e37f6728addc3164980f75369fe52858 100644 --- a/src/api/nationapi.js +++ b/src/api/nationapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchNations = async (params) => { try { const response = await api.get('/Base/SelectNationAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/noticetypeapi.js b/src/api/noticetypeapi.js index f57088f7037342474c51979461d75705c0be3525..b581b5ee49b3947ab5f8bc0a475b398b978e9683 100644 --- a/src/api/noticetypeapi.js +++ b/src/api/noticetypeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchNoticeTypes = async (params) => { try { const response = await api.get('/Base/SelectAppointmentNoticeTypeAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/passportapi.js b/src/api/passportapi.js index 1133012c9f21f338504f3fac194cebe8eb5e2797..8217bdb3718dcfaa18d966e631f79b3c6da140b4 100644 --- a/src/api/passportapi.js +++ b/src/api/passportapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchPassports = async (params) => { try { const response = await api.get('/Base/SelectPassPortTypeAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -14,7 +14,7 @@ export const fetchPassports = async (params) => { export const fetchCanUsePassports = async (params) => { try { const response = await api.get('/Base/SelectPassPortTypeAllCanUse', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/positionapi.js b/src/api/positionapi.js index f36b375cabf9a3b2293fc151c83c113fe56deb7c..c118cfc27910814475cd7e6e5d852ffa64a3bd56 100644 --- a/src/api/positionapi.js +++ b/src/api/positionapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchPositions = async (params) => { try { const response = await api.get('/Base/SelectPositionAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/promotioncontentapi.js b/src/api/promotioncontentapi.js index d88e668d5f3d725ddad7ccebc132fa1dc282b044..61cce6b8f0456133117748d3b05f91a40b66bcd9 100644 --- a/src/api/promotioncontentapi.js +++ b/src/api/promotioncontentapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchPromotionContents = async (params) => { try { const response = await api.get('/PromotionContent/SelectPromotionContentAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/qualificationapi.js b/src/api/qualificationapi.js index e1724c718182c219370e8c01a0217a849e487ff3..e09bedc8c90d71c9f001a8ccbc0b3751683a17bf 100644 --- a/src/api/qualificationapi.js +++ b/src/api/qualificationapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchQualifications = async (params) => { try { const response = await api.get('/Base/SelectEducationAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/reserapi.js b/src/api/reserapi.js index 081913b397bd4968e116fb03dbd1a64d21e9529b..802284fa13ca283fbf70e8ec4c0c9a44933ce63e 100644 --- a/src/api/reserapi.js +++ b/src/api/reserapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchResers = async (params) => { try { const response = await api.get('/Reser/SelectReserAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/roleapi.js b/src/api/roleapi.js index ac7ff375cad768ace7020e00ed1c484a86822c33..76f158582580963a070ed751a31a418c13e08151 100644 --- a/src/api/roleapi.js +++ b/src/api/roleapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchRoles = async (params) => { try { const response = await api.get('/Role/SelectRoleList', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/roomapi.js b/src/api/roomapi.js index c173ed1d5076371f7f27220f11a1c8b479293ca6..555dd6047f8e33855e0f6df4d4e803d67238976b 100644 --- a/src/api/roomapi.js +++ b/src/api/roomapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchRooms = async (params) => { try { const response = await api.get('/Room/SelectRoomAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -14,7 +14,7 @@ export const fetchRooms = async (params) => { export const fetchAvailableRooms = async (params) => { try { const response = await api.get('/Room/SelectCanUseRoomAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/roomstateapi.js b/src/api/roomstateapi.js index 5ac0732b12f80dabc5d9d58e7a19605562a769fc..f18d6ece6e59263c5fc673b72f2789e9fd465837 100644 --- a/src/api/roomstateapi.js +++ b/src/api/roomstateapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchRoomStates = async () => { try { const response = await api.get('/Base/SelectRoomStateAll'); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/roomtypeapi.js b/src/api/roomtypeapi.js index ddc4fc978fc6a6b63b2dd74885467c725a5ef3f2..d6cd2248a3fe550fe4f098f7ba1172f6e38389cb 100644 --- a/src/api/roomtypeapi.js +++ b/src/api/roomtypeapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchRoomTypes = async (params) => { try { const response = await api.get('/RoomType/SelectRoomTypesAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/spendinfoapi.js b/src/api/spendinfoapi.js index 57749c80d31f21bc4d599707ba6164e96961e1e4..a7f898ee888a64bb0174249bd94faef92d7fe66b 100644 --- a/src/api/spendinfoapi.js +++ b/src/api/spendinfoapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchSpendInfos = async (params) => { try { const response = await api.get('/Spend/SelectSpendInfoAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/supervisioninfoapi.js b/src/api/supervisioninfoapi.js index bd1f038b6bdc054846c75c7389b3bcd31b402d4b..f166459d4a194c000083ae7a7a9510ad10d5a3da 100644 --- a/src/api/supervisioninfoapi.js +++ b/src/api/supervisioninfoapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchSupervisionInfos = async (params) => { try { const response = await api.get('/SupervisionStatistics/SelectSupervisionStatisticsAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/utilityapi.js b/src/api/utilityapi.js index f5093efd2248ae82ff6d8f57d4622bf8738519d7..b65d88dd60071ff40d9e7576696305c48deed417 100644 --- a/src/api/utilityapi.js +++ b/src/api/utilityapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchOperationlogs = async (params) => { try { const response = await api.get('/Utility/SelectOperationlogAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } @@ -14,7 +14,7 @@ export const fetchOperationlogs = async (params) => { export const fetchRequestlogs = async (params) => { try { const response = await api.get('/Utility/SelectRequestlogAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/vipruleapi.js b/src/api/vipruleapi.js index 7e6b1e1091b8c2d20b8b4442dcf5518202b12142..05751cf57bcbc630bc504f0e68b356baa9b808d6 100644 --- a/src/api/vipruleapi.js +++ b/src/api/vipruleapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchVipRules = async (params) => { try { const response = await api.get('/VipRule/SelectVipRuleList', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/api/workerfeatureapi.js b/src/api/workerfeatureapi.js index 3c08ff74bed9381e3f9e2ab441238cc988dddde4..f07071eedbf53e792634a6554b2ba89467c31987 100644 --- a/src/api/workerfeatureapi.js +++ b/src/api/workerfeatureapi.js @@ -4,7 +4,7 @@ import api from '../api'; export const fetchWorkerFeatures = async (params) => { try { const response = await api.get('/Base/SelectWorkerFeatureAll', { params }); - return response.data; + return response.data.Data; } catch (error) { throw error; } diff --git a/src/entities/common.entity.js b/src/entities/common.entity.js index f8024416d43d3418a393ba6c2e1d786f3e0cf4c2..48ff7b0f7512b0024ecdd01feac97ea54aa746b4 100644 --- a/src/entities/common.entity.js +++ b/src/entities/common.entity.js @@ -1,3 +1,7 @@ +export const getCurrentAccount = () => { + return localStorage.getItem('account') || ''; +}; + export const BaseFields = { ID: 'Id', IGNOREPAGING:'IgnorePaging', @@ -6,17 +10,22 @@ export const BaseFields = { DATA_INS_DATE: 'DataInsDate', DATA_CHG_USER: 'DataChgUsr', DATA_CHG_DATE: 'DataChgDate', - USER_TOKEN: 'UserToken' + USER_TOKEN: 'UserToken', + MODIFYSTATUS: 'ModifyStatus', + PAGE: 'Page', + PAGE_SIZE: 'PageSize', }; export const BaseInitialValues = { [BaseFields.ID]: 0, [BaseFields.IGNOREPAGING]: false, [BaseFields.IS_DELETED]: 0, - [BaseFields.DATA_INS_USER]: '', + [BaseFields.DATA_INS_USER]: getCurrentAccount(), [BaseFields.DATA_INS_DATE]: null, - [BaseFields.DATA_CHG_USER]: '', + [BaseFields.DATA_CHG_USER]: getCurrentAccount(), [BaseFields.DATA_CHG_DATE]: null, [BaseFields.USER_TOKEN]: '', - MODIFYSTATUS: '', + [BaseFields.MODIFYSTATUS]: '', + [BaseFields.PAGE]: 1, + [BaseFields.PAGE_SIZE]: 15, }; \ No newline at end of file diff --git a/src/entities/log.entity.js b/src/entities/log.entity.js index 5dd3d8a09221c71b7019a616afdfd3b0e74e0547..a2c7f9ae6b422657726ff78738b924ef01d47fa6 100644 --- a/src/entities/log.entity.js +++ b/src/entities/log.entity.js @@ -9,7 +9,9 @@ export const LogSpecificFields = { LEVEL: 'LogLevel', VERSION: 'SoftwareVersion', IPADDRESS: 'LoginIpAddress', - LEVELNAME: 'LogLevelName' + LEVELNAME: 'LogLevelName', + STARTTIME: 'StartTime', + ENDTIME: 'EndTime' }; export const LogFields = { @@ -26,7 +28,8 @@ export const initialFormValues = { [LogFields.LEVEL]: null, [LogFields.VERSION]: '', [LogFields.IPADDRESS]: '', - modifystatus: '' + [LogFields.STARTTIME]: null, + [LogFields.ENDTIME]: null }; export const getColumns = (t) => [ diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 333b1124f2e51e6dd8de6a2d5bab28840ffc62ed..90318ca2ce70605e536a1fae641ae31398df6ea5 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -119,11 +119,14 @@ const currentRouteKey = ref(''); const refreshMenu = async () => { try { - const rawData = await fetchMenusTree({ + const menuItems = await fetchMenusTree({ [BaseFields.USER_TOKEN]: localStorage.getItem('token') }); const currentOpenKeys = [...openKeys.value]; const processMenuItems = (items) => { + if (!Array.isArray(items)) { + return []; + } return items.map(item => ({ key: item.Key, title: `message.${item.Key}`, @@ -132,10 +135,10 @@ const refreshMenu = async () => { children: item.Children ? processMenuItems(item.Children) : undefined })); }; - menuData.value = processMenuItems(rawData); + menuData.value = processMenuItems(menuItems.Items); openKeys.value = currentOpenKeys; } catch (error) { - console.error('菜单刷新失败:', error); + showErrorNotification(error.message) } }; @@ -178,6 +181,7 @@ const checkLoginStatus = () => { const logout = () => { localStorage.removeItem('token'); localStorage.removeItem('username'); + localStorage.removeItem('account'); isLoggedIn.value = false; username.value = ''; router.push('/signin'); diff --git a/src/router/index.js b/src/router/index.js index 1bb864eb2c6a140dc127d9b5e3af1f388b5f185d..e563758ad565dbc153b0a532cdd00645b338f622 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,4 @@ import { createRouter, createWebHistory } from 'vue-router'; -import HomeView from '../views/HomeView.vue'; import NotFound from '../views/responsepage/NotFound.vue'; import MainLayout from '../layouts/MainLayout.vue'; import SignIn from '../views/SignInView.vue'; @@ -38,10 +37,10 @@ const routes = [ path: '/', component: MainLayout, children: [ - { - path: '/home', - component: HomeView, - meta: { requiresAuth: true } + { + path: '/', + redirect: '/dashboard', + meta: { requiresAuth: true } }, { path: '/position', @@ -233,7 +232,7 @@ const router = createRouter({ router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth)) { if (!checkTokenValidity()) { - return + return next({ name: 'signin' }); } next(); } else { diff --git a/src/utils/index.js b/src/utils/index.js index cd40644a9f822570d232836c53a96515ad1069dd..2e234c7e3bfacc88c7260e9a969cd2027970b223 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -81,6 +81,10 @@ export const formatDateTime = (dateString) => { } }; +export const getLocalDate = () => { + return new Date(); +} + /** * 货币格式化函数 * @param {number|string} value - 需要格式化的数值 diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue deleted file mode 100644 index 2075dd573a623001f846f33130d225a5fcfe1a8b..0000000000000000000000000000000000000000 --- a/src/views/HomeView.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - {{ translatedPageTitle }} - Welcome to the {{ translatedPageTitle }} page! - - - - diff --git a/src/views/SignInView.vue b/src/views/SignInView.vue index edf058aa6da4fddf9eacf664b6c7531de4c73ba3..86cc3b12a4406c2d79e5c565d6f5d1181588641b 100644 --- a/src/views/SignInView.vue +++ b/src/views/SignInView.vue @@ -75,18 +75,24 @@ const onFinish = async () => { loading.value = true; try { const response = await signIn(form); - if (response && response.StatusCode === 200) { - const { Source } = response; - localStorage.setItem('token', Source.UserToken); - localStorage.setItem('username',Source.Name); - localStorage.setItem('account',Source.Number); + if (response.Success) { + const userData = response.Data; + + localStorage.setItem('token', userData.UserToken); + localStorage.setItem('username', userData.Name); + localStorage.setItem('account', userData.Number); + router.push('/'); - showSuccessNotification(t('message.welcomeBack')); + showSuccessNotification(t('message.welcomeBack')); } else { - showErrorNotification(t('message.checkUsernameAndPassword')); + showErrorNotification( + response.message || t('message.checkUsernameAndPassword') + ); } } catch (error) { - showErrorNotification(t('message.pleaseTryAgainLater')); + showErrorNotification( + error.response?.data?.message || t('message.pleaseTryAgainLater') + ); } finally { loading.value = false; } diff --git a/src/views/base/DepartmentView.vue b/src/views/base/DepartmentView.vue index 08efc94e91037396677c250a2175d52c0e87b5cb..63cb1879ab950535a9a3b9c4d7d4e5c3217efade 100644 --- a/src/views/base/DepartmentView.vue +++ b/src/views/base/DepartmentView.vue @@ -112,12 +112,12 @@ const fetchDepartmentData = async () => { loading.value = true; try { const result = await fetchDepartments({ - page: pagination.current, - pageSize: pagination.pageSize, + [DepartmentFields.PAGE]: pagination.current, + [DepartmentFields.PAGE_SIZE]: pagination.pageSize, [DepartmentFields.IS_DELETED]: 0 }); - if (result?.listSource) { - departments.value = result.listSource.map(item => ({ + if (result && Array.isArray(result.Items)) { + departments.value = result.Items.map(item => ({ [DepartmentFields.ID]: item[DepartmentFields.ID], [DepartmentFields.NUMBER]: item[DepartmentFields.NUMBER], [DepartmentFields.NAME]: item[DepartmentFields.NAME], @@ -129,7 +129,7 @@ const fetchDepartmentData = async () => { [DepartmentFields.CREATIONDATE]: item[DepartmentFields.CREATIONDATE], [DepartmentFields.IS_DELETED]: item[DepartmentFields.IS_DELETED] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } else { throw new Error('数据格式错误'); } @@ -143,9 +143,10 @@ const fetchDepartmentData = async () => { const fetchSelectDepartments = async () => { try { const result = await fetchDepartments({ - [DepartmentFields.IS_DELETED]: 0 + [DepartmentFields.IS_DELETED]: 0, + [DepartmentFields.IGNOREPAGING]: true }); - departmentOptions.value = result.listSource.map((item) => ({ + departmentOptions.value = result.Items.map((item) => ({ label: item[DepartmentFields.NAME], value: item[DepartmentFields.NUMBER], })); @@ -158,10 +159,9 @@ const fetchSelectLeaders = async () => { try { const result = await fetchEmployees({ [EmployeeFields.IS_DELETED]: 0, - page: 1, - pageSize: 9999 + [EmployeeFields.IGNOREPAGING]: true }); - leaderOptions.value = result.listSource.map((item) => ({ + leaderOptions.value = result.Items.map((item) => ({ label: item[EmployeeFields.NAME], value: item[EmployeeFields.NUMBER], })); @@ -189,7 +189,7 @@ const showModal = () => { form[DepartmentFields.LEADER] = ''; form[DepartmentFields.PARENT] = ''; form[DepartmentFields.CREATIONDATE] = null; - form.modifystatus = 'insert'; + form[DepartmentFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -207,16 +207,16 @@ const editDepartment = (record) => { form[DepartmentFields.LEADER] = record[DepartmentFields.LEADER]; form[DepartmentFields.PARENT] = record[DepartmentFields.PARENT]; form[DepartmentFields.CREATIONDATE] = record[DepartmentFields.CREATIONDATE] ? dayjs(record[DepartmentFields.CREATIONDATE]) : null; - form.modifystatus = 'update'; + form[DepartmentFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[DepartmentFields.MODIFYSTATUS] === 'update') { var response = await updateDepartment({ ...form,[DepartmentFields.CREATIONDATE]:form[DepartmentFields.CREATIONDATE]?form[DepartmentFields.CREATIONDATE].format('YYYY-MM-DD'):null}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -226,7 +226,7 @@ const handleModalOk = async () => { } } else { var response = await addDepartment({ ...form,[DepartmentFields.CREATIONDATE]:form[DepartmentFields.CREATIONDATE]?form[DepartmentFields.CREATIONDATE].format('YYYY-MM-DD'):null}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -252,7 +252,7 @@ const handleDelete = async (record) => { try { record[DepartmentFields.IS_DELETED] = 1; var response = await deleteDepartment(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } @@ -262,7 +262,6 @@ const handleDelete = async (record) => { } fetchDepartmentData(); } catch (error) { - console.error('Delete error:', error); showErrorNotification(t('message.pleaseTryAgainLater')); } }; diff --git a/src/views/base/NationView.vue b/src/views/base/NationView.vue index 8cac93205b1afef1a27281d2af81aba65523d698..5c0a4a8fca21024a4f972bd2790236bd72040613 100644 --- a/src/views/base/NationView.vue +++ b/src/views/base/NationView.vue @@ -77,17 +77,17 @@ const fetchNationData = async () => { loading.value = true; try { const result = await fetchNations({ - page: pagination.current, - pageSize: pagination.pageSize, + [NationFields.PAGE]: pagination.current, + [NationFields.PAGE_SIZE]: pagination.pageSize, [NationFields.IS_DELETED]: 0 }); - if (result?.listSource) { - nations.value = result.listSource.map(item => ({ + if (result?.Items) { + nations.value = result.Items.map(item => ({ [NationFields.ID]: item[NationFields.ID], [NationFields.NUMBER]: item[NationFields.NUMBER], [NationFields.NAME]: item[NationFields.NAME] })); - pagination.total = result.total; + pagination.total = result.TotlalCount; } else { throw new Error('数据格式错误'); } @@ -110,7 +110,7 @@ const showModal = () => { separator: null, }); form[NationFields.NAME] = ''; - form.modifystatus = 'insert'; + form[NationFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -124,16 +124,16 @@ const editNation = (record) => { form[NationFields.ID] = record[NationFields.ID]; form[NationFields.NUMBER] = record[NationFields.NUMBER]; form[NationFields.NAME] = record[NationFields.NAME]; - form.modifystatus = 'update'; + form[NationFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[NationFields.MODIFYSTATUS] === 'update') { var response = await updateNation({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -143,7 +143,7 @@ const handleModalOk = async () => { } } else { var response = await addNation({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -169,7 +169,7 @@ const handleDelete = async (record) => { try { record[NationFields.IS_DELETED] = 1; var response = await deleteNation(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } diff --git a/src/views/base/NoticeTypeView.vue b/src/views/base/NoticeTypeView.vue index e53e0d4fcf071e1c6fb5b8ab0274daea11b964aa..ac53bdeb2df7439a8ee91c9874c9ee4965ba7fea 100644 --- a/src/views/base/NoticeTypeView.vue +++ b/src/views/base/NoticeTypeView.vue @@ -77,20 +77,18 @@ loading.value = true; try { const result = await fetchNoticeTypes({ - page: pagination.current, - pageSize: pagination.pageSize, + [NoticeTypeFields.PAGE]: pagination.current, + [NoticeTypeFields.PAGE_SIZE]: pagination.pageSize, [NoticeTypeFields.IS_DELETED]: 0 }); - if (result?.listSource) { - notices.value = result.listSource.map(item => ({ + if (result?.Items) { + notices.value = result.Items.map(item => ({ [NoticeTypeFields.ID]: item[NoticeTypeFields.ID], [NoticeTypeFields.NUMBER]: item[NoticeTypeFields.NUMBER], [NoticeTypeFields.NAME]: item[NoticeTypeFields.NAME], [NoticeTypeFields.IS_DELETED]: item[NoticeTypeFields.IS_DELETED] })); - pagination.total = result.total; - } else { - showErrorNotification('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -111,7 +109,7 @@ separator: null, }); form[NoticeTypeFields.NAME] = ''; - form.modifystatus = 'insert'; + form[NoticeTypeFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -125,16 +123,16 @@ form[NoticeTypeFields.ID] = record[NoticeTypeFields.ID]; form[NoticeTypeFields.NUMBER] = record[NoticeTypeFields.NUMBER]; form[NoticeTypeFields.NAME] = record[NoticeTypeFields.NAME]; - form.modifystatus = 'update'; + form[NoticeTypeFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[NoticeTypeFields.MODIFYSTATUS] === 'update') { var response = await updateNoticeType({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -144,7 +142,7 @@ } } else { var response = await addNoticeType({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -170,7 +168,7 @@ try { record[NoticeTypeFields.IS_DELETED] = 1; var response = await deleteNoticeType(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } @@ -184,13 +182,13 @@ } }; - const handleTableChange = (newPagipassport) => { - pagipassport.current = newPagipassport.current; - pagipassport.pageSize = newPagipassport.pageSize; + const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchNoticeTypeData(); }; - const handleSorterChange = (pagipassport, filters, sorter) => { + const handleSorterChange = (newPagination, filters, sorter) => { sortedInfo.value = sorter; }; \ No newline at end of file diff --git a/src/views/base/PassportView.vue b/src/views/base/PassportView.vue index f953b3570738c0519d6ce60c3729cfd28103abac..387cedaad8f63d8d598e4427dd3d0c054bff7cd2 100644 --- a/src/views/base/PassportView.vue +++ b/src/views/base/PassportView.vue @@ -75,19 +75,17 @@ loading.value = true; try { const result = await fetchPassports({ - page: pagination.current, - pageSize: pagination.pageSize, + [PassportFields.PAGE]: pagination.current, + [PassportFields.PAGE_SIZE]: pagination.pageSize, [PassportFields.IS_DELETED]: 0 }); - if (result?.listSource) { - passports.value = result.listSource.map(item => ({ + if (result?.Items) { + passports.value = result.Items.map(item => ({ [PassportFields.ID]: item[PassportFields.ID], [PassportFields.NUMBER]: item[PassportFields.NUMBER], [PassportFields.NAME]: item[PassportFields.NAME] })); - pagination.total = result.total; - } else { - showErrorNotification('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -105,7 +103,7 @@ modalTitle.value = t('message.insertPassport'); form[PassportFields.NUMBER] = null; form[PassportFields.NAME] = ''; - form.modifystatus = 'insert'; + form[PassportFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -119,16 +117,16 @@ form[PassportFields.ID] = record[PassportFields.ID]; form[PassportFields.NUMBER] = record[PassportFields.NUMBER]; form[PassportFields.NAME] = record[PassportFields.NAME]; - form.modifystatus = 'update'; + form[PassportFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[PassportFields.MODIFYSTATUS] === 'update') { var response = await updatePassport({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -138,7 +136,7 @@ } } else { var response = await addPassport({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -164,7 +162,7 @@ try { record[PassportFields.IS_DELETED] = 1; var response = await deletePassport(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } @@ -178,13 +176,13 @@ } }; - const handleTableChange = (newPagipassport) => { - pagipassport.current = newPagipassport.current; - pagipassport.pageSize = newPagipassport.pageSize; + const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchPassportData(); }; - const handleSorterChange = (pagipassport, filters, sorter) => { + const handleSorterChange = (newPagination, filters, sorter) => { sortedInfo.value = sorter; }; \ No newline at end of file diff --git a/src/views/base/PositionView.vue b/src/views/base/PositionView.vue index 47c24ad7acec2105a4ae9e0c8ecf04abfe72f0de..2cef41e5535a2e3f65c11098cb46d233b4a63237 100644 --- a/src/views/base/PositionView.vue +++ b/src/views/base/PositionView.vue @@ -77,19 +77,17 @@ const fetchPositionData = async () => { loading.value = true; try { const result = await fetchPositions({ - page: pagination.current, - pageSize: pagination.pageSize, + [PositionFields.PAGE]: pagination.current, + [PositionFields.PAGE_SIZE]: pagination.pageSize, [PositionFields.IS_DELETED]: 0 }); - if (result?.listSource) { - positions.value = result.listSource.map(item => ({ + if (result && Array.isArray(result.Items)) { + positions.value = result.Items.map(item => ({ [PositionFields.ID]: item[PositionFields.ID], [PositionFields.NUMBER]: item[PositionFields.NUMBER], [PositionFields.NAME]: item[PositionFields.NAME] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -111,8 +109,7 @@ const showModal = () => { separator: null, }); form[PositionFields.NAME] = ''; - form.isDelete = 0; - form.modifystatus = 'insert'; + form[PositionFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -126,33 +123,32 @@ const editPosition = (record) => { form[PositionFields.ID] = record[PositionFields.ID]; form[PositionFields.NUMBER] = record.PositionNumber; form[PositionFields.NAME] = record.PositionName; - form.modifystatus = 'update'; + form[PositionFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[PositionFields.MODIFYSTATUS] === 'update') { var response = await updatePosition({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.updateSuccess')); + showSuccessNotification(t('message.updateSuccess')); } else { - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } } else { - console.log(form) var response = await addPosition({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.addSuccess')); + showSuccessNotification(t('message.addSuccess')); } else { - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } } modalVisible.value = false; @@ -172,13 +168,13 @@ const handleDelete = async (record) => { try { record[PositionFields.IS_DELETED] = 1; var response = await deletePosition(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle'), t('message.deleteSuccess')); + showSuccessNotification(t('message.deleteSuccess')); } else { - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } fetchPositionData(); } catch (error) { @@ -186,9 +182,9 @@ const handleDelete = async (record) => { } }; -const handleTableChange = (newPagiposition) => { - pagination.current = newPagiposition.current; - pagination.pageSize = newPagiposition.pageSize; +const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchPositionData(); }; diff --git a/src/views/base/PromotionContentView.vue b/src/views/base/PromotionContentView.vue index 294b0786ee62bba61cdf0ba5ab9e75053efec262..ab0af69616eab4cb73d4833f21c7c6b82b80159d 100644 --- a/src/views/base/PromotionContentView.vue +++ b/src/views/base/PromotionContentView.vue @@ -77,19 +77,17 @@ loading.value = true; try { const result = await fetchPromotionContents({ - page: pagination.current, - pageSize: pagination.pageSize, + [PromotionContentFields.PAGE]: pagination.current, + [PromotionContentFields.PAGE_SIZE]: pagination.pageSize, [PromotionContentFields.IS_DELETED]: 0 }); - if (result?.listSource) { - promotionContents.value = result.listSource.map(item => ({ + if (result?.Items) { + promotionContents.value = result.Items.map(item => ({ [PromotionContentFields.ID]: item[PromotionContentFields.ID], [PromotionContentFields.NUMBER]: item[PromotionContentFields.NUMBER], [PromotionContentFields.MESSAGE]: item[PromotionContentFields.MESSAGE] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -111,7 +109,7 @@ separator: null, }); form[PromotionContentFields.MESSAGE] = ''; - form.modifystatus = 'insert'; + form[PromotionContentFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -125,16 +123,16 @@ form[PromotionContentFields.ID] = record[PromotionContentFields.ID]; form[PromotionContentFields.NUMBER] = record[PromotionContentFields.NUMBER]; form[PromotionContentFields.MESSAGE] = record[PromotionContentFields.MESSAGE]; - form.modifystatus = 'update'; + form[PromotionContentFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[PromotionContentFields.MODIFYSTATUS] === 'update') { var response = await updatePromotionContent({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -144,7 +142,7 @@ } } else { var response = await addPromotionContent({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -170,13 +168,13 @@ try { record[PromotionContentFields.IS_DELETED] = 1; var response = await deletePromotionContent(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle'), t('message.deleteSuccess')); + showSuccessNotification(t('message.deleteSuccess')); } else { - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } fetchPromotionContentData(); } catch (error) { @@ -184,9 +182,9 @@ } }; - const handleTableChange = (newPagipromotionContent) => { - pagination.current = newPagipromotionContent.current; - pagination.pageSize = newPagipromotionContent.pageSize; + const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchPromotionContentData(); }; diff --git a/src/views/base/QualificationView.vue b/src/views/base/QualificationView.vue index eb342c1216f850952f7342313879dd9e66dca0d0..c662e174edefa75300a931585cb089fdda31be09 100644 --- a/src/views/base/QualificationView.vue +++ b/src/views/base/QualificationView.vue @@ -75,19 +75,17 @@ const fetchQualificationData = async () => { loading.value = true; try { const result = await fetchQualifications({ - page: pagination.current, - pageSize: pagination.pageSize, + [EducationFields.PAGE]: pagination.current, + [EducationFields.PAGE_SIZE]: pagination.pageSize, [EducationFields.IS_DELETED]: 0 }); - if (result?.listSource) { - qualifications.value = result.listSource.map(item => ({ + if (result?.Items) { + qualifications.value = result.Items.map(item => ({ [EducationFields.ID]: item[EducationFields.ID], [EducationFields.NUMBER]: item[EducationFields.NUMBER], [EducationFields.NAME]: item[EducationFields.NAME] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -110,7 +108,7 @@ const showModal = () => { }); form[EducationFields.NAME] = ''; form[EducationFields.IS_DELETED] = 0; - form.modifystatus = 'insert'; + form[EducationFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -124,29 +122,29 @@ const editQualification = (record) => { form[EducationFields.ID] = record[EducationFields.ID]; form[EducationFields.NUMBER] = record[EducationFields.NUMBER]; form[EducationFields.NAME] = record[EducationFields.NAME]; - form.modifystatus = 'update'; + form[EducationFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[EducationFields.MODIFYSTATUS] === 'update') { var response = await updateQualification({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.updateSuccess')); + showSuccessNotification(t('message.updateSuccess')); } else - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } else { var response = await addQualification({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.addSuccess')); + showSuccessNotification(t('message.addSuccess')); } else - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); } modalVisible.value = false; fetchQualificationData(); @@ -165,21 +163,21 @@ const handleDelete = async (record) => { try { record[EducationFields.IS_DELETED] = 1; var response = await deleteQualification(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.deleteSuccess')); + showSuccessNotification(t('message.deleteSuccess')); } else - showErrorNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showErrorNotification(t('message.pleaseTryAgainLater')); fetchQualificationData(); } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); } }; -const handleTableChange = (newPagiqualification) => { - pagination.current = newPagiqualification.current; - pagination.pageSize = newPagiqualification.pageSize; +const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchQualificationData(); }; diff --git a/src/views/customermanagement/CustomerSpendView.vue b/src/views/customermanagement/CustomerSpendView.vue index f485247d0b6795bc58ca15da9acc6e3ea58fc2be..5c99b7ec16bcdc27569c71149ec5df686fbc062b 100644 --- a/src/views/customermanagement/CustomerSpendView.vue +++ b/src/views/customermanagement/CustomerSpendView.vue @@ -105,10 +105,9 @@ import { ref, onMounted, computed, reactive } from 'vue'; import { useRoute } from 'vue-router'; import { getPageTitle } from '@/utils/pageTitle'; -import { fetchSpendInfos, addSpendInfo, updateSpendInfo } from '@/api/spendinfoapi'; +import { fetchSpendInfos, updateSpendInfo } from '@/api/spendinfoapi'; import { SpendInfoFields, - SpendState, DATE_FORMAT, initialFormValues, getColumns, @@ -163,12 +162,12 @@ const fetchSpendInfoData = async () => { loading.value = true; try { const result = await fetchSpendInfos({ - page: pagination.current, - pageSize: pagination.pageSize, + [SpendInfoFields.PAGE]: pagination.current, + [SpendInfoFields.PAGE_SIZE]: pagination.pageSize, [SpendInfoFields.IS_DELETED]: 0, }); - if(result?.listSource){ - spends.value = result.listSource.map(item => ({ + if(result?.Items){ + spends.value = result.Items.map(item => ({ [SpendInfoFields.ID]: item[SpendInfoFields.ID], [SpendInfoFields.NUMBER]: item[SpendInfoFields.NUMBER], [SpendInfoFields.ROOM_NO]: item[SpendInfoFields.ROOM_NO], @@ -183,7 +182,7 @@ const fetchSpendInfoData = async () => { [SpendInfoFields.STATE]: item[SpendInfoFields.STATE], [SpendInfoFields.STATE_NAME]: item[SpendInfoFields.STATE_NAME], })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -214,18 +213,18 @@ const editSpend = (record) => { form[SpendInfoFields.MONEY] = record[SpendInfoFields.MONEY]; form[SpendInfoFields.TIME] = record[SpendInfoFields.TIME] ? dayjs(record[SpendInfoFields.TIME]) : null; form[SpendInfoFields.STATE] = record[SpendInfoFields.STATE]; - form.modifystatus = 'update'; + form[SpendInfoFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[SpendInfoFields.MODIFYSTATUS] === 'update') { var response = await updateSpendInfo({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { - showSuccessNotification('success', t('message.operationTitle') , t('message.updateSuccess')); + showSuccessNotification(t('message.updateSuccess')); } else { diff --git a/src/views/customermanagement/CustomerTypeView.vue b/src/views/customermanagement/CustomerTypeView.vue index b33af127ac4cc26de4e7b54dd930dd4e742f192b..db10bcdc61595a6dd6616f1a59e2dde300a4f2e8 100644 --- a/src/views/customermanagement/CustomerTypeView.vue +++ b/src/views/customermanagement/CustomerTypeView.vue @@ -17,6 +17,7 @@ :pagination="pagination" bordered @change="handleTableChange" + :handleSorterChange="handleSorterChange" > @@ -123,20 +124,18 @@ const fetchCustomerTypeData = async () => { loading.value = true; try { const result = await fetchCustomerTypes({ - page: pagination.current, - pageSize: pagination.pageSize, + [CustomerTypeFields.PAGE]: pagination.current, + [CustomerTypeFields.PAGE_SIZE]: pagination.pageSize, [CustomerTypeFields.IS_DELETED]: 0 }); - if (result?.listSource) { - customerTypes.value = result.listSource.map(item => ({ + if (result?.Items) { + customerTypes.value = result.Items.map(item => ({ [CustomerTypeFields.ID]: item[CustomerTypeFields.ID], [CustomerTypeFields.NUMBER]: item[CustomerTypeFields.NUMBER], [CustomerTypeFields.NAME]: item[CustomerTypeFields.NAME], [CustomerTypeFields.DISCOUNT]: item[CustomerTypeFields.DISCOUNT], })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -155,7 +154,7 @@ const showModal = () => { form[CustomerTypeFields.NUMBER] = null; form[CustomerTypeFields.NAME] = ''; form[CustomerTypeFields.DISCOUNT] = 0; - form.modifystatus = 'insert'; + form[CustomerTypeFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -170,16 +169,16 @@ const editCustomerType = (record) => { form[CustomerTypeFields.NUMBER] = record[CustomerTypeFields.NUMBER]; form[CustomerTypeFields.NAME] = record[CustomerTypeFields.NAME]; form[CustomerTypeFields.DISCOUNT] = record[CustomerTypeFields.DISCOUNT]; - form.modifystatus = 'update'; + form[CustomerTypeFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[CustomerTypeFields.MODIFYSTATUS] === 'update') { var response = await updateCustomerType({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -189,7 +188,7 @@ const handleModalOk = async () => { } } else { var response = await addCustomerType({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -201,7 +200,7 @@ const handleModalOk = async () => { modalVisible.value = false; fetchCustomerTypeData(); } catch (error) { - showNotification('error', t('message.operationTitle'), t('message.pleaseTryAgainLater')); + showNotification(t('message.pleaseTryAgainLater')); } finally { confirmLoading.value = false; } @@ -215,7 +214,7 @@ const handleDelete = async (record) => { try { record[CustomerTypeFields.IS_DELETED] = 1; var response = await deleteCustomerType(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } diff --git a/src/views/customermanagement/CustomerView.vue b/src/views/customermanagement/CustomerView.vue index 82d07180205d5f2912e34f82b79d879ab8e0ddfe..a70f8d54b1883c982691d5adc17cbab66778a592 100644 --- a/src/views/customermanagement/CustomerView.vue +++ b/src/views/customermanagement/CustomerView.vue @@ -179,12 +179,12 @@ const fetchCustomerData = async () => { loading.value = true; try { const result = await fetchCustomers({ - page: pagination.current, - pageSize: pagination.pageSize, + [CustomerFields.PAGE]: pagination.current, + [CustomerFields.PAGE_SIZE]: pagination.pageSize, [CustomerFields.IS_DELETED]: 0, }); - if (result?.listSource){ - customers.value = result.listSource.map(item => ({ + if (result?.Items){ + customers.value = result.Items.map(item => ({ [CustomerFields.ID]: item[CustomerFields.ID], [CustomerFields.NUMBER]: item[CustomerFields.NUMBER], [CustomerFields.NAME]: item[CustomerFields.NAME], @@ -202,7 +202,7 @@ const fetchCustomerData = async () => { [CustomerFields.ADDRESS]: item[CustomerFields.ADDRESS], [CustomerFields.IS_DELETED]: item[CustomerFields.IS_DELETE] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -214,7 +214,7 @@ const fetchCustomerData = async () => { const fetchSelectPassports = async () => { try { const result = await fetchCanUsePassports(); - passportTypeOptions.value = result.listSource.map((item) => ({ + passportTypeOptions.value = result.Items.map((item) => ({ label: item[PassportFields.NAME], value: item[PassportFields.NUMBER], })); @@ -226,7 +226,7 @@ const fetchSelectPassports = async () => { const fetchSelectCustoTypes = async () => { try { const result = await fetchCanUseCustomerTypes(); - customerTypeOptions.value = result.listSource.map((item) => ({ + customerTypeOptions.value = result.Items.map((item) => ({ label: item[CustomerTypeFields.NAME], value: item[CustomerTypeFields.NUMBER], })); @@ -257,7 +257,7 @@ const showModal = () => { form[CustomerFields.PHONE] = ''; form[CustomerFields.ADDRESS] = ''; - form.modifystatus = 'insert'; + form[CustomerFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -279,16 +279,16 @@ const editCustomer = (record) => { form[CustomerFields.PHONE] = record[CustomerFields.PHONE]; form[CustomerFields.ADDRESS] = record[CustomerFields.ADDRESS]; - form.modifystatus = 'update'; + form[CustomerFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[CustomerFields.MODIFYSTATUS] === 'update') { var response = await updateCustomer({ ...form,[CustomerFields.BIRTH_DATE]:form[CustomerFields.BIRTH_DATE]?form[CustomerFields.BIRTH_DATE].format('YYYY-MM-DD'):null}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -298,7 +298,7 @@ const handleModalOk = async () => { } } else { var response = await addCustomer({ ...form,[CustomerFields.BIRTH_DATE]:form[CustomerFields.BIRTH_DATE]?form[CustomerFields.BIRTH_DATE].format('YYYY-MM-DD'):null}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -324,7 +324,7 @@ const handleDelete = async (record) => { try { record[CustomerFields.IS_DELETED] = 1; var response = await deleteCustomer(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } diff --git a/src/views/customermanagement/VipLevelView.vue b/src/views/customermanagement/VipLevelView.vue index 14828f858d53ebaa4bc5d91695cba8942aa757e1..88a707f771809adb4bc11592b2facc0d9144b0b2 100644 --- a/src/views/customermanagement/VipLevelView.vue +++ b/src/views/customermanagement/VipLevelView.vue @@ -111,12 +111,12 @@ const fetchVipRuleData = async () => { loading.value = true; try { const result = await fetchVipRules({ - page: pagination.current, - pageSize: pagination.pageSize, + [VipRuleFields.PAGE]: pagination.current, + [VipRuleFields.PAGE_SIZE]: pagination.pageSize, [VipRuleFields.IS_DELETED]: 0, }); - if (result?.listSource) { - viprules.value = result.listSource.map(item => ({ + if (result?.Items) { + viprules.value = result.Items.map(item => ({ [VipRuleFields.ID]: item[VipRuleFields.ID], [VipRuleFields.NUMBER]: item[VipRuleFields.NUMBER], [VipRuleFields.NAME]: item[VipRuleFields.NAME], @@ -124,7 +124,7 @@ const fetchVipRuleData = async () => { [VipRuleFields.CUSTOMER_TYPE_ID]: item[VipRuleFields.CUSTOMER_TYPE_ID], [VipRuleFields.CUSTOMER_TYPE_NAME]: item[VipRuleFields.CUSTOMER_TYPE_NAME] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -139,7 +139,7 @@ const fetchSelectCustomerTypes = async () => { [VipRuleFields.IS_DELETED]: 0, [VipRuleFields.IGNOREPAGING]: true, }); - custoTypeOptions.value = result.listSource.map((item) => ({ + custoTypeOptions.value = result.Items.map((item) => ({ label: item.CustomerTypeName, value: item.CustomerType, })); @@ -163,7 +163,7 @@ const showModal = () => { form[VipRuleFields.NAME] = ''; form[VipRuleFields.VALUE] = null; form[VipRuleFields.CUSTOMER_TYPE_ID] = null; - form.modifystatus = 'insert'; + form[VipRuleFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -180,16 +180,16 @@ const editVipRule = (record) => { form[VipRuleFields.VALUE] = record[VipRuleFields.VALUE]; form[VipRuleFields.CUSTOMER_TYPE_ID] = record[VipRuleFields.CUSTOMER_TYPE_ID]; form[VipRuleFields.IS_DELETED] = record[[VipRuleFields.IS_DELETED]]; - form.modifystatus = 'update'; + form[VipRuleFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[VipRuleFields.MODIFYSTATUS] === 'update') { var response = await updateVipRule({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -199,7 +199,7 @@ const handleModalOk = async () => { } } else { var response = await addVipRule({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -225,7 +225,7 @@ const handleDelete = async (record) => { try { record[VipRuleFields.IS_DELETED] = 1; var response = await deleteVipRule(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } diff --git a/src/views/dashboard/DashboardView.vue b/src/views/dashboard/DashboardView.vue index 42dc22ef23dbd395e0fe30780872e4bbe6afbaeb..82478639dd1b1c292bb61e15b496083701a1d790 100644 --- a/src/views/dashboard/DashboardView.vue +++ b/src/views/dashboard/DashboardView.vue @@ -226,7 +226,7 @@ const loadData = async () => { fetchHumanResourcesStatistics() ]) - if (roomRes.StatusCode === 200) { + if (roomRes.Success) { roomData.value = { Status: roomRes.Status || {}, Types: roomRes.Types || [], @@ -234,7 +234,7 @@ const loadData = async () => { } } - if (bizRes.StatusCode === 200) { + if (bizRes.Success) { businessData.value = { ...businessData.value, GenderRatio: { @@ -261,7 +261,7 @@ const loadData = async () => { } } - if (logRes.StatusCode === 200) { + if (logRes.Success) { logisticsData.value = { TotalProducts: logRes.TotalProducts || 0, InventoryWarning: logRes.InventoryWarning || null, @@ -276,7 +276,7 @@ const loadData = async () => { showErrorNotification(`后勤数据加载失败: ${logRes.Message}`) } - if (hrRes.StatusCode === 200) { + if (hrRes.Success) { hrData.value = { TotalEmployees: hrRes.TotalEmployees || 0, TotalDepartments: hrRes.TotalDepartments || 0, @@ -438,19 +438,6 @@ const getProgressStatus = (status) => { } } -const calcSettledPercent = (consumption) => { - if (!consumption || consumption.Total <= 0) return 0 - return Math.round((consumption.Settled / consumption.Total) * 100) -} - -const utcToLocal = (utcDate) => { - try { - return new Date(utcDate.getTime() - (utcDate.getTimezoneOffset() * 60000)) - } catch { - return new Date() - } -} - onMounted(() => { loadData() window.addEventListener('resize', initCharts) diff --git a/src/views/finance/InternalFinanceView.vue b/src/views/finance/InternalFinanceView.vue index 2ef55432a426a89c54d4d975951f09588b0ef0a8..140f8eb7e0aee0e87ac33e214d97a240ba6ca27b 100644 --- a/src/views/finance/InternalFinanceView.vue +++ b/src/views/finance/InternalFinanceView.vue @@ -130,12 +130,12 @@ const fetchInternalfinanceData = async () => { loading.value = true; try { const result = await fetchInternalFinances({ - page: pagination.current, - pageSize: pagination.pageSize, + [InternalFinanceFields.PAGE]: pagination.current, + [InternalFinanceFields.PAGE_SIZE]: pagination.pageSize, [InternalFinanceFields.IS_DELETED]: 0 }); - if (result?.listSource) { - cashs.value = result.listSource.map(item => ({ + if (result?.Items) { + cashs.value = result.Items.map(item => ({ [InternalFinanceFields.ID]: item[InternalFinanceFields.ID], [InternalFinanceFields.NUMBER]: item[InternalFinanceFields.NUMBER], [InternalFinanceFields.NAME]: item[InternalFinanceFields.NAME], @@ -149,9 +149,7 @@ const fetchInternalfinanceData = async () => { [InternalFinanceFields.ACQUIREDBYEMPLOYEENAME]: item[InternalFinanceFields.ACQUIREDBYEMPLOYEENAME], [InternalFinanceFields.IS_DELETED]: item[InternalFinanceFields.IS_DELETED] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -164,10 +162,9 @@ const fetchSelectDepartments = async () => { try { const result = await fetchDepartments({ [DepartmentFields.IS_DELETED]: 0, - page: 1, - pageSize: 9999 + [DepartmentFields.IGNOREPAGING]: true }); - departmentOptions.value = result.listSource.map((item) => ({ + departmentOptions.value = result.Items.map((item) => ({ label: item[DepartmentFields.NAME], value: item[DepartmentFields.NUMBER], })); @@ -180,10 +177,9 @@ const fetchSelectPersons = async () => { try { const result = await fetchEmployees({ [EmployeeFields.IS_DELETED]: 0, - page: 1, - pageSize: 9999 + [EmployeeFields.IGNOREPAGING]: true }); - personOptions.value = result.listSource.map((item) => ({ + personOptions.value = result.Items.map((item) => ({ label: item[EmployeeFields.NAME], value: item[EmployeeFields.NUMBER], })); @@ -212,7 +208,7 @@ const showModal = () => { form[InternalFinanceFields.ASSETSOURCE] = ''; form[InternalFinanceFields.ACQUIREDBYEMPLOYEE] = null; form[InternalFinanceFields.IS_DELETED] = 0; - form.modifystatus = 'insert'; + form[InternalFinanceFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -231,16 +227,16 @@ const editInternalfinance = (record) => { form[InternalFinanceFields.ACQUISITIONDATE] = dayjs(record[InternalFinanceFields.ACQUISITIONDATE], 'YYYY-MM-DD HH:mm:ss') form[InternalFinanceFields.ASSETSOURCE] = record[InternalFinanceFields.ASSETSOURCE]; form[InternalFinanceFields.ACQUIREDBYEMPLOYEE] = record[InternalFinanceFields.ACQUIREDBYEMPLOYEE]; - form.modifystatus = 'update'; + form[InternalFinanceFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[InternalFinanceFields.MODIFYSTATUS] === 'update') { var response = await updateInternalFinance({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -250,7 +246,7 @@ const handleModalOk = async () => { } } else { var response = await addInternalFinance({ ...form}); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -276,7 +272,7 @@ const handleDelete = async (record) => { try { record[InternalFinanceFields.IS_DELETED] = 1; var response = await deleteInternalFinance(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } @@ -290,9 +286,9 @@ const handleDelete = async (record) => { } }; -const handleTableChange = (newPagicash) => { - pagination.current = newPagicash.current; - pagination.pageSize = newPagicash.pageSize; +const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchInternalfinanceData(); }; diff --git a/src/views/humanresourcemanagement/EmployeeDetailView.vue b/src/views/humanresourcemanagement/EmployeeDetailView.vue index 696d9d23ff09dccd091e3ce00912d7a2dc71e5c3..449e356e7c79195694e689bbf7ba74a84ccda634 100644 --- a/src/views/humanresourcemanagement/EmployeeDetailView.vue +++ b/src/views/humanresourcemanagement/EmployeeDetailView.vue @@ -293,14 +293,14 @@ const customUpload = async ({ file, onProgress, onSuccess, onError }) => { progressText.value = t('message.uploadSuccess'); await new Promise(resolve => setTimeout(resolve, 800)); - if (response?.StatusCode === 200) { + if (response?.Success) { uploadStatus.value = 'success'; showSuccessNotification(t('message.avatarUpdateSuccess')); - avatarUrl.value = response.Source.PhotoPath || ''; + avatarUrl.value = response.Data.PhotoPath || ''; avatarPreviewUrl.value = ''; onSuccess(response, file); } else { - throw new Error(response?.message || t('message.uploadFailed')); + throw new Error(response?.Message || t('message.uploadFailed')); } } catch (error) { uploadStatus.value = 'exception'; @@ -354,8 +354,8 @@ const loadModalData = async () => { modalLoading.value = true; const params = { [EmployeeFields.NUMBER]: employeeId, - Page: modalPagination.value.current, - PageSize: modalPagination.value.pageSize, + [EmployeeFields.PAGE]: modalPagination.value.current, + [EmployeeFields.PAGE_SIZE]: modalPagination.value.pageSize, }; let response; @@ -365,9 +365,9 @@ const loadModalData = async () => { response = await fetchEmployeeAttendance(params); } - if (response?.listSource) { - modalData.value = response.listSource; - modalPagination.value.total = response.total || 0; + if (response?.Items) { + modalData.value = response.Items; + modalPagination.value.total = response.TotalCount || 0; } } finally { modalLoading.value = false; @@ -403,9 +403,8 @@ const loadData = async () => { const infoRes = await fetchEmployeeDetail({ [EmployeeFields.NUMBER]: employeeId }); - - if (infoRes?.Source) { - employeeInfo.value = infoRes.Source; + if (infoRes?.Success) { + employeeInfo.value = infoRes.Data; pageTitle.value = `${t('message.employeeDetail')} - ${employeeInfo.value[EmployeeFields.NUMBER]}`; if (employeeInfo.value.PhotoUrl) { @@ -417,8 +416,8 @@ const loadData = async () => { [EmployeeFields.NUMBER]: employeeId }); - if (historyRes?.listSource) { - workHistory.value = historyRes.listSource.map(item => ({ + if (historyRes?.Items) { + workHistory.value = historyRes.Items.map(item => ({ ...item, DateRange: `${formatDate(item.StartDate)} - ${formatDate(item.EndDate)}` })); @@ -426,24 +425,24 @@ const loadData = async () => { const rewardPunishmentRes = await fetchEmployeeRewardPunishment({ [EmployeeFields.NUMBER]: employeeId, - Page: 1, - PageSize: 3 + [EmployeeFields.PAGE]: 1, + [EmployeeFields.PAGE_SIZE]: 3 }); - if (rewardPunishmentRes?.listSource) { - workRewardPunishment.value = rewardPunishmentRes.listSource.map(item => ({ + if (rewardPunishmentRes?.Items) { + workRewardPunishment.value = rewardPunishmentRes.Items.map(item => ({ ...item })); } const attendanceRes = await fetchEmployeeAttendance({ [EmployeeFields.NUMBER]: employeeId, - Page: 1, - PageSize: 3 + [EmployeeFields.PAGE]: 1, + [EmployeeFields.PAGE_SIZE]: 3 }); - if(attendanceRes?.listSource) { - workCheckInfo.value = attendanceRes.listSource.map(item => ({ + if(attendanceRes?.Items) { + workCheckInfo.value = attendanceRes.Items.map(item => ({ ...item })); } diff --git a/src/views/humanresourcemanagement/StaffManagementView.vue b/src/views/humanresourcemanagement/StaffManagementView.vue index 4284bc962e04b6f6b939ff3ce002efe00d506163..66e0a979fe293c3b90fec83689100f8450c5d83a 100644 --- a/src/views/humanresourcemanagement/StaffManagementView.vue +++ b/src/views/humanresourcemanagement/StaffManagementView.vue @@ -228,7 +228,6 @@ import { PassportFields } from '@/entities/passport.entity'; import { formatDate, showErrorNotification, showSuccessNotification } from '@/utils/index'; import { useI18n } from 'vue-i18n'; import generateSnowflakeId from '@/utils/snowflake'; -import { dateFieldConfig } from '@/config/dateFields'; import dayjs from 'dayjs'; const { t } = useI18n(); @@ -250,10 +249,6 @@ const staffDepartmentOptions = ref([]); const staffPositionOptions = ref([]); const passportTypeOptions = ref([]); -const getDateFormat = () => 'YYYY-MM-DD'; - -const getValueFormat = () => 'YYYY-MM-DD'; - const viewDetail = (record) => { router.push({ path: `/employeedetail/${record[EmployeeFields.NUMBER]}` @@ -291,12 +286,12 @@ const queryAddress = debounce(async (idCard) => { IdentityCardNumber:idCard }); - if (result?.Source) { + if (result?.Success) { const { Province = '', City = '', District = '' - } = result?.Source || {}; + } = result || {}; const fullAddress = [Province, City, District] .filter(part => part?.trim()) .join(''); @@ -333,12 +328,12 @@ const fetchStaffData = async () => { loading.value = true; try { const result = await fetchEmployees({ - page: pagination.current, - pageSize: pagination.pageSize, + [EmployeeFields.PAGE]: pagination.current, + [EmployeeFields.PAGE_SIZE]: pagination.pageSize, [EmployeeFields.IS_DELETED]: 0, }); - if(result?.listSource){ - staffs.value = result.listSource.map(item => ({ + if(result?.Items){ + staffs.value = result.Items.map(item => ({ [EmployeeFields.ID]: item[EmployeeFields.ID], [EmployeeFields.NUMBER]: item[EmployeeFields.NUMBER], [EmployeeFields.NAME]: item[EmployeeFields.NAME], @@ -365,7 +360,7 @@ const fetchStaffData = async () => { [EmployeeFields.EMAILADDRESS]: item[EmployeeFields.EMAILADDRESS], [EmployeeFields.ISENABLE]: item[EmployeeFields.ISENABLE] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -377,7 +372,7 @@ const fetchStaffData = async () => { const fetchSelectPassports = async () => { try { const result = await fetchCanUsePassports(); - passportTypeOptions.value = result.listSource.map((item) => ({ + passportTypeOptions.value = result.Items.map((item) => ({ label: item[PassportFields.NAME], value: item[PassportFields.NUMBER], })); @@ -392,7 +387,7 @@ const fetchSelectNations = async () => { [NationFields.IS_DELETED]: 0, [NationFields.IGNOREPAGING]: true }); - staffNationOptions.value = result.listSource.map((item) => ({ + staffNationOptions.value = result.Items.map((item) => ({ label: item[NationFields.NAME], value: item[NationFields.NUMBER], })); @@ -407,7 +402,7 @@ const fetchSelectQualifications = async () => { [EducationFields.IS_DELETED]: 0, [EducationFields.IGNOREPAGING]: true }); - staffQualificationOptions.value = result.listSource.map((item) => ({ + staffQualificationOptions.value = result.Items.map((item) => ({ label: item[EducationFields.NAME], value: item[EducationFields.NUMBER], })); @@ -422,7 +417,7 @@ const fetchSelectDepartments = async () => { [DepartmentFields.IS_DELETED]: 0, [DepartmentFields.IGNOREPAGING]: true }); - staffDepartmentOptions.value = result.listSource.map((item) => ({ + staffDepartmentOptions.value = result.Items.map((item) => ({ label: item[DepartmentFields.NAME], value: item[DepartmentFields.NUMBER], })); @@ -437,7 +432,7 @@ const fetchSelectPositions = async () => { [PositionFields.IS_DELETED]: 0, [PositionFields.IGNOREPAGING]: true }); - staffPositionOptions.value = result.listSource.map((item) => ({ + staffPositionOptions.value = result.Items.map((item) => ({ label: item[PositionFields.NAME], value: item[PositionFields.NUMBER], })); @@ -450,7 +445,7 @@ const fetchSelectWorkerFeatures = async () => { try { const result = await fetchWorkerFeatures({ }); - staffFeaturesOptions.value = result.listSource.map((item) => ({ + staffFeaturesOptions.value = result.Items.map((item) => ({ label: item.Description, value: item.Name, })); @@ -492,7 +487,7 @@ const showModal = () => { form[EmployeeFields.EMAILADDRESS] = ''; form[EmployeeFields.POLITICALAFFILIATION] = null; - form.modifystatus = 'insert'; + form[EmployeeFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -526,7 +521,7 @@ const editStaff = (record) => { form[EmployeeFields.ISENABLE] = record[EmployeeFields.ISENABLE]; form[EmployeeFields.IS_DELETED] = record[EmployeeFields.IS_DELETED]; - form.modifystatus = 'update'; + form[EmployeeFields.MODIFYSTATUS] = 'update'; }; const disabledStaff = async (record) => { @@ -536,7 +531,7 @@ const disabledStaff = async (record) => { const resetPassword = async (record) => { var result = await resetEmployeePassword({ [EmployeeFields.NUMBER]: record[EmployeeFields.NUMBER] }); - if(result.StatusCode !== 200){ + if(result.Success === false){ showErrorNotification(result.Message); } else @@ -555,10 +550,9 @@ const handleModalOk = async () => { }; await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { - console.log(payload); + if (form[EmployeeFields.MODIFYSTATUS] === 'update') { var response = await updateEmployee(payload); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } @@ -568,7 +562,7 @@ const handleModalOk = async () => { } } else { var response = await addEmployee(payload); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } @@ -594,7 +588,7 @@ const handleDelete = async (record) => { try { record[EmployeeFields.IS_DELETED] = 1; var response = await updateEmployee(record); - if(response && response.StatusCode === 200) + if(response && response.Success) { showSuccessNotification(t('message.deleteSuccess')); } diff --git a/src/views/hydroelectricity/HydroelectricityInfoView.vue b/src/views/hydroelectricity/HydroelectricityInfoView.vue index abc783789b3bebf1e4e22c44958d7097d2c1dfc1..0eda896184e5a6bfc7de99f95dbf9028143a2abb 100644 --- a/src/views/hydroelectricity/HydroelectricityInfoView.vue +++ b/src/views/hydroelectricity/HydroelectricityInfoView.vue @@ -101,12 +101,12 @@ const fetchHydroelectricityData = async () => { loading.value = true; try { const result = await fetchHydroelectricitys({ - page: pagination.current, - pageSize: pagination.pageSize, + [EnergyManagementFields.PAGE]: pagination.current, + [EnergyManagementFields.PAGE_SIZE]: pagination.pageSize, [EnergyManagementFields.IS_DELETED]: 0 }); - if (result?.listSource) { - hydroelectricitys.value = result.listSource.map(item => ({ + if (result?.Items) { + hydroelectricitys.value = result.Items.map(item => ({ [EnergyManagementFields.ID]: item[EnergyManagementFields.ID], [EnergyManagementFields.NUMBER]: item[EnergyManagementFields.NUMBER], [EnergyManagementFields.ROOMNUMBER]: item[EnergyManagementFields.ROOMNUMBER], @@ -118,7 +118,7 @@ const fetchHydroelectricityData = async () => { [EnergyManagementFields.RECORDER]: item[EnergyManagementFields.RECORDER], [EnergyManagementFields.IS_DELETED]: item[EnergyManagementFields.IS_DELETED] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } else { throw new Error('数据格式错误'); } @@ -145,20 +145,18 @@ const editHydroelectricity = (record) => { form[EnergyManagementFields.WATERUSAGE] = record[EnergyManagementFields.WATERUSAGE]; form[EnergyManagementFields.POWERUSAGE] = record[EnergyManagementFields.POWERUSAGE]; form[EnergyManagementFields.RECORDER] = record[EnergyManagementFields.RECORDER]; - form.modifystatus = 'update'; + form[EnergyManagementFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[EnergyManagementFields.MODIFYSTATUS] === 'update') { var response = await updateHydroelectricity({ ...form,[EnergyManagementFields.STARTDATE]:form[EnergyManagementFields.STARTDATE]?form[EnergyManagementFields.STARTDATE].format('YYYY-MM-DD HH:mm:ss'):null,[EnergyManagementFields.ENDDATE]:form[EnergyManagementFields.ENDDATE]?form[EnergyManagementFields.ENDDATE].format('YYYY-MM-DD HH:mm:ss'):null}); - if (response.code !== 200) { - showErrorNotification(response.message); - return; + if (response.Success) { + showSuccessNotification(t('message.updateSuccess')); } - showSuccessNotification(t('message.updateSuccess')); } modalVisible.value = false; fetchHydroelectricityData(); @@ -182,11 +180,9 @@ const handleDelete = async (record) => { try { record[EnergyManagementFields.IS_DELETED] = 1; var response = await deleteHydroelectricity(record); - if (response.code !== 200) { - showErrorNotification(response.message); - return; + if (response.Success) { + showSuccessNotification(t('message.deleteSuccess')); } - showSuccessNotification(t('message.deleteSuccess')); fetchHydroelectricityData(); } catch (error) { showErrorNotification(t('message.pleaseTryAgainLater')); diff --git a/src/views/materialmanagement/GoodsmanagementView.vue b/src/views/materialmanagement/GoodsmanagementView.vue index 4863d8c5f5f240458b93805d77071be8ff86f84f..b4b9eb8c05d3d286ec3713b8d6bdaf6a1ef5b49d 100644 --- a/src/views/materialmanagement/GoodsmanagementView.vue +++ b/src/views/materialmanagement/GoodsmanagementView.vue @@ -104,12 +104,12 @@ const fetchGoodsData = async () => { loading.value = true; try { const result = await fetchGoodss({ - page: pagination.current, - pageSize: pagination.pageSize, + [GoodsFields.PAGE]: pagination.current, + [GoodsFields.PAGE_SIZE]: pagination.pageSize, [GoodsFields.IS_DELETED]: 0 }); - if (result?.listSource) { - goodss.value = result.listSource.map(item => ({ + if (result?.Items) { + goodss.value = result.Items.map(item => ({ [GoodsFields.ID]: item[GoodsFields.ID], [GoodsFields.NUMBER]: item[GoodsFields.NUMBER], [GoodsFields.NAME]: item[GoodsFields.NAME], @@ -118,7 +118,7 @@ const fetchGoodsData = async () => { [GoodsFields.STOCK]: item[GoodsFields.STOCK], [GoodsFields.IS_DELETED]: item[GoodsFields.IS_DELETED] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.fetchDataFailed')); @@ -134,11 +134,14 @@ onMounted(() => { const showModal = () => { modalVisible.value = true; modalTitle.value = t('message.insertGoods'); - Object.assign(form, { - ...initialFormValues, - [GoodsFields.NUMBER]: generateSnowflakeId({ prefix: 'ST-' }), - modifystatus: 'insert' - }); + form[GoodsFields.ID] = null; + form[GoodsFields.NAME] = ''; + form[GoodsFields.SPECIFICATION] = ''; + form[GoodsFields.PRICE] = 0.00; + form[GoodsFields.STOCK] = 0; + form[GoodsFields.IS_DELETED] = 0; + form[GoodsFields.NUMBER] = generateSnowflakeId({ prefix: 'ST-' }); + form[GoodsFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -149,10 +152,14 @@ const refreshData = () => const editGoods = (record) => { modalVisible.value = true; modalTitle.value = t('message.updateGoods'); - Object.assign(form, { - ...record, - modifystatus: 'update' - }); + form[GoodsFields.ID] = record[GoodsFields.ID]; + form[GoodsFields.NAME] = record[GoodsFields.NAME]; + form[GoodsFields.SPECIFICATION] = record[GoodsFields.SPECIFICATION]; + form[GoodsFields.PRICE] = record[GoodsFields.PRICE]; + form[GoodsFields.STOCK] = record[GoodsFields.STOCK]; + form[GoodsFields.IS_DELETED] = record[GoodsFields.IS_DELETED]; + form[GoodsFields.NUMBER] = record[GoodsFields.NUMBER]; + form[GoodsFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { @@ -166,16 +173,16 @@ const handleModalOk = async () => { [GoodsFields.STOCK]: Math.floor(form[GoodsFields.STOCK]) }; - if (form.modifystatus === 'update') { + if (form[GoodsFields.MODIFYSTATUS] === 'update') { var response = await updateGoods(payload); - if (response && response.StatusCode !== 200) { + if (response && response.Success === false) { showErrorNotification(response.message); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addGoods(payload); - if (response && response.StatusCode !== 200) { + if (response && response.Success === false) { showErrorNotification(response.message); return; } @@ -197,9 +204,9 @@ const handleModalCancel = () => { const handleDelete = async (record) => { try { - record[DepartmentFields.IS_DELETED] = 1; - var response = await deleteDepartment(record); - if (response && response.StatusCode === 200) { + record[GoodsFields.IS_DELETED] = 1; + var response = await deleteGoods(record); + if (response && response.Success === false) { showErrorNotification(response.message); return; } diff --git a/src/views/operationmanagement/OperationLogView.vue b/src/views/operationmanagement/OperationLogView.vue index 576f625e1f4e8aa973a882316d6f02dcaad59f28..d512382e72260fb510a9d82b8ae041f8e93c0625 100644 --- a/src/views/operationmanagement/OperationLogView.vue +++ b/src/views/operationmanagement/OperationLogView.vue @@ -5,9 +5,9 @@ {{ $t('message.refreshData') }} - - {{ $t('message.deleteLogBySevenDays') }} - + + {{ $t('message.deleteLogBySevenDays') }} + t(getPageTitle(route.path))); const columns = computed(() => getColumns(t)); -const levelOptions = [ - { label: t('message.normal'), value: 100 }, - { label: t('message.warning'), value: 200 }, - { label: t('message.error'), value: 300 } -]; - const fetchLogData = async () => { loading.value = true; try { const params = { - page: pagination.current, - pageSize: pagination.pageSize, + [LogFields.PAGE]: pagination.current, + [LogFields.PAGE_SIZE]: pagination.pageSize, [LogFields.IS_DELETED]: 0 }; const result = await fetchOperationlogs(params); - if (result?.listSource) { - logs.value = result.listSource.map(item => ({ + if (result?.Items) { + logs.value = result.Items.map(item => ({ ...item, [LogFields.LEVELNAME]: getLevelName(item[LogFields.LEVEL]) })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message); @@ -121,28 +114,34 @@ const handleTableChange = (newPagination) => { fetchLogData(); }; -const deleteLogBySevenDays = () => { - const now = new Date(); - - const sevenDaysAgoStart = new Date(now); - sevenDaysAgoStart.setDate(now.getDate() - 7); - sevenDaysAgoStart.setHours(0, 0, 0, 0); - - const sevenDaysAgoEnd = new Date(sevenDaysAgoStart); - sevenDaysAgoEnd.setHours(23, 59, 59, 999); - - deleteOperationlogByRange({ - startTime: sevenDaysAgoStart.toISOString(), - endTime: sevenDaysAgoEnd.toISOString() - }); - - fetchLogData(); +const deleteLogBySevenDays = async () => { + try { + const now = getLocalDate(); + + const sevenDaysAgo = new Date(now); + sevenDaysAgo.setDate(now.getDate() - 7); + + const response = await deleteOperationlogByRange({ + [LogFields.STARTTIME]: sevenDaysAgo.toISOString(), + [LogFields.ENDTIME]: now.toISOString() + }); + + if (!response?.Success) { + showErrorNotification(response?.Error || t('message.deleteFailed')); + return; + } + + showSuccessNotification(t('message.deleteSuccess')); + fetchLogData(); + } catch (error) { + showErrorNotification(error.message || t('message.generalError')); + } }; const handleDelete = async (record) => { try { - var response = deleteOperationlog(record[LogFields.ID]); - if (response && response.StatusCode !== 200) { + var response = deleteOperationlog(record[LogFields.NUMBER]); + if (response && response.Success !== true) { showErrorNotification(error.message || t('message.deleteFailed')); return; } diff --git a/src/views/operationmanagement/RequestLogView.vue b/src/views/operationmanagement/RequestLogView.vue index 6f7b74416520b0ce762e95696ee84a8b02c51006..b268ae5fa72318482e275b14797fba3e977b37b0 100644 --- a/src/views/operationmanagement/RequestLogView.vue +++ b/src/views/operationmanagement/RequestLogView.vue @@ -35,11 +35,10 @@ import { SyncOutlined, GlobalOutlined } from '@ant-design/icons-vue'; import { LogFields, - initialFormValues, getColumns } from '@/entities/requestlog.entity'; import { fetchRequestlogs } from '@/api/utilityapi'; - import { showErrorNotification, showSuccessNotification } from '@/utils/index'; + import { showErrorNotification } from '@/utils/index'; import { getPageTitle } from '@/utils/pageTitle'; const { t } = useI18n(); @@ -66,17 +65,17 @@ loading.value = true; try { const params = { - page: pagination.current, - pageSize: pagination.pageSize, + [LogFields.PAGE]: pagination.current, + [LogFields.PAGE_SIZE]: pagination.pageSize, [LogFields.IS_DELETED]: 0 }; const result = await fetchRequestlogs(params); - if (result?.listSource) { - logs.value = result.listSource.map(item => ({ + if (result?.Items) { + logs.value = result.Items.map(item => ({ ...item })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message); diff --git a/src/views/roominformation/ReserManagementView.vue b/src/views/roominformation/ReserManagementView.vue index 117f9ea2596dae64c359ebe485bdf0aac67ece6f..8195cc5a7f665b79ed67031e1b8bc1eef2111424 100644 --- a/src/views/roominformation/ReserManagementView.vue +++ b/src/views/roominformation/ReserManagementView.vue @@ -113,11 +113,11 @@ loading.value = true; try { const result = await fetchResers({ - page: pagination.current, - pageSize: pagination.pageSize, + [ReserFields.PAGE]: pagination.current, + [ReserFields.PAGE_SIZE]: pagination.pageSize, [ReserFields.IS_DELETED]: 0 }); - resers.value = result.listSource.map(item => ({ + resers.value = result.Items.map(item => ({ [ReserFields.ID]: item[ReserFields.ID], [ReserFields.NUMBER]: item[ReserFields.NUMBER], [ReserFields.PHONENUMBER]: item[ReserFields.PHONENUMBER], @@ -127,7 +127,7 @@ [ReserFields.STARTDATE]: item[ReserFields.STARTDATE], [ReserFields.ENDDATE]: item[ReserFields.ENDDATE] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); } finally { @@ -138,7 +138,7 @@ const fetchSelectRooms = async () => { try { const result = await fetchAvailableRooms(); - roomOptions.value = result.listSource.map((item) => ({ + roomOptions.value = result.Items.map((item) => ({ label: item[RoomFields.NO], value: item[RoomFields.NO], })); @@ -196,15 +196,15 @@ const fetchSelectRooms = async () => { confirmLoading.value = true; if (form[ReserFields.MODIFYSTATUS] === 'update') { var response = await updateReser({ ...form}); - if (response && response.StatusCode !== 200) { - showErrorNotification(t('message.operationTitle'), t('message.updateFailed')); + if (response && response.Success !== true) { + showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addReser({ ...form}); - if (response && response.StatusCode !== 200) { - showErrorNotification(t('message.operationTitle'), t('message.addFailed')); + if (response && response.Success !== true) { + showErrorNotification(t('message.addFailed')); return; } showSuccessNotification(t('message.addSuccess')); @@ -226,8 +226,8 @@ const fetchSelectRooms = async () => { try { record[ReserFields.IS_DELETED] = 1; var response = await deleteReser(record); - if (response && response.StatusCode !== 200) { - showErrorNotification(t('message.operationTitle'), t('message.deleteFailed')); + if (response && response.Success !== true) { + showErrorNotification(t('message.deleteFailed')); return; } showSuccessNotification(t('message.deleteSuccess')); diff --git a/src/views/roominformation/RoomConfigView.vue b/src/views/roominformation/RoomConfigView.vue index cf68d2b4116a7f4a9038d6faa23d1bff745f80b5..d35c18fb57d9f80ce26fd2ebe914a4ef891a95ef 100644 --- a/src/views/roominformation/RoomConfigView.vue +++ b/src/views/roominformation/RoomConfigView.vue @@ -113,19 +113,19 @@ const fetchRoomConfigData = async () => { loading.value = true; try { const result = await fetchRoomTypes({ - page: pagination.current, - pageSize: pagination.pageSize, + [RoomConfigFields.PAGE]: pagination.current, + [RoomConfigFields.PAGE_SIZE]: pagination.pageSize, [RoomConfigFields.IS_DELETED]: 0 }); - if (result?.listSource) { - roomconfigs.value = result.listSource.map(item => ({ + if (result?.Items) { + roomconfigs.value = result.Items.map(item => ({ [RoomConfigFields.ID]: item[RoomConfigFields.ID], [RoomConfigFields.NO]: item[RoomConfigFields.NO], [RoomConfigFields.NAME]: item[RoomConfigFields.NAME], [RoomConfigFields.RENT]: item[RoomConfigFields.RENT], [RoomConfigFields.DEPOSIT]: item[RoomConfigFields.DEPOSIT] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -146,7 +146,7 @@ const showModal = () => { form[RoomConfigFields.RENT] = 0; form[RoomConfigFields.DEPOSIT] = 0; - form.modifystatus = 'insert'; + form[RoomConfigFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -163,23 +163,23 @@ const editRoomConfig = (record) => { form[RoomConfigFields.RENT] = record[RoomConfigFields.RENT]; form[RoomConfigFields.DEPOSIT] = record[RoomConfigFields.DEPOSIT]; - form.modifystatus = 'update'; + form[RoomConfigFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[RoomConfigFields.MODIFYSTATUS] === 'update') { var response = await updateRoomType({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addRoomType({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.addFailed')); return; } @@ -202,7 +202,7 @@ const handleDelete = async (record) => { try { record[RoomConfigFields.IS_DELETED] = 1; var response = await deleteRoomType(record); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.deleteFailed')); return; } diff --git a/src/views/roominformation/RoomManagementView.vue b/src/views/roominformation/RoomManagementView.vue index f1772abe50e94ffd7e91429c59c25b0ad6fbb13d..967768eb8a28c976578f5027f3b9c63c434d38b7 100644 --- a/src/views/roominformation/RoomManagementView.vue +++ b/src/views/roominformation/RoomManagementView.vue @@ -121,11 +121,11 @@ const fetchRoomData = async () => { loading.value = true; try { const result = await fetchRooms({ - page: pagination.current, - pageSize: pagination.pageSize, + [RoomFields.PAGE]: pagination.current, + [RoomFields.PAGE_SIZE]: pagination.pageSize, [RoomFields.IS_DELETED]: 0 }); - rooms.value = result.listSource.map(item => ({ + rooms.value = result.Items.map(item => ({ [RoomFields.ID]: item[RoomFields.ID], [RoomFields.NO]: item[RoomFields.NO], [RoomFields.NAME]: item[RoomFields.NAME], @@ -137,7 +137,7 @@ const fetchRoomData = async () => { [RoomFields.DEPOSIT]: item[RoomFields.DEPOSIT], [RoomFields.POSITION]: item[RoomFields.POSITION] })); - pagination.total = result.total; + pagination.total = result.TotalCount; } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); } finally { @@ -151,7 +151,7 @@ const fetchSelectRoomTypes = async () => { [RoomFields.IS_DELETED]: 0, [RoomFields.IGNOREPAGING]: true }); - roomTypeOptions.value = result.listSource.map((item) => ({ + roomTypeOptions.value = result.Items.map((item) => ({ label: item.RoomTypeName, value: item.RoomTypeId, })); @@ -164,7 +164,7 @@ const fetchSelectRoomTypes = async () => { const fetchSelectRoomStates = async () => { try { const result = await fetchRoomStates(); - roomStateOptions.value = result.listSource.map((item) => ({ + roomStateOptions.value = result.Items.map((item) => ({ label: item.Description, value: item.Id, })); @@ -189,7 +189,7 @@ const showModal = () => { form[RoomFields.STATE_ID] = null; form[RoomFields.POSITION] = ''; - form.modifystatus = 'insert'; + form[RoomFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -208,23 +208,23 @@ const editRoom = (record) => { form[RoomFields.DEPOSIT] = record[RoomFields.DEPOSIT]; form[RoomFields.POSITION] = record[RoomFields.POSITION]; - form.modifystatus = 'update'; + form[RoomFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[RoomFields.MODIFYSTATUS] === 'update') { var response = await updateRoom({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addRoom({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.addFailed')); return; } @@ -247,7 +247,7 @@ const handleDelete = async (record) => { try { record[RoomFields.IS_DELETED] = 1; var response = await deleteRoom(record); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.deleteFailed')); return; } @@ -269,7 +269,7 @@ const handleSorterChange = (pagination, filters, sorter) => { }; const handleRoomTypeSelectChange = (value) => { form[RoomFields.TYPE] = value; - const foundData = roomTypes.value.listSource.find((item) => item.RoomTypeId === value); + const foundData = roomTypes.value.Items.find((item) => item.RoomTypeId === value); if (foundData) { form[RoomFields.RENT] = foundData.RoomRent; form[RoomFields.DEPOSIT] = foundData.RoomDeposit; diff --git a/src/views/roominformation/RoomMapView.vue b/src/views/roominformation/RoomMapView.vue index a6a300024ffe638757752ecb5965e92b1aed0bce..140591dc53f69ee1d32173d8177fee4a79a2fd1d 100644 --- a/src/views/roominformation/RoomMapView.vue +++ b/src/views/roominformation/RoomMapView.vue @@ -47,7 +47,7 @@ import { } from '@/entities/room.entity'; import { getPageTitle } from '@/utils/pageTitle'; import { fetchRooms } from '@/api/roomapi'; -import { formatDate, showErrorNotification, showSuccessNotification, formatCurrency } from '@/utils/index'; +import { formatDate, showErrorNotification, formatCurrency } from '@/utils/index'; import { useI18n } from 'vue-i18n'; import dayjs from 'dayjs'; @@ -68,8 +68,8 @@ const fetchRoomData = async () => { [RoomFields.IGNOREPAGING]: true }); - if (response?.listSource) { - rooms.value = response.listSource.map(item => ({ + if (response?.Items) { + rooms.value = response.Items.map(item => ({ [RoomFields.ID]: item[RoomFields.ID], [RoomFields.NO]: item[RoomFields.NO], [RoomFields.NAME]: item[RoomFields.NAME], diff --git a/src/views/supervision/SupervisionView.vue b/src/views/supervision/SupervisionView.vue index 7d1f8e35cd5100278139eac1f8aaea733d4282ca..c92f8265f7f74405b641a6d3ce9462acb9d4296d 100644 --- a/src/views/supervision/SupervisionView.vue +++ b/src/views/supervision/SupervisionView.vue @@ -112,12 +112,12 @@ const fetchSupervisionInfoData = async () => { loading.value = true; try { const result = await fetchSupervisionInfos({ - page: pagination.current, - pageSize: pagination.pageSize, + [SupervisionFields.PAGE]: pagination.current, + [SupervisionFields.PAGE_SIZE]: pagination.pageSize, [SupervisionFields.IS_DELETED]: 0 }); - if (result?.listSource) { - supervisioninfos.value = result.listSource.map(item => ({ + if (result?.Items) { + supervisioninfos.value = result.Items.map(item => ({ [SupervisionFields.ID]: item[SupervisionFields.ID], [SupervisionFields.CHECK_NO]: item[SupervisionFields.CHECK_NO], [SupervisionFields.CHECK_CLUB]: item[SupervisionFields.CHECK_CLUB], @@ -132,7 +132,7 @@ const fetchSupervisionInfoData = async () => { [SupervisionFields.DATA_CHG_USR]: item[SupervisionFields.DATA_CHG_USR], [SupervisionFields.DATA_CHG_DATE]: item[SupervisionFields.DATA_CHG_DATE], })); - pagination.total = result.total; + pagination.total = result.TotalCount; } else { throw new Error('数据格式错误'); } @@ -148,7 +148,7 @@ const fetchSelectDepartments = async () => { const result = await fetchDepartments({ [SupervisionFields.IS_DELETED]: 0 }); - departmentOptions.value = result.listSource.map((item) => ({ + departmentOptions.value = result.Items.map((item) => ({ label: item[DepartmentFields.NAME], value: item[DepartmentFields.NUMBER], })); @@ -170,7 +170,7 @@ const showModal = () => { prefix: 'SI-', separator: null, }); - form.modifystatus = 'insert'; + form[SupervisionFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => { @@ -183,7 +183,7 @@ const editSupervisionInfo = (record) => { Object.keys(SupervisionFields).forEach(field => { form[field] = record[field] || initialFormValues[field]; }); - form.modifystatus = 'update'; + form[SupervisionFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { @@ -191,21 +191,19 @@ const handleModalOk = async () => { await formRef.value.validate(); confirmLoading.value = true; const payload = { - ...form, - [SupervisionFields.DATA_INS_DATE]: form[SupervisionFields.DATA_INS_DATE]?.format('YYYY-MM-DD'), - [SupervisionFields.DATA_CHG_DATE]: dayjs().format('YYYY-MM-DD') + ...form }; - if (form.modifystatus === 'update') { + if (form[SupervisionFields.MODIFYSTATUS] === 'update') { var response = await updateSupervisionInfo(payload); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addSupervisionInfo(payload); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.addFailed')); return; } @@ -228,7 +226,7 @@ const handleDelete = async (record) => { try { record[SupervisionFields.IS_DELETED] = 1; var response = await deleteSupervisionInfo(record); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.deleteFailed')); return; } diff --git a/src/views/systemmanagement/AdminTypeManagementView.vue b/src/views/systemmanagement/AdminTypeManagementView.vue index b1067b25e46c391aa61386d2442d81bdb3e9d76d..cbb079fdf8e177673851d3378d8970f3df787fc9 100644 --- a/src/views/systemmanagement/AdminTypeManagementView.vue +++ b/src/views/systemmanagement/AdminTypeManagementView.vue @@ -77,19 +77,18 @@ loading.value = true; try { const result = await fetchAdminTypes({ - page: pagination.current, - pageSize: pagination.pageSize, + [AdministratorTypeFields.PAGE]: pagination.current, + [AdministratorTypeFields.PAGE_SIZE]: pagination.pageSize, [AdministratorTypeFields.IS_DELETED]: 0 }); - if (result?.listSource) { - roles.value = result.listSource.map(item => ({ + if (result?.Items) { + roles.value = result.Items.map(item => ({ [AdministratorTypeFields.ID]: item[AdministratorTypeFields.ID], [AdministratorTypeFields.NUMBER]: item[AdministratorTypeFields.NUMBER], - [AdministratorTypeFields.NAME]: item[AdministratorTypeFields.NAME] + [AdministratorTypeFields.NAME]: item[AdministratorTypeFields.NAME], + [AdministratorTypeFields.IS_DELETED]: item[AdministratorTypeFields.IS_DELETED] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -110,7 +109,7 @@ separator: null, }); form[AdministratorTypeFields.NAME] = ''; - form.modifystatus = 'insert'; + form[AdministratorTypeFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -124,23 +123,23 @@ form[AdministratorTypeFields.ID] = record[AdministratorTypeFields.ID]; form[AdministratorTypeFields.NUMBER] = record[AdministratorTypeFields.NUMBER]; form[AdministratorTypeFields.NAME] = record[AdministratorTypeFields.NAME]; - form.modifystatus = 'update'; + form[AdministratorTypeFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[AdministratorTypeFields.MODIFYSTATUS] === 'update') { var response = await updateAdminType({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addAdminType({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.addFailed')); return; } @@ -163,8 +162,8 @@ try { record[AdministratorTypeFields.IS_DELETED] = 1; var response = await deleteAdminType(record); - if (response && response.StatusCode !== 200) { - showErrorNotification(t('message.operationTitle'), t('message.deleteFailed')); + if (response && response.Success !== true) { + showErrorNotification(t('message.deleteFailed')); return; } showSuccessNotification(t('message.deleteSuccess')); @@ -174,13 +173,13 @@ } }; - const handleTableChange = (newPagirole) => { - pagirole.current = newPagirole.current; - pagirole.pageSize = newPagirole.pageSize; + const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchAdminTypeData(); }; - const handleSorterChange = (pagirole, filters, sorter) => { + const handleSorterChange = (pagination, filters, sorter) => { sortedInfo.value = sorter; }; \ No newline at end of file diff --git a/src/views/systemmanagement/AdministratorManagementView.vue b/src/views/systemmanagement/AdministratorManagementView.vue index 48ccd74dc820bcf359c9a2df139f37ad8cd5efe9..ed8a7d383ad94d49b8a744c3cba0fa6b038150fa 100644 --- a/src/views/systemmanagement/AdministratorManagementView.vue +++ b/src/views/systemmanagement/AdministratorManagementView.vue @@ -108,12 +108,12 @@ const fetchAdministratorData = async () => { loading.value = true; try { const result = await fetchAdmins({ - page: pagination.current, - pageSize: pagination.pageSize, + [AdministratorFields.PAGE]: pagination.current, + [AdministratorFields.PAGE_SIZE]: pagination.pageSize, [AdministratorFields.IS_DELETED]: 0 }); - if (result?.listSource) { - admins.value = result.listSource.map(item => ({ + if (result?.Items) { + admins.value = result.Items.map(item => ({ [AdministratorFields.ID]: item[AdministratorFields.ID], [AdministratorFields.NUMBER]: item[AdministratorFields.NUMBER], [AdministratorFields.NAME]: item[AdministratorFields.NAME], @@ -124,9 +124,7 @@ const fetchAdministratorData = async () => { [AdministratorFields.ISSUPERADMIN]: item[AdministratorFields.ISSUPERADMIN], [AdministratorFields.ISSUPERADMINDESCRIPTION]: item[AdministratorFields.ISSUPERADMINDESCRIPTION], })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -141,7 +139,7 @@ const fetchSelectAdminTypes = async () => { [AdministratorTypeFields.IS_DELETED]: 0, [AdministratorTypeFields.IGNOREPAGING]: true, }); - adminTypeOptions.value = result.listSource.map((item) => ({ + adminTypeOptions.value = result.Items.map((item) => ({ label: item[AdministratorTypeFields.NAME], value: item[AdministratorTypeFields.NUMBER], })); @@ -166,7 +164,7 @@ const showModal = () => { form[AdministratorFields.PASSWORD] = ''; form[AdministratorFields.TYPE] = ''; form[AdministratorFields.ISSUPERADMIN] = null; - form.modifystatus = 'insert'; + form[AdministratorFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -185,7 +183,7 @@ const editAdministrator = (record) => { form[AdministratorFields.TYPE] = record[AdministratorFields.TYPE]; form[AdministratorFields.ISSUPERADMIN] = record[AdministratorFields.ISSUPERADMIN]; form[AdministratorFields.ORIGINALPASSWORD] = record[AdministratorFields.PASSWORD]; - form.modifystatus = 'update'; + form[AdministratorFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { @@ -197,7 +195,7 @@ const handleModalOk = async () => { ...form, }; - if (form.modifystatus === 'update') { + if (form[AdministratorFields.MODIFYSTATUS] === 'update') { if (!submitData[AdministratorFields.PASSWORD]) { submitData[AdministratorFields.PASSWORD] = form.originalPassword; } @@ -206,16 +204,16 @@ const handleModalOk = async () => { } } - if (form.modifystatus === 'update') { + if (form[AdministratorFields.MODIFYSTATUS] === 'update') { var response = await updateAdmin(submitData); - if (response && response.StatusCode !== 200) { + if (response && response.Success === false) { showErrorNotification(t('message.updateFailed')); return; } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addAdmin(submitData); - if (response && response.StatusCode !== 200) { + if (response && response.Success === false) { showErrorNotification(t('message.addFailed')); return; } @@ -238,7 +236,7 @@ const handleDelete = async (record) => { try { record[AdministratorFields.IS_DELETED] = 1; var response = await deleteAdmin(record); - if (response && response.StatusCode !== 200) { + if (response && response.Success === false) { showErrorNotification(t('message.deleteFailed')); return; } diff --git a/src/views/systemmanagement/MenuManagementView.vue b/src/views/systemmanagement/MenuManagementView.vue index 257320e9363ca0cb5a5b9fe99278a913dd34e118..d71738e61149af0a725e7d1ad154521deaa9220e 100644 --- a/src/views/systemmanagement/MenuManagementView.vue +++ b/src/views/systemmanagement/MenuManagementView.vue @@ -93,12 +93,12 @@ loading.value = true; try { const result = await fetchMenus({ - page: pagination.current, - pageSize: pagination.pageSize, + [MenuFields.PAGE]: pagination.current, + [MenuFields.PAGE_SIZE]: pagination.pageSize, [MenuFields.IS_DELETED]: 0 }); - if (result?.listSource) { - roles.value = result.listSource.map(item => ({ + if (result?.Items) { + roles.value = result.Items.map(item => ({ [MenuFields.ID]: item[MenuFields.ID], [MenuFields.KEY]: item[MenuFields.KEY], [MenuFields.TITLE]: item[MenuFields.TITLE], @@ -106,9 +106,7 @@ [MenuFields.PARENT]: item[MenuFields.PARENT], [MenuFields.ICON]: item[MenuFields.ICON], })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(t('message.pleaseTryAgainLater')); @@ -124,7 +122,7 @@ const fetchSelectMenus = async () => { [MenuFields.IS_DELETED]: 0, [MenuFields.ID]: null, }); - menuOptions.value = result.listSource.map((item) => ({ + menuOptions.value = result.Items.map((item) => ({ label: item[MenuFields.TITLE], value: item[MenuFields.ID], })); @@ -146,7 +144,7 @@ const fetchSelectMenus = async () => { form[MenuFields.PATH] = ''; form[MenuFields.PARENT] = null; form[MenuFields.ICON] = ''; - form.modifystatus = 'insert'; + form[MenuFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -163,16 +161,16 @@ const fetchSelectMenus = async () => { form[MenuFields.PATH] = record[MenuFields.PATH]; form[MenuFields.PARENT] = record[MenuFields.PARENT]; form[MenuFields.ICON] = record[MenuFields.ICON]; - form.modifystatus = 'update'; + form[MenuFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[MenuFields.MODIFYSTATUS] === 'update') { var response = await updateMenu({ ...form}); - if(response && response.StatusCode === 200) { + if(response && response.Success) { showSuccessNotification(t('message.updateSuccess')); } else { @@ -180,7 +178,7 @@ const fetchSelectMenus = async () => { } } else { var response = await addMenu({ ...form}); - if(response && response.StatusCode === 200) { + if(response && response.Success) { showSuccessNotification(t('message.addSuccess')); } else { @@ -210,12 +208,16 @@ const fetchSelectMenus = async () => { record[MenuFields.PARENT] = record[MenuFields.PARENT]; record[MenuFields.ICON] = record[MenuFields.ICON]; record[MenuFields.IS_DELETED] = 1; - await deleteMenu(record); - showSuccessNotification(t('message.deleteSuccess')); + var response = await deleteMenu(record); + if(response && response.Success) { + showSuccessNotification(t('message.deleteSuccess')); + } + else { + showErrorNotification(response.Message); + } emitter.emit('refresh-menu'); fetchMenuData(); } catch (error) { - console.error('Delete error:', error); showErrorNotification(t('message.pleaseTryAgainLater')); } }; diff --git a/src/views/systemmanagement/RoleManagementView.vue b/src/views/systemmanagement/RoleManagementView.vue index 8d014daec00051e1e33b5bd287e0ae878fed9c58..c87a873c0de4493581a9baadfbe9d82204abafd1 100644 --- a/src/views/systemmanagement/RoleManagementView.vue +++ b/src/views/systemmanagement/RoleManagementView.vue @@ -81,20 +81,18 @@ loading.value = true; try { const result = await fetchRoles({ - page: pagination.current, - pageSize: pagination.pageSize, + [RoleFields.PAGE]: pagination.current, + [RoleFields.PAGE_SIZE]: pagination.pageSize, [RoleFields.IS_DELETED]: 0 }); - if (result?.listSource) { - roles.value = result.listSource.map(item => ({ + if (result?.Items) { + roles.value = result.Items.map(item => ({ [RoleFields.ID]: item[RoleFields.ID], [RoleFields.NUMBER]: item[RoleFields.NUMBER], [RoleFields.NAME]: item[RoleFields.NAME], [RoleFields.DESCRIPTION]: item[RoleFields.DESCRIPTION] })); - pagination.total = result.total; - } else { - throw new Error('数据格式错误'); + pagination.total = result.TotalCount; } } catch (error) { showErrorNotification(error.message || t('message.pleaseTryAgainLater')); @@ -116,7 +114,7 @@ }); form[RoleFields.NAME] = ''; form[RoleFields.DESCRIPTION] = ''; - form.modifystatus = 'insert'; + form[RoleFields.MODIFYSTATUS] = 'insert'; }; const refreshData = () => @@ -131,23 +129,23 @@ form[RoleFields.NUMBER] = record[RoleFields.NUMBER]; form[RoleFields.NAME] = record[RoleFields.NAME]; form[RoleFields.DESCRIPTION] = record[RoleFields.DESCRIPTION]; - form.modifystatus = 'update'; + form[RoleFields.MODIFYSTATUS] = 'update'; }; const handleModalOk = async () => { try { await formRef.value.validate(); confirmLoading.value = true; - if (form.modifystatus === 'update') { + if (form[RoleFields.MODIFYSTATUS] === 'update') { var response = await updateRole({ ...form}); - if (response && response.StatusCode !== 200) { - showErrorNotification(t('message.updateFailed')); - return; - } + if (response && response.Success !== true) { + showErrorNotification(t('message.updateFailed')); + return; + } showSuccessNotification(t('message.updateSuccess')); } else { var response = await addRole({ ...form}); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.addFailed')); return; } @@ -170,7 +168,7 @@ try { record[RoleFields.IS_DELETED] = 1; var response = await deleteRole(record); - if (response && response.StatusCode !== 200) { + if (response && response.Success !== true) { showErrorNotification(t('message.deleteFailed')); return; } @@ -181,13 +179,13 @@ } }; - const handleTableChange = (newPagirole) => { - pagirole.current = newPagirole.current; - pagirole.pageSize = newPagirole.pageSize; + const handleTableChange = (newPagination) => { + pagination.current = newPagination.current; + pagination.pageSize = newPagination.pageSize; fetchRoleData(); }; - const handleSorterChange = (pagirole, filters, sorter) => { + const handleSorterChange = (pagination, filters, sorter) => { sortedInfo.value = sorter; }; \ No newline at end of file
Welcome to the {{ translatedPageTitle }} page!