fix: 查询记录数1问题
This commit is contained in:
1 parent
09bcf2dc25
commit
0dee0fecc0
12 files changed
+25
-25
No files matched your search
@@ -42,7 +42,7 @@ export async function listNeBackup(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['ne_backup'];
|
const itemData = item['ne_backup'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export async function listNeInfo(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['ne_info'];
|
const itemData = item['ne_info'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export async function listNeSoftware(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['ne_software'];
|
const itemData = item['ne_software'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
@@ -141,7 +141,7 @@ export async function listNeVersion(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['ne_version'];
|
const itemData = item['ne_version'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { stringify } from 'querystring';
|
|||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
/**
|
/**
|
||||||
* 查询列表
|
* ��ѯ�б�
|
||||||
* @param query 查询参数
|
* @param query ��ѯ����
|
||||||
* @returns object
|
* @returns object
|
||||||
*/
|
*/
|
||||||
export async function listAct(query: Record<string, any>) {
|
export async function listAct(query: Record<string, any>) {
|
||||||
@@ -15,7 +15,7 @@ export async function listAct(query: Record<string, any>) {
|
|||||||
let totalSQL = `select count(*) as total from alarm where alarm_status='1' ${filterData} `;
|
let totalSQL = `select count(*) as total from alarm where alarm_status='1' ${filterData} `;
|
||||||
let rowsSQL = `select * from alarm where alarm_status='1' ${filterData}`;
|
let rowsSQL = `select * from alarm where alarm_status='1' ${filterData}`;
|
||||||
|
|
||||||
// 查询
|
// ��ѯ
|
||||||
let querySQL = '';
|
let querySQL = '';
|
||||||
if (query.alarm_code) {
|
if (query.alarm_code) {
|
||||||
querySQL += ` and alarm_code = '${query.alarm_code}' `;
|
querySQL += ` and alarm_code = '${query.alarm_code}' `;
|
||||||
@@ -39,11 +39,11 @@ export async function listAct(query: Record<string, any>) {
|
|||||||
querySQL += ` and ne_type like '%${query.ne_type}%' `;
|
querySQL += ` and ne_type like '%${query.ne_type}%' `;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页
|
// ��ҳ
|
||||||
const pageNum = (query.pageNum - 1) * query.pageSize;
|
const pageNum = (query.pageNum - 1) * query.pageSize;
|
||||||
const limtSql = ` order by event_time desc limit ${pageNum},${query.pageSize} `;
|
const limtSql = ` order by event_time desc limit ${pageNum},${query.pageSize} `;
|
||||||
|
|
||||||
// 发起请求
|
// ��������
|
||||||
const result = await request({
|
const result = await request({
|
||||||
url: `/databaseManagement/v1/select/omc_db/alarm`,
|
url: `/databaseManagement/v1/select/omc_db/alarm`,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -53,7 +53,7 @@ export async function listAct(query: Record<string, any>) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// 解析数据
|
// ��������
|
||||||
if (result.code === RESULT_CODE_SUCCESS) {
|
if (result.code === RESULT_CODE_SUCCESS) {
|
||||||
const data: DataList = {
|
const data: DataList = {
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -64,7 +64,7 @@ export async function listAct(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['alarm'];
|
const itemData = item['alarm'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
@@ -77,8 +77,8 @@ export async function listAct(query: Record<string, any>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认告警信息
|
* ȷ�ϸ澯��Ϣ
|
||||||
* @param data 鉴权对象
|
* @param data ��Ȩ����
|
||||||
* @returns object
|
* @returns object
|
||||||
*/
|
*/
|
||||||
export function updateConfirm(data: Record<string, any>) {
|
export function updateConfirm(data: Record<string, any>) {
|
||||||
@@ -100,8 +100,8 @@ export function updateConfirm(data: Record<string, any>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消确认告警
|
* ȡ��ȷ�ϸ澯
|
||||||
* @param data 鉴权对象
|
* @param data ��Ȩ����
|
||||||
* @returns object
|
* @returns object
|
||||||
*/
|
*/
|
||||||
export function cancelConfirm(data: (string | number)[]) {
|
export function cancelConfirm(data: (string | number)[]) {
|
||||||
@@ -125,8 +125,8 @@ export function cancelConfirm(data: (string | number)[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手工同步
|
* �ֹ�ͬ��
|
||||||
* @param data 鉴权对象
|
* @param data ��Ȩ����
|
||||||
* @returns object
|
* @returns object
|
||||||
*/
|
*/
|
||||||
export function listSync() {
|
export function listSync() {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export async function listAlarm(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['alarm_log'];
|
const itemData = item['alarm_log'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export async function listForwarding(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['alarm_forward_log'];
|
const itemData = item['alarm_forward_log'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export async function listMML(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['mml_log'];
|
const itemData = item['mml_log'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export async function listOperationLog(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['operation_log'];
|
const itemData = item['operation_log'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export async function listSecurityLog(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['security_log'];
|
const itemData = item['security_log'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export async function listSession(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['session'];
|
const itemData = item['session'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export async function listTraceData(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['trace_data'];
|
const itemData = item['trace_data'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export async function listTraceTask(query: Record<string, any>) {
|
|||||||
result.data.data.forEach((item: any) => {
|
result.data.data.forEach((item: any) => {
|
||||||
const itemData = item['trace_task'];
|
const itemData = item['trace_task'];
|
||||||
if (Array.isArray(itemData)) {
|
if (Array.isArray(itemData)) {
|
||||||
if (itemData.length === 1 && itemData[0]['total']) {
|
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||||
data.total = itemData[0]['total'];
|
data.total = itemData[0]['total'];
|
||||||
} else {
|
} else {
|
||||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||||
|
|||||||
Reference in new issue
Block a user