feat: 机组管理迁移l2代码

This commit is contained in:
砂糖
2025-10-10 14:40:29 +08:00
parent b0b8416e2f
commit 0a366b054c
32 changed files with 5133 additions and 11 deletions

View File

@@ -0,0 +1,75 @@
import axios from 'axios'
export default function createFetch(url) {
const l2Request = axios.create({
baseURL: url,
headers: {
'Content-Type': 'application/json'
},
timeout: 10000,
// 自定义响应数据转换处理大整数ID精度问题
transformResponse: [data => {
// 在JSON解析前将所有id数值转换为字符串避免大整数精度丢失
const modifiedData = data.replace(/"id":\s*(\d+)/g, '"id": "$1"');
return JSON.parse(modifiedData);
}]
})
l2Request.interceptors.response.use(response => {
return response.data
})
return {
getRollIdList: () => {
return l2Request({
method: 'get',
url: '/api/roller/history/rollid'
})
},
getChangeIdList: () => {
return l2Request({
method: 'get',
url: '/api/roller/history/changeid'
})
},
getRollHistorytList: (params) => {
return l2Request({
method: 'post',
data: params,
url: '/api/roller/history/list'
})
},
backupRoll: (data) => {
return l2Request({
method: 'post',
data,
url: '/api/roller/change/standby'
})
},
onlineRoll: (data) => {
return l2Request({
method: 'post',
data,
url: '/api/roller/change/online'
})
},
getOnlineRollList: () => {
return l2Request({
method: 'get',
url: '/api/roller/data/online'
})
},
getOfflineRollList: (position, type) => {
return l2Request({
method: 'get',
url: `/api/roller/data/ready/${position}/${type}`
})
},
getReadyRollList: () => {
return l2Request({
method: 'get',
url: '/api/roller/data/standby'
})
}
}
}