暂降治理评估
This commit is contained in:
3
src/utils/emitter.ts
Normal file
3
src/utils/emitter.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import mitt from 'mitt'
|
||||
const emitter = new mitt()
|
||||
export default emitter
|
||||
6
src/utils/regexPattern.ts
Normal file
6
src/utils/regexPattern.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
// 数字,包含小数,不支持负数
|
||||
export const numberRegex = /^[+]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
|
||||
//邮箱
|
||||
export const emailRegex: RegExp = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
//手机号
|
||||
export const phoneRegex: RegExp = /^\d{10}$/;
|
||||
@@ -55,10 +55,10 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
// 请求拦截
|
||||
Axios.interceptors.request.use(
|
||||
config => {
|
||||
if (config.url?.substring(0, 13) == '/advance-boot') {
|
||||
config.url = config.url?.slice(13)
|
||||
config.baseURL = '/hzj'
|
||||
}
|
||||
// if(config.url?.substring(0, 13)=='/advance-boot'){
|
||||
// config.url=config.url?.slice(13)
|
||||
// config.baseURL='/hzj'
|
||||
// }
|
||||
// 取消重复请求
|
||||
removePending(config)
|
||||
options.CancelDuplicateRequest && addPending(config)
|
||||
@@ -93,11 +93,9 @@ function createAxios<Data = any, T = ApiPromise<Data>>(
|
||||
options.loading && closeLoading(options) // 关闭loading
|
||||
|
||||
if (
|
||||
Array.isArray(response.data) ||
|
||||
response.data.code === 'A0000' ||
|
||||
response.data.type === 'application/json' ||
|
||||
response.data.type === 'application/octet-stream' ||
|
||||
response.data.type === 'text/xml' ||
|
||||
response.data.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
) {
|
||||
return options.reductDataFormat ? response.data : response
|
||||
|
||||
@@ -76,8 +76,13 @@ export default class TableStore {
|
||||
requestPayload(this.method, this.table.params)
|
||||
)
|
||||
).then((res: any) => {
|
||||
this.table.data = res.data.records || res.data
|
||||
this.table.total = res.data.total || res.data.length || 0
|
||||
if (res.data) {
|
||||
this.table.data = res.data.records || res.data
|
||||
this.table.total = res.data.total || res.data.length || 0
|
||||
} else {
|
||||
this.table.data = []
|
||||
this.table.total = 0
|
||||
}
|
||||
if (this.isWebPaging) {
|
||||
this.table.webPagingData = window.XEUtils.chunk(this.table.data, this.table.params.pageSize)
|
||||
this.table.data = this.table.webPagingData[this.table.params.pageNum - 1]
|
||||
|
||||
Reference in New Issue
Block a user