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 { request } from '@/plugins/http-fetch';
|
||||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
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 = {
|
const data: DataList = {
|
||||||
total: 0,
|
total: 0,
|
||||||
rows: [],
|
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];
|
let data = result.data.data[0];
|
||||||
return Object.assign(result, {
|
return Object.assign(result, {
|
||||||
data: parseObjLineToHump(data['ne_info'][0]),
|
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 { request } from '@/plugins/http-fetch';
|
||||||
import { parseObjLineToHump } from '@/utils/parse-utils';
|
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 = {
|
const data: DataList = {
|
||||||
total: 0,
|
total: 0,
|
||||||
rows: [],
|
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];
|
let data = result.data.data[0];
|
||||||
return Object.assign(result, {
|
return Object.assign(result, {
|
||||||
data: parseObjLineToHump(data['ne_info'][0]),
|
data: parseObjLineToHump(data['ne_info'][0]),
|
||||||
@@ -116,3 +117,27 @@ export async function delNeInfo(data: Record<string, any>) {
|
|||||||
method: 'delete',
|
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 { defineStore } from 'pinia';
|
||||||
import { getDictDataType } from '@/api/system/dict/data';
|
import { getDictDataType } from '@/api/system/dict/data';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
|
||||||
/**字典参数类型 */
|
/**字典参数类型 */
|
||||||
type DictStore = {
|
type DictStore = {
|
||||||
@@ -42,7 +43,7 @@ const useDictStore = defineStore('dict', {
|
|||||||
let disct = this.dicts.get(key);
|
let disct = this.dicts.get(key);
|
||||||
if (disct === undefined || disct.length === 0) {
|
if (disct === undefined || disct.length === 0) {
|
||||||
const res = await getDictDataType(key);
|
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 => ({
|
const dictData: DictType[] = res.data.map(d => ({
|
||||||
label: d.dictLabel,
|
label: d.dictLabel,
|
||||||
value: d.dictValue,
|
value: d.dictValue,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
MENU_COMPONENT_LAYOUT_BLANK,
|
MENU_COMPONENT_LAYOUT_BLANK,
|
||||||
MENU_COMPONENT_LAYOUT_LINK,
|
MENU_COMPONENT_LAYOUT_LINK,
|
||||||
} from '@/constants/menu-constants';
|
} from '@/constants/menu-constants';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
|
||||||
/**路由构建参数类型 */
|
/**路由构建参数类型 */
|
||||||
type RouterStore = {
|
type RouterStore = {
|
||||||
@@ -46,7 +47,7 @@ const useRouterStore = defineStore('router', {
|
|||||||
*/
|
*/
|
||||||
async generateRoutes() {
|
async generateRoutes() {
|
||||||
const res = await getRouters();
|
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());
|
const buildRoutes = buildRouters(res.data.concat());
|
||||||
this.buildRouterData = buildRoutes;
|
this.buildRouterData = buildRoutes;
|
||||||
return buildRoutes;
|
return buildRoutes;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { getToken, setToken, removeToken } from '@/plugins/auth-token';
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { TOKEN_RESPONSE_FIELD } from '@/constants/token-constants';
|
import { TOKEN_RESPONSE_FIELD } from '@/constants/token-constants';
|
||||||
import { validHttp } from '@/utils/regular-utils';
|
import { validHttp } from '@/utils/regular-utils';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
|
||||||
/**用户信息类型 */
|
/**用户信息类型 */
|
||||||
type UserInfo = {
|
type UserInfo = {
|
||||||
@@ -107,7 +108,7 @@ const useUserStore = defineStore('user', {
|
|||||||
// 登录
|
// 登录
|
||||||
async fnLogin(loginBody: Record<string, string>) {
|
async fnLogin(loginBody: Record<string, string>) {
|
||||||
const res = await login(loginBody);
|
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];
|
const token = res.data[TOKEN_RESPONSE_FIELD];
|
||||||
setToken(token);
|
setToken(token);
|
||||||
this.token = token;
|
this.token = token;
|
||||||
@@ -117,7 +118,7 @@ const useUserStore = defineStore('user', {
|
|||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
async fnGetInfo() {
|
async fnGetInfo() {
|
||||||
const res = await getInfo();
|
const res = await getInfo();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
const { user, roles, permissions } = res.data;
|
const { user, roles, permissions } = res.data;
|
||||||
// 登录账号
|
// 登录账号
|
||||||
this.userName = user.accountId;
|
this.userName = user.accountId;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { getUserProfile } from '@/api/profile';
|
|||||||
import { reactive, ref, onMounted } from 'vue';
|
import { reactive, ref, onMounted } from 'vue';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
|
||||||
/**加载状态 */
|
/**加载状态 */
|
||||||
let loading = ref<boolean>(true);
|
let loading = ref<boolean>(true);
|
||||||
@@ -54,7 +55,7 @@ let listData = ref([
|
|||||||
/**查询用户个人信息 */
|
/**查询用户个人信息 */
|
||||||
function fnGetProfile() {
|
function fnGetProfile() {
|
||||||
getUserProfile().then(res => {
|
getUserProfile().then(res => {
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
const { user, roleGroup, postGroup } = res.data;
|
const { user, roleGroup, postGroup } = res.data;
|
||||||
state.user = user;
|
state.user = user;
|
||||||
state.roleGroup = roleGroup;
|
state.roleGroup = roleGroup;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
} from '@/api/configManage/neManage';
|
} from '@/api/configManage/neManage';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
@@ -271,7 +272,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
|
|||||||
getNeInfo(row.id).then(res => {
|
getNeInfo(row.id).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改网元';
|
modalState.title = '修改网元';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -296,7 +297,7 @@ function fnModalOk() {
|
|||||||
const hide = message.loading({ content: t('common.loading') });
|
const hide = message.loading({ content: t('common.loading') });
|
||||||
result
|
result
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||||
duration: 3,
|
duration: 3,
|
||||||
@@ -367,7 +368,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
listNeInfo(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
} from '@/api/configManage/neManage';
|
} from '@/api/configManage/neManage';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ function fnModalVisibleByEdit(row?: Record<string, any>) {
|
|||||||
getNeInfo(row.id).then(res => {
|
getNeInfo(row.id).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改网元';
|
modalState.title = '修改网元';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -262,7 +263,7 @@ function fnModalOk() {
|
|||||||
const hide = message.loading({ content: t('common.loading') });
|
const hide = message.loading({ content: t('common.loading') });
|
||||||
result
|
result
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: t('common.msgSuccess', { msg: modalState.title }),
|
content: t('common.msgSuccess', { msg: modalState.title }),
|
||||||
duration: 3,
|
duration: 3,
|
||||||
@@ -333,7 +334,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
listNeInfo(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { getCaptchaImage } from '@/api/login';
|
|||||||
import { useRouter, useRoute } from 'vue-router';
|
import { useRouter, useRoute } from 'vue-router';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
import { toRaw } from 'vue';
|
import { toRaw } from 'vue';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { t, changeLocale } = useI18n();
|
const { t, changeLocale } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -54,7 +55,7 @@ function fnFinish() {
|
|||||||
useUserStore()
|
useUserStore()
|
||||||
.fnLogin(toRaw(state.from))
|
.fnLogin(toRaw(state.from))
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.login.loginSuccess'), 3);
|
message.success(t('views.login.loginSuccess'), 3);
|
||||||
router.push({ path: redirectPath });
|
router.push({ path: redirectPath });
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { register } from '@/api/login';
|
|||||||
import { regExpPasswd, regExpUserName } from '@/utils/regular-utils';
|
import { regExpPasswd, regExpUserName } from '@/utils/regular-utils';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
import useI18n from '@/hooks/useI18n';
|
import useI18n from '@/hooks/useI18n';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ function fnFinish() {
|
|||||||
const hide = message.loading(t('common.loading'), 0);
|
const hide = message.loading(t('common.loading'), 0);
|
||||||
register(toRaw(state.form))
|
register(toRaw(state.form))
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
Modal.success({
|
Modal.success({
|
||||||
title: t('common.tipTitle'),
|
title: t('common.tipTitle'),
|
||||||
content: t('views.register.tipContent', {
|
content: t('views.register.tipContent', {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
import { saveAs } from 'file-saver';
|
import { saveAs } from 'file-saver';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +240,7 @@ function fnModalVisibleByVive(configId: string | number) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getConfig(configId).then(res => {
|
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.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '参数配置信息';
|
modalState.title = '参数配置信息';
|
||||||
modalState.visibleByView = true;
|
modalState.visibleByView = true;
|
||||||
@@ -265,7 +266,7 @@ function fnModalVisibleByEdit(configId?: string | number) {
|
|||||||
getConfig(configId).then(res => {
|
getConfig(configId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改参数配置';
|
modalState.title = '修改参数配置';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -291,7 +292,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
config
|
config
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -342,7 +343,7 @@ function fnRecordDelete(configId: string = '0') {
|
|||||||
const key = 'delConfig';
|
const key = 'delConfig';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
delConfig(configId).then(res => {
|
delConfig(configId).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
key,
|
key,
|
||||||
@@ -370,7 +371,7 @@ function fnExportList() {
|
|||||||
const key = 'exportConfig';
|
const key = 'exportConfig';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
exportConfig(toRaw(queryParams)).then(res => {
|
exportConfig(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `已完成导出`,
|
content: `已完成导出`,
|
||||||
key,
|
key,
|
||||||
@@ -400,7 +401,7 @@ function fnRefreshCache() {
|
|||||||
const key = 'refreshCache';
|
const key = 'refreshCache';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
refreshCache().then(res => {
|
refreshCache().then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `刷新缓存成功`,
|
content: `刷新缓存成功`,
|
||||||
key,
|
key,
|
||||||
@@ -425,7 +426,7 @@ function fnGetList() {
|
|||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listConfig(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { saveAs } from 'file-saver';
|
|||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useTabsStore from '@/store/modules/tabs';
|
import useTabsStore from '@/store/modules/tabs';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const tabsStore = useTabsStore();
|
const tabsStore = useTabsStore();
|
||||||
const { parseDataDict, getDict } = useDictStore();
|
const { parseDataDict, getDict } = useDictStore();
|
||||||
const route = useRoute();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +287,7 @@ function fnModalVisibleByEdit(dictCode?: string | number) {
|
|||||||
getData(dictCode).then(res => {
|
getData(dictCode).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改字典数据';
|
modalState.title = '修改字典数据';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -312,7 +313,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
dictData
|
dictData
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -363,7 +364,7 @@ function fnRecordDelete(dictCode: string = '0') {
|
|||||||
const key = 'delData';
|
const key = 'delData';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
delData(dictCode).then(res => {
|
delData(dictCode).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
key,
|
key,
|
||||||
@@ -391,7 +392,7 @@ function fnExportList() {
|
|||||||
const key = 'exportData';
|
const key = 'exportData';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
exportData(toRaw(queryParams)).then(res => {
|
exportData(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `已完成导出`,
|
content: `已完成导出`,
|
||||||
key,
|
key,
|
||||||
@@ -425,7 +426,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
listData(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
@@ -448,7 +449,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
if (resArr[1].status === 'fulfilled') {
|
if (resArr[1].status === 'fulfilled') {
|
||||||
const dicts = resArr[1].value;
|
const dicts = resArr[1].value;
|
||||||
if (dicts.code === 1) {
|
if (dicts.code === RESULT_CODE_SUCCESS) {
|
||||||
dict.sysDictType = dicts.data;
|
dict.sysDictType = dicts.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -456,7 +457,7 @@ onMounted(() => {
|
|||||||
// 指定字典id列表数据
|
// 指定字典id列表数据
|
||||||
if (dictId && dictId !== '0') {
|
if (dictId && dictId !== '0') {
|
||||||
getType(dictId).then(res => {
|
getType(dictId).then(res => {
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
queryParams.dictType = res.data.dictType;
|
queryParams.dictType = res.data.dictType;
|
||||||
fnGetList();
|
fnGetList();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { saveAs } from 'file-saver';
|
|||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +238,7 @@ function fnModalVisibleByVive(dictId: string | number) {
|
|||||||
getType(dictId).then(res => {
|
getType(dictId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '字典类型信息';
|
modalState.title = '字典类型信息';
|
||||||
modalState.visibleByView = true;
|
modalState.visibleByView = true;
|
||||||
@@ -263,7 +264,7 @@ function fnModalVisibleByEdit(dictId?: string | number) {
|
|||||||
getType(dictId).then(res => {
|
getType(dictId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改字典类型';
|
modalState.title = '修改字典类型';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -289,7 +290,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
dictType
|
dictType
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -340,7 +341,7 @@ function fnRecordDelete(dictId: string = '0') {
|
|||||||
const key = 'delType';
|
const key = 'delType';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
delType(dictId).then(res => {
|
delType(dictId).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
key,
|
key,
|
||||||
@@ -368,7 +369,7 @@ function fnExportList() {
|
|||||||
const key = 'exportType';
|
const key = 'exportType';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
exportType(toRaw(queryParams)).then(res => {
|
exportType(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `已完成导出`,
|
content: `已完成导出`,
|
||||||
key,
|
key,
|
||||||
@@ -398,7 +399,7 @@ function fnRefreshCache() {
|
|||||||
const key = 'refreshCache';
|
const key = 'refreshCache';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
refreshCache().then(res => {
|
refreshCache().then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `刷新缓存成功`,
|
content: `刷新缓存成功`,
|
||||||
key,
|
key,
|
||||||
@@ -428,7 +429,7 @@ function fnGetList() {
|
|||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listType(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
MENU_TYPE_BUTTON,
|
MENU_TYPE_BUTTON,
|
||||||
} from '@/constants/menu-constants';
|
} from '@/constants/menu-constants';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +276,7 @@ function fnModalVisibleByVive(menuId: string | number) {
|
|||||||
getMenu(menuId).then(res => {
|
getMenu(menuId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '菜单信息';
|
modalState.title = '菜单信息';
|
||||||
modalState.visibleByView = true;
|
modalState.visibleByView = true;
|
||||||
@@ -311,7 +312,7 @@ function fnModalVisibleByEdit(
|
|||||||
getMenu(menuId).then(res => {
|
getMenu(menuId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1 && res.data) {
|
if (res.code === RESULT_CODE_SUCCESS && res.data) {
|
||||||
modalState.from = Object.assign(modalState.from, res.data);
|
modalState.from = Object.assign(modalState.from, res.data);
|
||||||
modalState.title = '修改菜单信息';
|
modalState.title = '修改菜单信息';
|
||||||
modalState.visibleByEdit = true;
|
modalState.visibleByEdit = true;
|
||||||
@@ -349,7 +350,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
menu
|
menu
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -398,7 +399,7 @@ function fnRecordDelete(menuId: string | number) {
|
|||||||
const key = 'delMenu';
|
const key = 'delMenu';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
delMenu(menuId).then(res => {
|
delMenu(menuId).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
key,
|
key,
|
||||||
@@ -422,7 +423,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
listMenu(toRaw(queryParams)).then(res => {
|
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));
|
menuListData = JSON.parse(JSON.stringify(res.data));
|
||||||
// 初始上级菜单和展开编号key
|
// 初始上级菜单和展开编号key
|
||||||
if (treeDataAll.length <= 0) {
|
if (treeDataAll.length <= 0) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { authUserAllocatedList, authUserChecked } from '@/api/system/role';
|
|||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useTabsStore from '@/store/modules/tabs';
|
import useTabsStore from '@/store/modules/tabs';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const tabsStore = useTabsStore();
|
const tabsStore = useTabsStore();
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +216,7 @@ function fnModalOk(userIds: string[] | number[]) {
|
|||||||
roleId: roleId,
|
roleId: roleId,
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
modalState.visibleBySelectUser = false;
|
modalState.visibleBySelectUser = false;
|
||||||
message.success({
|
message.success({
|
||||||
content: `授权用户添加成功`,
|
content: `授权用户添加成功`,
|
||||||
@@ -247,7 +248,7 @@ function fnRecordDelete(userId: string | number) {
|
|||||||
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then(
|
authUserChecked({ checked: false, userIds: userId, roleId: roleId }).then(
|
||||||
res => {
|
res => {
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `取消授权成功`,
|
content: `取消授权成功`,
|
||||||
duration: 3,
|
duration: 3,
|
||||||
@@ -280,7 +281,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
authUserAllocatedList(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { ColumnsType } from 'ant-design-vue/lib/table';
|
|||||||
import { authUserAllocatedList } from '@/api/system/role';
|
import { authUserAllocatedList } from '@/api/system/role';
|
||||||
import { parseDateToStr } from '@/utils/date-utils';
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const emit = defineEmits(['ok', 'cancel', 'update:visible']);
|
const emit = defineEmits(['ok', 'cancel', 'update:visible']);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -150,7 +151,7 @@ function fnGetList() {
|
|||||||
if (tableState.loading) return;
|
if (tableState.loading) return;
|
||||||
tableState.loading = true;
|
tableState.loading = true;
|
||||||
authUserAllocatedList(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { DataNode } from 'ant-design-vue/lib/tree';
|
|||||||
import { parseTreeKeys, parseTreeNodeKeys } from '@/utils/parse-tree-utils';
|
import { parseTreeKeys, parseTreeNodeKeys } from '@/utils/parse-tree-utils';
|
||||||
import { hasPermissions } from '@/plugins/auth-user';
|
import { hasPermissions } from '@/plugins/auth-user';
|
||||||
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
import { MENU_PATH_INLINE } from '@/constants/menu-constants';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
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;
|
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 => {
|
Promise.all([getRole(roleId), roleMenuTreeSelect(roleId)]).then(resArr => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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);
|
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;
|
const { menus, checkedKeys } = resArr[1].data;
|
||||||
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
||||||
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
||||||
@@ -343,7 +344,7 @@ function fnModalVisibleByEdit(roleId?: string | number) {
|
|||||||
menuTreeSelect().then(res => {
|
menuTreeSelect().then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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.checkedKeys = parseTreeKeys(res.data, 'id');
|
||||||
menuTree.expandedKeys = parseTreeNodeKeys(res.data, 'id');
|
menuTree.expandedKeys = parseTreeNodeKeys(res.data, 'id');
|
||||||
menuTree.treeData = res.data;
|
menuTree.treeData = res.data;
|
||||||
@@ -361,9 +362,9 @@ function fnModalVisibleByEdit(roleId?: string | number) {
|
|||||||
Promise.all([getRole(roleId), roleMenuTreeSelect(roleId)]).then(resArr => {
|
Promise.all([getRole(roleId), roleMenuTreeSelect(roleId)]).then(resArr => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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);
|
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;
|
const { menus, checkedKeys } = resArr[1].data;
|
||||||
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
menuTree.checkedKeys = parseTreeKeys(menus, 'id');
|
||||||
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
menuTree.expandedKeys = parseTreeNodeKeys(menus, 'id');
|
||||||
@@ -396,7 +397,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
role
|
role
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -507,7 +508,7 @@ function fnModalOkDataScope() {
|
|||||||
}
|
}
|
||||||
dataScope(fromInfo)
|
dataScope(fromInfo)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
duration: 2,
|
duration: 2,
|
||||||
@@ -542,9 +543,9 @@ function fnRecordDataScope(roleId: string | number) {
|
|||||||
// 查询角色详细同时根据角色ID查询部门树结构
|
// 查询角色详细同时根据角色ID查询部门树结构
|
||||||
Promise.all([getRole(roleId), roleDeptTreeSelect(roleId)])
|
Promise.all([getRole(roleId), roleDeptTreeSelect(roleId)])
|
||||||
.then(resArr => {
|
.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);
|
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;
|
const { depts, checkedKeys } = resArr[1].data;
|
||||||
deptTree.checkedKeys = parseTreeKeys(depts, 'id');
|
deptTree.checkedKeys = parseTreeKeys(depts, 'id');
|
||||||
deptTree.expandedKeys = parseTreeNodeKeys(depts, 'id');
|
deptTree.expandedKeys = parseTreeNodeKeys(depts, 'id');
|
||||||
@@ -591,7 +592,7 @@ function fnRecordStatus(row: Record<string, string>) {
|
|||||||
const hide = message.loading('请稍等...', 0);
|
const hide = message.loading('请稍等...', 0);
|
||||||
changeRoleStatus(row.roleId, row.status).then(res => {
|
changeRoleStatus(row.roleId, row.status).then(res => {
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${row.roleName} ${text}成功`,
|
content: `${row.roleName} ${text}成功`,
|
||||||
duration: 2,
|
duration: 2,
|
||||||
@@ -626,7 +627,7 @@ function fnRecordDelete(roleId: string = '0') {
|
|||||||
const hide = message.loading('请稍等...', 0);
|
const hide = message.loading('请稍等...', 0);
|
||||||
delRole(roleId).then(res => {
|
delRole(roleId).then(res => {
|
||||||
hide();
|
hide();
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
duration: 2,
|
duration: 2,
|
||||||
@@ -651,7 +652,7 @@ function fnExportList() {
|
|||||||
onOk() {
|
onOk() {
|
||||||
const hide = message.loading('请稍等...', 0);
|
const hide = message.loading('请稍等...', 0);
|
||||||
exportRole(toRaw(queryParams)).then(res => {
|
exportRole(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `已完成导出`,
|
content: `已完成导出`,
|
||||||
duration: 2,
|
duration: 2,
|
||||||
@@ -675,7 +676,7 @@ function fnGetList() {
|
|||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listRole(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import useDictStore from '@/store/modules/dict';
|
|||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import { DataNode } from 'ant-design-vue/lib/tree';
|
import { DataNode } from 'ant-design-vue/lib/tree';
|
||||||
import { hasPermissions } from '@/plugins/auth-user';
|
import { hasPermissions } from '@/plugins/auth-user';
|
||||||
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const route = useRoute();
|
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;
|
return tableState.striped && index % 2 === 1 ? 'table-striped' : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +322,7 @@ function fnModalVisibleByVive(userId: string | number) {
|
|||||||
getUser(userId).then(res => {
|
getUser(userId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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 roles = res.data.roles.map((m: Record<string, any>) => {
|
||||||
const disabled = m.status === '0';
|
const disabled = m.status === '0';
|
||||||
Reflect.set(m, 'disabled', disabled);
|
Reflect.set(m, 'disabled', disabled);
|
||||||
@@ -361,7 +362,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
|||||||
getUser().then(res => {
|
getUser().then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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 roles = res.data.roles.map((m: Record<string, any>) => {
|
||||||
const disabled = m.status === '0';
|
const disabled = m.status === '0';
|
||||||
Reflect.set(m, 'disabled', disabled);
|
Reflect.set(m, 'disabled', disabled);
|
||||||
@@ -387,7 +388,7 @@ function fnModalVisibleByEdit(userId?: string | number) {
|
|||||||
getUser(userId).then(res => {
|
getUser(userId).then(res => {
|
||||||
modalState.confirmLoading = false;
|
modalState.confirmLoading = false;
|
||||||
hide();
|
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 roles = res.data.roles.map((m: Record<string, any>) => {
|
||||||
const disabled = m.status === '0';
|
const disabled = m.status === '0';
|
||||||
Reflect.set(m, 'disabled', disabled);
|
Reflect.set(m, 'disabled', disabled);
|
||||||
@@ -426,7 +427,7 @@ function fnModalOk() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
user
|
user
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -477,7 +478,7 @@ function fnModalOkResetPwd() {
|
|||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
resetUserPwd(modalState.from.userId, modalState.from.password)
|
resetUserPwd(modalState.from.userId, modalState.from.password)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${modalState.title}成功`,
|
content: `${modalState.title}成功`,
|
||||||
key,
|
key,
|
||||||
@@ -527,7 +528,7 @@ function fnRecordStatus(row: Record<string, string>) {
|
|||||||
const key = 'changeUserStatus';
|
const key = 'changeUserStatus';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
changeUserStatus(row.userId, row.status).then(res => {
|
changeUserStatus(row.userId, row.status).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `${row.userName} ${text}成功`,
|
content: `${row.userName} ${text}成功`,
|
||||||
key: key,
|
key: key,
|
||||||
@@ -564,7 +565,7 @@ function fnRecordDelete(userId: string = '0') {
|
|||||||
const key = 'delUser';
|
const key = 'delUser';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
delUser(userId).then(res => {
|
delUser(userId).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `删除成功`,
|
content: `删除成功`,
|
||||||
key,
|
key,
|
||||||
@@ -592,7 +593,7 @@ function fnExportList() {
|
|||||||
const key = 'exportUser';
|
const key = 'exportUser';
|
||||||
message.loading({ content: '请稍等...', key });
|
message.loading({ content: '请稍等...', key });
|
||||||
exportUser(toRaw(queryParams)).then(res => {
|
exportUser(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `已完成导出`,
|
content: `已完成导出`,
|
||||||
key,
|
key,
|
||||||
@@ -650,7 +651,7 @@ function fnModalUploadXlsxImportExportTemplate() {
|
|||||||
const hide = message.loading('正在下载...', 0);
|
const hide = message.loading('正在下载...', 0);
|
||||||
importTemplate()
|
importTemplate()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 1) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success({
|
message.success({
|
||||||
content: `成功读取并下载导入模板`,
|
content: `成功读取并下载导入模板`,
|
||||||
duration: 2,
|
duration: 2,
|
||||||
@@ -676,7 +677,7 @@ function fnGetList() {
|
|||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listUser(toRaw(queryParams)).then(res => {
|
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) {
|
if (tableState.selectedRowKeys.length > 0) {
|
||||||
tableState.selectedRowKeys = [];
|
tableState.selectedRowKeys = [];
|
||||||
@@ -695,7 +696,7 @@ let deptTreeData = ref<DataNode[]>([]);
|
|||||||
function fnGetDeptTree() {
|
function fnGetDeptTree() {
|
||||||
if (deptTreeData.value.length > 0) return;
|
if (deptTreeData.value.length > 0) return;
|
||||||
deptTreeSelect().then(res => {
|
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;
|
deptTreeData.value = res.data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user