From b135c3dd79ef7701e0d8273813caf053a15680af Mon Sep 17 00:00:00 2001 From: hyt <958868763@qq.com> Date: Tue, 21 May 2024 11:02:29 +0800 Subject: [PATCH] =?UTF-8?q?5.21=E4=BF=AE=E6=94=B9=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=B7=B2=E5=87=BA=E7=8E=B0=E7=9A=84bug=E5=92=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base/baseLayout/index.vue | 2 +- src/components/base/baseNewLayout/index.vue | 4 +- .../base/baseOrganization/index.vue | 2 +- src/components/base/basePage/index.vue | 89 +- src/components/base/basePerson/index.vue | 7 +- src/layout/components/Sidebar/index.vue | 842 +++++++++--------- src/store/modules/permission.js | 7 - src/store/modules/user.js | 5 + src/utils/request.js | 542 +++++------ .../IntegratedProductManagement/index.vue | 4 +- .../index.vue | 4 +- src/views/applicationList/applicationAdd.vue | 207 +++-- .../dataSourceManagement/index.vue | 4 +- .../esbCenter/messageManagement/index.vue | 4 +- .../esbCenter/messageManagementLog/index.vue | 12 +- src/views/index_v2.vue | 7 +- .../contrast/baseContrastSelect.vue | 2 +- .../contrast/baseContrastSelect.vue | 2 +- src/views/integrationOptionV2/index.vue | 1 + .../compoments/baseNewSelect.vue | 2 +- src/views/intergrationOptionScene/index.vue | 2 +- .../compoments/baseNewSelect.vue | 2 +- .../intergrationTask/detailData/index.vue | 2 +- src/views/intergrationTask/monRightDialog.vue | 2 +- src/views/intergrationTask/monitoring.vue | 2 +- src/views/intergrationTask/taskAdd.vue | 2 +- src/views/login.vue | 2 + .../compoments/baseNewSelect.vue | 2 +- .../plugInOptions/rightDialog.vue | 4 +- .../compoments/baseLeftRightSelect.vue | 2 +- .../receiptsPage/compoments/baseNewSelect.vue | 2 +- .../buttonManagement/index.vue | 2 +- .../systemMaintenance/operationLog/index.vue | 2 +- .../roleJurisdiction/index.vue | 2 +- .../userJurisdiction/index.vue | 12 +- .../systemSettings/userManagement/index.vue | 2 +- .../PersonnelSettings/configData.js | 488 +++++----- .../userSettings/PersonnelSettings/index.vue | 3 + .../userSettings/roleSettings/index.vue | 6 +- .../userInformation/configData.js | 1 + .../userSettings/userInformation/index.vue | 4 +- 41 files changed, 1195 insertions(+), 1100 deletions(-) diff --git a/src/components/base/baseLayout/index.vue b/src/components/base/baseLayout/index.vue index ff30de7..e84327f 100644 --- a/src/components/base/baseLayout/index.vue +++ b/src/components/base/baseLayout/index.vue @@ -324,7 +324,7 @@ export default { pageModel: { total: 0, pageIndex: 1, - pageSize: 10, + pageSize: 100, }, // 清除状态 clearState: 0, diff --git a/src/components/base/baseNewLayout/index.vue b/src/components/base/baseNewLayout/index.vue index ff7e2db..98fa22c 100644 --- a/src/components/base/baseNewLayout/index.vue +++ b/src/components/base/baseNewLayout/index.vue @@ -410,7 +410,7 @@ export default { pageModel: { total: 0, page: 1, - limit: 20, + pageSize: 100, }, // 清除状态 clearState: 0, @@ -600,7 +600,7 @@ export default { } let page = { page: this.pageModel.page, - limit: this.pageModel.limit, + limit: this.pageModel.pageSize, }; for (let i in this.model) { if (!this.model[i]) { diff --git a/src/components/base/baseOrganization/index.vue b/src/components/base/baseOrganization/index.vue index 95975e9..e07bacb 100644 --- a/src/components/base/baseOrganization/index.vue +++ b/src/components/base/baseOrganization/index.vue @@ -36,7 +36,7 @@ - diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 0621828..0a1e907 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -29,7 +29,6 @@ const permission = { name: 'applicationEdit', hidden: true, meta: { - title: '应用编辑', hidden: true } }, @@ -39,7 +38,6 @@ const permission = { name: 'exploit', hidden: true, meta: { - title: '开发管理', hidden: true } }, @@ -49,7 +47,6 @@ const permission = { name: 'authority', hidden: true, meta: { - title: '权限管理', hidden: true } @@ -59,7 +56,6 @@ const permission = { name: 'appApiAdmin', component: () => import('@/views/applicationList/apiList/apiAdmin'), meta: { - title: 'API管理', hidden: true } }, @@ -68,7 +64,6 @@ const permission = { name: 'inserterAdmin', component: () => import('@/views/applicationList/inserterAdmin'), meta: { - title: '插件管理', hidden: true } }, @@ -79,7 +74,6 @@ const permission = { hidden: 'true', component: () => import('@/views/applicationList/apiList/apiAdd'), meta: { - title: 'API新增' } }, @@ -89,7 +83,6 @@ const permission = { hidden: 'true', component: () => import('@/views/applicationList/apiList/apiView'), meta: { - title: 'API查看' } } ] diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 4cce30a..7e773b3 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -64,7 +64,11 @@ const user = { resolve(); }) .catch((error) => { + console.log(123) + // + commit("LogOut") reject(error); + }); }); }, @@ -98,6 +102,7 @@ const user = { // 退出系统 LogOut({ commit, state }) { + console.log("触发推出") return new Promise((resolve, reject) => { commit("SET_TOKEN", ""); commit("SET_ROLES", []); diff --git a/src/utils/request.js b/src/utils/request.js index 67c7e5d..3fdbcf5 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,298 +1,314 @@ -import axios from "axios"; +import axios from 'axios' import { - Notification, - MessageBox, - Message, - Loading -} from "element-ui"; -import store from "@/store"; + Notification, + MessageBox, + Message, + Loading +} from 'element-ui' +import store from '@/store' import { - getToken, - setToken, - removeCompanyId, - removeToken, - removeInfo, -} from "@/utils/auth"; -import errorCode from "@/utils/errorCode"; + getToken, + setToken, + removeCompanyId, + removeToken, + removeInfo +} from '@/utils/auth' +import errorCode from '@/utils/errorCode' import { - tansParams, - blobValidate -} from "@/utils/ruoyi"; + tansParams, + blobValidate +} from '@/utils/ruoyi' import { closeLoading, openLoading } from '@/utils/loading' -import cache from "@/plugins/cache"; +import cache from '@/plugins/cache' import { - saveAs -} from "file-saver"; -import route from "../router/index"; + saveAs +} from 'file-saver' +import route from '../router/index' // import configKey from '@/assets/js/configKey.js' -let downloadLoadingInstance; -let downloadLoadingAxios; +let downloadLoadingInstance +let downloadLoadingAxios // 是否显示重新登录 export let isRelogin = { - show: false, -}; -let timer = null; + show: false +} +let timer = null // 是否正在刷新的标记 -let isRefreshing = false; +let isRefreshing = false //重试队列 -let requests = []; +let requests = [] -axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8"; +axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' // 创建axios实例 const service = axios.create({ - // axios中请求配置有baseURL选项,表示请求URL公共部分 - // baseURL:configKey.urlType?configKey.baseURL:process.env.VUE_APP_BASE_API, - baseURL: process.env.VUE_APP_BASE_API, - // baseURL: "http://192.168.2.240:8066/", - // 超时 - timeout: 2 * 60 * 1000, -}); + // axios中请求配置有baseURL选项,表示请求URL公共部分 + // baseURL:configKey.urlType?configKey.baseURL:process.env.VUE_APP_BASE_API, + baseURL: process.env.VUE_APP_BASE_API, + // baseURL: "http://192.168.2.240:8066/", + // 超时 + timeout: 2 * 60 * 1000 +}) // request拦截器 service.interceptors.request.use( - (config) => { - // do something bedocument.getElementById("")fore request is sent - // config.headers['secretkey'] = 'aQ+b2wGj1LuhR8N2O0aOmKlkjgnOyHSlZ0QUtZMP3dHkVkAGhJe37KOdmpexsE6W' //本机密钥 + (config) => { + // do something bedocument.getElementById("")fore request is sent + // config.headers['secretkey'] = 'aQ+b2wGj1LuhR8N2O0aOmKlkjgnOyHSlZ0QUtZMP3dHkVkAGhJe37KOdmpexsE6W' //本机密钥 - // config.headers['secretkey'] = 'm/Ah8KQ6IfWEv85KEoaHKf4SfwtemYtGkiuBabkQCnOuJ/+nyvqBLOVheirHN1TO' //本机密钥 - config.headers["secretkey"] = configKey.secretkey; + // config.headers['secretkey'] = 'm/Ah8KQ6IfWEv85KEoaHKf4SfwtemYtGkiuBabkQCnOuJ/+nyvqBLOVheirHN1TO' //本机密钥 + config.headers['secretkey'] = configKey.secretkey - // if (store.getters.token) { - // if (window.localStorage.userToken) { - let token = getToken(); - if (token) { - config.headers["token"] = token; - } + // if (store.getters.token) { + // if (window.localStorage.userToken) { + let token = getToken() + if (token) { + config.headers['token'] = token + } - if (config.url.indexOf('updateDto') != -1 || config.url.indexOf('saveDto') != -1) { - openLoading('submit') - } else if (config.url.indexOf('getById') != -1) { - openLoading('detail') - } else if (config.url.indexOf('deleteById') != -1) { - openLoading('del') - } else if (config.url.indexOf('changerState') != -1) { - openLoading('submit') - } + if (config.url.indexOf('updateDto') != -1 || config.url.indexOf('saveDto') != -1) { + openLoading('submit') + } else if (config.url.indexOf('getById') != -1) { + openLoading('detail') + } else if (config.url.indexOf('deleteById') != -1) { + openLoading('del') + } else if (config.url.indexOf('changerState') != -1) { + openLoading('submit') + } - // 生成请求的唯一标识符 - const requestIdentifier = `${config.url}-${config.method}`; - // 判断是否已存在相同的请求 - const isDuplicateRequest = requests.includes(requestIdentifier); - // 如果存在相同请求,取消当前请求 - if (isDuplicateRequest) { - // return Promise.reject(new Error("Duplicate request")); - } - // 将请求的唯一标识符添加到请求队列中 - requests.push(requestIdentifier); - // 设置计时器,在秒后移除请求的唯一标识符 - clearTimeout(timer); - timer = setTimeout(() => { - const index = requests.indexOf(requestIdentifier); - if (index !== -1) { - requests.splice(index, 1); // 移除请求的唯一标识符 - } - }, 2000); - return config; - }, + // 生成请求的唯一标识符 + const requestIdentifier = `${config.url}-${config.method}` + // 判断是否已存在相同的请求 + const isDuplicateRequest = requests.includes(requestIdentifier) + // 如果存在相同请求,取消当前请求 + if (isDuplicateRequest) { + // return Promise.reject(new Error("Duplicate request")); + } + // 将请求的唯一标识符添加到请求队列中 + requests.push(requestIdentifier) + // 设置计时器,在秒后移除请求的唯一标识符 + clearTimeout(timer) + timer = setTimeout(() => { + const index = requests.indexOf(requestIdentifier) + if (index !== -1) { + requests.splice(index, 1) // 移除请求的唯一标识符 + } + }, 2000) + return config + }, - (error) => { - // do something with request error - // 请求发生错误时清除唯一标识符 - const requestIdentifier = `${error.config.url}-${error.config.method}`; - const index = requests.indexOf(requestIdentifier); - if (index !== -1) { - requests.splice(index, 1); // 清除唯一标识符 - } - return Promise.reject(error); - } -); + (error) => { + // do something with request error + // 请求发生错误时清除唯一标识符 + const requestIdentifier = `${error.config.url}-${error.config.method}` + const index = requests.indexOf(requestIdentifier) + if (index !== -1) { + requests.splice(index, 1) // 清除唯一标识符 + } + return Promise.reject(error) + } +) // 响应拦截器 service.interceptors.response.use( - (res) => { - // 请求完成时清除唯一标识符 - const requestIdentifier = `${res.config.url}-${res.config.method}`; - const index = requests.indexOf(requestIdentifier); - if (index !== -1) { - requests.splice(index, 1); // 清除唯一标识符 - } - // downloadLoadingAxios.close() - // 未设置状态码则默认成功状态 - const code = res.data.status || '200'; - // 获取错误信息 - const msg = res.data.msg; - closeLoading(); - // 二进制数据则直接返回 - if ( - res.request.responseType === "blob" || - res.request.responseType === "arraybuffer" - ) { - return res.data; - } + (res) => { + console.log(res, '相应拦截器拦截内容') + // 请求完成时清除唯一标识符 + const requestIdentifier = `${res.config.url}-${res.config.method}` + const index = requests.indexOf(requestIdentifier) + if (index !== -1) { + requests.splice(index, 1) // 清除唯一标识符 + } + // downloadLoadingAxios.close() + // 未设置状态码则默认成功状态 + const code = res.data.status || '200' + // 获取错误信息 + const msg = res.data.msg + closeLoading() + // 二进制数据则直接返回 + if ( + res.request.responseType === 'blob' || + res.request.responseType === 'arraybuffer' + ) { + return res.data + } - if (code === '500') { - MessageBox.confirm(msg, "系统提示", { - confirmButtonText: "确定", - showCancelButton: false, - showClose: false, - closeOnClickModal: false, - closeOnPressEscape: false, - type: "error", - }) - .then(() => { - if (msg === 'token无效') { - store.dispatch('LogOut').then(() => { - route.replace({ - path: "/login" - });; - }) - } + if (code === '500') { + MessageBox.confirm(msg, '系统提示', { + confirmButtonText: '确定', + showCancelButton: false, + showClose: false, + closeOnClickModal: false, + closeOnPressEscape: false, + type: 'error' + }) + .then(() => { + console.log(res, '相应拦截器拦截内容') + if (msg === 'token无效') { + store.dispatch('LogOut').then(() => { + route.replace({ + path: '/login' + }) - }) - .catch(() => { }); - return Promise.reject(new Error(msg)); - } else if (code == '1002') { + }) + } + if (res.config.headers.dj==='queryTreeById') { + store.dispatch('LogOut').then(() => { + route.replace({ + path: '/login' + }) - MessageBox.confirm(msg, "系统提示", { - confirmButtonText: "确定", - showCancelButton: false, - showClose: false, - closeOnClickModal: false, - closeOnPressEscape: false, - type: "error", - }) - .then(() => { - store.dispatch('LogOut').then(() => { - route.replace({ - path: "/login" - });; - }) - }) - .catch(() => { }); - } else if (code !== '200') { + }) + } - MessageBox.confirm(msg, "系统提示", { - confirmButtonText: "确定", - showCancelButton: false, - showClose: false, - closeOnClickModal: false, - closeOnPressEscape: false, - type: "error", - }) - .then(() => { }) - .catch(() => { }); - return Promise.reject("error"); - } else { - return res.data; - } - }, - (error) => { - let response = error.response; - closeLoading(); - // downloadLoadingAxios.close() - // if (response.status == 401) { - // if (response.data.code == 1002) { - // if (!isRefreshing) { - // isRefreshing = true; - // setToken(response.data.data[0]); - // response.headers.token = response.data.data[0]; - // // token 刷新后将数组的方法重新执行 - // requests.forEach((cb) => cb(token)); - // requests = []; // 重新请求完清空 - // return service(response.config); - // isRefreshing = false; - // } else { - // // 返回未执行 resolve 的 Promise - // return new Promise((resolve) => { - // // 用函数形式将 resolve 存入,等待刷新后再执行 - // requests.push((token) => { - // response.headers.token = `${token}`; - // resolve(service(response.config)); - // }); - // }); - // } - // return response && response.data; - // } else { - // Message({ - // message: response.data.message, - // type: "error", - // showClose: true, - // duration: 0, - // }); - // if (response.data.code == -1) {} else { - // store.dispatch("LogOut").then(() => { - // route.replace({ - // path: "/login", - // }); - // }); - // } - // } - // } else { - // let { - // message - // } = error; - // if (message == "Network Error") { - // message = "后端接口连接异常"; - // } else if (message.includes("timeout")) { - // message = "系统接口请求超时"; - // } else if (message.includes("Request failed with status code")) { - // message = "系统接口" + message.substr(message.length - 3) + "异常"; - // } - // MessageBox.confirm(message, "系统提示", { - // confirmButtonText: "确定", - // showCancelButton: false, - // showClose: false, - // closeOnClickModal: false, - // closeOnPressEscape: false, - // type: "error", - // }) - // .then(() => {}) - // .catch(() => {}); - // } + }) + .catch(() => { + }) + return Promise.reject(new Error(msg)) + } else if (code == '1002') { - return Promise.reject(error); - } -); + MessageBox.confirm(msg, '系统提示', { + confirmButtonText: '确定', + showCancelButton: false, + showClose: false, + closeOnClickModal: false, + closeOnPressEscape: false, + type: 'error' + }) + .then(() => { + store.dispatch('LogOut').then(() => { + route.replace({ + path: '/login' + }) + + }) + }) + .catch(() => { + }) + } else if (code !== '200') { + + MessageBox.confirm(msg, '系统提示', { + confirmButtonText: '确定', + showCancelButton: false, + showClose: false, + closeOnClickModal: false, + closeOnPressEscape: false, + type: 'error' + }) + .then(() => { + }) + .catch(() => { + }) + return Promise.reject('error') + } else { + return res.data + } + }, + (error) => { + let response = error.response + closeLoading() + // downloadLoadingAxios.close() + // if (response.status == 401) { + // if (response.data.code == 1002) { + // if (!isRefreshing) { + // isRefreshing = true; + // setToken(response.data.data[0]); + // response.headers.token = response.data.data[0]; + // // token 刷新后将数组的方法重新执行 + // requests.forEach((cb) => cb(token)); + // requests = []; // 重新请求完清空 + // return service(response.config); + // isRefreshing = false; + // } else { + // // 返回未执行 resolve 的 Promise + // return new Promise((resolve) => { + // // 用函数形式将 resolve 存入,等待刷新后再执行 + // requests.push((token) => { + // response.headers.token = `${token}`; + // resolve(service(response.config)); + // }); + // }); + // } + // return response && response.data; + // } else { + // Message({ + // message: response.data.message, + // type: "error", + // showClose: true, + // duration: 0, + // }); + // if (response.data.code == -1) {} else { + // store.dispatch("LogOut").then(() => { + // route.replace({ + // path: "/login", + // }); + // }); + // } + // } + // } else { + // let { + // message + // } = error; + // if (message == "Network Error") { + // message = "后端接口连接异常"; + // } else if (message.includes("timeout")) { + // message = "系统接口请求超时"; + // } else if (message.includes("Request failed with status code")) { + // message = "系统接口" + message.substr(message.length - 3) + "异常"; + // } + // MessageBox.confirm(message, "系统提示", { + // confirmButtonText: "确定", + // showCancelButton: false, + // showClose: false, + // closeOnClickModal: false, + // closeOnPressEscape: false, + // type: "error", + // }) + // .then(() => {}) + // .catch(() => {}); + // } + + return Promise.reject(error) + } +) // 通用下载方法 export function download(url, params, filename, config) { - downloadLoadingInstance = Loading.service({ - text: "正在下载数据,请稍候", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); - return service - .post(url, params, { - transformRequest: [ - (params) => { - return tansParams(params); - }, - ], - headers: { - "Content-Type": "application/x-www-form-urlencoded", - }, - responseType: "blob", - ...config, - }) - .then(async (data) => { - const isLogin = await blobValidate(data); - if (isLogin) { - const blob = new Blob([data]); - saveAs(blob, filename); - } else { - const resText = await data.text(); - const rspObj = JSON.parse(resText); - const errMsg = - errorCode[rspObj.code] || rspObj.msg || errorCode["default"]; - Message.error(errMsg); - } - downloadLoadingInstance.close(); - }) - .catch((r) => { - Message.error("下载文件出现错误,请联系管理员!"); - downloadLoadingInstance.close(); - }); + downloadLoadingInstance = Loading.service({ + text: '正在下载数据,请稍候', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + return service + .post(url, params, { + transformRequest: [ + (params) => { + return tansParams(params) + } + ], + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + responseType: 'blob', + ...config + }) + .then(async(data) => { + const isLogin = await blobValidate(data) + if (isLogin) { + const blob = new Blob([data]) + saveAs(blob, filename) + } else { + const resText = await data.text() + const rspObj = JSON.parse(resText) + const errMsg = + errorCode[rspObj.code] || rspObj.msg || errorCode['default'] + Message.error(errMsg) + } + downloadLoadingInstance.close() + }) + .catch((r) => { + Message.error('下载文件出现错误,请联系管理员!') + downloadLoadingInstance.close() + }) } -export default service; +export default service diff --git a/src/views/applicationIntegration/IntegratedProductManagement/index.vue b/src/views/applicationIntegration/IntegratedProductManagement/index.vue index aa4666e..f7b2eb4 100644 --- a/src/views/applicationIntegration/IntegratedProductManagement/index.vue +++ b/src/views/applicationIntegration/IntegratedProductManagement/index.vue @@ -99,7 +99,7 @@ export default { tableData: [], //表格数据 pageModel: { pageNum: 1, - pageSize: 10, + pageSize: 100, }, queryModel: { code: "", @@ -225,4 +225,4 @@ export default { color: #409eff; cursor: pointer; } - \ No newline at end of file + diff --git a/src/views/applicationIntegration/applicationConfigurationManagement/index.vue b/src/views/applicationIntegration/applicationConfigurationManagement/index.vue index 33916e8..fb40c02 100644 --- a/src/views/applicationIntegration/applicationConfigurationManagement/index.vue +++ b/src/views/applicationIntegration/applicationConfigurationManagement/index.vue @@ -107,7 +107,7 @@ export default { tableData: [], //表格数据 pageModel: { pageNum: 1, - pageSize: 10, + pageSize: 100, }, queryModel: { code: "", @@ -244,4 +244,4 @@ export default { color: #409eff; cursor: pointer; } - \ No newline at end of file + diff --git a/src/views/applicationList/applicationAdd.vue b/src/views/applicationList/applicationAdd.vue index 823abe7..c647311 100644 --- a/src/views/applicationList/applicationAdd.vue +++ b/src/views/applicationList/applicationAdd.vue @@ -5,19 +5,25 @@