fix: 状态码使用常量避免后续变更
This commit is contained in:
@@ -19,6 +19,7 @@ import { saveAs } from 'file-saver';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useTabsStore from '@/store/modules/tabs';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const tabsStore = useTabsStore();
|
||||
const { parseDataDict, getDict } = useDictStore();
|
||||
const route = useRoute();
|
||||
@@ -202,7 +203,7 @@ function fnTableSize({ key }: MenuInfo) {
|
||||
}
|
||||
|
||||
/**表格斑马纹 */
|
||||
function fnTableStriped(_record: unknown, index: number) {
|
||||
function fnTableStriped(_record: unknown, index: number):any {
|
||||
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||
}
|
||||
|
||||
@@ -286,7 +287,7 @@ function fnModalVisibleByEdit(dictCode?: string | number) {
|
||||
getData(dictCode).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;
|
||||
@@ -312,7 +313,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
dictData
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -363,7 +364,7 @@ function fnRecordDelete(dictCode: string = '0') {
|
||||
const key = 'delData';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
delData(dictCode).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
key,
|
||||
@@ -391,7 +392,7 @@ function fnExportList() {
|
||||
const key = 'exportData';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
exportData(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `已完成导出`,
|
||||
key,
|
||||
@@ -425,7 +426,7 @@ function fnGetList() {
|
||||
if (tableState.loading) return;
|
||||
tableState.loading = true;
|
||||
listData(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 = [];
|
||||
@@ -448,7 +449,7 @@ onMounted(() => {
|
||||
}
|
||||
if (resArr[1].status === 'fulfilled') {
|
||||
const dicts = resArr[1].value;
|
||||
if (dicts.code === 1) {
|
||||
if (dicts.code === RESULT_CODE_SUCCESS) {
|
||||
dict.sysDictType = dicts.data;
|
||||
}
|
||||
}
|
||||
@@ -456,7 +457,7 @@ onMounted(() => {
|
||||
// 指定字典id列表数据
|
||||
if (dictId && dictId !== '0') {
|
||||
getType(dictId).then(res => {
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
queryParams.dictType = res.data.dictType;
|
||||
fnGetList();
|
||||
} else {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { saveAs } from 'file-saver';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { getDict } = useDictStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
@@ -171,7 +172,7 @@ function fnTableSize({ key }: MenuInfo) {
|
||||
}
|
||||
|
||||
/**表格斑马纹 */
|
||||
function fnTableStriped(_record: unknown, index: number) {
|
||||
function fnTableStriped(_record: unknown, index: number):any {
|
||||
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||
}
|
||||
|
||||
@@ -237,7 +238,7 @@ function fnModalVisibleByVive(dictId: string | number) {
|
||||
getType(dictId).then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
modalState.from = Object.assign(modalState.from, res.data);
|
||||
modalState.title = '字典类型信息';
|
||||
modalState.visibleByView = true;
|
||||
@@ -263,7 +264,7 @@ function fnModalVisibleByEdit(dictId?: string | number) {
|
||||
getType(dictId).then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
modalState.from = Object.assign(modalState.from, res.data);
|
||||
modalState.title = '修改字典类型';
|
||||
modalState.visibleByEdit = true;
|
||||
@@ -289,7 +290,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
dictType
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -340,7 +341,7 @@ function fnRecordDelete(dictId: string = '0') {
|
||||
const key = 'delType';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
delType(dictId).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
key,
|
||||
@@ -368,7 +369,7 @@ function fnExportList() {
|
||||
const key = 'exportType';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
exportType(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `已完成导出`,
|
||||
key,
|
||||
@@ -398,7 +399,7 @@ function fnRefreshCache() {
|
||||
const key = 'refreshCache';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
refreshCache().then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `刷新缓存成功`,
|
||||
key,
|
||||
@@ -428,7 +429,7 @@ function fnGetList() {
|
||||
queryParams.beginTime = queryRangePicker.value[0];
|
||||
queryParams.endTime = queryRangePicker.value[1];
|
||||
listType(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 = [];
|
||||
|
||||
Reference in New Issue
Block a user