diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 7dfe88a..951bff6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,5 @@ import axios from 'axios' -// import qs from 'qs' +import qs from 'qs' import { ElLoading, ElMessage } from 'element-plus' import router from '@/router/index' import useUserStore from '@/store/modules/user' @@ -41,11 +41,11 @@ request.headers.token = userStore.token } // 是否将 POST 请求参数进行字符串化处理 - if (request.method === 'post') { - // request.data = qs.stringify(request.data, { - // arrayFormat: 'brackets', - // }) - } + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } return request }, ) diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 7dfe88a..951bff6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,5 @@ import axios from 'axios' -// import qs from 'qs' +import qs from 'qs' import { ElLoading, ElMessage } from 'element-plus' import router from '@/router/index' import useUserStore from '@/store/modules/user' @@ -41,11 +41,11 @@ request.headers.token = userStore.token } // 是否将 POST 请求参数进行字符串化处理 - if (request.method === 'post') { - // request.data = qs.stringify(request.data, { - // arrayFormat: 'brackets', - // }) - } + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } return request }, ) diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..d622539 --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,133 @@ +import axios from 'axios' +import qs from 'qs' +import { ElLoading, ElMessage } from 'element-plus' +import router from '@/router/index' +import useUserStore from '@/store/modules/user' +// 错误码枚举 +enum responseCode { + success = 200, // 成功 + noPermission = 401, // 未授权 + error = 500, // 服务器异常 +} +// 以下地址发生错误直接跳转至登录页 +const toLoginPath = ['/sys/user/permission', '/sys/user/info'] + +// 跳转到登录页面 +const toLogin = () => { + useUserStore().logout() + router.push({ + path: '/login', + query: { + redirect: router.currentRoute.value.path !== '/login' ? router.currentRoute.value.fullPath : undefined, + }, + }) +} + +const request = axios.create({ + // baseURL: window.localStorage.getItem('baseURL')!, + baseURL: import.meta.env.VITE_METER_API_BASEURL, + timeout: 1000 * 60, + responseType: 'json', +}) + +request.interceptors.request.use( + (request) => { + const userStore = useUserStore() + /** + * 全局拦截请求发送前提交的参数 + * 以下代码为示例,在请求头里带上 token 信息 + */ + if (userStore.isLogin && request.headers) { + request.headers.token = userStore.token + } + // 是否将 POST 请求参数进行字符串化处理 + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } + return request + }, +) + +request.interceptors.response.use( + (response) => { + /** + * 全局拦截请求发送后返回的数据,如果数据有报错则在这做全局的错误提示 + * 如果是文件直接返回整个response对象 + */ + if (response.data instanceof Blob) { + return Promise.resolve(response) + } + else if (response.data.code !== responseCode.success) { + if (response.data.code === responseCode.noPermission) { // token失效状态跳转到登录页 + toLogin() + if (useUserStore().isLogout === 0) { + ElMessage.error(response.data.message || '发生错误') + } + useUserStore().toLogout() + } + else { + // 这里做错误提 + ElMessage.error(`${response.data.message}` || '发生错误') + const loadingInstance = ElLoading.service({}) + nextTick(() => { + // Loading should be closed asynchronously + loadingInstance.close() + }) + } + + return Promise.reject(response.data) + } + else { // 成功 + return Promise.resolve(response.data) + } + }, + (error) => { + // 处理文件下载的错误提示 + if (error.response && error.response.data instanceof Blob) { + const reader = new FileReader() + reader.onload = (e) => { + let errMsg = '发生错误!' + if (e && e.target!.result) { + errMsg = JSON.parse(e.target!.result as string) + } + ElMessage.error(errMsg) + } + } + else if (error.response && error.response.data) { + // 如果是发生错误必须回到登录页的api + const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) + if (needLogin > -1) { + toLogin() + } + else { + const message: string = error.response.data.message + ElMessage({ + message, + type: 'error', + }) + } + } + else if (error.message) { + let message = error.message + if (message === 'Network Error') { + message = '后端网络故障' + } + else if (message.includes('timeout')) { + message = '接口请求超时' + } + else if (message.includes('Request failed with status code')) { + message = `接口${message.substr(message.length - 3)}异常` + } + ElMessage({ + message, + type: 'error', + }) + } + + return Promise.reject(error) + }, +) + +export default request diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 7dfe88a..951bff6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,5 @@ import axios from 'axios' -// import qs from 'qs' +import qs from 'qs' import { ElLoading, ElMessage } from 'element-plus' import router from '@/router/index' import useUserStore from '@/store/modules/user' @@ -41,11 +41,11 @@ request.headers.token = userStore.token } // 是否将 POST 请求参数进行字符串化处理 - if (request.method === 'post') { - // request.data = qs.stringify(request.data, { - // arrayFormat: 'brackets', - // }) - } + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } return request }, ) diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..d622539 --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,133 @@ +import axios from 'axios' +import qs from 'qs' +import { ElLoading, ElMessage } from 'element-plus' +import router from '@/router/index' +import useUserStore from '@/store/modules/user' +// 错误码枚举 +enum responseCode { + success = 200, // 成功 + noPermission = 401, // 未授权 + error = 500, // 服务器异常 +} +// 以下地址发生错误直接跳转至登录页 +const toLoginPath = ['/sys/user/permission', '/sys/user/info'] + +// 跳转到登录页面 +const toLogin = () => { + useUserStore().logout() + router.push({ + path: '/login', + query: { + redirect: router.currentRoute.value.path !== '/login' ? router.currentRoute.value.fullPath : undefined, + }, + }) +} + +const request = axios.create({ + // baseURL: window.localStorage.getItem('baseURL')!, + baseURL: import.meta.env.VITE_METER_API_BASEURL, + timeout: 1000 * 60, + responseType: 'json', +}) + +request.interceptors.request.use( + (request) => { + const userStore = useUserStore() + /** + * 全局拦截请求发送前提交的参数 + * 以下代码为示例,在请求头里带上 token 信息 + */ + if (userStore.isLogin && request.headers) { + request.headers.token = userStore.token + } + // 是否将 POST 请求参数进行字符串化处理 + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } + return request + }, +) + +request.interceptors.response.use( + (response) => { + /** + * 全局拦截请求发送后返回的数据,如果数据有报错则在这做全局的错误提示 + * 如果是文件直接返回整个response对象 + */ + if (response.data instanceof Blob) { + return Promise.resolve(response) + } + else if (response.data.code !== responseCode.success) { + if (response.data.code === responseCode.noPermission) { // token失效状态跳转到登录页 + toLogin() + if (useUserStore().isLogout === 0) { + ElMessage.error(response.data.message || '发生错误') + } + useUserStore().toLogout() + } + else { + // 这里做错误提 + ElMessage.error(`${response.data.message}` || '发生错误') + const loadingInstance = ElLoading.service({}) + nextTick(() => { + // Loading should be closed asynchronously + loadingInstance.close() + }) + } + + return Promise.reject(response.data) + } + else { // 成功 + return Promise.resolve(response.data) + } + }, + (error) => { + // 处理文件下载的错误提示 + if (error.response && error.response.data instanceof Blob) { + const reader = new FileReader() + reader.onload = (e) => { + let errMsg = '发生错误!' + if (e && e.target!.result) { + errMsg = JSON.parse(e.target!.result as string) + } + ElMessage.error(errMsg) + } + } + else if (error.response && error.response.data) { + // 如果是发生错误必须回到登录页的api + const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) + if (needLogin > -1) { + toLogin() + } + else { + const message: string = error.response.data.message + ElMessage({ + message, + type: 'error', + }) + } + } + else if (error.message) { + let message = error.message + if (message === 'Network Error') { + message = '后端网络故障' + } + else if (message.includes('timeout')) { + message = '接口请求超时' + } + else if (message.includes('Request failed with status code')) { + message = `接口${message.substr(message.length - 3)}异常` + } + ElMessage({ + message, + type: 'error', + }) + } + + return Promise.reject(error) + }, +) + +export default request diff --git a/src/api/system/user.ts b/src/api/system/user.ts index ad39cbb..f0d36f8 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -1,5 +1,6 @@ // import qs from 'qs' import request from '../index' +import request1 from '../request' const prefix = 'sys/' // const baseURL = window.localStorage.getItem('baseUrlAccount')! // const baseURL = 'http://192.168.1.200:5910/' @@ -20,9 +21,10 @@ // 添加用户 export function addUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/add`, + // url: `${prefix}mgr/add`, + url: 'sysytem/mgr/add', method: 'post', data, }) @@ -30,9 +32,10 @@ } // 修改用户 export function updateUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/update`, + // url: `${prefix}mgr/update`, + url: 'system/mgr/update', method: 'post', data, }) diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 7dfe88a..951bff6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,5 @@ import axios from 'axios' -// import qs from 'qs' +import qs from 'qs' import { ElLoading, ElMessage } from 'element-plus' import router from '@/router/index' import useUserStore from '@/store/modules/user' @@ -41,11 +41,11 @@ request.headers.token = userStore.token } // 是否将 POST 请求参数进行字符串化处理 - if (request.method === 'post') { - // request.data = qs.stringify(request.data, { - // arrayFormat: 'brackets', - // }) - } + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } return request }, ) diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..d622539 --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,133 @@ +import axios from 'axios' +import qs from 'qs' +import { ElLoading, ElMessage } from 'element-plus' +import router from '@/router/index' +import useUserStore from '@/store/modules/user' +// 错误码枚举 +enum responseCode { + success = 200, // 成功 + noPermission = 401, // 未授权 + error = 500, // 服务器异常 +} +// 以下地址发生错误直接跳转至登录页 +const toLoginPath = ['/sys/user/permission', '/sys/user/info'] + +// 跳转到登录页面 +const toLogin = () => { + useUserStore().logout() + router.push({ + path: '/login', + query: { + redirect: router.currentRoute.value.path !== '/login' ? router.currentRoute.value.fullPath : undefined, + }, + }) +} + +const request = axios.create({ + // baseURL: window.localStorage.getItem('baseURL')!, + baseURL: import.meta.env.VITE_METER_API_BASEURL, + timeout: 1000 * 60, + responseType: 'json', +}) + +request.interceptors.request.use( + (request) => { + const userStore = useUserStore() + /** + * 全局拦截请求发送前提交的参数 + * 以下代码为示例,在请求头里带上 token 信息 + */ + if (userStore.isLogin && request.headers) { + request.headers.token = userStore.token + } + // 是否将 POST 请求参数进行字符串化处理 + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } + return request + }, +) + +request.interceptors.response.use( + (response) => { + /** + * 全局拦截请求发送后返回的数据,如果数据有报错则在这做全局的错误提示 + * 如果是文件直接返回整个response对象 + */ + if (response.data instanceof Blob) { + return Promise.resolve(response) + } + else if (response.data.code !== responseCode.success) { + if (response.data.code === responseCode.noPermission) { // token失效状态跳转到登录页 + toLogin() + if (useUserStore().isLogout === 0) { + ElMessage.error(response.data.message || '发生错误') + } + useUserStore().toLogout() + } + else { + // 这里做错误提 + ElMessage.error(`${response.data.message}` || '发生错误') + const loadingInstance = ElLoading.service({}) + nextTick(() => { + // Loading should be closed asynchronously + loadingInstance.close() + }) + } + + return Promise.reject(response.data) + } + else { // 成功 + return Promise.resolve(response.data) + } + }, + (error) => { + // 处理文件下载的错误提示 + if (error.response && error.response.data instanceof Blob) { + const reader = new FileReader() + reader.onload = (e) => { + let errMsg = '发生错误!' + if (e && e.target!.result) { + errMsg = JSON.parse(e.target!.result as string) + } + ElMessage.error(errMsg) + } + } + else if (error.response && error.response.data) { + // 如果是发生错误必须回到登录页的api + const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) + if (needLogin > -1) { + toLogin() + } + else { + const message: string = error.response.data.message + ElMessage({ + message, + type: 'error', + }) + } + } + else if (error.message) { + let message = error.message + if (message === 'Network Error') { + message = '后端网络故障' + } + else if (message.includes('timeout')) { + message = '接口请求超时' + } + else if (message.includes('Request failed with status code')) { + message = `接口${message.substr(message.length - 3)}异常` + } + ElMessage({ + message, + type: 'error', + }) + } + + return Promise.reject(error) + }, +) + +export default request diff --git a/src/api/system/user.ts b/src/api/system/user.ts index ad39cbb..f0d36f8 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -1,5 +1,6 @@ // import qs from 'qs' import request from '../index' +import request1 from '../request' const prefix = 'sys/' // const baseURL = window.localStorage.getItem('baseUrlAccount')! // const baseURL = 'http://192.168.1.200:5910/' @@ -20,9 +21,10 @@ // 添加用户 export function addUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/add`, + // url: `${prefix}mgr/add`, + url: 'sysytem/mgr/add', method: 'post', data, }) @@ -30,9 +32,10 @@ } // 修改用户 export function updateUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/update`, + // url: `${prefix}mgr/update`, + url: 'system/mgr/update', method: 'post', data, }) diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue index e2b8f12..95a44cc 100644 --- a/src/components/Echart/PieChart.vue +++ b/src/components/Echart/PieChart.vue @@ -190,13 +190,17 @@ // 标题 if (props.title) { option.title = { - show: true, + show: false, text: props.title, - // textStyle: { - // color: props.fontColor, - // fontWeight: 'bolder', - // fontSize: 19, - // }, + textStyle: { + color: props.fontColor, + fontWeight: 'normal', + fontSize: 16, + }, + top: 0, + left: '35%', + textAlign: 'cenetr', + // right: 'middle', } } // 标题 diff --git a/.env.development b/.env.development index f5906c2..b7ccb77 100644 --- a/.env.development +++ b/.env.development @@ -3,9 +3,10 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 # VITE_APP_API_BASEURL = http://139.198.29.133:8089 -# VITE_APP_API_BASEURL = http://111.198.10.15:21611 -# VITE_APP_API_BASEURL = http://192.168.8.100:5909 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +# VITE_APP_API_BASEURL = http://192.168.8.100:5909 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 +# VITE_APP_API_BASEURL = http://111.198.10.15:21611 # VITE_APP_API_BASEURL = http://192.168.8.107:5909 # VITE_APP_API_BASEURL = http://111.198.10.15:21710 diff --git a/.env.production b/.env.production index 36e6ad3..b413207 100644 --- a/.env.production +++ b/.env.production @@ -5,6 +5,7 @@ VITE_SYS_TITLE = 受检设备管理系统 # 接口请求地址,会设置到 axios 的 baseURL 参数上 VITE_APP_API_BASEURL = http://111.198.10.15:21611 +VITE_METER_API_BASEURL = http://111.198.10.15:21606 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空 VITE_APP_DEBUG_TOOL = diff --git a/src/api/eqpt/dashboard/index.ts b/src/api/eqpt/dashboard/index.ts index 3f6e96d..fcf88a1 100644 --- a/src/api/eqpt/dashboard/index.ts +++ b/src/api/eqpt/dashboard/index.ts @@ -1,6 +1,7 @@ /** * 首页接口 */ +import QS from 'qs' import request from '@/api/index' // 检定统计 @@ -17,3 +18,76 @@ method: 'get', }) } +// 日历列表 +export function getCalendarList(params: object) { + return request({ + url: '/board/calendar/list', + method: 'get', + params, + }) +} +// 删除日历 +export function delSchedule(params: object) { + return request({ + url: `/board/calendar/remove?id=${params.id}`, + method: 'post', + }) +} +// 编辑日历 +export function editSchedule(data: object) { + return request({ + url: '/board/calendar/save', + method: 'post', + data, + }) +} +// 设备分类统计 +export function getDeviceClassify(params: object) { + return request({ + url: '/board/overview/equipmentCategory', + method: 'get', + params, + }) +} +// 设备状态统计 +export function getDeviceStatus(params: object) { + return request({ + url: '/board/overview/equipmentUsageStatus', + method: 'get', + params, + }) +} +// 设备类型统计 +export function getDeviceType(params: object) { + return request({ + url: '/board/overview/equipmentName', + method: 'get', + params, + }) +} +// 首页看板消息 +export function getBoardMessage(data: any) { + return request({ + url: `/board/message/listPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) +} +// 审批列表-待处理 +export function getBoardApprove(data: any) { + if (data.readStatus === '0') { + // 已处理 + return request({ + url: `/board/message/approvedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } + else { + return request({ + url: `/board/message/toBeApprovedListPage?limit=${data.limit}&offset=${data.offset}`, + method: 'post', + data, + }) + } +} diff --git a/src/api/eqpt/device/remind.ts b/src/api/eqpt/device/remind.ts index 7d8eae9..c9d2d06 100644 --- a/src/api/eqpt/device/remind.ts +++ b/src/api/eqpt/device/remind.ts @@ -27,3 +27,11 @@ params, }) } +// 提醒 +export function remindRow(params: object) { + return request({ + url: '/equipment/remind/remind', + method: 'get', + params, + }) +} diff --git a/src/api/index.ts b/src/api/index.ts index 7dfe88a..951bff6 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,5 +1,5 @@ import axios from 'axios' -// import qs from 'qs' +import qs from 'qs' import { ElLoading, ElMessage } from 'element-plus' import router from '@/router/index' import useUserStore from '@/store/modules/user' @@ -41,11 +41,11 @@ request.headers.token = userStore.token } // 是否将 POST 请求参数进行字符串化处理 - if (request.method === 'post') { - // request.data = qs.stringify(request.data, { - // arrayFormat: 'brackets', - // }) - } + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } return request }, ) diff --git a/src/api/request.ts b/src/api/request.ts new file mode 100644 index 0000000..d622539 --- /dev/null +++ b/src/api/request.ts @@ -0,0 +1,133 @@ +import axios from 'axios' +import qs from 'qs' +import { ElLoading, ElMessage } from 'element-plus' +import router from '@/router/index' +import useUserStore from '@/store/modules/user' +// 错误码枚举 +enum responseCode { + success = 200, // 成功 + noPermission = 401, // 未授权 + error = 500, // 服务器异常 +} +// 以下地址发生错误直接跳转至登录页 +const toLoginPath = ['/sys/user/permission', '/sys/user/info'] + +// 跳转到登录页面 +const toLogin = () => { + useUserStore().logout() + router.push({ + path: '/login', + query: { + redirect: router.currentRoute.value.path !== '/login' ? router.currentRoute.value.fullPath : undefined, + }, + }) +} + +const request = axios.create({ + // baseURL: window.localStorage.getItem('baseURL')!, + baseURL: import.meta.env.VITE_METER_API_BASEURL, + timeout: 1000 * 60, + responseType: 'json', +}) + +request.interceptors.request.use( + (request) => { + const userStore = useUserStore() + /** + * 全局拦截请求发送前提交的参数 + * 以下代码为示例,在请求头里带上 token 信息 + */ + if (userStore.isLogin && request.headers) { + request.headers.token = userStore.token + } + // 是否将 POST 请求参数进行字符串化处理 + // if (request.method === 'get') { + // if (request.params?.deptIds) { + // request.params.deptIds = qs.stringify(request.params.deptIds, { indices: false }) + // } + // } + return request + }, +) + +request.interceptors.response.use( + (response) => { + /** + * 全局拦截请求发送后返回的数据,如果数据有报错则在这做全局的错误提示 + * 如果是文件直接返回整个response对象 + */ + if (response.data instanceof Blob) { + return Promise.resolve(response) + } + else if (response.data.code !== responseCode.success) { + if (response.data.code === responseCode.noPermission) { // token失效状态跳转到登录页 + toLogin() + if (useUserStore().isLogout === 0) { + ElMessage.error(response.data.message || '发生错误') + } + useUserStore().toLogout() + } + else { + // 这里做错误提 + ElMessage.error(`${response.data.message}` || '发生错误') + const loadingInstance = ElLoading.service({}) + nextTick(() => { + // Loading should be closed asynchronously + loadingInstance.close() + }) + } + + return Promise.reject(response.data) + } + else { // 成功 + return Promise.resolve(response.data) + } + }, + (error) => { + // 处理文件下载的错误提示 + if (error.response && error.response.data instanceof Blob) { + const reader = new FileReader() + reader.onload = (e) => { + let errMsg = '发生错误!' + if (e && e.target!.result) { + errMsg = JSON.parse(e.target!.result as string) + } + ElMessage.error(errMsg) + } + } + else if (error.response && error.response.data) { + // 如果是发生错误必须回到登录页的api + const needLogin = toLoginPath.findIndex(path => error.request.responseURL.includes(path)) + if (needLogin > -1) { + toLogin() + } + else { + const message: string = error.response.data.message + ElMessage({ + message, + type: 'error', + }) + } + } + else if (error.message) { + let message = error.message + if (message === 'Network Error') { + message = '后端网络故障' + } + else if (message.includes('timeout')) { + message = '接口请求超时' + } + else if (message.includes('Request failed with status code')) { + message = `接口${message.substr(message.length - 3)}异常` + } + ElMessage({ + message, + type: 'error', + }) + } + + return Promise.reject(error) + }, +) + +export default request diff --git a/src/api/system/user.ts b/src/api/system/user.ts index ad39cbb..f0d36f8 100644 --- a/src/api/system/user.ts +++ b/src/api/system/user.ts @@ -1,5 +1,6 @@ // import qs from 'qs' import request from '../index' +import request1 from '../request' const prefix = 'sys/' // const baseURL = window.localStorage.getItem('baseUrlAccount')! // const baseURL = 'http://192.168.1.200:5910/' @@ -20,9 +21,10 @@ // 添加用户 export function addUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/add`, + // url: `${prefix}mgr/add`, + url: 'sysytem/mgr/add', method: 'post', data, }) @@ -30,9 +32,10 @@ } // 修改用户 export function updateUser(data: object) { - return request({ + return request1({ // baseURL, - url: `${prefix}mgr/update`, + // url: `${prefix}mgr/update`, + url: 'system/mgr/update', method: 'post', data, }) diff --git a/src/components/Echart/PieChart.vue b/src/components/Echart/PieChart.vue index e2b8f12..95a44cc 100644 --- a/src/components/Echart/PieChart.vue +++ b/src/components/Echart/PieChart.vue @@ -190,13 +190,17 @@ // 标题 if (props.title) { option.title = { - show: true, + show: false, text: props.title, - // textStyle: { - // color: props.fontColor, - // fontWeight: 'bolder', - // fontSize: 19, - // }, + textStyle: { + color: props.fontColor, + fontWeight: 'normal', + fontSize: 16, + }, + top: 0, + left: '35%', + textAlign: 'cenetr', + // right: 'middle', } } // 标题 diff --git a/src/layouts/components/Topbar/index.vue b/src/layouts/components/Topbar/index.vue index 2863cef..c9596f9 100644 --- a/src/layouts/components/Topbar/index.vue +++ b/src/layouts/components/Topbar/index.vue @@ -4,7 +4,7 @@ import useSettingsStore from '@/store/modules/settings' const route = useRoute() - +const router = useRouter() const settingsStore = useSettingsStore() const enableSubMenuCollapseButton = computed(() => { @@ -43,6 +43,15 @@ const toPath = compile(path) return toPath(route.params) } +const collapse = () => { + const arr = ['verification', 'notice', 'approve', 'work'] + if (arr.includes(route.params.type as string)) { + router.go(-1) + } + else { + settingsStore.toggleSidebarCollapse() + } +}