diff --git a/src/api/index.js b/src/api/index.js index 72b9a84..0b9c2c5 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -2,6 +2,7 @@ import request from '@/utils/request' export function findNextSequenceFlowList(params) { return request({ + useResponseData: true, url: '/xrActivity/findNextSequenceFlowList', method: 'get', params @@ -10,6 +11,7 @@ export function findNextSequenceFlowList(params) { export function taskInfo(params) { return request({ + useResponseData: true, url: '/xrTaskList/taskInfo', method: 'get', params @@ -23,6 +25,7 @@ export function taskInfo(params) { */ export function getEBaseinfo(params) { return request({ + useResponseData: true, url: '/baseinfo/getEBaseinfo', method: 'get', params @@ -36,6 +39,7 @@ export function getEBaseinfo(params) { */ export function baseinfoList(data) { return request({ + useResponseData: true, url: '/baseinfo/baseinfoList', method: 'post', data @@ -44,6 +48,7 @@ export function baseinfoList(data) { export function marketEntities(data) { return request({ + useResponseData: true, url: '/xr-claim/marketEntities', method: 'post', data @@ -51,6 +56,7 @@ export function marketEntities(data) { } export function fetchAicorgUrl(params) { return request({ + useResponseData: true, url: '/user/fetchAicorgUrl', method: 'post', params @@ -59,6 +65,7 @@ export function fetchAicorgUrl(params) { export function isTaskCreater(params) { return request({ + useResponseData: true, url: '/xrTaskList/isTaskCreater', method: 'get', params @@ -67,6 +74,7 @@ export function isTaskCreater(params) { export function findCurrentNode(params) { return request({ + useResponseData: true, url: '/xrActivity/findCurrentNode', method: 'get', params @@ -79,6 +87,7 @@ export function findCurrentNode(params) { */ export function listBaseinfo(data) { return request({ + useResponseData: true, url: '/baseinfo/list', method: 'post', data @@ -91,6 +100,7 @@ export function listBaseinfo(data) { */ export function superviseDeptEBaseinfoList(data) { return request({ + useResponseData: true, url: '/xr-supervisor/superviseDeptEBaseinfoList', method: 'post', data @@ -104,6 +114,7 @@ export function superviseDeptEBaseinfoList(data) { */ export function getTOrgunitsByOrgnumber(params) { return request({ + useResponseData: true, url: '/tOrgunits/getTOrgunitsByOrgnumber', method: 'get', params @@ -112,6 +123,7 @@ export function getTOrgunitsByOrgnumber(params) { export function getEntTSAbnListPage(data) { return request({ + useResponseData: true, url: '/baseinfo/getEntTSAbnListPage', method: 'post', data @@ -120,6 +132,7 @@ export function getEntTSAbnListPage(data) { export function getEntIllegalPage(data) { return request({ + useResponseData: true, url: '/baseinfo/getEntIllegalPage', method: 'post', data diff --git a/src/utils/index.js b/src/utils/index.js index accc574..3f0db5a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,3 +1,4 @@ +import { Loading } from 'element-ui' /** * Created by PanJiaChen on 16/11/18. */ @@ -131,3 +132,46 @@ export function resetObj(obj, defaultValue = {}) { } } } + +export const createGlobalLoading = (function() { + const handlersMap = { + default: [] + } + let loading + return function(handler, scopeKey = 'default', cusLoading) { + if (!handlersMap[scopeKey]) { + handlersMap[scopeKey] = [] + } + const handlers = handlersMap[scopeKey] + if (handlers.length === 0) { + if (cusLoading) { + if (typeof cusLoading.start === 'function') { + cusLoading.start() + } + } else { + loading = Loading.service({ + lock: true, + text: '请稍后', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + } + } + const id = (new Date()).valueOf() + handlers.push(id) + return (async() => { return typeof handler === 'function' ? handler() : handler })().then((result) => { + return result + }).finally(() => { + handlers.splice(handlers.indexOf(id), 1) + if (handlers.length === 0) { + if (cusLoading) { + if (typeof cusLoading.finally === 'function') { + cusLoading.finally() + } + } else { + loading.close() + } + } + }) + } +})() diff --git a/vue.config.js b/vue.config.js index cec2b20..82e32a6 100644 --- a/vue.config.js +++ b/vue.config.js @@ -50,8 +50,7 @@ module.exports = { // target: `http://172.22.80.129`, changeOrigin: true } - }, - after: require('./mock/mock-server.js') + } }, configureWebpack: { // provide the app's title in webpack's name field, so that