fix: 查询记录数1问题
This commit is contained in:
@@ -59,7 +59,7 @@ export async function listAlarm(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['alarm_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total']) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
} else {
|
||||
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) => {
|
||||
const itemData = item['alarm_forward_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total']) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
} else {
|
||||
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) => {
|
||||
const itemData = item['mml_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total']) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
} else {
|
||||
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) => {
|
||||
const itemData = item['operation_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total']) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
} else {
|
||||
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) => {
|
||||
const itemData = item['security_log'];
|
||||
if (Array.isArray(itemData)) {
|
||||
if (itemData.length === 1 && itemData[0]['total']) {
|
||||
if (itemData.length === 1 && itemData[0]['total'] >= 0) {
|
||||
data.total = itemData[0]['total'];
|
||||
} else {
|
||||
data.rows = itemData.map(v => parseObjLineToHump(v));
|
||||
|
||||
Reference in New Issue
Block a user