fix: 状态码使用常量避免后续变更

This commit is contained in:
TsMask
2023-09-14 15:19:37 +08:00
parent 9a88d9b8de
commit 03e1b4b8bd
18 changed files with 120 additions and 78 deletions

View File

@@ -15,6 +15,7 @@ import {
} from '@/api/configManage/neManage';
import { parseDateToStr } from '@/utils/date-utils';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { t } = useI18n();
const route = useRoute();
@@ -271,7 +272,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
getNeInfo(row.id).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改网元';
modalState.visibleByEdit = true;
@@ -296,7 +297,7 @@ function fnModalOk() {
const hide = message.loading({ content: t('common.loading') });
result
.then(res => {
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
@@ -367,7 +368,7 @@ function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
listNeInfo(toRaw(queryParams)).then(res => {
if (res.code === 1 && Array.isArray(res.rows)) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];

View File

@@ -15,6 +15,7 @@ import {
} from '@/api/configManage/neManage';
import { parseDateToStr } from '@/utils/date-utils';
import useI18n from '@/hooks/useI18n';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
const { t } = useI18n();
const route = useRoute();
@@ -237,7 +238,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
getNeInfo(row.id).then(res => {
modalState.confirmLoading = false;
hide();
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.from = Object.assign(modalState.from, res.data);
modalState.title = '修改网元';
modalState.visibleByEdit = true;
@@ -262,7 +263,7 @@ function fnModalOk() {
const hide = message.loading({ content: t('common.loading') });
result
.then(res => {
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: t('common.msgSuccess', { msg: modalState.title }),
duration: 3,
@@ -333,7 +334,7 @@ function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
listNeInfo(toRaw(queryParams)).then(res => {
if (res.code === 1 && Array.isArray(res.rows)) {
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.rows)) {
// 取消勾选
if (tableState.selectedRowKeys.length > 0) {
tableState.selectedRowKeys = [];