diff --git a/src/pages/Index/Settings/Lis.vue b/src/pages/Index/Settings/Lis.vue index d1372ea..40c4c48 100644 --- a/src/pages/Index/Settings/Lis.vue +++ b/src/pages/Index/Settings/Lis.vue @@ -1,10 +1,280 @@ - + + diff --git a/src/router/router.ts b/src/router/router.ts index 5f5c5b7..b34237c 100644 --- a/src/router/router.ts +++ b/src/router/router.ts @@ -118,12 +118,12 @@ router.beforeEach((to, from, next) => { return next('/login') // 保存当前访问的路径,用于登录后重定向 } // 判断是否需要 Admin 权限 - if ( - to.matched.some((record) => record.meta.requiresAdmin) && - user.usrRole !== 'Admin' - ) { - return next({ path: '/notFound' }) // 权限不足,重定向到首页或者其他页面 - } + // if ( + // to.matched.some((record) => record.meta.requiresAdmin) && + // user.usrRole !== 'Admin' + // ) { + // return next({ path: '/notFound' }) // 权限不足,重定向到首页或者其他页面 + // } } // next() // 删除这行,否则控制台警告 diff --git a/src/services/Index/settings/settings.ts b/src/services/Index/settings/settings.ts index 2b08a90..efaab6a 100644 --- a/src/services/Index/settings/settings.ts +++ b/src/services/Index/settings/settings.ts @@ -4,7 +4,7 @@ import apiClient from '../../../utils/axios' export const setTemperature = async (data: any) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setTemperature?val=${data}`, + `/api/v1/app/DeviceSetting/setTemperature?val=${data}`, ) return res.data } catch (error) { @@ -17,7 +17,7 @@ export const setLanguage = async (language: 'zh_CN' | 'en_US') => { console.log('修改语言', language) try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLanguage?val=${language}`, + `/api/v1/app/DeviceSetting/setLanguage?val=${language}`, ) return res.data } catch (error) { @@ -25,11 +25,52 @@ export const setLanguage = async (language: 'zh_CN' | 'en_US') => { } } +// 设置自动打印报告 +export const setAutoPrint = async (data: any) => { + try { + const res = await apiClient.post( + `/api/v1/app/DeviceSetting/setAutoPrint?val=${data}`, + ) + return res.data + } catch (error) { + console.log('设置自动打印出错', error) + } +} + +// 设置自动登出 +export const setAutoLogout = async (data: any) => { + try { + const res = await apiClient.post( + `/api/v1/app/DeviceSetting/setAutoLogout?val=${data}`, + ) + return res.data + } catch (error) { + console.log('设置自动登出出错', error) + } +} + +//获取系统设置 +export const getSystemSettings = async () => { + try { + const res = await apiClient.post('/api/v1/app/DeviceSetting/getSetting') + return res.data + } catch (error) { + console.log('获取系统设置出错', error) + } +} + +// LIS 相关 + +export type LISType = 'SINGLE_TRACK' | 'DOUBLE_TRACK' +export const LISTypeMap = { + SINGLE_TRACK: '单向', + DOUBLE_TRACK: '双向', +} // 设置LIS类型 -export const setLISType = async (data: any) => { +export const setLISType = async (data: LISType) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISType?val=${data}`, + `/api/v1/app/LISSetting/setLISType?val=${data}`, ) return res.data } catch (error) { @@ -37,11 +78,18 @@ export const setLISType = async (data: any) => { } } +export type LISSerialBaudrate = 'B9600' | 'B12800' | 'B19200' | 'B115200' +export const LISSerialBaudrateMap = { + B9600: '9,600bps', + B12800: '12,800bps', + B19200: '19,200bps', + B115200: '115,200bps', +} // 设置LIS串口波特率 -export const setLISSerialBaudrate = async (data: any) => { +export const setLISSerialBaudrate = async (data: LISSerialBaudrate) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISSerialBaudrate?val=${data}`, + `/api/v1/app/LISSetting/setLISSerialBaudrate?val=${data}`, data, ) return res.data @@ -49,12 +97,12 @@ export const setLISSerialBaudrate = async (data: any) => { console.log('设置LIS串口波特率出错', error) } } - +export type LISProtocol = 'Boditech' | 'Simens' // 设置LIS协议 -export const setLISProtocol = async (data: any) => { +export const setLISProtocol = async (data: LISProtocol) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISProtocol?val=${data}`, + `/api/v1/app/LISSetting/setLISProtocol?val=${data}`, ) return res.data } catch (error) { @@ -63,10 +111,10 @@ export const setLISProtocol = async (data: any) => { } // 设置LIS端口 -export const setLISNetPort = async (data: any) => { +export const setLISNetPort = async (data: number | string) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISNetPort?val=${data}`, + `/api/v1/app/LISSetting/setLISNetPort?val=${data}`, ) return res.data } catch (error) { @@ -75,10 +123,10 @@ export const setLISNetPort = async (data: any) => { } // 设置LIS IP -export const setLISNetIp = async (data: any) => { +export const setLISNetIp = async (data: string) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISNetIp?val=${data}`, + `/api/v1/app/LISSetting/setLISNetIp?val=${data}`, ) return res.data } catch (error) { @@ -87,22 +135,26 @@ export const setLISNetIp = async (data: any) => { } // 设置LIS是否自动上传报告 -export const setLISAutoExport = async (data: any) => { +export const setLISAutoExport = async (data: boolean) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISAutoExport?val=${data}`, + `/api/v1/app/LISSetting/setLISAutoExport?val=${data}`, ) return res.data } catch (error) { console.log('设置LIS自动上传出错', error) } } - +export type LISInterface = 'SERIAL' | 'NETWORK' +export const LISInterfaceMap = { + SERIAL: 'Serial', + NETWORK: 'TCP/IP', +} // 设置LIS接口 -export const setLISIF = async (data: any) => { +export const setLISInterface = async (data: LISInterface) => { try { const res = await apiClient.post( - `/api/v1/app/AppSetting/setLISIF?val=${data}`, + `/api/v1/app/LISSetting/setLIFIf?val=${data}`, ) return res.data } catch (error) { @@ -110,36 +162,21 @@ export const setLISIF = async (data: any) => { } } -// 设置自动打印报告 -export const setAutoPrint = async (data: any) => { - try { - const res = await apiClient.post( - `/api/v1/app/AppSetting/setAutoPrint?val=${data}`, - ) - return res.data - } catch (error) { - console.log('设置自动打印出错', error) - } -} - -// 设置自动登出 -export const setAutoLogout = async (data: any) => { - try { - const res = await apiClient.post( - `/api/v1/app/AppSetting/setAutoLogout?val=${data}`, - ) - return res.data - } catch (error) { - console.log('设置自动登出出错', error) - } +export type LISSettings = { + LISType: LISType + LISProtocol: LISProtocol + LIFIf: LISInterface + LISAutoExport: boolean + LISSerialBaudrate: LISSerialBaudrate + LISNetIp: string + LISNetPort: number } -//获取系统设置 -export const getSystemSettings = async () => { +export const getLISSetting = async () => { try { - const res = await apiClient.post('/api/v1/app/AppSetting/getAppSettings') + const res = await apiClient.post(`/api/v1/app/LISSetting/getSetting`) return res.data } catch (error) { - console.log('获取系统设置出错', error) + console.log('设置LIS配置出错', error) } }