fix: 接口变更/请求方法为大写
This commit is contained in:
@@ -9,7 +9,7 @@ export async function listCustomData(query: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/pm/kpiC/report`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
timeout: 60_000,
|
||||
});
|
||||
|
||||
@@ -1,66 +1,4 @@
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { request } from '@/plugins/http-fetch';
|
||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
|
||||
/**
|
||||
* 查询自定义指标
|
||||
* @param query 查询参数
|
||||
* @returns object
|
||||
*/
|
||||
// export async function listCustom(query: Record<string, any>) {
|
||||
// let totalSQL = 'select count(*) as total from pm_custom_title where 1=1 ';
|
||||
// let rowsSQL = 'select * from pm_custom_title where 1=1 ';
|
||||
|
||||
// // 查询
|
||||
// let querySQL = '';
|
||||
// if (query.neType) {
|
||||
// querySQL += ` and ne_type like '%${query.neType}%' `;
|
||||
// }
|
||||
|
||||
// // 排序
|
||||
// let sortSql = ' order by update_time ';
|
||||
// if (query.sortOrder === 'asc') {
|
||||
// sortSql += ' asc ';
|
||||
// } else {
|
||||
// sortSql += ' desc ';
|
||||
// }
|
||||
// // 分页
|
||||
// const pageNum = (query.pageNum - 1) * query.pageSize;
|
||||
// const limtSql = ` limit ${pageNum},${query.pageSize} `;
|
||||
|
||||
// // 发起请求
|
||||
// const result = await request({
|
||||
// url: `/api/rest/databaseManagement/v1/select/omc_db/pm_custom_title`,
|
||||
// method: 'get',
|
||||
// params: {
|
||||
// totalSQL: totalSQL + querySQL,
|
||||
// rowsSQL: rowsSQL + querySQL + sortSql + limtSql,
|
||||
// },
|
||||
// });
|
||||
|
||||
// // 解析数据
|
||||
// if (result.code === RESULT_CODE_SUCCESS) {
|
||||
// const data: DataList = {
|
||||
// total: 0,
|
||||
// rows: [],
|
||||
// code: result.code,
|
||||
// msg: result.msg,
|
||||
// };
|
||||
// result.data.data.forEach((item: any) => {
|
||||
// const itemData = item['pm_custom_title'];
|
||||
// if (Array.isArray(itemData)) {
|
||||
// if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
// data.total = itemData[0]['total'];
|
||||
// } else {
|
||||
// data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// return data;
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 新 查询自定义指标
|
||||
@@ -71,7 +9,7 @@ export async function listCustom(query?: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/pm/kpiC/title/totalList`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
});
|
||||
return result;
|
||||
@@ -85,7 +23,7 @@ export async function listCustom(query?: Record<string, any>) {
|
||||
export async function getCustom(id: string | number) {
|
||||
return request({
|
||||
url: `/pm/kpiC/title/${id}`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -97,7 +35,7 @@ export async function getCustom(id: string | number) {
|
||||
export function addCustom(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/pm/kpiC/title`,
|
||||
method: 'post',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
@@ -110,7 +48,7 @@ export function addCustom(data: Record<string, any>) {
|
||||
export function updateCustom(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/pm/kpiC/title/${data.id}`,
|
||||
method: 'put',
|
||||
method: 'PUT',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
@@ -122,6 +60,6 @@ export function updateCustom(data: Record<string, any>) {
|
||||
export async function delCustom(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/pm/kpiC/title/${data.id}`,
|
||||
method: 'delete',
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function listgoldData(query: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/gold_kpi`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
totalSQL: totalSQL + querySQL,
|
||||
rowsSQL: rowsSQL + querySQL + sortSql + limtSql,
|
||||
@@ -56,9 +56,8 @@ export async function listgoldData(query: Record<string, any>) {
|
||||
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
const data = {
|
||||
data: { total: 0, rows: [] as any },
|
||||
code: result.code,
|
||||
msg: result.msg,
|
||||
};
|
||||
@@ -66,9 +65,9 @@ export async function listgoldData(query: Record<string, any>) {
|
||||
const itemData = item['gold_kpi'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
data.data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
data.data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -85,7 +84,7 @@ export async function listgoldData(query: Record<string, any>) {
|
||||
export async function listKPIData(query: Record<string, any>) {
|
||||
const result = await request({
|
||||
url: `/neData/kpi/data`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
timeout: 60_000,
|
||||
});
|
||||
@@ -102,7 +101,7 @@ export async function getKPITitle(neType: string) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/neData/kpi/title`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: { neType },
|
||||
});
|
||||
// 解析数据//
|
||||
@@ -125,7 +124,7 @@ export async function listUPFData(timeArr: any) {
|
||||
// 获取参数规则
|
||||
request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/gold_kpi`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `SELECT gold_kpi.*,kpi_title.en_title FROM gold_kpi LEFT JOIN kpi_title on gold_kpi.kpi_id=kpi_title.kpi_id where 1=1 and gold_kpi.kpi_id ='UPF.03' AND timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 10 MINUTE) AND NOW()`,
|
||||
},
|
||||
@@ -134,7 +133,7 @@ export async function listUPFData(timeArr: any) {
|
||||
// 获取对应信息
|
||||
request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/gold_kpi`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `SELECT gold_kpi.*,kpi_title.en_title FROM gold_kpi LEFT JOIN kpi_title on gold_kpi.kpi_id=kpi_title.kpi_id where 1=1 and gold_kpi.kpi_id ='UPF.06' AND timestamp BETWEEN DATE_SUB(NOW(), INTERVAL 10 MINUTE) AND NOW()`,
|
||||
},
|
||||
|
||||
@@ -30,10 +30,10 @@ export async function listperfData(query: Record<string, any>) {
|
||||
let sortSql = ' order by ';
|
||||
if (query.sortField) {
|
||||
sortSql += ` ${query.sortField} `;
|
||||
}else{
|
||||
} else {
|
||||
sortSql += ` start_time `;
|
||||
}
|
||||
|
||||
|
||||
if (query.sortOrder === 'asc') {
|
||||
sortSql += ' asc ';
|
||||
} else {
|
||||
@@ -47,7 +47,7 @@ export async function listperfData(query: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/measure_data`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
totalSQL: totalSQL + querySQL,
|
||||
rowsSQL: rowsSQL + querySQL + sortSql + limtSql,
|
||||
@@ -56,9 +56,8 @@ export async function listperfData(query: Record<string, any>) {
|
||||
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
const data = {
|
||||
data: { total: 0, rows: [] as any },
|
||||
code: result.code,
|
||||
msg: result.msg,
|
||||
};
|
||||
@@ -66,9 +65,9 @@ export async function listperfData(query: Record<string, any>) {
|
||||
const itemData = item['measure_data'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
data.data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
data.data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function listPerfThreshold(query: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/measure_threshold`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
totalSQL: totalSQL + querySQL,
|
||||
rowsSQL: rowsSQL + querySQL + sortSql + limtSql,
|
||||
@@ -41,9 +41,8 @@ export async function listPerfThreshold(query: Record<string, any>) {
|
||||
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
const data = {
|
||||
data: { total: 0, rows: [] as any },
|
||||
code: result.code,
|
||||
msg: result.msg,
|
||||
};
|
||||
@@ -51,9 +50,9 @@ export async function listPerfThreshold(query: Record<string, any>) {
|
||||
const itemData = item['measure_threshold'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
data.data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
data.data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -71,7 +70,7 @@ export async function getPerfThre(id: string | number) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/measure_threshold`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `select * from measure_threshold where id = ${id}`,
|
||||
},
|
||||
@@ -102,7 +101,7 @@ export function addPerfThre(data: Record<string, any>) {
|
||||
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_threshold`,
|
||||
method: 'post',
|
||||
method: 'POST',
|
||||
data: { measure_threshold: [obj] },
|
||||
});
|
||||
}
|
||||
@@ -122,7 +121,7 @@ export function updatePerfThre(data: Record<string, any>) {
|
||||
};
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_threshold?WHERE=id=${data.id}`,
|
||||
method: 'put',
|
||||
method: 'PUT',
|
||||
data: { measure_threshold: obj },
|
||||
});
|
||||
}
|
||||
@@ -135,7 +134,7 @@ export function updatePerfThre(data: Record<string, any>) {
|
||||
export async function delPerfThre(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_threshold?WHERE=id=${data.id}`,
|
||||
method: 'delete',
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -147,7 +146,7 @@ export async function getNePerformanceList() {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/measure_title`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `SELECT * FROM measure_title`,
|
||||
},
|
||||
@@ -170,7 +169,7 @@ export async function getNePerformanceList() {
|
||||
export function threRun(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_threshold?WHERE=id=${data.id}`,
|
||||
method: 'put',
|
||||
method: 'PUT',
|
||||
data: { data: { status: 'Active' } },
|
||||
});
|
||||
}
|
||||
@@ -183,7 +182,7 @@ export function threRun(data: Record<string, any>) {
|
||||
export function threStop(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_threshold?WHERE=id=${data.id}`,
|
||||
method: 'put',
|
||||
method: 'PUT',
|
||||
data: { data: { status: 'Inactive' } },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export async function listPerfTask(query: Record<string, any>) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/measure_task`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
totalSQL: totalSQL + querySQL,
|
||||
rowsSQL: rowsSQL + querySQL + sortSql+ limtSql,
|
||||
@@ -41,9 +41,8 @@ export async function listPerfTask(query: Record<string, any>) {
|
||||
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
const data = {
|
||||
data: { total: 0, rows: [] as any },
|
||||
code: result.code,
|
||||
msg: result.msg,
|
||||
};
|
||||
@@ -51,9 +50,9 @@ export async function listPerfTask(query: Record<string, any>) {
|
||||
const itemData = item['measure_task'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
data.data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
data.data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -71,7 +70,7 @@ export async function getPerfTask(id: string | number) {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/select/omc_db/measure_task`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `select * from measure_task where id = ${id}`,
|
||||
},
|
||||
@@ -120,7 +119,7 @@ export function addPerfTask(data: Record<string, any>) {
|
||||
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_task`,
|
||||
method: 'post',
|
||||
method: 'POST',
|
||||
data: { measure_task: [obj] },
|
||||
});
|
||||
}
|
||||
@@ -158,7 +157,7 @@ export function updatePerfTask(data: Record<string, any>) {
|
||||
};
|
||||
return request({
|
||||
url: `/api/rest/databaseManagement/v1/omc_db/measure_task?WHERE=id=${data.id}`,
|
||||
method: 'put',
|
||||
method: 'PUT',
|
||||
data: { measure_task: obj },
|
||||
});
|
||||
}
|
||||
@@ -173,7 +172,7 @@ export async function delPerfTask(data: Record<string, any>) {
|
||||
url: `/api/rest/performanceManagement/v1/elementType/${data.neType.toLowerCase()}/objectType/measureTask?id=${
|
||||
data.id
|
||||
}`,
|
||||
method: 'delete',
|
||||
method: 'DELETE',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -185,7 +184,7 @@ export async function getNePerformanceList() {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/api/rest/databaseManagement/v1/elementType/omc_db/objectType/measure_title`,
|
||||
method: 'get',
|
||||
method: 'GET',
|
||||
params: {
|
||||
SQL: `SELECT * FROM measure_title`,
|
||||
},
|
||||
@@ -209,7 +208,7 @@ export async function getNePerformanceList() {
|
||||
export function taskRun(data: Record<string, any>) {
|
||||
return request({
|
||||
url: `/api/rest/performanceManagement/v1/elementType/${data.neType.toLowerCase()}/objectType/measureTask?id=${data.id}`,
|
||||
method: 'post',
|
||||
method: 'POST',
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user