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

@@ -11,6 +11,7 @@ import { authUserAllocatedList, authUserChecked } from '@/api/system/role';
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 { getDict } = useDictStore();
const route = useRoute();
@@ -169,7 +170,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;
}
@@ -215,7 +216,7 @@ function fnModalOk(userIds: string[] | number[]) {
roleId: roleId,
}).then(res => {
hide();
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
modalState.visibleBySelectUser = false;
message.success({
content: `授权用户添加成功`,
@@ -247,7 +248,7 @@ function fnRecordDelete(userId: string | number) {
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then(
res => {
hide();
if (res.code === 1) {
if (res.code === RESULT_CODE_SUCCESS) {
message.success({
content: `取消授权成功`,
duration: 3,
@@ -280,7 +281,7 @@ function fnGetList() {
if (tableState.loading) return;
tableState.loading = true;
authUserAllocatedList(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 = [];