fix: 查询记录数1问题
This commit is contained in:
@@ -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';
|
||||||
/**
|
/**
|
||||||
* <20><>ѯ<EFBFBD>б<EFBFBD>
|
* <20><>ѯ<EFBFBD>б<EFBFBD>
|
||||||
* @param query <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
* @param query <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||||||
* @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}`;
|
||||||
|
|
||||||
// <20><>ѯ
|
// <20><>ѯ
|
||||||
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}%' `;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <20><>ҳ
|
// <20><>ҳ
|
||||||
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} `;
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
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>) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
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>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ȷ<>ϸ澯<CFB8><E6BEAF>Ϣ
|
* ȷ<>ϸ澯<CFB8><E6BEAF>Ϣ
|
||||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||||
* @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>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ȡ<><C8A1>ȷ<EFBFBD>ϸ澯
|
* ȡ<><C8A1>ȷ<EFBFBD>ϸ澯
|
||||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||||
* @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)[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <20>ֹ<EFBFBD>ͬ<EFBFBD><CDAC>
|
* <20>ֹ<EFBFBD>ͬ<EFBFBD><CDAC>
|
||||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||||
* @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