Pre Merge pull request !164 from LionZzzi/通用download新增json格式
This commit is contained in:
commit
2876f8c4cf
@ -11,7 +11,7 @@ VITE_APP_BASE_API = '/dev-api'
|
|||||||
VITE_APP_CONTEXT_PATH = '/'
|
VITE_APP_CONTEXT_PATH = '/'
|
||||||
|
|
||||||
# 监控地址
|
# 监控地址
|
||||||
VITE_APP_MONITOR_ADMIN = 'http://localhost:9090/admin/applications'
|
VITE_APP_MONITOR_ADMIN = 'http://localhost:9090/applications'
|
||||||
|
|
||||||
# SnailJob 控制台地址
|
# SnailJob 控制台地址
|
||||||
VITE_APP_SNAILJOB_ADMIN = 'http://localhost:8800/snail-job'
|
VITE_APP_SNAILJOB_ADMIN = 'http://localhost:8800/snail-job'
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
*.sh
|
|
||||||
node_modules
|
|
||||||
*.md
|
|
||||||
*.woff
|
|
||||||
*.ttf
|
|
||||||
.vscode
|
|
||||||
.idea
|
|
||||||
dist
|
|
||||||
/public
|
|
||||||
/docs
|
|
||||||
.husky
|
|
||||||
.local
|
|
||||||
/bin
|
|
||||||
.eslintrc.cjs
|
|
||||||
prettier.config.js
|
|
||||||
src/assets
|
|
||||||
tailwind.config.js
|
|
@ -1,51 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
node: true,
|
|
||||||
es6: true
|
|
||||||
},
|
|
||||||
parser: 'vue-eslint-parser',
|
|
||||||
extends: [
|
|
||||||
'plugin:vue/vue3-recommended',
|
|
||||||
'./.eslintrc-auto-import.json',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'prettier',
|
|
||||||
'plugin:prettier/recommended'
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: '2020',
|
|
||||||
sourceType: 'module',
|
|
||||||
project: './tsconfig.*?.json',
|
|
||||||
parser: '@typescript-eslint/parser'
|
|
||||||
},
|
|
||||||
plugins: ['vue', '@typescript-eslint', 'import', 'promise', 'node', 'prettier'],
|
|
||||||
rules: {
|
|
||||||
'@typescript-eslint/no-empty-function': 'off',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-this-alias': 'off',
|
|
||||||
|
|
||||||
// vue
|
|
||||||
'vue/multi-word-component-names': 'off',
|
|
||||||
'vue/valid-define-props': 'off',
|
|
||||||
'vue/no-v-model-argument': 'off',
|
|
||||||
'prefer-rest-params': 'off',
|
|
||||||
// prettier
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
'@typescript-eslint/ban-types': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
// 关闭空类型检查 {}
|
|
||||||
extendDefaults: true,
|
|
||||||
types: {
|
|
||||||
'{}': false,
|
|
||||||
Function: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
DialogOption: 'readonly',
|
|
||||||
OptionType: 'readonly'
|
|
||||||
}
|
|
||||||
};
|
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
- 本仓库为前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [TS](https://www.typescriptlang.org/) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。
|
- 本仓库为前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [TS](https://www.typescriptlang.org/) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。
|
||||||
- 成员项目: 基于 vben(ant-design-vue) 的前端项目 [ruoyi-plus-vben](https://gitee.com/dapppp/ruoyi-plus-vben)
|
- 成员项目: 基于 vben(ant-design-vue) 的前端项目 [ruoyi-plus-vben](https://gitee.com/dapppp/ruoyi-plus-vben)
|
||||||
|
- 成员项目: 基于 vben5(ant-design-vue) 的前端项目 [ruoyi-plus-vben5](https://gitee.com/dapppp/ruoyi-plus-vben5)
|
||||||
- 配套后端代码仓库地址
|
- 配套后端代码仓库地址
|
||||||
- [RuoYi-Vue-Plus 5.X(注意版本号)](https://gitee.com/dromara/RuoYi-Vue-Plus)
|
- [RuoYi-Vue-Plus 5.X(注意版本号)](https://gitee.com/dromara/RuoYi-Vue-Plus)
|
||||||
- [RuoYi-Cloud-Plus 2.X(注意版本号)](https://gitee.com/dromara/RuoYi-Cloud-Plus)
|
- [RuoYi-Cloud-Plus 2.X(注意版本号)](https://gitee.com/dromara/RuoYi-Cloud-Plus)
|
||||||
|
86
eslint.config.js
Normal file
86
eslint.config.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import globals from 'globals';
|
||||||
|
import pluginJs from '@eslint/js';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import pluginVue from 'eslint-plugin-vue';
|
||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
|
import prettier from 'eslint-plugin-prettier';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://blog.csdn.net/sayUonly/article/details/123482912
|
||||||
|
* 自动导入的配置
|
||||||
|
*/
|
||||||
|
const autoImportFile = new URL('./.eslintrc-auto-import.json', import.meta.url);
|
||||||
|
const autoImportGlobals = JSON.parse(await readFile(autoImportFile, 'utf8'));
|
||||||
|
|
||||||
|
/** @type {import('eslint').Linter.Config[]} */
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 不需要.eslintignore文件 而是在这里配置
|
||||||
|
*/
|
||||||
|
ignores: [
|
||||||
|
'*.sh',
|
||||||
|
'node_modules',
|
||||||
|
'*.md',
|
||||||
|
'*.woff',
|
||||||
|
'*.ttf',
|
||||||
|
'.vscode',
|
||||||
|
'.idea',
|
||||||
|
'dist',
|
||||||
|
'/public',
|
||||||
|
'/docs',
|
||||||
|
'.husky',
|
||||||
|
'.local',
|
||||||
|
'/bin',
|
||||||
|
'.eslintrc.cjs',
|
||||||
|
'prettier.config.js',
|
||||||
|
'src/assets',
|
||||||
|
'tailwind.config.js'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{ files: ['**/*.{js,mjs,cjs,ts,vue}'] },
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: globals.browser
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pluginJs.configs.recommended,
|
||||||
|
...tseslint.configs.recommended,
|
||||||
|
...pluginVue.configs['flat/essential'],
|
||||||
|
{
|
||||||
|
files: ['**/*.vue'],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
parser: tseslint.parser
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
// 自动导入的配置 undef
|
||||||
|
...autoImportGlobals.globals,
|
||||||
|
DialogOption: 'readonly',
|
||||||
|
LayoutSetting: 'readonly'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: { prettier },
|
||||||
|
rules: {
|
||||||
|
'@typescript-eslint/no-empty-function': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-this-alias': 'off',
|
||||||
|
|
||||||
|
// vue
|
||||||
|
'vue/multi-word-component-names': 'off',
|
||||||
|
'vue/valid-define-props': 'off',
|
||||||
|
'vue/no-v-model-argument': 'off',
|
||||||
|
'prefer-rest-params': 'off',
|
||||||
|
// prettier
|
||||||
|
'prettier/prettier': 'error',
|
||||||
|
// 允许使用空Object类型 {}
|
||||||
|
'@typescript-eslint/no-empty-object-type': 'off',
|
||||||
|
'@typescript-eslint/no-unused-expressions': 'off'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
53
package.json
53
package.json
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"name": "ruoyi-vue-plus",
|
"name": "ruoyi-vue-plus",
|
||||||
"version": "5.2.3",
|
"version": "5.2.3",
|
||||||
"description": "RuoYi-Vue-Plus多租户管理系统",
|
"description": "RuoYi-Vue-Plus多租户管理系统",
|
||||||
@ -10,7 +11,8 @@
|
|||||||
"build:prod": "vite build --mode production",
|
"build:prod": "vite build --mode production",
|
||||||
"build:dev": "vite build --mode development",
|
"build:dev": "vite build --mode development",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint:eslint": "eslint --fix --ext .ts,.js,.vue ./src ",
|
"lint:eslint": "eslint",
|
||||||
|
"lint:eslint:fix": "eslint --fix",
|
||||||
"prettier": "prettier --write ."
|
"prettier": "prettier --write ."
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -21,71 +23,66 @@
|
|||||||
"@element-plus/icons-vue": "2.3.1",
|
"@element-plus/icons-vue": "2.3.1",
|
||||||
"@highlightjs/vue-plugin": "2.1.0",
|
"@highlightjs/vue-plugin": "2.1.0",
|
||||||
"@vueup/vue-quill": "1.2.0",
|
"@vueup/vue-quill": "1.2.0",
|
||||||
"@vueuse/core": "10.9.0",
|
"@vueuse/core": "11.3.0",
|
||||||
"animate.css": "4.1.1",
|
"animate.css": "4.1.1",
|
||||||
"await-to-js": "3.0.0",
|
"await-to-js": "3.0.0",
|
||||||
"axios": "1.6.8",
|
"axios": "1.7.8",
|
||||||
"bpmn-js": "16.4.0",
|
"bpmn-js": "16.4.0",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"diagram-js": "12.3.0",
|
"diagram-js": "12.3.0",
|
||||||
"didi": "9.0.2",
|
"didi": "9.0.2",
|
||||||
"echarts": "5.5.0",
|
"echarts": "5.5.0",
|
||||||
"element-plus": "2.7.8",
|
"element-plus": "2.8.8",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "7.0.0",
|
"fuse.js": "7.0.0",
|
||||||
"highlight.js": "11.9.0",
|
"highlight.js": "11.9.0",
|
||||||
"image-conversion": "^2.1.1",
|
"image-conversion": "2.1.1",
|
||||||
"js-cookie": "3.0.5",
|
"js-cookie": "3.0.5",
|
||||||
"jsencrypt": "3.3.2",
|
"jsencrypt": "3.3.2",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"pinia": "2.1.7",
|
"pinia": "2.2.6",
|
||||||
"screenfull": "6.0.2",
|
"screenfull": "6.0.2",
|
||||||
"vue": "3.4.34",
|
"vue": "3.5.13",
|
||||||
"vue-cropper": "1.1.1",
|
"vue-cropper": "1.1.1",
|
||||||
"vue-i18n": "9.10.2",
|
"vue-i18n": "9.10.2",
|
||||||
"vue-router": "4.3.2",
|
"vue-json-pretty": "2.4.0",
|
||||||
"vue-types": "5.1.1",
|
"vue-router": "4.4.5",
|
||||||
|
"vue-types": "5.1.3",
|
||||||
"vxe-table": "4.5.22"
|
"vxe-table": "4.5.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify/json": "2.2.201",
|
"@eslint/js": "9.15.0",
|
||||||
"@intlify/unplugin-vue-i18n": "3.0.1",
|
"@iconify/json": "2.2.276",
|
||||||
"@types/crypto-js": "4.2.2",
|
"@types/crypto-js": "4.2.2",
|
||||||
"@types/file-saver": "2.0.7",
|
"@types/file-saver": "2.0.7",
|
||||||
"@types/js-cookie": "3.0.6",
|
"@types/js-cookie": "3.0.6",
|
||||||
"@types/node": "18.18.2",
|
"@types/node": "18.18.2",
|
||||||
"@types/nprogress": "0.2.3",
|
"@types/nprogress": "0.2.3",
|
||||||
"@typescript-eslint/eslint-plugin": "7.3.1",
|
"@unocss/preset-attributify": "0.64.1",
|
||||||
"@typescript-eslint/parser": "7.3.1",
|
"@unocss/preset-icons": "0.64.1",
|
||||||
"@unocss/preset-attributify": "0.58.6",
|
"@unocss/preset-uno": "0.64.1",
|
||||||
"@unocss/preset-icons": "0.58.6",
|
|
||||||
"@unocss/preset-uno": "0.58.6",
|
|
||||||
"@vitejs/plugin-vue": "5.0.4",
|
"@vitejs/plugin-vue": "5.0.4",
|
||||||
"@vue/compiler-sfc": "3.4.23",
|
"@vue/compiler-sfc": "3.4.23",
|
||||||
"autoprefixer": "10.4.18",
|
"autoprefixer": "10.4.18",
|
||||||
"eslint": "8.57.0",
|
"eslint": "9.15.0",
|
||||||
"eslint-config-prettier": "9.1.0",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-define-config": "2.1.0",
|
"eslint-plugin-vue": "9.31.0",
|
||||||
"eslint-plugin-prettier": "5.1.3",
|
|
||||||
"eslint-plugin-promise": "6.1.1",
|
|
||||||
"eslint-plugin-node": "11.1.0",
|
|
||||||
"eslint-plugin-import": "2.29.1",
|
|
||||||
"eslint-plugin-vue": "9.23.0",
|
|
||||||
"fast-glob": "3.3.2",
|
"fast-glob": "3.3.2",
|
||||||
|
"globals": "15.12.0",
|
||||||
"postcss": "8.4.36",
|
"postcss": "8.4.36",
|
||||||
"prettier": "3.2.5",
|
"prettier": "3.2.5",
|
||||||
"sass": "1.72.0",
|
"sass": "1.72.0",
|
||||||
"typescript": "5.4.5",
|
"typescript": "5.7.2",
|
||||||
"unocss": "0.58.6",
|
"typescript-eslint": "8.16.0",
|
||||||
|
"unocss": "0.64.1",
|
||||||
"unplugin-auto-import": "0.17.5",
|
"unplugin-auto-import": "0.17.5",
|
||||||
"unplugin-icons": "0.18.5",
|
"unplugin-icons": "0.18.5",
|
||||||
"unplugin-vue-components": "0.26.0",
|
"unplugin-vue-components": "0.26.0",
|
||||||
"unplugin-vue-setup-extend-plus": "1.0.1",
|
"unplugin-vue-setup-extend-plus": "1.0.1",
|
||||||
"vite": "5.2.12",
|
"vite": "5.4.11",
|
||||||
"vite-plugin-compression": "0.5.1",
|
"vite-plugin-compression": "0.5.1",
|
||||||
"vite-plugin-svg-icons": "2.0.1",
|
"vite-plugin-svg-icons": "2.0.1",
|
||||||
"vitest": "1.5.0",
|
"vitest": "1.5.0",
|
||||||
"vue-eslint-parser": "9.4.2",
|
|
||||||
"vue-tsc": "2.0.13"
|
"vue-tsc": "2.0.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,12 @@ export function register(data: any) {
|
|||||||
* 注销
|
* 注销
|
||||||
*/
|
*/
|
||||||
export function logout() {
|
export function logout() {
|
||||||
request({
|
if (import.meta.env.VITE_APP_SSE === 'true') {
|
||||||
url: '/resource/sse/close',
|
request({
|
||||||
method: 'get'
|
url: '/resource/sse/close',
|
||||||
});
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/logout',
|
url: '/auth/logout',
|
||||||
method: 'post'
|
method: 'post'
|
||||||
@ -100,11 +102,11 @@ export function getInfo(): AxiosPromise<UserInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取租户列表
|
// 获取租户列表
|
||||||
export function getTenantList(): AxiosPromise<TenantInfo> {
|
export function getTenantList(isToken: boolean): AxiosPromise<TenantInfo> {
|
||||||
return request({
|
return request({
|
||||||
url: '/auth/tenant/list',
|
url: '/auth/tenant/list',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false
|
isToken: isToken
|
||||||
},
|
},
|
||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
|
@ -30,7 +30,7 @@ export function getOnline() {
|
|||||||
// 删除当前在线设备
|
// 删除当前在线设备
|
||||||
export function delOnline(tokenId: string) {
|
export function delOnline(tokenId: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/monitor/online/' + tokenId,
|
url: '/monitor/online/myself/' + tokenId,
|
||||||
method: 'post'
|
method: 'delete'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,6 @@ export function syncTenantPackage(tenantId: string | number, packageId: string |
|
|||||||
export function syncTenantDict() {
|
export function syncTenantDict() {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/tenant/syncTenantDict',
|
url: '/system/tenant/syncTenantDict',
|
||||||
method: 'get',
|
method: 'get'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.el-collapse {
|
.el-collapse {
|
||||||
.collapse__title {
|
.collapse__title {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
--bpmn-panel-bar-background-color: #f5f7fa;
|
--bpmn-panel-bar-background-color: #f5f7fa;
|
||||||
|
|
||||||
// ele
|
// ele
|
||||||
--brder-color: #e8e8e8
|
--brder-color: #e8e8e8;
|
||||||
}
|
}
|
||||||
html.dark {
|
html.dark {
|
||||||
--menuBg: #1d1e1f;
|
--menuBg: #1d1e1f;
|
||||||
@ -42,25 +42,25 @@ html.dark {
|
|||||||
--el-color-primary-light-9: #262727;
|
--el-color-primary-light-9: #262727;
|
||||||
}
|
}
|
||||||
// vxe-table 主题
|
// vxe-table 主题
|
||||||
--vxe-font-color: #98989E;
|
--vxe-font-color: #98989e;
|
||||||
--vxe-primary-color: #2C7ECF;
|
--vxe-primary-color: #2c7ecf;
|
||||||
--vxe-icon-background-color: #98989E;
|
--vxe-icon-background-color: #98989e;
|
||||||
--vxe-table-font-color: #98989E;
|
--vxe-table-font-color: #98989e;
|
||||||
--vxe-table-resizable-color: #95969a;
|
--vxe-table-resizable-color: #95969a;
|
||||||
--vxe-table-header-background-color: #28282A;
|
--vxe-table-header-background-color: #28282a;
|
||||||
--vxe-table-body-background-color: #151518;
|
--vxe-table-body-background-color: #151518;
|
||||||
--vxe-table-background-color: #4a5663;
|
--vxe-table-background-color: #4a5663;
|
||||||
--vxe-table-border-width: 1px;
|
--vxe-table-border-width: 1px;
|
||||||
--vxe-table-border-color: #37373A;
|
--vxe-table-border-color: #37373a;
|
||||||
--vxe-toolbar-background-color: #37373A;
|
--vxe-toolbar-background-color: #37373a;
|
||||||
|
|
||||||
// 工作流
|
// 工作流
|
||||||
--bpmn-panel-border: #37373A;
|
--bpmn-panel-border: #37373a;
|
||||||
--bpmn-panel-box-shadow: #37373A;
|
--bpmn-panel-box-shadow: #37373a;
|
||||||
--bpmn-panel-bar-background-color: #37373A;
|
--bpmn-panel-bar-background-color: #37373a;
|
||||||
|
|
||||||
// ele
|
// ele
|
||||||
--brder-color: #37373A
|
--brder-color: #37373a;
|
||||||
}
|
}
|
||||||
|
|
||||||
// base color
|
// base color
|
||||||
|
@ -11,21 +11,53 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RouteLocationMatched } from 'vue-router';
|
import { RouteLocationMatched } from 'vue-router';
|
||||||
|
import usePermissionStore from '@/store/modules/permission';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const permissionStore = usePermissionStore();
|
||||||
const levelList = ref<RouteLocationMatched[]>([]);
|
const levelList = ref<RouteLocationMatched[]>([]);
|
||||||
|
|
||||||
const getBreadcrumb = () => {
|
const getBreadcrumb = () => {
|
||||||
// only show routes with meta.title
|
// only show routes with meta.title
|
||||||
let matched = route.matched.filter((item) => item.meta && item.meta.title);
|
let matched = [];
|
||||||
const first = matched[0];
|
const pathNum = findPathNum(route.path);
|
||||||
|
// multi-level menu
|
||||||
|
if (pathNum > 2) {
|
||||||
|
const reg = /\/\w+/gi;
|
||||||
|
const pathList = route.path.match(reg).map((item, index) => {
|
||||||
|
if (index !== 0) item = item.slice(1);
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
getMatched(pathList, permissionStore.defaultRoutes, matched);
|
||||||
|
} else {
|
||||||
|
matched = route.matched.filter((item) => item.meta && item.meta.title);
|
||||||
|
}
|
||||||
// 判断是否为首页
|
// 判断是否为首页
|
||||||
if (!isDashboard(first)) {
|
if (!isDashboard(matched[0])) {
|
||||||
matched = ([{ path: '/index', meta: { title: '首页' } }] as any).concat(matched);
|
matched = [{ path: '/index', meta: { title: '首页' } }].concat(matched);
|
||||||
}
|
}
|
||||||
levelList.value = matched.filter((item) => item.meta && item.meta.title && item.meta.breadcrumb !== false);
|
levelList.value = matched.filter((item) => item.meta && item.meta.title && item.meta.breadcrumb !== false);
|
||||||
};
|
};
|
||||||
|
const findPathNum = (str, char = '/') => {
|
||||||
|
let index = str.indexOf(char);
|
||||||
|
let num = 0;
|
||||||
|
while (index !== -1) {
|
||||||
|
num++;
|
||||||
|
index = str.indexOf(char, index + 1);
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
};
|
||||||
|
const getMatched = (pathList, routeList, matched) => {
|
||||||
|
let data = routeList.find((item) => item.path == pathList[0] || (item.name += '').toLowerCase() == pathList[0]);
|
||||||
|
if (data) {
|
||||||
|
matched.push(data);
|
||||||
|
if (data.children && pathList.length) {
|
||||||
|
pathList.shift();
|
||||||
|
getMatched(pathList, data.children, matched);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
const isDashboard = (route: RouteLocationMatched) => {
|
const isDashboard = (route: RouteLocationMatched) => {
|
||||||
const name = route && (route.name as string);
|
const name = route && (route.name as string);
|
||||||
if (!name) {
|
if (!name) {
|
||||||
|
@ -121,6 +121,11 @@ const handleBeforeUpload = (file: any) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 校检文件名是否包含特殊字符
|
||||||
|
if (file.name.includes(',')) {
|
||||||
|
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// 校检文件大小
|
// 校检文件大小
|
||||||
if (props.fileSize) {
|
if (props.fileSize) {
|
||||||
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
||||||
|
@ -139,6 +139,10 @@ const handleBeforeUpload = (file: any) => {
|
|||||||
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
|
proxy?.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join('/')}图片格式文件!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (file.name.includes(',')) {
|
||||||
|
proxy?.$modal.msgError('文件名不正确,不能包含英文逗号!');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (props.fileSize) {
|
if (props.fileSize) {
|
||||||
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
||||||
if (!isLt) {
|
if (!isLt) {
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<right-toolbar v-model:showSearch="showSearch" :search="true" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" :search="true" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ const confirm = () => {
|
|||||||
|
|
||||||
const computedIds = (data) => {
|
const computedIds = (data) => {
|
||||||
if (data instanceof Array) {
|
if (data instanceof Array) {
|
||||||
return [...data];
|
return data.map(item => String(item));
|
||||||
} else if (typeof data === 'string') {
|
} else if (typeof data === 'string') {
|
||||||
return data.split(',');
|
return data.split(',');
|
||||||
} else if (typeof data === 'number') {
|
} else if (typeof data === 'number') {
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"route": {
|
|
||||||
"dashboard": "Dashboard",
|
|
||||||
"document": "Document"
|
|
||||||
},
|
|
||||||
"login": {
|
|
||||||
"username": "Username",
|
|
||||||
"password": "Password",
|
|
||||||
"login": "Login",
|
|
||||||
"code": "Verification Code",
|
|
||||||
"copyright": ""
|
|
||||||
},
|
|
||||||
"navbar": {
|
|
||||||
"full": "Full Screen",
|
|
||||||
"language": "Language",
|
|
||||||
"dashboard": "Dashboard",
|
|
||||||
"document": "Document",
|
|
||||||
"message": "Message",
|
|
||||||
"layoutSize": "Layout Size",
|
|
||||||
"selectTenant": "Select Tenant",
|
|
||||||
"layoutSetting": "Layout Setting",
|
|
||||||
"personalCenter": "Personal Center",
|
|
||||||
"logout": "Logout"
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,11 +6,68 @@ export default {
|
|||||||
},
|
},
|
||||||
// 登录页面国际化
|
// 登录页面国际化
|
||||||
login: {
|
login: {
|
||||||
|
selectPlaceholder: 'Please select/enter a company name',
|
||||||
username: 'Username',
|
username: 'Username',
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
login: 'Login',
|
login: 'Login',
|
||||||
|
logging: 'Logging...',
|
||||||
code: 'Verification Code',
|
code: 'Verification Code',
|
||||||
copyright: ''
|
rememberPassword: 'Remember me',
|
||||||
|
switchRegisterPage: 'Sign up now',
|
||||||
|
rule: {
|
||||||
|
tenantId: {
|
||||||
|
required: 'Please enter your tenant id'
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
required: 'Please enter your account'
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
required: 'Please enter your password'
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
required: 'Please enter a verification code'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
social: {
|
||||||
|
wechat: 'Wechat Login',
|
||||||
|
maxkey: 'MaxKey Login',
|
||||||
|
topiam: 'TopIam Login',
|
||||||
|
gitee: 'Gitee Login',
|
||||||
|
github: 'Github Login'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 注册页面国际化
|
||||||
|
register: {
|
||||||
|
selectPlaceholder: 'Please select/enter a company name',
|
||||||
|
username: 'Username',
|
||||||
|
password: 'Password',
|
||||||
|
confirmPassword: 'Confirm Password',
|
||||||
|
register: 'Register',
|
||||||
|
registering: 'Registering...',
|
||||||
|
registerSuccess: 'Congratulations, your {username} account has been registered!',
|
||||||
|
code: 'Verification Code',
|
||||||
|
switchLoginPage: 'Log in with an existing account',
|
||||||
|
rule: {
|
||||||
|
tenantId: {
|
||||||
|
required: 'Please enter your tenant id'
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
required: 'Please enter your account',
|
||||||
|
length: 'The length of the user account must be between {min} and {max}'
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
required: 'Please enter your password',
|
||||||
|
length: 'The user password must be between {min} and {max} in length',
|
||||||
|
pattern: "Can't contain illegal characters: {strings}"
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
required: 'Please enter a verification code'
|
||||||
|
},
|
||||||
|
confirmPassword: {
|
||||||
|
required: 'Please enter your password again',
|
||||||
|
equalToPassword: 'The password entered twice is inconsistent'
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 导航栏国际化
|
// 导航栏国际化
|
||||||
navbar: {
|
navbar: {
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
import { createI18n } from 'vue-i18n';
|
import { createI18n } from 'vue-i18n';
|
||||||
|
|
||||||
import { LanguageEnum } from '@/enums/LanguageEnum';
|
import { LanguageEnum } from '@/enums/LanguageEnum';
|
||||||
import messages from '@intlify/unplugin-vue-i18n/messages';
|
import zh_CN from '@/lang/zh_CN';
|
||||||
|
import en_US from '@/lang/en_US';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前语言
|
* 获取当前语言
|
||||||
@ -21,7 +22,12 @@ const i18n = createI18n({
|
|||||||
allowComposition: true,
|
allowComposition: true,
|
||||||
legacy: false,
|
legacy: false,
|
||||||
locale: getLanguage(),
|
locale: getLanguage(),
|
||||||
messages
|
messages: {
|
||||||
|
zh_CN: zh_CN,
|
||||||
|
en_US: en_US
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|
||||||
|
export type LanguageType = typeof zh_CN;
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"route": {
|
|
||||||
"dashboard": "首页",
|
|
||||||
"document": "项目文档"
|
|
||||||
},
|
|
||||||
"login": {
|
|
||||||
"username": "用户名",
|
|
||||||
"password": "密码",
|
|
||||||
"login": "登 录",
|
|
||||||
"code": "请输入验证码",
|
|
||||||
"copyright": ""
|
|
||||||
},
|
|
||||||
"navbar": {
|
|
||||||
"full": "全屏",
|
|
||||||
"language": "语言",
|
|
||||||
"dashboard": "首页",
|
|
||||||
"document": "项目文档",
|
|
||||||
"message": "消息",
|
|
||||||
"layoutSize": "布局大小",
|
|
||||||
"selectTenant": "选择租户",
|
|
||||||
"layoutSetting": "布局设置",
|
|
||||||
"personalCenter": "个人中心",
|
|
||||||
"logout": "退出登录"
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,12 +6,70 @@ export default {
|
|||||||
},
|
},
|
||||||
// 登录页面国际化
|
// 登录页面国际化
|
||||||
login: {
|
login: {
|
||||||
|
selectPlaceholder: '请选择/输入公司名称',
|
||||||
username: '用户名',
|
username: '用户名',
|
||||||
password: '密码',
|
password: '密码',
|
||||||
login: '登 录',
|
login: '登 录',
|
||||||
code: '请输入验证码',
|
logging: '登 录 中...',
|
||||||
copyright: ''
|
code: '验证码',
|
||||||
|
rememberPassword: '记住我',
|
||||||
|
switchRegisterPage: '立即注册',
|
||||||
|
rule: {
|
||||||
|
tenantId: {
|
||||||
|
required: '请输入您的租户编号'
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
required: '请输入您的账号'
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
required: '请输入您的密码'
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
required: '请输入验证码'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
social: {
|
||||||
|
wechat: '微信登录',
|
||||||
|
maxkey: 'MaxKey登录',
|
||||||
|
topiam: 'TopIam登录',
|
||||||
|
gitee: 'Gitee登录',
|
||||||
|
github: 'Github登录'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
// 注册页面国际化
|
||||||
|
register: {
|
||||||
|
selectPlaceholder: '请选择/输入公司名称',
|
||||||
|
username: '用户名',
|
||||||
|
password: '密码',
|
||||||
|
confirmPassword: '确认密码',
|
||||||
|
register: '注 册',
|
||||||
|
registering: '注 册 中...',
|
||||||
|
registerSuccess: '恭喜你,您的账号 {username} 注册成功!',
|
||||||
|
code: '验证码',
|
||||||
|
switchLoginPage: '使用已有账户登录',
|
||||||
|
rule: {
|
||||||
|
tenantId: {
|
||||||
|
required: '请输入您的租户编号'
|
||||||
|
},
|
||||||
|
username: {
|
||||||
|
required: '请输入您的账号',
|
||||||
|
length: '用户账号长度必须介于 {min} 和 {max} 之间'
|
||||||
|
},
|
||||||
|
password: {
|
||||||
|
required: '请输入您的密码',
|
||||||
|
length: '用户密码长度必须介于 {min} 和 {max} 之间',
|
||||||
|
pattern: '不能包含非法字符:{strings}'
|
||||||
|
},
|
||||||
|
code: {
|
||||||
|
required: '请输入验证码'
|
||||||
|
},
|
||||||
|
confirmPassword: {
|
||||||
|
required: '请再次输入您的密码',
|
||||||
|
equalToPassword: '两次输入的密码不一致'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 导航栏国际化
|
||||||
navbar: {
|
navbar: {
|
||||||
full: '全屏',
|
full: '全屏',
|
||||||
language: '语言',
|
language: '语言',
|
||||||
|
@ -20,6 +20,7 @@ import useTagsViewStore from '@/store/modules/tagsView';
|
|||||||
|
|
||||||
import IframeToggle from './IframeToggle/index.vue';
|
import IframeToggle from './IframeToggle/index.vue';
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const route = useRoute();
|
||||||
const tagsViewStore = useTagsViewStore();
|
const tagsViewStore = useTagsViewStore();
|
||||||
|
|
||||||
// 随机动画集合
|
// 随机动画集合
|
||||||
@ -37,6 +38,20 @@ watch(
|
|||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
addIframe()
|
||||||
|
})
|
||||||
|
|
||||||
|
watch((route) => {
|
||||||
|
addIframe()
|
||||||
|
})
|
||||||
|
|
||||||
|
function addIframe() {
|
||||||
|
if (route.meta.link) {
|
||||||
|
useTagsViewStore().addIframeView(route)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
@ -98,6 +98,7 @@ import { getTenantList } from '@/api/login';
|
|||||||
import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
|
import { dynamicClear, dynamicTenant } from '@/api/system/tenant';
|
||||||
import { TenantVO } from '@/api/types';
|
import { TenantVO } from '@/api/types';
|
||||||
import notice from './notice/index.vue';
|
import notice from './notice/index.vue';
|
||||||
|
import router from '@/router';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
@ -142,7 +143,7 @@ const dynamicClearEvent = async () => {
|
|||||||
|
|
||||||
/** 租户列表 */
|
/** 租户列表 */
|
||||||
const initTenantList = async () => {
|
const initTenantList = async () => {
|
||||||
const { data } = await getTenantList();
|
const { data } = await getTenantList(true);
|
||||||
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
||||||
if (tenantEnabled.value) {
|
if (tenantEnabled.value) {
|
||||||
tenantList.value = data.voList;
|
tenantList.value = data.voList;
|
||||||
@ -163,8 +164,14 @@ const logout = async () => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
await userStore.logout();
|
userStore.logout().then(() => {
|
||||||
location.href = import.meta.env.VITE_APP_CONTEXT_PATH + 'index';
|
router.replace({
|
||||||
|
path: '/login',
|
||||||
|
query: {
|
||||||
|
redirect: encodeURIComponent(router.currentRoute.value.fullPath || '/')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const emits = defineEmits(['setLayout']);
|
const emits = defineEmits(['setLayout']);
|
||||||
|
@ -59,11 +59,9 @@ const hasOneShowingChild = (parent: RouteRecordRaw, children?: RouteRecordRaw[])
|
|||||||
const showingChildren = children.filter((item) => {
|
const showingChildren = children.filter((item) => {
|
||||||
if (item.hidden) {
|
if (item.hidden) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
// Temp set(will be used if only has one showing child)
|
|
||||||
onlyOneChild.value = item;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
onlyOneChild.value = item;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// When there is only one child router, the child router is displayed by default
|
// When there is only one child router, the child router is displayed by default
|
||||||
|
@ -135,11 +135,7 @@ const addTags = () => {
|
|||||||
}
|
}
|
||||||
if (name) {
|
if (name) {
|
||||||
useTagsViewStore().addView(route as any);
|
useTagsViewStore().addView(route as any);
|
||||||
if (route.meta.link) {
|
|
||||||
useTagsViewStore().addIframeView(route as any);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
const moveToCurrentTag = () => {
|
const moveToCurrentTag = () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
@ -66,7 +66,7 @@ const closeSearch = () => {
|
|||||||
state.isShowSearch = false;
|
state.isShowSearch = false;
|
||||||
};
|
};
|
||||||
// 菜单搜索数据过滤
|
// 菜单搜索数据过滤
|
||||||
const menuSearch = (queryString: string, cb: Function) => {
|
const menuSearch = (queryString: string, cb: (options: any[]) => void) => {
|
||||||
let options = state.menuList.filter((item) => {
|
let options = state.menuList.filter((item) => {
|
||||||
return item.title.indexOf(queryString) > -1;
|
return item.title.indexOf(queryString) > -1;
|
||||||
});
|
});
|
||||||
|
@ -27,7 +27,7 @@ import { AppMain, Navbar, Settings, TagsView } from './components';
|
|||||||
import useAppStore from '@/store/modules/app';
|
import useAppStore from '@/store/modules/app';
|
||||||
import useSettingsStore from '@/store/modules/settings';
|
import useSettingsStore from '@/store/modules/settings';
|
||||||
import { initWebSocket } from '@/utils/websocket';
|
import { initWebSocket } from '@/utils/websocket';
|
||||||
import { initSSE } from "@/utils/sse";
|
import { initSSE } from '@/utils/sse';
|
||||||
|
|
||||||
const settingsStore = useSettingsStore();
|
const settingsStore = useSettingsStore();
|
||||||
const theme = computed(() => settingsStore.theme);
|
const theme = computed(() => settingsStore.theme);
|
||||||
|
@ -3,14 +3,18 @@ import router from './router';
|
|||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
import 'nprogress/nprogress.css';
|
import 'nprogress/nprogress.css';
|
||||||
import { getToken } from '@/utils/auth';
|
import { getToken } from '@/utils/auth';
|
||||||
import { isHttp } from '@/utils/validate';
|
import { isHttp, isPathMatch } from '@/utils/validate';
|
||||||
import { isRelogin } from '@/utils/request';
|
import { isRelogin } from '@/utils/request';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import useSettingsStore from '@/store/modules/settings';
|
import useSettingsStore from '@/store/modules/settings';
|
||||||
import usePermissionStore from '@/store/modules/permission';
|
import usePermissionStore from '@/store/modules/permission';
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false });
|
NProgress.configure({ showSpinner: false });
|
||||||
const whiteList = ['/login', '/register', '/social-callback'];
|
const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*'];
|
||||||
|
|
||||||
|
const isWhiteList = (path: string) => {
|
||||||
|
return whiteList.some(pattern => isPathMatch(pattern, path))
|
||||||
|
}
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
NProgress.start();
|
NProgress.start();
|
||||||
@ -20,7 +24,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (to.path === '/login') {
|
if (to.path === '/login') {
|
||||||
next({ path: '/' });
|
next({ path: '/' });
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
} else if (whiteList.indexOf(to.path as string) !== -1) {
|
} else if (isWhiteList(to.path)) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
if (useUserStore().roles.length === 0) {
|
if (useUserStore().roles.length === 0) {
|
||||||
@ -40,7 +44,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
router.addRoute(route); // 动态添加可访问路由表
|
router.addRoute(route); // 动态添加可访问路由表
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// @ts-ignore
|
// @ts-expect-error hack方法 确保addRoutes已完成
|
||||||
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -49,7 +53,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有token
|
// 没有token
|
||||||
if (whiteList.indexOf(to.path as string) !== -1) {
|
if (isWhiteList(to.path)) {
|
||||||
// 在免登录白名单,直接进入
|
// 在免登录白名单,直接进入
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
|
@ -26,6 +26,7 @@ const sessionCache = {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
return JSON.parse(value);
|
return JSON.parse(value);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
remove(key: string) {
|
remove(key: string) {
|
||||||
sessionStorage.removeItem(key);
|
sessionStorage.removeItem(key);
|
||||||
@ -59,6 +60,7 @@ const localCache = {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
return JSON.parse(value);
|
return JSON.parse(value);
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
},
|
},
|
||||||
remove(key: string) {
|
remove(key: string) {
|
||||||
localStorage.removeItem(key);
|
localStorage.removeItem(key);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import {RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw} from 'vue-router';
|
import { RouteLocationMatched, RouteLocationNormalized, RouteLocationRaw } from 'vue-router';
|
||||||
import useTagsViewStore from '@/store/modules/tagsView';
|
import useTagsViewStore from '@/store/modules/tagsView';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -103,7 +103,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
|||||||
path: 'role/:userId(\\d+)',
|
path: 'role/:userId(\\d+)',
|
||||||
component: () => import('@/views/system/user/authRole.vue'),
|
component: () => import('@/views/system/user/authRole.vue'),
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
meta: { title: '分配角色', activeMenu: '/system/user', icon: '' }
|
meta: { title: '分配角色', activeMenu: '/system/user', icon: '', noCache: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -117,7 +117,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
|||||||
path: 'user/:roleId(\\d+)',
|
path: 'user/:roleId(\\d+)',
|
||||||
component: () => import('@/views/system/role/authUser.vue'),
|
component: () => import('@/views/system/role/authUser.vue'),
|
||||||
name: 'AuthUser',
|
name: 'AuthUser',
|
||||||
meta: { title: '分配用户', activeMenu: '/system/role', icon: '' }
|
meta: { title: '分配用户', activeMenu: '/system/role', icon: '', noCache: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -131,7 +131,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
|||||||
path: 'index/:dictId(\\d+)',
|
path: 'index/:dictId(\\d+)',
|
||||||
component: () => import('@/views/system/dict/data.vue'),
|
component: () => import('@/views/system/dict/data.vue'),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '字典数据', activeMenu: '/system/dict', icon: '' }
|
meta: { title: '字典数据', activeMenu: '/system/dict', icon: '', noCache: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -145,7 +145,7 @@ export const dynamicRoutes: RouteRecordRaw[] = [
|
|||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/system/oss/config.vue'),
|
component: () => import('@/views/system/oss/config.vue'),
|
||||||
name: 'OssConfig',
|
name: 'OssConfig',
|
||||||
meta: { title: '配置管理', activeMenu: '/system/oss', icon: '' }
|
meta: { title: '配置管理', activeMenu: '/system/oss', icon: '', noCache: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -189,9 +189,8 @@ const router = createRouter({
|
|||||||
scrollBehavior(to, from, savedPosition) {
|
scrollBehavior(to, from, savedPosition) {
|
||||||
if (savedPosition) {
|
if (savedPosition) {
|
||||||
return savedPosition;
|
return savedPosition;
|
||||||
} else {
|
|
||||||
return { top: 0 };
|
|
||||||
}
|
}
|
||||||
|
return { top: 0 };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,29 +1,15 @@
|
|||||||
export const useDictStore = defineStore('dict', () => {
|
export const useDictStore = defineStore('dict', () => {
|
||||||
const dict = ref<
|
const dict = ref<Map<string, DictDataOption[]>>(new Map());
|
||||||
Array<{
|
|
||||||
key: string;
|
|
||||||
value: DictDataOption[];
|
|
||||||
}>
|
|
||||||
>([]);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取字典
|
* 获取字典
|
||||||
* @param _key 字典key
|
* @param _key 字典key
|
||||||
*/
|
*/
|
||||||
const getDict = (_key: string): DictDataOption[] | null => {
|
const getDict = (_key: string): DictDataOption[] | null => {
|
||||||
if (_key == null && _key == '') {
|
if (!_key) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
return dict.value.get(_key) || null;
|
||||||
for (let i = 0; i < dict.value.length; i++) {
|
|
||||||
if (dict.value[i].key == _key) {
|
|
||||||
return dict.value[i].value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,11 +18,15 @@ export const useDictStore = defineStore('dict', () => {
|
|||||||
* @param _value 字典value
|
* @param _value 字典value
|
||||||
*/
|
*/
|
||||||
const setDict = (_key: string, _value: DictDataOption[]) => {
|
const setDict = (_key: string, _value: DictDataOption[]) => {
|
||||||
if (_key !== null && _key !== '') {
|
if (!_key) {
|
||||||
dict.value.push({
|
return false;
|
||||||
key: _key,
|
}
|
||||||
value: _value
|
try {
|
||||||
});
|
dict.value.set(_key, _value);
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error in setDict:', e);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,25 +35,22 @@ export const useDictStore = defineStore('dict', () => {
|
|||||||
* @param _key
|
* @param _key
|
||||||
*/
|
*/
|
||||||
const removeDict = (_key: string): boolean => {
|
const removeDict = (_key: string): boolean => {
|
||||||
let bln = false;
|
if (!_key) {
|
||||||
try {
|
return false;
|
||||||
for (let i = 0; i < dict.value.length; i++) {
|
}
|
||||||
if (dict.value[i].key == _key) {
|
try {
|
||||||
dict.value.splice(i, 1);
|
return dict.value.delete(_key);
|
||||||
return true;
|
} catch (e) {
|
||||||
}
|
console.error('Error in removeDict:', e);
|
||||||
}
|
return false;
|
||||||
} catch (e) {
|
|
||||||
bln = false;
|
|
||||||
}
|
}
|
||||||
return bln;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空字典
|
* 清空字典
|
||||||
*/
|
*/
|
||||||
const cleanDict = (): void => {
|
const cleanDict = (): void => {
|
||||||
dict.value = [];
|
dict.value.clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -158,9 +158,12 @@ export const filterDynamicRoutes = (routes: RouteRecordRaw[]) => {
|
|||||||
export const loadView = (view: any, name: string) => {
|
export const loadView = (view: any, name: string) => {
|
||||||
let res;
|
let res;
|
||||||
for (const path in modules) {
|
for (const path in modules) {
|
||||||
const dir = path.split('views/')[1].split('.vue')[0];
|
const viewsIndex = path.indexOf('/views/');
|
||||||
|
let dir = path.substring(viewsIndex + 7);
|
||||||
|
dir = dir.substring(0, dir.lastIndexOf('.vue'));
|
||||||
if (dir === view) {
|
if (dir === view) {
|
||||||
res = createCustomNameComponent(modules[path], { name });
|
res = createCustomNameComponent(modules[path], { name });
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -31,7 +31,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
const delIframeView = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
|
iframeViews.value = iframeViews.value.filter((item: RouteLocationNormalized) => item.path !== view.path);
|
||||||
resolve([...iframeViews.value as RouteLocationNormalized[]]);
|
resolve([...(iframeViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const addVisitedView = (view: RouteLocationNormalized): void => {
|
const addVisitedView = (view: RouteLocationNormalized): void => {
|
||||||
@ -54,7 +54,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delCachedView(view);
|
delCachedView(view);
|
||||||
}
|
}
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
visitedViews: [...(visitedViews.value as RouteLocationNormalized[])],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -68,7 +68,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
resolve([...(visitedViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
|
const delCachedView = (view?: RouteLocationNormalized): Promise<string[]> => {
|
||||||
@ -92,7 +92,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delOthersVisitedViews(view);
|
delOthersVisitedViews(view);
|
||||||
delOthersCachedViews(view);
|
delOthersCachedViews(view);
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
visitedViews: [...(visitedViews.value as RouteLocationNormalized[])],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -103,7 +103,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
|
visitedViews.value = visitedViews.value.filter((v: RouteLocationNormalized) => {
|
||||||
return v.meta?.affix || v.path === view.path;
|
return v.meta?.affix || v.path === view.path;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
resolve([...(visitedViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
|
const delOthersCachedViews = (view: RouteLocationNormalized): Promise<string[]> => {
|
||||||
@ -124,7 +124,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
delAllVisitedViews();
|
delAllVisitedViews();
|
||||||
delAllCachedViews();
|
delAllCachedViews();
|
||||||
resolve({
|
resolve({
|
||||||
visitedViews: [...visitedViews.value as RouteLocationNormalized[]],
|
visitedViews: [...(visitedViews.value as RouteLocationNormalized[])],
|
||||||
cachedViews: [...cachedViews.value]
|
cachedViews: [...cachedViews.value]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -132,7 +132,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
|
const delAllVisitedViews = (): Promise<RouteLocationNormalized[]> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
|
visitedViews.value = visitedViews.value.filter((tag: RouteLocationNormalized) => tag.meta?.affix);
|
||||||
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
resolve([...(visitedViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
resolve([...(visitedViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
const delLeftTags = (view: RouteLocationNormalized): Promise<RouteLocationNormalized[]> => {
|
||||||
@ -186,7 +186,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
resolve([...visitedViews.value as RouteLocationNormalized[]]);
|
resolve([...(visitedViews.value as RouteLocationNormalized[])]);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
22
src/types/module.d.ts
vendored
22
src/types/module.d.ts
vendored
@ -8,10 +8,11 @@ import { useDict } from '@/utils/dict';
|
|||||||
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
|
import { handleTree, addDateRange, selectDictLabel, selectDictLabels, parseTime } from '@/utils/ruoyi';
|
||||||
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
|
import { getConfigKey, updateConfigByKey } from '@/api/system/config';
|
||||||
import { download as rd } from '@/utils/request';
|
import { download as rd } from '@/utils/request';
|
||||||
|
import type { LanguageType } from '@/lang';
|
||||||
|
|
||||||
export {};
|
export {};
|
||||||
|
|
||||||
declare module 'vue' {
|
declare module '@vue/runtime-core' {
|
||||||
interface ComponentCustomProperties {
|
interface ComponentCustomProperties {
|
||||||
// 全局方法声明
|
// 全局方法声明
|
||||||
$modal: typeof modal;
|
$modal: typeof modal;
|
||||||
@ -20,6 +21,11 @@ declare module 'vue' {
|
|||||||
$auth: typeof auth;
|
$auth: typeof auth;
|
||||||
$cache: typeof cache;
|
$cache: typeof cache;
|
||||||
animate: typeof animate;
|
animate: typeof animate;
|
||||||
|
/**
|
||||||
|
* i18n $t方法支持ts类型提示
|
||||||
|
* @param key i18n key
|
||||||
|
*/
|
||||||
|
$t(key: ObjKeysToUnion<LanguageType>): string;
|
||||||
|
|
||||||
useDict: typeof useDict;
|
useDict: typeof useDict;
|
||||||
addDateRange: typeof addDateRange;
|
addDateRange: typeof addDateRange;
|
||||||
@ -33,7 +39,13 @@ declare module 'vue' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'vform3-builds' {
|
/**
|
||||||
const content: any;
|
* { a: 1, b: { ba: { baa: 1, bab: 2 }, bb: 2} } ---> a | b.ba.baa | b.ba.bab | b.bb
|
||||||
export = content;
|
* https://juejin.cn/post/7280062870670606397
|
||||||
}
|
*/
|
||||||
|
export type ObjKeysToUnion<T, P extends string = ''> = T extends object
|
||||||
|
? {
|
||||||
|
[K in keyof T]: ObjKeysToUnion<T[K], P extends '' ? `${K & string}` : `${P}.${K & string}`>;
|
||||||
|
}[keyof T]
|
||||||
|
: P;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import FileSaver from 'file-saver';
|
|||||||
import { getLanguage } from '@/lang';
|
import { getLanguage } from '@/lang';
|
||||||
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
|
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
|
||||||
import { encrypt, decrypt } from '@/utils/jsencrypt';
|
import { encrypt, decrypt } from '@/utils/jsencrypt';
|
||||||
import router from "@/router";
|
import router from '@/router';
|
||||||
|
|
||||||
const encryptHeader = 'encrypt-key';
|
const encryptHeader = 'encrypt-key';
|
||||||
let downloadLoadingInstance: LoadingInstance;
|
let downloadLoadingInstance: LoadingInstance;
|
||||||
@ -174,18 +174,26 @@ service.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 通用下载方法
|
// 通用下载方法
|
||||||
export function download(url: string, params: any, fileName: string) {
|
export function download(url: string, params: any, fileName: string, isJson: boolean = false) {
|
||||||
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
|
downloadLoadingInstance = ElLoading.service({ text: '正在下载数据,请稍候', background: 'rgba(0, 0, 0, 0.7)' });
|
||||||
// prettier-ignore
|
|
||||||
return service.post(url, params, {
|
const config = {
|
||||||
transformRequest: [
|
headers: {
|
||||||
|
'Content-Type': isJson ? 'application/json' : 'application/x-www-form-urlencoded'
|
||||||
|
},
|
||||||
|
responseType: 'blob' as const,
|
||||||
|
transformRequest: isJson
|
||||||
|
? undefined
|
||||||
|
: [
|
||||||
(params: any) => {
|
(params: any) => {
|
||||||
return tansParams(params);
|
return tansParams(params);
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
};
|
||||||
responseType: 'blob'
|
|
||||||
}).then(async (resp: any) => {
|
// prettier-ignore
|
||||||
|
return service.post(url, isJson ? params : tansParams(params), config)
|
||||||
|
.then(async (resp: any) => {
|
||||||
const isLogin = blobValidate(resp);
|
const isLogin = blobValidate(resp);
|
||||||
if (isLogin) {
|
if (isLogin) {
|
||||||
const blob = new Blob([resp]);
|
const blob = new Blob([resp]);
|
||||||
|
@ -8,11 +8,8 @@ export const initSSE = (url: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
|
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
const {
|
const { data, error } = useEventSource(url, [], {
|
||||||
data,
|
|
||||||
error
|
|
||||||
} = useEventSource(url, [], {
|
|
||||||
autoReconnect: {
|
autoReconnect: {
|
||||||
retries: 10,
|
retries: 10,
|
||||||
delay: 3000,
|
delay: 3000,
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* 路径匹配器
|
||||||
|
* @param {string} pattern
|
||||||
|
* @param {string} path
|
||||||
|
* @returns {Boolean}
|
||||||
|
*/
|
||||||
|
export function isPathMatch(pattern: string, path: string) {
|
||||||
|
const regexPattern = pattern.replace(/\//g, '\\/').replace(/\*\*/g, '.*').replace(/\*/g, '[^\\/]*')
|
||||||
|
const regex = new RegExp(`^${regexPattern}$`)
|
||||||
|
return regex.test(path)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断url是否是http或https
|
* 判断url是否是http或https
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
|
@ -7,7 +7,7 @@ export const initWebSocket = (url: any) => {
|
|||||||
if (import.meta.env.VITE_APP_WEBSOCKET === 'false') {
|
if (import.meta.env.VITE_APP_WEBSOCKET === 'false') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID
|
url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
useWebSocket(url, {
|
useWebSocket(url, {
|
||||||
autoReconnect: {
|
autoReconnect: {
|
||||||
// 重连最大次数
|
// 重连最大次数
|
||||||
@ -16,14 +16,14 @@ export const initWebSocket = (url: any) => {
|
|||||||
delay: 1000,
|
delay: 1000,
|
||||||
onFailed() {
|
onFailed() {
|
||||||
console.log('websocket重连失败');
|
console.log('websocket重连失败');
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
heartbeat: {
|
heartbeat: {
|
||||||
message: JSON.stringify({type: 'ping'}),
|
message: JSON.stringify({ type: 'ping' }),
|
||||||
// 发送心跳的间隔
|
// 发送心跳的间隔
|
||||||
interval: 10000,
|
interval: 10000,
|
||||||
// 接收到心跳response的超时时间
|
// 接收到心跳response的超时时间
|
||||||
pongTimeout: 2000,
|
pongTimeout: 2000
|
||||||
},
|
},
|
||||||
onConnected() {
|
onConnected() {
|
||||||
console.log('websocket已经连接');
|
console.log('websocket已经连接');
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['demo:demo:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['demo:demo:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
|
@ -1,56 +1,73 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
||||||
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
<div class="title-box">
|
||||||
|
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
||||||
|
<lang-select />
|
||||||
|
</div>
|
||||||
<el-form-item v-if="tenantEnabled" prop="tenantId">
|
<el-form-item v-if="tenantEnabled" prop="tenantId">
|
||||||
<el-select v-model="loginForm.tenantId" filterable placeholder="请选择/输入公司名称" style="width: 100%">
|
<el-select v-model="loginForm.tenantId" filterable :placeholder="$t('login.selectPlaceholder')" style="width: 100%">
|
||||||
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
|
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"></el-option>
|
||||||
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" :placeholder="$t('login.username')">
|
||||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleLogin">
|
<el-input
|
||||||
|
v-model="loginForm.password"
|
||||||
|
type="password"
|
||||||
|
size="large"
|
||||||
|
auto-complete="off"
|
||||||
|
:placeholder="$t('login.password')"
|
||||||
|
@keyup.enter="handleLogin"
|
||||||
|
>
|
||||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="captchaEnabled" prop="code">
|
<el-form-item v-if="captchaEnabled" prop="code">
|
||||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleLogin">
|
<el-input
|
||||||
|
v-model="loginForm.code"
|
||||||
|
size="large"
|
||||||
|
auto-complete="off"
|
||||||
|
:placeholder="$t('login.code')"
|
||||||
|
style="width: 63%"
|
||||||
|
@keyup.enter="handleLogin"
|
||||||
|
>
|
||||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="login-code">
|
<div class="login-code">
|
||||||
<img :src="codeUrl" class="login-code-img" @click="getCode" />
|
<img :src="codeUrl" class="login-code-img" @click="getCode" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">记住密码</el-checkbox>
|
<el-checkbox v-model="loginForm.rememberMe" style="margin: 0 0 25px 0">{{ $t('login.rememberPassword') }}</el-checkbox>
|
||||||
<el-form-item style="float: right">
|
<el-form-item style="float: right">
|
||||||
<el-button circle title="微信登录" @click="doSocialLogin('wechat')">
|
<el-button circle :title="$t('login.social.wechat')" @click="doSocialLogin('wechat')">
|
||||||
<svg-icon icon-class="wechat" />
|
<svg-icon icon-class="wechat" />
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button circle title="MaxKey登录" @click="doSocialLogin('maxkey')">
|
<el-button circle :title="$t('login.social.maxkey')" @click="doSocialLogin('maxkey')">
|
||||||
<svg-icon icon-class="maxkey" />
|
<svg-icon icon-class="maxkey" />
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button circle title="TopIam登录" @click="doSocialLogin('topiam')">
|
<el-button circle :title="$t('login.social.topiam')" @click="doSocialLogin('topiam')">
|
||||||
<svg-icon icon-class="topiam" />
|
<svg-icon icon-class="topiam" />
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button circle title="Gitee登录" @click="doSocialLogin('gitee')">
|
<el-button circle :title="$t('login.social.gitee')" @click="doSocialLogin('gitee')">
|
||||||
<svg-icon icon-class="gitee" />
|
<svg-icon icon-class="gitee" />
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button circle title="Github登录" @click="doSocialLogin('github')">
|
<el-button circle :title="$t('login.social.github')" @click="doSocialLogin('github')">
|
||||||
<svg-icon icon-class="github" />
|
<svg-icon icon-class="github" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="width: 100%">
|
<el-form-item style="width: 100%">
|
||||||
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
|
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleLogin">
|
||||||
<span v-if="!loading">登 录</span>
|
<span v-if="!loading">{{ $t('login.login') }}</span>
|
||||||
<span v-else>登 录 中...</span>
|
<span v-else>{{ $t('login.logging') }}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<div v-if="register" style="float: right">
|
<div v-if="register" style="float: right">
|
||||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
<router-link class="link-type" :to="'/register'">{{ $t('login.switchRegisterPage') }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -68,9 +85,11 @@ import { useUserStore } from '@/store/modules/user';
|
|||||||
import { LoginData, TenantVO } from '@/api/types';
|
import { LoginData, TenantVO } from '@/api/types';
|
||||||
import { to } from 'await-to-js';
|
import { to } from 'await-to-js';
|
||||||
import { HttpStatus } from '@/enums/RespEnum';
|
import { HttpStatus } from '@/enums/RespEnum';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const loginForm = ref<LoginData>({
|
const loginForm = ref<LoginData>({
|
||||||
tenantId: '000000',
|
tenantId: '000000',
|
||||||
@ -82,10 +101,10 @@ const loginForm = ref<LoginData>({
|
|||||||
} as LoginData);
|
} as LoginData);
|
||||||
|
|
||||||
const loginRules: ElFormRules = {
|
const loginRules: ElFormRules = {
|
||||||
tenantId: [{ required: true, trigger: 'blur', message: '请输入您的租户编号' }],
|
tenantId: [{ required: true, trigger: 'blur', message: t('login.rule.tenantId.required') }],
|
||||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
username: [{ required: true, trigger: 'blur', message: t('login.rule.username.required') }],
|
||||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
password: [{ required: true, trigger: 'blur', message: t('login.rule.password.required') }],
|
||||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
code: [{ required: true, trigger: 'change', message: t('login.rule.code.required') }]
|
||||||
};
|
};
|
||||||
|
|
||||||
const codeUrl = ref('');
|
const codeUrl = ref('');
|
||||||
@ -105,7 +124,7 @@ const tenantList = ref<TenantVO[]>([]);
|
|||||||
watch(
|
watch(
|
||||||
() => router.currentRoute.value,
|
() => router.currentRoute.value,
|
||||||
(newRoute: any) => {
|
(newRoute: any) => {
|
||||||
redirect.value = newRoute.query && decodeURIComponent(newRoute.query.redirect);
|
redirect.value = newRoute.query && newRoute.query.redirect && decodeURIComponent(newRoute.query.redirect);
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
@ -176,7 +195,7 @@ const getLoginData = () => {
|
|||||||
* 获取租户列表
|
* 获取租户列表
|
||||||
*/
|
*/
|
||||||
const initTenantList = async () => {
|
const initTenantList = async () => {
|
||||||
const { data } = await getTenantList();
|
const { data } = await getTenantList(false);
|
||||||
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
||||||
if (tenantEnabled.value) {
|
if (tenantEnabled.value) {
|
||||||
tenantList.value = data.voList;
|
tenantList.value = data.voList;
|
||||||
@ -218,10 +237,19 @@ onMounted(() => {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title-box {
|
||||||
margin: 0px auto 30px auto;
|
display: flex;
|
||||||
text-align: center;
|
|
||||||
color: #707070;
|
.title {
|
||||||
|
margin: 0px auto 30px auto;
|
||||||
|
text-align: center;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.lang-select--style) {
|
||||||
|
line-height: 0;
|
||||||
|
color: #7483a3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form {
|
.login-form {
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['monitor:logininfor:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['monitor:logininfor:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['monitor:operlog:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['monitor:operlog:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -123,56 +123,14 @@
|
|||||||
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
<pagination v-show="total > 0" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" :total="total" @pagination="getList" />
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 操作日志详细 -->
|
<!-- 操作日志详细 -->
|
||||||
<el-dialog v-model="dialog.visible" title="操作日志详细" width="700px" append-to-body>
|
<OperInfoDialog ref="operInfoDialogRef" />
|
||||||
<el-form :model="form" label-width="100px">
|
|
||||||
<el-row>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="登录信息:">{{ form.operName }} / {{ form.deptName }} / {{ form.operIp }} / {{ form.operLocation }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="请求信息:">{{ form.requestMethod }} {{ form.operUrl }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="操作模块:">{{ form.title }} / {{ typeFormat(form) }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="操作方法:">{{ form.method }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="请求参数:">{{ form.operParam }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item label="返回参数:">{{ form.jsonResult }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="6">
|
|
||||||
<el-form-item label="操作状态:">
|
|
||||||
<div v-if="form.status === 0">正常</div>
|
|
||||||
<div v-else-if="form.status === 1">失败</div>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="8">
|
|
||||||
<el-form-item label="消耗时间:">{{ form.costTime }}毫秒</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="10">
|
|
||||||
<el-form-item label="操作时间:">{{ parseTime(form.operTime) }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="24">
|
|
||||||
<el-form-item v-if="form.status === 1" label="异常信息:">{{ form.errorMsg }}</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<div class="dialog-footer">
|
|
||||||
<el-button @click="dialog.visible = false">关 闭</el-button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Operlog" lang="ts">
|
<script setup name="Operlog" lang="ts">
|
||||||
import { list, delOperlog, cleanOperlog } from '@/api/monitor/operlog';
|
import { list, delOperlog, cleanOperlog } from '@/api/monitor/operlog';
|
||||||
import { OperLogForm, OperLogQuery, OperLogVO } from '@/api/monitor/operlog/types';
|
import { OperLogForm, OperLogQuery, OperLogVO } from '@/api/monitor/operlog/types';
|
||||||
|
import OperInfoDialog from './oper-info-dialog.vue';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const { sys_oper_type, sys_common_status } = toRefs<any>(proxy?.useDict('sys_oper_type', 'sys_common_status'));
|
const { sys_oper_type, sys_common_status } = toRefs<any>(proxy?.useDict('sys_oper_type', 'sys_common_status'));
|
||||||
@ -189,11 +147,6 @@ const defaultSort = ref<any>({ prop: 'operTime', order: 'descending' });
|
|||||||
const operLogTableRef = ref<ElTableInstance>();
|
const operLogTableRef = ref<ElTableInstance>();
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
|
||||||
visible: false,
|
|
||||||
title: ''
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = reactive<PageData<OperLogForm, OperLogQuery>>({
|
const data = reactive<PageData<OperLogForm, OperLogQuery>>({
|
||||||
form: {
|
form: {
|
||||||
operId: undefined,
|
operId: undefined,
|
||||||
@ -267,11 +220,13 @@ const handleSortChange = (column: any) => {
|
|||||||
queryParams.value.isAsc = column.order;
|
queryParams.value.isAsc = column.order;
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const operInfoDialogRef = ref<InstanceType<typeof OperInfoDialog>>();
|
||||||
/** 详细按钮操作 */
|
/** 详细按钮操作 */
|
||||||
const handleView = (row: OperLogVO) => {
|
const handleView = (row: OperLogVO) => {
|
||||||
dialog.visible = true;
|
operInfoDialogRef.value.openDialog(row);
|
||||||
form.value = row;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: OperLogVO) => {
|
const handleDelete = async (row?: OperLogVO) => {
|
||||||
const operIds = row?.operId || ids.value;
|
const operIds = row?.operId || ids.value;
|
||||||
|
111
src/views/monitor/operlog/oper-info-dialog.vue
Normal file
111
src/views/monitor/operlog/oper-info-dialog.vue
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="open" title="操作日志详细" width="700px" append-to-body close-on-click-modal @closed="info = null">
|
||||||
|
<el-descriptions v-if="info" :column="1" border>
|
||||||
|
<el-descriptions-item label="操作状态">
|
||||||
|
<template #default>
|
||||||
|
<el-tag v-if="info.status === 0" type="success">正常</el-tag>
|
||||||
|
<el-tag v-else-if="info.status === 1" type="danger">失败</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="登录信息">
|
||||||
|
<template #default> {{ info.operName }} / {{ info.deptName }} / {{ info.operIp }} / {{ info.operLocation }} </template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求信息">
|
||||||
|
<template #default> {{ info.requestMethod }} {{ info.operUrl }} </template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="操作模块">
|
||||||
|
<template #default> {{ info.title }} / {{ typeFormat(info) }} </template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="操作方法">
|
||||||
|
<template #default>
|
||||||
|
{{ info.method }}
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="请求参数">
|
||||||
|
<template #default>
|
||||||
|
<div class="max-h-300px overflow-y-auto">
|
||||||
|
<VueJsonPretty :data="formatToJsonObject(info.operParam)" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="返回参数">
|
||||||
|
<template #default>
|
||||||
|
<div class="max-h-300px overflow-y-auto">
|
||||||
|
<VueJsonPretty :data="formatToJsonObject(info.jsonResult)" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="消耗时间">
|
||||||
|
<template #default>
|
||||||
|
<span> {{ info.costTime }}ms </span>
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="操作时间">
|
||||||
|
<template #default> {{ parseTime(info.operTime) }}</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item v-if="info.status === 1" label="异常信息">
|
||||||
|
<template #default>
|
||||||
|
<span class="text-danger"> {{ info.errorMsg }}</span>
|
||||||
|
</template>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { OperLogForm } from '@/api/monitor/operlog/types';
|
||||||
|
import VueJsonPretty from 'vue-json-pretty';
|
||||||
|
import 'vue-json-pretty/lib/styles.css';
|
||||||
|
|
||||||
|
const open = ref(false);
|
||||||
|
const info = ref<OperLogForm | null>(null);
|
||||||
|
function openDialog(row: OperLogForm) {
|
||||||
|
info.value = row;
|
||||||
|
open.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeDialog() {
|
||||||
|
open.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
openDialog,
|
||||||
|
closeDialog
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json转为对象
|
||||||
|
* @param data 原始数据
|
||||||
|
*/
|
||||||
|
function formatToJsonObject(data: string) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(data);
|
||||||
|
} catch (error) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典信息
|
||||||
|
*/
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { sys_oper_type } = toRefs<any>(proxy?.useDict('sys_oper_type'));
|
||||||
|
const typeFormat = (row: OperLogForm) => {
|
||||||
|
return proxy?.selectDictLabel(sys_oper_type.value, row.businessType);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/**
|
||||||
|
label宽度固定
|
||||||
|
*/
|
||||||
|
:deep(.el-descriptions__label) {
|
||||||
|
min-width: 100px;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
文字超过 换行显示
|
||||||
|
*/
|
||||||
|
:deep(.el-descriptions__content) {
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,20 +1,30 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="register">
|
<div class="register">
|
||||||
<el-form ref="registerRef" :model="registerForm" :rules="registerRules" class="register-form">
|
<el-form ref="registerRef" :model="registerForm" :rules="registerRules" class="register-form">
|
||||||
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
<div class="title-box">
|
||||||
|
<h3 class="title">RuoYi-Vue-Plus多租户管理系统</h3>
|
||||||
|
<lang-select />
|
||||||
|
</div>
|
||||||
<el-form-item v-if="tenantEnabled" prop="tenantId">
|
<el-form-item v-if="tenantEnabled" prop="tenantId">
|
||||||
<el-select v-model="registerForm.tenantId" filterable placeholder="请选择/输入公司名称" style="width: 100%">
|
<el-select v-model="registerForm.tenantId" filterable :placeholder="$t('register.selectPlaceholder')" style="width: 100%">
|
||||||
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"> </el-option>
|
<el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName" :value="item.tenantId"> </el-option>
|
||||||
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="registerForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
<el-input v-model="registerForm.username" type="text" size="large" auto-complete="off" :placeholder="$t('register.username')">
|
||||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input v-model="registerForm.password" type="password" size="large" auto-complete="off" placeholder="密码" @keyup.enter="handleRegister">
|
<el-input
|
||||||
|
v-model="registerForm.password"
|
||||||
|
type="password"
|
||||||
|
size="large"
|
||||||
|
auto-complete="off"
|
||||||
|
:placeholder="$t('register.password')"
|
||||||
|
@keyup.enter="handleRegister"
|
||||||
|
>
|
||||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -24,14 +34,21 @@
|
|||||||
type="password"
|
type="password"
|
||||||
size="large"
|
size="large"
|
||||||
auto-complete="off"
|
auto-complete="off"
|
||||||
placeholder="确认密码"
|
:placeholder="$t('register.confirmPassword')"
|
||||||
@keyup.enter="handleRegister"
|
@keyup.enter="handleRegister"
|
||||||
>
|
>
|
||||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="captchaEnabled" prop="code">
|
<el-form-item v-if="captchaEnabled" prop="code">
|
||||||
<el-input v-model="registerForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter="handleRegister">
|
<el-input
|
||||||
|
v-model="registerForm.code"
|
||||||
|
size="large"
|
||||||
|
auto-complete="off"
|
||||||
|
:placeholder="$t('register.code')"
|
||||||
|
style="width: 63%"
|
||||||
|
@keyup.enter="handleRegister"
|
||||||
|
>
|
||||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<div class="register-code">
|
<div class="register-code">
|
||||||
@ -40,11 +57,11 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item style="width: 100%">
|
<el-form-item style="width: 100%">
|
||||||
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleRegister">
|
<el-button :loading="loading" size="large" type="primary" style="width: 100%" @click.prevent="handleRegister">
|
||||||
<span v-if="!loading">注 册</span>
|
<span v-if="!loading">{{ $t('register.register') }}</span>
|
||||||
<span v-else>注 册 中...</span>
|
<span v-else>{{ $t('register.registering') }}</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
<div style="float: right">
|
<div style="float: right">
|
||||||
<router-link class="link-type" :to="'/login'">使用已有账户登录</router-link>
|
<router-link class="link-type" :to="'/login'">{{ $t('register.switchLoginPage') }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -59,9 +76,12 @@
|
|||||||
import { getCodeImg, register, getTenantList } from '@/api/login';
|
import { getCodeImg, register, getTenantList } from '@/api/login';
|
||||||
import { RegisterForm, TenantVO } from '@/api/types';
|
import { RegisterForm, TenantVO } from '@/api/types';
|
||||||
import { to } from 'await-to-js';
|
import { to } from 'await-to-js';
|
||||||
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const registerForm = ref<RegisterForm>({
|
const registerForm = ref<RegisterForm>({
|
||||||
tenantId: '',
|
tenantId: '',
|
||||||
username: '',
|
username: '',
|
||||||
@ -77,28 +97,28 @@ const tenantEnabled = ref(true);
|
|||||||
|
|
||||||
const equalToPassword = (rule: any, value: string, callback: any) => {
|
const equalToPassword = (rule: any, value: string, callback: any) => {
|
||||||
if (registerForm.value.password !== value) {
|
if (registerForm.value.password !== value) {
|
||||||
callback(new Error('两次输入的密码不一致'));
|
callback(new Error(t('register.rule.confirmPassword.equalToPassword')));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const registerRules: ElFormRules = {
|
const registerRules: ElFormRules = {
|
||||||
tenantId: [{ required: true, trigger: 'blur', message: '请输入您的租户编号' }],
|
tenantId: [{ required: true, trigger: 'blur', message: t('register.rule.tenantId.required') }],
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: 'blur', message: '请输入您的账号' },
|
{ required: true, trigger: 'blur', message: t('register.rule.username.required') },
|
||||||
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
{ min: 2, max: 20, message: t('register.rule.username.length', { min: 2, max: 20 }), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, trigger: 'blur', message: '请输入您的密码' },
|
{ required: true, trigger: 'blur', message: t('register.rule.password.required') },
|
||||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
{ min: 5, max: 20, message: t('register.rule.password.length', { min: 5, max: 20 }), trigger: 'blur' },
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\\ |', trigger: 'blur' }
|
{ pattern: /^[^<>"'|\\]+$/, message: t('register.rule.password.pattern', { strings: '< > " \' \\ |' }), trigger: 'blur' }
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, trigger: 'blur', message: '请再次输入您的密码' },
|
{ required: true, trigger: 'blur', message: t('register.rule.confirmPassword.required') },
|
||||||
{ required: true, validator: equalToPassword, trigger: 'blur' }
|
{ required: true, validator: equalToPassword, trigger: 'blur' }
|
||||||
],
|
],
|
||||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
code: [{ required: true, trigger: 'change', message: t('register.rule.code.required') }]
|
||||||
};
|
};
|
||||||
const codeUrl = ref('');
|
const codeUrl = ref('');
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
@ -114,7 +134,8 @@ const handleRegister = () => {
|
|||||||
const [err] = await to(register(registerForm.value));
|
const [err] = await to(register(registerForm.value));
|
||||||
if (!err) {
|
if (!err) {
|
||||||
const username = registerForm.value.username;
|
const username = registerForm.value.username;
|
||||||
await ElMessageBox.alert("<font color='red'>恭喜你,您的账号 " + username + ' 注册成功!</font>', '系统提示', {
|
await ElMessageBox.alert('<span style="color: red; ">' + t('register.registerSuccess', { username }) + '</font>', '系统提示', {
|
||||||
|
app: undefined,
|
||||||
dangerouslyUseHTMLString: true,
|
dangerouslyUseHTMLString: true,
|
||||||
type: 'success'
|
type: 'success'
|
||||||
});
|
});
|
||||||
@ -140,7 +161,7 @@ const getCode = async () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const initTenantList = async () => {
|
const initTenantList = async () => {
|
||||||
const { data } = await getTenantList();
|
const { data } = await getTenantList(false);
|
||||||
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
tenantEnabled.value = data.tenantEnabled === undefined ? true : data.tenantEnabled;
|
||||||
if (tenantEnabled.value) {
|
if (tenantEnabled.value) {
|
||||||
tenantList.value = data.voList;
|
tenantList.value = data.voList;
|
||||||
@ -166,10 +187,20 @@ onMounted(() => {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title-box {
|
||||||
margin: 0 auto 30px auto;
|
display: flex;
|
||||||
text-align: center;
|
|
||||||
color: #707070;
|
.title {
|
||||||
|
margin: 0px auto 30px auto;
|
||||||
|
text-align: center;
|
||||||
|
color: #707070;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.lang-select--style) {
|
||||||
|
line-height: 0;
|
||||||
|
color: #7483a3;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.register-form {
|
.register-form {
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:client:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['system:client:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:config:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
|
<el-button v-hasPermi="['system:config:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -101,7 +101,7 @@
|
|||||||
<el-input v-model="form.configKey" placeholder="请输入参数键名" />
|
<el-input v-model="form.configKey" placeholder="请输入参数键名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="参数键值" prop="configValue">
|
<el-form-item label="参数键值" prop="configValue">
|
||||||
<el-input v-model="form.configValue" placeholder="请输入参数键值" />
|
<el-input v-model="form.configValue" type="textarea" placeholder="请输入参数键值" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="系统内置" prop="configType">
|
<el-form-item label="系统内置" prop="configType">
|
||||||
<el-radio-group v-model="form.configType">
|
<el-radio-group v-model="form.configType">
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -49,10 +49,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:dict:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
|
<el-button v-hasPermi="['system:dict:remove']" type="danger" plain icon="Refresh" @click="handleRefreshCache">刷新缓存</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
<el-button v-if="userId === 1" type="success" plain icon="Refresh" @click="handleSyncTenantDict">同步租户字典</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -112,15 +109,11 @@
|
|||||||
|
|
||||||
<script setup name="Dict" lang="ts">
|
<script setup name="Dict" lang="ts">
|
||||||
import useDictStore from '@/store/modules/dict';
|
import useDictStore from '@/store/modules/dict';
|
||||||
import useUserStore from "@/store/modules/user";
|
|
||||||
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
|
import { listType, getType, delType, addType, updateType, refreshCache } from '@/api/system/dict/type';
|
||||||
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
|
import { DictTypeForm, DictTypeQuery, DictTypeVO } from '@/api/system/dict/type/types';
|
||||||
import { syncTenantDict } from "@/api/system/tenant";
|
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const userId = ref(userStore.userId);
|
|
||||||
const typeList = ref<DictTypeVO[]>([]);
|
const typeList = ref<DictTypeVO[]>([]);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
@ -246,12 +239,6 @@ const handleRefreshCache = async () => {
|
|||||||
proxy?.$modal.msgSuccess('刷新成功');
|
proxy?.$modal.msgSuccess('刷新成功');
|
||||||
useDictStore().cleanDict();
|
useDictStore().cleanDict();
|
||||||
};
|
};
|
||||||
/**同步租户字典*/
|
|
||||||
const handleSyncTenantDict = async () => {
|
|
||||||
await proxy?.$modal.confirm('确认要同步所有租户字典吗?');
|
|
||||||
let res = await syncTenantDict();
|
|
||||||
proxy?.$modal.msgSuccess(res.msg);
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:ossConfig:list']" type="info" plain icon="Operation" @click="handleOssConfig">配置管理</el-button>
|
<el-button v-hasPermi="['system:ossConfig:list']" type="info" plain icon="Operation" @click="handleOssConfig">配置管理</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:post:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['system:post:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
<el-button type="warning" plain icon="Close" @click="handleClose">关闭</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" :search="true" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" :search="true" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:role:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['system:role:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -223,7 +223,8 @@ const dataScopeOptions = ref([
|
|||||||
{ value: '2', label: '自定数据权限' },
|
{ value: '2', label: '自定数据权限' },
|
||||||
{ value: '3', label: '本部门数据权限' },
|
{ value: '3', label: '本部门数据权限' },
|
||||||
{ value: '4', label: '本部门及以下数据权限' },
|
{ value: '4', label: '本部门及以下数据权限' },
|
||||||
{ value: '5', label: '仅本人数据权限' }
|
{ value: '5', label: '仅本人数据权限' },
|
||||||
|
{ value: '6', label: '部门及以下或本人数据权限' }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
@ -44,7 +44,10 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:tenant:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['system:tenant:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<el-col :span="1.5">
|
||||||
|
<el-button v-if="userId === 1" type="success" plain icon="Refresh" @click="handleSyncTenantDict">同步租户字典</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -141,13 +144,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Tenant" lang="ts">
|
<script setup name="Tenant" lang="ts">
|
||||||
import { listTenant, getTenant, delTenant, addTenant, updateTenant, changeTenantStatus, syncTenantPackage } from '@/api/system/tenant';
|
import {
|
||||||
|
listTenant,
|
||||||
|
getTenant,
|
||||||
|
delTenant,
|
||||||
|
addTenant,
|
||||||
|
updateTenant,
|
||||||
|
changeTenantStatus,
|
||||||
|
syncTenantPackage,
|
||||||
|
syncTenantDict
|
||||||
|
} from '@/api/system/tenant';
|
||||||
import { selectTenantPackage } from '@/api/system/tenantPackage';
|
import { selectTenantPackage } from '@/api/system/tenantPackage';
|
||||||
|
import useUserStore from '@/store/modules/user';
|
||||||
import { TenantForm, TenantQuery, TenantVO } from '@/api/system/tenant/types';
|
import { TenantForm, TenantQuery, TenantVO } from '@/api/system/tenant/types';
|
||||||
import { TenantPkgVO } from '@/api/system/tenantPackage/types';
|
import { TenantPkgVO } from '@/api/system/tenantPackage/types';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const userId = ref(userStore.userId);
|
||||||
const tenantList = ref<TenantVO[]>([]);
|
const tenantList = ref<TenantVO[]>([]);
|
||||||
const packageList = ref<TenantPkgVO[]>([]);
|
const packageList = ref<TenantPkgVO[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
@ -343,6 +358,13 @@ const handleExport = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**同步租户字典*/
|
||||||
|
const handleSyncTenantDict = async () => {
|
||||||
|
await proxy?.$modal.confirm('确认要同步所有租户字典吗?');
|
||||||
|
let res = await syncTenantDict();
|
||||||
|
proxy?.$modal.msgSuccess(res.msg);
|
||||||
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['system:tenantPackage:export']" type="warning" plain icon="Download" @click="handleExport">导出 </el-button>
|
<el-button v-hasPermi="['system:tenantPackage:export']" type="warning" plain icon="Download" @click="handleExport">导出 </el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ const tableRef = ref<ElTableInstance>();
|
|||||||
|
|
||||||
/** 单击选中行数据 */
|
/** 单击选中行数据 */
|
||||||
const clickRow = (row: RoleVO) => {
|
const clickRow = (row: RoleVO) => {
|
||||||
row.flag = !row.flag
|
row.flag = !row.flag;
|
||||||
tableRef.value?.toggleRowSelection(row, row.flag);
|
tableRef.value?.toggleRowSelection(row, row.flag);
|
||||||
};
|
};
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
|
@ -81,13 +81,13 @@
|
|||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<el-dropdown-menu>
|
<el-dropdown-menu>
|
||||||
<el-dropdown-item icon="Download" @click="importTemplate">下载模板</el-dropdown-item>
|
<el-dropdown-item icon="Download" @click="importTemplate">下载模板</el-dropdown-item>
|
||||||
<el-dropdown-item icon="Top" @click="handleImport"> 导入数据</el-dropdown-item>
|
<el-dropdown-item icon="Top" @click="handleImport">导入数据</el-dropdown-item>
|
||||||
<el-dropdown-item icon="Download" @click="handleExport"> 导出数据</el-dropdown-item>
|
<el-dropdown-item icon="Download" @click="handleExport"> 导出数据</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" :columns="columns" :search="true" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -393,7 +393,7 @@ const initData: PageData<UserForm, UserQuery> = {
|
|||||||
message: '用户密码长度必须介于 5 和 20 之间',
|
message: '用户密码长度必须介于 5 和 20 之间',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\\ |', trigger: 'blur' }
|
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
@ -506,7 +506,7 @@ const handleResetPwd = async (row: UserVO) => {
|
|||||||
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间',
|
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间',
|
||||||
inputValidator: (value) => {
|
inputValidator: (value) => {
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
if (/<|>|"|'|\||\\/.test(value)) {
|
||||||
return '不能包含非法字符:< > " \' \\\ |';
|
return '不能包含非法字符:< > " \' \\ |';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -45,7 +45,7 @@ const rules = ref({
|
|||||||
message: '长度在 6 到 20 个字符',
|
message: '长度在 6 到 20 个字符',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\\ |', trigger: 'blur' }
|
{ pattern: /^[^<>"'|\\]+$/, message: '不能包含非法字符:< > " \' \\ |', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
||||||
|
@ -63,14 +63,18 @@ const emit = defineEmits(['ok']);
|
|||||||
|
|
||||||
/** 查询参数列表 */
|
/** 查询参数列表 */
|
||||||
const show = (dataName: string) => {
|
const show = (dataName: string) => {
|
||||||
getDataNameList();
|
getDataNames().then((res) => {
|
||||||
if (dataName) {
|
if (res.code == 200) {
|
||||||
queryParams.dataName = dataName;
|
dataNameList.value = res.data;
|
||||||
} else {
|
if (dataName) {
|
||||||
queryParams.dataName = 'master';
|
queryParams.dataName = dataName;
|
||||||
}
|
} else {
|
||||||
getList();
|
queryParams.dataName = dataNameList.value[0];
|
||||||
visible.value = true;
|
}
|
||||||
|
getList();
|
||||||
|
visible.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
/** 单击选择行 */
|
/** 单击选择行 */
|
||||||
const clickRow = (row: DbTableVO) => {
|
const clickRow = (row: DbTableVO) => {
|
||||||
@ -111,11 +115,6 @@ const handleImportTable = async () => {
|
|||||||
emit('ok');
|
emit('ok');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/** 查询多数据源名称 */
|
|
||||||
const getDataNameList = async () => {
|
|
||||||
const res = await getDataNames();
|
|
||||||
dataNameList.value = res.data;
|
|
||||||
};
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
show
|
show
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -113,8 +113,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Gen" lang="ts">
|
<script setup name="Gen" lang="ts">
|
||||||
import { listTable, previewTable, delTable, genCode, synchDb, getDataNames } from '@/api/tool/gen';
|
import {delTable, genCode, getDataNames, listTable, previewTable, synchDb} from '@/api/tool/gen';
|
||||||
import { TableQuery, TableVO } from '@/api/tool/gen/types';
|
import {TableQuery, TableVO} from '@/api/tool/gen/types';
|
||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
import ImportTable from './importTable.vue';
|
import ImportTable from './importTable.vue';
|
||||||
|
|
||||||
@ -155,17 +155,6 @@ const dialog = reactive<DialogOption>({
|
|||||||
title: '代码预览'
|
title: '代码预览'
|
||||||
});
|
});
|
||||||
|
|
||||||
onActivated(() => {
|
|
||||||
const time = route.query.t;
|
|
||||||
if (time != null && time != uniqueId.value) {
|
|
||||||
uniqueId.value = time as string;
|
|
||||||
queryParams.value.pageNum = Number(route.query.pageNum);
|
|
||||||
dateRange.value = ['', ''];
|
|
||||||
queryFormRef.value?.resetFields();
|
|
||||||
getList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/** 查询多数据源名称 */
|
/** 查询多数据源名称 */
|
||||||
const getDataNameList = async () => {
|
const getDataNameList = async () => {
|
||||||
const res = await getDataNames();
|
const res = await getDataNames();
|
||||||
@ -248,7 +237,14 @@ const handleDelete = async (row?: TableVO) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
const time = route.query.t;
|
||||||
|
if (time != null && time != uniqueId.value) {
|
||||||
|
uniqueId.value = time as string;
|
||||||
|
queryParams.value.pageNum = Number(route.query.pageNum);
|
||||||
|
dateRange.value = ['', ''];
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
getList();
|
||||||
|
}
|
||||||
getDataNameList();
|
getDataNameList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
<el-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
<el-table
|
<el-table
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['workflow:formManage:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['workflow:formManage:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button v-hasPermi="['workflow:leave:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
<el-button v-hasPermi="['workflow:leave:export']" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -192,8 +192,8 @@ const handleStartWorkFlow = async (data: LeaveVO) => {
|
|||||||
taskVariables.value = {
|
taskVariables.value = {
|
||||||
entity: data,
|
entity: data,
|
||||||
leaveDays: data.leaveDays,
|
leaveDays: data.leaveDays,
|
||||||
userList: ["1", "3"],
|
userList: ['1', '3'],
|
||||||
userList2: ["1", "3"]
|
userList2: ['1', '3']
|
||||||
};
|
};
|
||||||
submitFormData.value.variables = taskVariables.value;
|
submitFormData.value.variables = taskVariables.value;
|
||||||
const resp = await startWorkFlow(submitFormData.value);
|
const resp = await startWorkFlow(submitFormData.value);
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain :disabled="multiple" icon="Download" @click="clickExportZip()">导出</el-button>
|
<el-button type="primary" plain :disabled="multiple" icon="Download" @click="clickExportZip()">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" icon="UploadFilled" @click="uploadDialog.visible = true">部署流程文件</el-button>
|
<el-button type="primary" icon="UploadFilled" @click="uploadDialog.visible = true">部署流程文件</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="getList"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">修改办理人</el-button>
|
<el-button type="primary" plain icon="Edit" :disabled="multiple" @click="handleUpdate">修改办理人</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<template #header>
|
<template #header>
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<right-toolbar v-model:showSearch="showSearch" @query-table="handleQuery"></right-toolbar>
|
<right-toolbar v-model:show-search="showSearch" @query-table="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
// "useDefineForClassFields": true,
|
// "useDefineForClassFields": true,
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
|
|
||||||
export default (path: any) => {
|
|
||||||
return VueI18nPlugin({
|
|
||||||
include: [path.resolve(__dirname, '../../src/lang/**.json')]
|
|
||||||
});
|
|
||||||
};
|
|
@ -6,7 +6,6 @@ import createIcons from './icons';
|
|||||||
import createSvgIconsPlugin from './svg-icon';
|
import createSvgIconsPlugin from './svg-icon';
|
||||||
import createCompression from './compression';
|
import createCompression from './compression';
|
||||||
import createSetupExtend from './setup-extend';
|
import createSetupExtend from './setup-extend';
|
||||||
import createI18n from './i18n';
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
export default (viteEnv: any, isBuild = false): [] => {
|
export default (viteEnv: any, isBuild = false): [] => {
|
||||||
@ -19,6 +18,5 @@ export default (viteEnv: any, isBuild = false): [] => {
|
|||||||
vitePlugins.push(createIcons());
|
vitePlugins.push(createIcons());
|
||||||
vitePlugins.push(createSvgIconsPlugin(path, isBuild));
|
vitePlugins.push(createSvgIconsPlugin(path, isBuild));
|
||||||
vitePlugins.push(createSetupExtend());
|
vitePlugins.push(createSetupExtend());
|
||||||
vitePlugins.push(createI18n(path));
|
|
||||||
return vitePlugins;
|
return vitePlugins;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user