fix: 状态码使用常量避免后续变更
This commit is contained in:
@@ -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