稳态报表页面
This commit is contained in:
@@ -55,7 +55,21 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
// 请求拦截
|
||||
Axios.interceptors.request.use(
|
||||
config => {
|
||||
removePending(config)
|
||||
// if(config.url?.substring(0, 13)=='/advance-boot'){
|
||||
// config.url=config.url?.slice(13)
|
||||
// config.baseURL='/hzj'
|
||||
// }
|
||||
// 取消重复请求
|
||||
|
||||
if (
|
||||
!(
|
||||
config.url == '/system-boot/file/upload' ||
|
||||
config.url == '/harmonic-boot/grid/getAssessOverview' ||
|
||||
config.url == '/harmonic-boot/gridDiagram/getGridDiagramAreaData'
|
||||
)
|
||||
)
|
||||
removePending(config)
|
||||
|
||||
options.CancelDuplicateRequest && addPending(config)
|
||||
// 创建loading实例
|
||||
if (options.loading) {
|
||||
@@ -86,10 +100,15 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
response => {
|
||||
removePending(response.config)
|
||||
options.loading && closeLoading(options) // 关闭loading
|
||||
|
||||
if (
|
||||
response.data.code === 'A0000' ||
|
||||
response.data.type === 'application/json' ||
|
||||
response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
Array.isArray(response.data) ||
|
||||
response.data.size
|
||||
// ||
|
||||
// response.data.type === 'application/octet-stream' ||
|
||||
// response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
) {
|
||||
return options.reductDataFormat ? response.data : response
|
||||
} else if (response.data.code == 'A0202') {
|
||||
@@ -121,11 +140,11 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
})
|
||||
}
|
||||
} else if (response.data.code == 'A0024') {
|
||||
// 登录失效
|
||||
ElNotification({
|
||||
type: 'error',
|
||||
message: response.data.message
|
||||
})
|
||||
// // 登录失效
|
||||
// ElNotification({
|
||||
// type: 'error',
|
||||
// message: response.data.message
|
||||
// })
|
||||
adminInfo.removeToken()
|
||||
router.push({ name: 'login' })
|
||||
return Promise.reject(response.data)
|
||||
@@ -218,6 +237,37 @@ export function requestPayload(method: Method, data: anyObj) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 适配器, 用于适配不同的请求方式
|
||||
export function baseRequest(url, value = {}, method = 'post', options = {}) {
|
||||
url = sysConfig.API_URL + url
|
||||
if (method === 'post') {
|
||||
return service.post(url, value, options)
|
||||
} else if (method === 'get') {
|
||||
return service.get(url, { params: value, ...options })
|
||||
} else if (method === 'formdata') {
|
||||
// form-data表单提交的方式
|
||||
return service.post(url, qs.stringify(value), {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
...options
|
||||
})
|
||||
} else {
|
||||
// 其他请求方式,例如:put、delete
|
||||
return service({
|
||||
method: method,
|
||||
url: url,
|
||||
data: value,
|
||||
...options
|
||||
})
|
||||
}
|
||||
}
|
||||
// 模块内的请求, 会自动加上模块的前缀
|
||||
export const moduleRequest =
|
||||
moduleUrl =>
|
||||
(url, ...arg) => {
|
||||
return baseRequest(moduleUrl + url, ...arg)
|
||||
}
|
||||
|
||||
interface LoadingInstance {
|
||||
target: any
|
||||
|
||||
@@ -94,7 +94,7 @@ const reportFormList: any = ref([
|
||||
}
|
||||
])
|
||||
const tableStore = new TableStore({
|
||||
// url: '/harmonic-boot/customReport/getCustomReport',
|
||||
url: '/harmonic-boot/customReport/getCustomReport',
|
||||
method: 'POST',
|
||||
column: [],
|
||||
beforeSearchFun: () => {
|
||||
@@ -115,8 +115,8 @@ const tableStore = new TableStore({
|
||||
showtoolbar: false, // 是否显示工具栏
|
||||
showinfobar: false, // 是否显示顶部信息栏
|
||||
showsheetbar: true, // 是否显示底部sheet按钮
|
||||
data: data
|
||||
// tableStore.table.data
|
||||
// data: data
|
||||
data: tableStore.table.data
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -159,7 +159,7 @@ const exportEvent = () => {
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
.splitpanes.default-theme .splitpanes__pane{
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user