fix: 状态码使用常量避免后续变更
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { request } from '@/plugins/http-fetch';
|
||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
|
||||
@@ -31,7 +32,7 @@ export async function listNeInfo(query: Record<string, any>) {
|
||||
});
|
||||
|
||||
// 解析数据
|
||||
if (result.code === 1) {
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
@@ -68,7 +69,7 @@ export async function getNeInfo(id: string | number) {
|
||||
},
|
||||
});
|
||||
// 解析数据
|
||||
if (result.code === 1 && Array.isArray(result.data.data)) {
|
||||
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
|
||||
let data = result.data.data[0];
|
||||
return Object.assign(result, {
|
||||
data: parseObjLineToHump(data['ne_info'][0]),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
import { request } from '@/plugins/http-fetch';
|
||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
||||
|
||||
@@ -31,7 +32,7 @@ export async function listNeInfo(query: Record<string, any>) {
|
||||
});
|
||||
|
||||
// 解析数据
|
||||
if (result.code === 1) {
|
||||
if (result.code === RESULT_CODE_SUCCESS) {
|
||||
const data: DataList = {
|
||||
total: 0,
|
||||
rows: [],
|
||||
@@ -68,7 +69,7 @@ export async function getNeInfo(id: string | number) {
|
||||
},
|
||||
});
|
||||
// 解析数据
|
||||
if (result.code === 1 && Array.isArray(result.data.data)) {
|
||||
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
|
||||
let data = result.data.data[0];
|
||||
return Object.assign(result, {
|
||||
data: parseObjLineToHump(data['ne_info'][0]),
|
||||
@@ -116,3 +117,27 @@ export async function delNeInfo(data: Record<string, any>) {
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询网元详细
|
||||
* @param menuId 网元ID
|
||||
* @returns object
|
||||
*/
|
||||
export async function getNeType() {
|
||||
// 发起请求
|
||||
const result = await request({
|
||||
url: `/databaseManagement/v1/select/omc_db/ne_info`,
|
||||
method: 'get',
|
||||
params: {
|
||||
SQL: `SELECT ne_type,ne_name,ne_id FROM ne_info WHERE status = 0`,
|
||||
},
|
||||
});
|
||||
// 解析数据
|
||||
if (result.code === RESULT_CODE_SUCCESS && Array.isArray(result.data.data)) {
|
||||
let data = result.data.data[0];
|
||||
return Object.assign(result, {
|
||||
data: parseObjLineToHump(data['ne_info'][0]),
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { getDictDataType } from '@/api/system/dict/data';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
|
||||
/**字典参数类型 */
|
||||
type DictStore = {
|
||||
@@ -42,7 +43,7 @@ const useDictStore = defineStore('dict', {
|
||||
let disct = this.dicts.get(key);
|
||||
if (disct === undefined || disct.length === 0) {
|
||||
const res = await getDictDataType(key);
|
||||
if (res.code === 1 && Array.isArray(res.data)) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
const dictData: DictType[] = res.data.map(d => ({
|
||||
label: d.dictLabel,
|
||||
value: d.dictValue,
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
MENU_COMPONENT_LAYOUT_BLANK,
|
||||
MENU_COMPONENT_LAYOUT_LINK,
|
||||
} from '@/constants/menu-constants';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
|
||||
/**路由构建参数类型 */
|
||||
type RouterStore = {
|
||||
@@ -46,7 +47,7 @@ const useRouterStore = defineStore('router', {
|
||||
*/
|
||||
async generateRoutes() {
|
||||
const res = await getRouters();
|
||||
if (res.code === 1 && Array.isArray(res.data)) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
const buildRoutes = buildRouters(res.data.concat());
|
||||
this.buildRouterData = buildRoutes;
|
||||
return buildRoutes;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getToken, setToken, removeToken } from '@/plugins/auth-token';
|
||||
import { defineStore } from 'pinia';
|
||||
import { TOKEN_RESPONSE_FIELD } from '@/constants/token-constants';
|
||||
import { validHttp } from '@/utils/regular-utils';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
|
||||
/**用户信息类型 */
|
||||
type UserInfo = {
|
||||
@@ -107,7 +108,7 @@ const useUserStore = defineStore('user', {
|
||||
// 登录
|
||||
async fnLogin(loginBody: Record<string, string>) {
|
||||
const res = await login(loginBody);
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||
setToken(token);
|
||||
this.token = token;
|
||||
@@ -117,7 +118,7 @@ const useUserStore = defineStore('user', {
|
||||
// 获取用户信息
|
||||
async fnGetInfo() {
|
||||
const res = await getInfo();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const { user, roles, permissions } = res.data;
|
||||
// 登录账号
|
||||
this.userName = user.accountId;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { getUserProfile } from '@/api/profile';
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
|
||||
/**加载状态 */
|
||||
let loading = ref<boolean>(true);
|
||||
@@ -54,7 +55,7 @@ let listData = ref([
|
||||
/**查询用户个人信息 */
|
||||
function fnGetProfile() {
|
||||
getUserProfile().then(res => {
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const { user, roleGroup, postGroup } = res.data;
|
||||
state.user = user;
|
||||
state.roleGroup = roleGroup;
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -7,6 +7,7 @@ import { getCaptchaImage } from '@/api/login';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { toRaw } from 'vue';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { t, changeLocale } = useI18n();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@@ -54,7 +55,7 @@ function fnFinish() {
|
||||
useUserStore()
|
||||
.fnLogin(toRaw(state.from))
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success(t('views.login.loginSuccess'), 3);
|
||||
router.push({ path: redirectPath });
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ import { register } from '@/api/login';
|
||||
import { regExpPasswd, regExpUserName } from '@/utils/regular-utils';
|
||||
import { useRouter } from 'vue-router';
|
||||
import useI18n from '@/hooks/useI18n';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -44,7 +45,7 @@ function fnFinish() {
|
||||
const hide = message.loading(t('common.loading'), 0);
|
||||
register(toRaw(state.form))
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
Modal.success({
|
||||
title: t('common.tipTitle'),
|
||||
content: t('views.register.tipContent', {
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
import { saveAs } from 'file-saver';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { getDict } = useDictStore();
|
||||
const route = useRoute();
|
||||
|
||||
@@ -174,7 +175,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;
|
||||
}
|
||||
|
||||
@@ -239,7 +240,7 @@ function fnModalVisibleByVive(configId: string | number) {
|
||||
return;
|
||||
}
|
||||
getConfig(configId).then(res => {
|
||||
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;
|
||||
@@ -265,7 +266,7 @@ function fnModalVisibleByEdit(configId?: string | number) {
|
||||
getConfig(configId).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;
|
||||
@@ -291,7 +292,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
config
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -342,7 +343,7 @@ function fnRecordDelete(configId: string = '0') {
|
||||
const key = 'delConfig';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
delConfig(configId).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
key,
|
||||
@@ -370,7 +371,7 @@ function fnExportList() {
|
||||
const key = 'exportConfig';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
exportConfig(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `已完成导出`,
|
||||
key,
|
||||
@@ -400,7 +401,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,
|
||||
@@ -425,7 +426,7 @@ function fnGetList() {
|
||||
queryParams.beginTime = queryRangePicker.value[0];
|
||||
queryParams.endTime = queryRangePicker.value[1];
|
||||
listConfig(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 = [];
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
MENU_TYPE_BUTTON,
|
||||
} from '@/constants/menu-constants';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { getDict } = useDictStore();
|
||||
const route = useRoute();
|
||||
|
||||
@@ -160,7 +161,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;
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ function fnModalVisibleByVive(menuId: string | number) {
|
||||
getMenu(menuId).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;
|
||||
@@ -311,7 +312,7 @@ function fnModalVisibleByEdit(
|
||||
getMenu(menuId).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;
|
||||
@@ -349,7 +350,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
menu
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -398,7 +399,7 @@ function fnRecordDelete(menuId: string | number) {
|
||||
const key = 'delMenu';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
delMenu(menuId).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
key,
|
||||
@@ -422,7 +423,7 @@ function fnGetList() {
|
||||
if (tableState.loading) return;
|
||||
tableState.loading = true;
|
||||
listMenu(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1 && Array.isArray(res.data)) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
menuListData = JSON.parse(JSON.stringify(res.data));
|
||||
// 初始上级菜单和展开编号key
|
||||
if (treeDataAll.length <= 0) {
|
||||
|
||||
@@ -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 = [];
|
||||
|
||||
@@ -6,6 +6,7 @@ import { ColumnsType } from 'ant-design-vue/lib/table';
|
||||
import { authUserAllocatedList } from '@/api/system/role';
|
||||
import { parseDateToStr } from '@/utils/date-utils';
|
||||
import useDictStore from '@/store/modules/dict';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { getDict } = useDictStore();
|
||||
const emit = defineEmits(['ok', 'cancel', 'update:visible']);
|
||||
const props = defineProps({
|
||||
@@ -150,7 +151,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 = [];
|
||||
|
||||
@@ -25,6 +25,7 @@ import { DataNode } from 'ant-design-vue/lib/tree';
|
||||
import { parseTreeKeys, parseTreeNodeKeys } from '@/utils/parse-tree-utils';
|
||||
import { hasPermissions } from '@/plugins/auth-user';
|
||||
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();
|
||||
@@ -182,7 +183,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;
|
||||
}
|
||||
|
||||
@@ -305,9 +306,9 @@ function fnModalVisibleByVive(roleId: string | number) {
|
||||
Promise.all([getRole(roleId), roleMenuTreeSelect(roleId)]).then(resArr => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (resArr[0].code === 1 && resArr[0].data) {
|
||||
if (resArr[0].code === RESULT_CODE_SUCCESS && resArr[0].data) {
|
||||
modalState.from = Object.assign(modalState.from, resArr[0].data);
|
||||
if (resArr[1].code === 1 && resArr[1].data) {
|
||||
if (resArr[1].code === RESULT_CODE_SUCCESS && resArr[1].data) {
|
||||
const { menus, checkedKeys } = resArr[1].data;
|
||||
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
||||
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
||||
@@ -343,7 +344,7 @@ function fnModalVisibleByEdit(roleId?: string | number) {
|
||||
menuTreeSelect().then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && Array.isArray(res.data)) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
menuTree.checkedKeys = parseTreeKeys(res.data, 'id');
|
||||
menuTree.expandedKeys = parseTreeNodeKeys(res.data, 'id');
|
||||
menuTree.treeData = res.data;
|
||||
@@ -361,9 +362,9 @@ function fnModalVisibleByEdit(roleId?: string | number) {
|
||||
Promise.all([getRole(roleId), roleMenuTreeSelect(roleId)]).then(resArr => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (resArr[0].code === 1 && resArr[0].data) {
|
||||
if (resArr[0].code === RESULT_CODE_SUCCESS && resArr[0].data) {
|
||||
modalState.from = Object.assign(modalState.from, resArr[0].data);
|
||||
if (resArr[1].code === 1 && resArr[1].data) {
|
||||
if (resArr[1].code === RESULT_CODE_SUCCESS && resArr[1].data) {
|
||||
const { menus, checkedKeys } = resArr[1].data;
|
||||
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
||||
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
||||
@@ -396,7 +397,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
role
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -507,7 +508,7 @@ function fnModalOkDataScope() {
|
||||
}
|
||||
dataScope(fromInfo)
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
duration: 2,
|
||||
@@ -542,9 +543,9 @@ function fnRecordDataScope(roleId: string | number) {
|
||||
// 查询角色详细同时根据角色ID查询部门树结构
|
||||
Promise.all([getRole(roleId), roleDeptTreeSelect(roleId)])
|
||||
.then(resArr => {
|
||||
if (resArr[0].code === 1 && resArr[0].data) {
|
||||
if (resArr[0].code === RESULT_CODE_SUCCESS && resArr[0].data) {
|
||||
modalState.from = Object.assign(modalState.from, resArr[0].data);
|
||||
if (resArr[1].code === 1 && resArr[1].data) {
|
||||
if (resArr[1].code === RESULT_CODE_SUCCESS && resArr[1].data) {
|
||||
const { depts, checkedKeys } = resArr[1].data;
|
||||
deptTree.checkedKeys = parseTreeKeys(depts, 'id');
|
||||
deptTree.expandedKeys = parseTreeNodeKeys(depts, 'id');
|
||||
@@ -591,7 +592,7 @@ function fnRecordStatus(row: Record<string, string>) {
|
||||
const hide = message.loading('请稍等...', 0);
|
||||
changeRoleStatus(row.roleId, row.status).then(res => {
|
||||
hide();
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${row.roleName} ${text}成功`,
|
||||
duration: 2,
|
||||
@@ -626,7 +627,7 @@ function fnRecordDelete(roleId: string = '0') {
|
||||
const hide = message.loading('请稍等...', 0);
|
||||
delRole(roleId).then(res => {
|
||||
hide();
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
duration: 2,
|
||||
@@ -651,7 +652,7 @@ function fnExportList() {
|
||||
onOk() {
|
||||
const hide = message.loading('请稍等...', 0);
|
||||
exportRole(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `已完成导出`,
|
||||
duration: 2,
|
||||
@@ -675,7 +676,7 @@ function fnGetList() {
|
||||
queryParams.beginTime = queryRangePicker.value[0];
|
||||
queryParams.endTime = queryRangePicker.value[1];
|
||||
listRole(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 = [];
|
||||
|
||||
@@ -33,6 +33,7 @@ import useDictStore from '@/store/modules/dict';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { DataNode } from 'ant-design-vue/lib/tree';
|
||||
import { hasPermissions } from '@/plugins/auth-user';
|
||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||
const { getDict } = useDictStore();
|
||||
const route = useRoute();
|
||||
|
||||
@@ -198,7 +199,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;
|
||||
}
|
||||
|
||||
@@ -321,7 +322,7 @@ function fnModalVisibleByVive(userId: string | number) {
|
||||
getUser(userId).then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const roles = res.data.roles.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
@@ -361,7 +362,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
||||
getUser().then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const roles = res.data.roles.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
@@ -387,7 +388,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
||||
getUser(userId).then(res => {
|
||||
modalState.confirmLoading = false;
|
||||
hide();
|
||||
if (res.code === 1 && res.data) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||
const roles = res.data.roles.map((m: Record<string, any>) => {
|
||||
const disabled = m.status === '0';
|
||||
Reflect.set(m, 'disabled', disabled);
|
||||
@@ -426,7 +427,7 @@ function fnModalOk() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
user
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -477,7 +478,7 @@ function fnModalOkResetPwd() {
|
||||
message.loading({ content: '请稍等...', key });
|
||||
resetUserPwd(modalState.from.userId, modalState.from.password)
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${modalState.title}成功`,
|
||||
key,
|
||||
@@ -527,7 +528,7 @@ function fnRecordStatus(row: Record<string, string>) {
|
||||
const key = 'changeUserStatus';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
changeUserStatus(row.userId, row.status).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `${row.userName} ${text}成功`,
|
||||
key: key,
|
||||
@@ -564,7 +565,7 @@ function fnRecordDelete(userId: string = '0') {
|
||||
const key = 'delUser';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
delUser(userId).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `删除成功`,
|
||||
key,
|
||||
@@ -592,7 +593,7 @@ function fnExportList() {
|
||||
const key = 'exportUser';
|
||||
message.loading({ content: '请稍等...', key });
|
||||
exportUser(toRaw(queryParams)).then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `已完成导出`,
|
||||
key,
|
||||
@@ -650,7 +651,7 @@ function fnModalUploadXlsxImportExportTemplate() {
|
||||
const hide = message.loading('正在下载...', 0);
|
||||
importTemplate()
|
||||
.then(res => {
|
||||
if (res.code === 1) {
|
||||
if (res.code === RESULT_CODE_SUCCESS) {
|
||||
message.success({
|
||||
content: `成功读取并下载导入模板`,
|
||||
duration: 2,
|
||||
@@ -676,7 +677,7 @@ function fnGetList() {
|
||||
queryParams.beginTime = queryRangePicker.value[0];
|
||||
queryParams.endTime = queryRangePicker.value[1];
|
||||
listUser(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 = [];
|
||||
@@ -695,7 +696,7 @@ let deptTreeData = ref<DataNode[]>([]);
|
||||
function fnGetDeptTree() {
|
||||
if (deptTreeData.value.length > 0) return;
|
||||
deptTreeSelect().then(res => {
|
||||
if (res.code === 1 && Array.isArray(res.data)) {
|
||||
if (res.code === RESULT_CODE_SUCCESS && Array.isArray(res.data)) {
|
||||
deptTreeData.value = res.data;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user