暂降治理评估

This commit is contained in:
2024-03-28 13:25:41 +08:00
parent 45ba496361
commit 965b18b540
44 changed files with 2748 additions and 1108 deletions

3
src/utils/emitter.ts Normal file
View File

@@ -0,0 +1,3 @@
import mitt from 'mitt'
const emitter = new mitt()
export default emitter

View 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}$/;

View File

@@ -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

View File

@@ -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]