diff --git a/src/api/minipro.js b/src/api/minipro.js index 77dfb03..dfb1617 100644 --- a/src/api/minipro.js +++ b/src/api/minipro.js @@ -4,24 +4,85 @@ // 消息列表 export function GetMessageList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'message/messageList', + url: `message/messageList?limit=${limit}&offset=${offset}`, method: 'post', data }) } -// 用户列表 -export function getUserList(data) { +// 消息导出 +export function messageExport(data) { return request({ baseURL, - url: 'user/getUserList', + url: '/message/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 用户列表 +export function getUserList(data) { + const { + offset, + limit + } = data + return request({ + baseURL, + url: `user/getUserList?limit=${limit}&offset=${offset}`, method: 'post', data }) } +// 人员导入 +export function batchImportFire(fileobj) { + const param = new FormData() + param.append('multipartFile', fileobj) + return request({ + baseURL, + url: '/user/importList', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + +// 模板下载 +export function downloadTemplate(fileName) { + return request({ + baseURL, + url: '/user/download', + method: 'get', + params: { + filename: 'userModel.xlsx' + }, + headers: { + responseType: 'blob' + }, + responseType: 'blob' + }) +} + +// 访客导出 +export function userExport(data) { + return request({ + baseURL, + url: '/user/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + // 新增 export function addUser(data) { return request({ @@ -32,6 +93,16 @@ }) } +// 编辑 +export function updateUser(data) { + return request({ + baseURL, + url: 'user/updateUser', + method: 'post', + data + }) +} + // 删除 export function delUser(data) { return request({ @@ -42,13 +113,29 @@ }) } - // 访客列表 export function getApplyList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'visitor/getApplyList', + url: `visitor/getApplyList?limit=${limit}&offset=${offset}`, method: 'post', data }) } + +// 访客导出 +export function visitorExport(data) { + return request({ + baseURL, + url: '/visitor/exportApplyList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + diff --git a/src/api/minipro.js b/src/api/minipro.js index 77dfb03..dfb1617 100644 --- a/src/api/minipro.js +++ b/src/api/minipro.js @@ -4,24 +4,85 @@ // 消息列表 export function GetMessageList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'message/messageList', + url: `message/messageList?limit=${limit}&offset=${offset}`, method: 'post', data }) } -// 用户列表 -export function getUserList(data) { +// 消息导出 +export function messageExport(data) { return request({ baseURL, - url: 'user/getUserList', + url: '/message/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 用户列表 +export function getUserList(data) { + const { + offset, + limit + } = data + return request({ + baseURL, + url: `user/getUserList?limit=${limit}&offset=${offset}`, method: 'post', data }) } +// 人员导入 +export function batchImportFire(fileobj) { + const param = new FormData() + param.append('multipartFile', fileobj) + return request({ + baseURL, + url: '/user/importList', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + +// 模板下载 +export function downloadTemplate(fileName) { + return request({ + baseURL, + url: '/user/download', + method: 'get', + params: { + filename: 'userModel.xlsx' + }, + headers: { + responseType: 'blob' + }, + responseType: 'blob' + }) +} + +// 访客导出 +export function userExport(data) { + return request({ + baseURL, + url: '/user/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + // 新增 export function addUser(data) { return request({ @@ -32,6 +93,16 @@ }) } +// 编辑 +export function updateUser(data) { + return request({ + baseURL, + url: 'user/updateUser', + method: 'post', + data + }) +} + // 删除 export function delUser(data) { return request({ @@ -42,13 +113,29 @@ }) } - // 访客列表 export function getApplyList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'visitor/getApplyList', + url: `visitor/getApplyList?limit=${limit}&offset=${offset}`, method: 'post', data }) } + +// 访客导出 +export function visitorExport(data) { + return request({ + baseURL, + url: '/visitor/exportApplyList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + diff --git a/src/router/modules/menu0.js b/src/router/modules/menu0.js index 3a62b17..dc2d4fd 100644 --- a/src/router/modules/menu0.js +++ b/src/router/modules/menu0.js @@ -273,37 +273,6 @@ meta: { title: '能源数据', icon: '', permission: ['/energy/list'] } } ] - }, - { - path: 'backstage', - component: Layout, - redirect: '/backstage', - name: 'Backstage', - meta: { - title: '', - // permission: ['/asset'], // 权限名称 - icon: 'icon-config' // 图标 - }, - children: [ - { - path: '/messageList', - name: 'MessageList', - component: () => import('@/views/backstage/messageList'), - meta: { title: '消息后台', icon: '', permission: [''] } - }, - { - path: '/personList', - name: 'PersonList', - component: () => import('@/views/backstage/personList'), - meta: { title: '人员管理后台', icon: '', permission: [''] } - }, - { - path: '/visitList', - name: 'VisitList', - component: () => import('@/views/backstage/visitList'), - meta: { title: '访客申请后台', icon: '', permission: [''] } - } - ] } // { // path: 'security', diff --git a/src/api/minipro.js b/src/api/minipro.js index 77dfb03..dfb1617 100644 --- a/src/api/minipro.js +++ b/src/api/minipro.js @@ -4,24 +4,85 @@ // 消息列表 export function GetMessageList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'message/messageList', + url: `message/messageList?limit=${limit}&offset=${offset}`, method: 'post', data }) } -// 用户列表 -export function getUserList(data) { +// 消息导出 +export function messageExport(data) { return request({ baseURL, - url: 'user/getUserList', + url: '/message/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + +// 用户列表 +export function getUserList(data) { + const { + offset, + limit + } = data + return request({ + baseURL, + url: `user/getUserList?limit=${limit}&offset=${offset}`, method: 'post', data }) } +// 人员导入 +export function batchImportFire(fileobj) { + const param = new FormData() + param.append('multipartFile', fileobj) + return request({ + baseURL, + url: '/user/importList', + method: 'post', + headers: { 'Content-Type': 'multipart/form-data' }, + data: param + }) +} + +// 模板下载 +export function downloadTemplate(fileName) { + return request({ + baseURL, + url: '/user/download', + method: 'get', + params: { + filename: 'userModel.xlsx' + }, + headers: { + responseType: 'blob' + }, + responseType: 'blob' + }) +} + +// 访客导出 +export function userExport(data) { + return request({ + baseURL, + url: '/user/exportList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + // 新增 export function addUser(data) { return request({ @@ -32,6 +93,16 @@ }) } +// 编辑 +export function updateUser(data) { + return request({ + baseURL, + url: 'user/updateUser', + method: 'post', + data + }) +} + // 删除 export function delUser(data) { return request({ @@ -42,13 +113,29 @@ }) } - // 访客列表 export function getApplyList(data) { + const { + offset, + limit + } = data return request({ baseURL, - url: 'visitor/getApplyList', + url: `visitor/getApplyList?limit=${limit}&offset=${offset}`, method: 'post', data }) } + +// 访客导出 +export function visitorExport(data) { + return request({ + baseURL, + url: '/visitor/exportApplyList', + method: 'post', + timeout: 120000, + data, + responseType: 'blob' // 这一步也很关键,一定要加上 responseType 值为 blob + }) +} + diff --git a/src/router/modules/menu0.js b/src/router/modules/menu0.js index 3a62b17..dc2d4fd 100644 --- a/src/router/modules/menu0.js +++ b/src/router/modules/menu0.js @@ -273,37 +273,6 @@ meta: { title: '能源数据', icon: '', permission: ['/energy/list'] } } ] - }, - { - path: 'backstage', - component: Layout, - redirect: '/backstage', - name: 'Backstage', - meta: { - title: '', - // permission: ['/asset'], // 权限名称 - icon: 'icon-config' // 图标 - }, - children: [ - { - path: '/messageList', - name: 'MessageList', - component: () => import('@/views/backstage/messageList'), - meta: { title: '消息后台', icon: '', permission: [''] } - }, - { - path: '/personList', - name: 'PersonList', - component: () => import('@/views/backstage/personList'), - meta: { title: '人员管理后台', icon: '', permission: [''] } - }, - { - path: '/visitList', - name: 'VisitList', - component: () => import('@/views/backstage/visitList'), - meta: { title: '访客申请后台', icon: '', permission: [''] } - } - ] } // { // path: 'security', diff --git a/src/views/backstage/messageList.vue b/src/views/backstage/messageList.vue index 99032bb..8fc86ef 100644 --- a/src/views/backstage/messageList.vue +++ b/src/views/backstage/messageList.vue @@ -7,9 +7,8 @@ size="small" search-more-type="default" @search="fetchData(false)" - @clear="clearInput"> - - + @clear="clearInput" + > @@ -45,8 +44,8 @@ + >