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) => {
|
||||
const itemData = item['ne_backup'];
|
||||
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));
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function listNeInfo(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['ne_info'];
|
||||
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));
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function listNeSoftware(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['ne_software'];
|
||||
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));
|
||||
@@ -141,7 +141,7 @@ export async function listNeVersion(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['ne_version'];
|
||||
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));
|
||||
|
||||
@@ -6,8 +6,8 @@ import { stringify } from 'querystring';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
/**
|
||||
* <20><>ѯ<EFBFBD>б<EFBFBD>
|
||||
* @param query <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||||
* <20><>ѯ<EFBFBD>б<EFBFBD>
|
||||
* @param query <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||||
* @returns object
|
||||
*/
|
||||
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 rowsSQL = `select * from alarm where alarm_status='1' ${filterData}`;
|
||||
|
||||
// <20><>ѯ
|
||||
// <20><>ѯ
|
||||
let querySQL = '';
|
||||
if (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}%' `;
|
||||
}
|
||||
|
||||
// <20><>ҳ
|
||||
// <20><>ҳ
|
||||
const pageNum = (query.pageNum - 1) * 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({
|
||||
url: `/databaseManagement/v1/select/omc_db/alarm`,
|
||||
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) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
@@ -64,7 +64,7 @@ export async function listAct(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['alarm'];
|
||||
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));
|
||||
@@ -77,8 +77,8 @@ export async function listAct(query: Record<string, any>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* ȷ<>ϸ澯<CFB8><E6BEAF>Ϣ
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* ȷ<>ϸ澯<CFB8><E6BEAF>Ϣ
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* @returns object
|
||||
*/
|
||||
export function updateConfirm(data: Record<string, any>) {
|
||||
@@ -100,8 +100,8 @@ export function updateConfirm(data: Record<string, any>) {
|
||||
}
|
||||
|
||||
/**
|
||||
* ȡ<><C8A1>ȷ<EFBFBD>ϸ澯
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* ȡ<><C8A1>ȷ<EFBFBD>ϸ澯
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* @returns object
|
||||
*/
|
||||
export function cancelConfirm(data: (string | number)[]) {
|
||||
@@ -125,8 +125,8 @@ export function cancelConfirm(data: (string | number)[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* <20>ֹ<EFBFBD>ͬ<EFBFBD><CDAC>
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* <20>ֹ<EFBFBD>ͬ<EFBFBD><CDAC>
|
||||
* @param data <20><>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
|
||||
* @returns object
|
||||
*/
|
||||
export function listSync() {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function listSession(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['session'];
|
||||
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));
|
||||
|
||||
@@ -45,7 +45,7 @@ export async function listTraceData(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['trace_data'];
|
||||
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));
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function listTraceTask(query: Record<string, any>) {
|
||||
result.data.data.forEach((item: any) => {
|
||||
const itemData = item['trace_task'];
|
||||
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