Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5683c89c0e | ||
![]() |
e19be90529 | ||
![]() |
ba1a2279f8 | ||
![]() |
7f8bec5bfc | ||
![]() |
09a3c478ed | ||
![]() |
cac8820983 | ||
![]() |
dd072c51cb | ||
![]() |
403372207c | ||
![]() |
d3e71c0855 | ||
![]() |
4baabd03c8 | ||
![]() |
a859ba4778 | ||
![]() |
1882be13d3 | ||
![]() |
8036aa44a3 | ||
![]() |
aa5d5abdf5 | ||
![]() |
403292b771 | ||
![]() |
91c843f098 | ||
![]() |
81bfda2564 | ||
![]() |
d47ce6d41f | ||
![]() |
d9082f6f41 | ||
![]() |
d53d02a4d7 | ||
![]() |
9e9773fa82 | ||
![]() |
0112faf3ba | ||
![]() |
ce275d9590 | ||
![]() |
7fb42fd344 | ||
![]() |
17628d285b | ||
![]() |
5b437124bc | ||
![]() |
1c7271ce12 | ||
![]() |
b842e849a5 |
@ -16,8 +16,14 @@ VITE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/applications'
|
|||||||
# powerjob 控制台地址
|
# powerjob 控制台地址
|
||||||
VITE_APP_POWERJOB_ADMIN = 'http://localhost:7700/'
|
VITE_APP_POWERJOB_ADMIN = 'http://localhost:7700/'
|
||||||
|
|
||||||
|
# easyretry 控制台地址
|
||||||
|
VITE_APP_EASYRETRY_ADMIN = 'http://localhost:8800/easy-retry'
|
||||||
|
|
||||||
VITE_APP_PORT = 80
|
VITE_APP_PORT = 80
|
||||||
|
|
||||||
|
VITE_APP_ENCRYPT_HEADER = 'encrypt-key'
|
||||||
|
# 接口加密功能开关(如需关闭 后端也必须对应关闭)
|
||||||
|
VITE_APP_ENCRYPT = true
|
||||||
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
|
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
|
||||||
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
||||||
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换
|
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换
|
||||||
|
@ -13,6 +13,9 @@ VITE_APP_MONITRO_ADMIN = '/admin/applications'
|
|||||||
# powerjob 控制台地址
|
# powerjob 控制台地址
|
||||||
VITE_APP_POWERJOB_ADMIN = '/powerjob'
|
VITE_APP_POWERJOB_ADMIN = '/powerjob'
|
||||||
|
|
||||||
|
# easyretry 控制台地址
|
||||||
|
VITE_APP_EASYRETRY_ADMIN = '/easy-retry'
|
||||||
|
|
||||||
# 生产环境
|
# 生产环境
|
||||||
VITE_APP_BASE_API = '/prod-api'
|
VITE_APP_BASE_API = '/prod-api'
|
||||||
|
|
||||||
@ -21,6 +24,9 @@ VITE_BUILD_COMPRESS = gzip
|
|||||||
|
|
||||||
VITE_APP_PORT = 80
|
VITE_APP_PORT = 80
|
||||||
|
|
||||||
|
VITE_APP_ENCRYPT_HEADER = 'encrypt-key'
|
||||||
|
# 接口加密功能开关(如需关闭 后端也必须对应关闭)
|
||||||
|
VITE_APP_ENCRYPT = true
|
||||||
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
|
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
|
||||||
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
||||||
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换
|
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,6 +24,8 @@ package-lock.json
|
|||||||
yarn.lock
|
yarn.lock
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
*开发日志.txt
|
||||||
|
|
||||||
# 编译生成的文件
|
# 编译生成的文件
|
||||||
auto-imports.d.ts
|
auto-imports.d.ts
|
||||||
components.d.ts
|
components.d.ts
|
||||||
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM nginx
|
||||||
|
|
||||||
|
MAINTAINER onesummer
|
||||||
|
|
||||||
|
RUN rm /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
|
ADD default.conf /etc/nginx/conf.d/
|
||||||
|
|
||||||
|
COPY dist/ /usr/share/nginx/html/
|
@ -1,7 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="https://gitee.com/dataprince/ruoyi-flex/raw/master/image/ruoyi-flex-logo.png">
|
<img alt="logo" src="https://gitee.com/dataprince/ruoyi-flex/raw/master/image/ruoyi-flex-logo.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Ruoyi-Flex V5.1.0</h1>
|
<h1 align="center" style="margin: 30px 0 30px; font-weight: bold;">Ruoyi-Flex V5.2.0-SNAPSHOT</h1>
|
||||||
<h4 align="center">Ruoyi-Flex是基于JDK21、Spring Boot V3.2.X+平台 前后端分离的未来8年更快的Java开发框架</h4>
|
<h4 align="center">Ruoyi-Flex是基于JDK21、Spring Boot V3.2.X+平台 前后端分离的未来8年更快的Java开发框架</h4>
|
||||||
|
|
||||||
|
|
||||||
|
29
default.conf
Normal file
29
default.conf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
charset utf-8;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /prod-api/ {
|
||||||
|
proxy_pass http://172.16.0.151:8080/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-Port $server_port;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root html;
|
||||||
|
}
|
||||||
|
}
|
71
package.json
71
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ruoyiflex-elementplus-ts",
|
"name": "ruoyiflex-elementplus-ts",
|
||||||
"version": "5.1.0",
|
"version": "5.2.0-SNAPSHOT",
|
||||||
"description": "Ruoyi-Flex多租户管理系统",
|
"description": "Ruoyi-Flex多租户管理系统",
|
||||||
"author": "数据小王子",
|
"author": "数据小王子",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -24,12 +24,14 @@
|
|||||||
"@vueuse/core": "10.7.2",
|
"@vueuse/core": "10.7.2",
|
||||||
"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.5",
|
"axios": "1.6.8",
|
||||||
"crypto-js": "4.2.0",
|
"crypto-js": "4.2.0",
|
||||||
"echarts": "5.4.3",
|
"echarts": "5.5.0",
|
||||||
"element-plus": "2.5.3",
|
"element-plus": "2.6.2",
|
||||||
|
"encryptlong": "^3.1.4",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "7.0.0",
|
"fuse.js": "7.0.0",
|
||||||
|
"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",
|
||||||
@ -38,53 +40,54 @@
|
|||||||
"pinia": "2.1.7",
|
"pinia": "2.1.7",
|
||||||
"screenfull": "6.0.2",
|
"screenfull": "6.0.2",
|
||||||
"vform3-builds": "3.0.10",
|
"vform3-builds": "3.0.10",
|
||||||
"vue": "3.4.13",
|
"vue": "3.4.21",
|
||||||
"vue-cropper": "1.1.1",
|
"vue-cropper": "1.1.1",
|
||||||
"vue-i18n": "9.9.0",
|
"vue-i18n": "9.10.2",
|
||||||
"vue-router": "4.2.5",
|
"vue-router": "4.3.0",
|
||||||
"vue-types": "5.1.1"
|
"vue-types": "5.1.1",
|
||||||
|
"vxe-table": "4.5.21"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify/json": "2.2.168",
|
"@iconify/json": "2.2.193",
|
||||||
"@intlify/unplugin-vue-i18n": "2.0.0",
|
"@intlify/unplugin-vue-i18n": "3.0.1",
|
||||||
"@types/crypto-js": "4.2.1",
|
"@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.14.2",
|
"@types/node": "18.18.2",
|
||||||
"@types/nprogress": "0.2.3",
|
"@types/nprogress": "0.2.3",
|
||||||
"@types/path-browserify": "1.0.2",
|
"@types/path-browserify": "1.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "6.18.1",
|
"@typescript-eslint/eslint-plugin": "7.3.1",
|
||||||
"@typescript-eslint/parser": "6.18.1",
|
"@typescript-eslint/parser": "7.3.1",
|
||||||
"@unocss/preset-attributify": "0.58.3",
|
"@unocss/preset-attributify": "0.58.6",
|
||||||
"@unocss/preset-icons": "0.58.3",
|
"@unocss/preset-icons": "0.58.6",
|
||||||
"@unocss/preset-uno": "0.58.3",
|
"@unocss/preset-uno": "0.58.6",
|
||||||
"@vue/compiler-sfc": "3.4.13",
|
"@vue/compiler-sfc": "3.4.21",
|
||||||
|
"autoprefixer": "10.4.18",
|
||||||
"@vitejs/plugin-vue": "5.0.3",
|
"@vitejs/plugin-vue": "5.0.3",
|
||||||
"autoprefixer": "10.4.16",
|
"eslint": "8.57.0",
|
||||||
"eslint": "8.56.0",
|
|
||||||
"eslint-config-prettier": "9.1.0",
|
"eslint-config-prettier": "9.1.0",
|
||||||
"eslint-define-config": "2.1.0",
|
"eslint-define-config": "2.1.0",
|
||||||
"eslint-plugin-prettier": "5.1.3",
|
"eslint-plugin-prettier": "5.1.3",
|
||||||
"eslint-plugin-promise": "6.1.1",
|
"eslint-plugin-promise": "6.1.1",
|
||||||
"eslint-plugin-node": "11.1.0",
|
"eslint-plugin-node": "11.1.0",
|
||||||
"eslint-plugin-import": "2.29.1",
|
"eslint-plugin-import": "2.29.1",
|
||||||
"eslint-plugin-vue": "9.20.1",
|
"eslint-plugin-vue": "9.23.0",
|
||||||
"fast-glob": "3.3.2",
|
"fast-glob": "3.3.2",
|
||||||
"husky": "8.0.3",
|
"husky": "9.0.11",
|
||||||
"postcss": "8.4.33",
|
"postcss": "8.4.36",
|
||||||
"prettier": "3.2.2",
|
"prettier": "3.2.5",
|
||||||
"sass": "1.69.7",
|
"sass": "1.72.0",
|
||||||
"typescript": "5.3.3",
|
"typescript": "5.4.3",
|
||||||
"unocss": "0.58.3",
|
"unocss": "0.58.6",
|
||||||
"unplugin-auto-import": "0.17.3",
|
"unplugin-auto-import": "0.17.5",
|
||||||
"unplugin-icons": "0.18.2",
|
"unplugin-icons": "0.18.5",
|
||||||
"unplugin-vue-components": "0.26.0",
|
"unplugin-vue-components": "0.26.0",
|
||||||
"unplugin-vue-setup-extend-plus": "1.0.0",
|
"unplugin-vue-setup-extend-plus": "1.0.1",
|
||||||
"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.2.0",
|
"vite": "5.2.6",
|
||||||
"vue-eslint-parser": "9.4.0",
|
"vitest": "1.4.0",
|
||||||
"vue-tsc": "1.8.27",
|
"vue-eslint-parser": "9.4.2",
|
||||||
"vite": "5.0.12"
|
"vue-tsc": "2.0.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
src/api/genKeyPair.ts
Normal file
18
src/api/genKeyPair.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import request from '@/utils/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成密钥对
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
export function genKeyPair(callback: Function) {
|
||||||
|
return request({
|
||||||
|
url: '/genKeyPair',
|
||||||
|
headers: {
|
||||||
|
isToken: false,
|
||||||
|
repeatSubmit: false
|
||||||
|
},
|
||||||
|
method: 'get'
|
||||||
|
}).then((res) => {
|
||||||
|
return callback(res.data.uuidPrivateKey, res.data.RSA_PUBLIC_KEY);
|
||||||
|
});
|
||||||
|
}
|
@ -2,9 +2,11 @@ import request from '@/utils/request';
|
|||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
|
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
|
||||||
import { UserInfo } from '@/api/system/user/types';
|
import { UserInfo } from '@/api/system/user/types';
|
||||||
|
import { genKeyPair } from '@/api/genKeyPair';
|
||||||
|
|
||||||
// pc端固定客户端授权id
|
// pc端固定客户端授权id
|
||||||
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
|
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
|
||||||
|
const encryptHeader = import.meta.env.VITE_APP_ENCRYPT_HEADER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param data {LoginData}
|
* @param data {LoginData}
|
||||||
@ -16,14 +18,26 @@ export function login(data: LoginData): AxiosPromise<LoginResult> {
|
|||||||
clientId: data.clientId || clientId,
|
clientId: data.clientId || clientId,
|
||||||
grantType: data.grantType || 'password'
|
grantType: data.grantType || 'password'
|
||||||
};
|
};
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
|
genKeyPair((uuid, public_key) => {
|
||||||
|
request({
|
||||||
url: '/auth/login',
|
url: '/auth/login',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false,
|
isToken: false,
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
[encryptHeader]: uuid,
|
||||||
|
publicKey: public_key
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,14 +48,26 @@ export function register(data: any) {
|
|||||||
clientId: clientId,
|
clientId: clientId,
|
||||||
grantType: 'password'
|
grantType: 'password'
|
||||||
};
|
};
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
|
genKeyPair((uuid, public_key) => {
|
||||||
|
request({
|
||||||
url: '/auth/register',
|
url: '/auth/register',
|
||||||
headers: {
|
headers: {
|
||||||
isToken: false,
|
isToken: false,
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
[encryptHeader]: uuid,
|
||||||
|
publicKey: public_key
|
||||||
},
|
},
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: params
|
data: params
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
export interface ProductVO extends BaseEntity {
|
export interface ProductVO extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 父产品id
|
* 产品编号
|
||||||
*/
|
*/
|
||||||
parentId: string | number;
|
productId: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品名称
|
* 产品名称
|
||||||
@ -19,20 +19,20 @@ export interface ProductVO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
status: string;
|
status: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子对象
|
* 子树对象
|
||||||
*/
|
*/
|
||||||
children: ProductVO[];
|
children: ProductVO[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductForm {
|
export interface ProductForm {
|
||||||
/**
|
/**
|
||||||
* 产品id
|
* 产品编号
|
||||||
*/
|
*/
|
||||||
productId?: string | number;
|
productId?: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父产品id
|
* 上级编号
|
||||||
*/
|
*/
|
||||||
parentId?: string | number;
|
parentId?: string | number;
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ export interface ProductForm {
|
|||||||
*/
|
*/
|
||||||
version?: number;
|
version?: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductQuery {
|
export interface ProductQuery {
|
||||||
/**
|
/**
|
||||||
* 产品名称
|
* 产品名称
|
||||||
*/
|
*/
|
||||||
@ -73,4 +73,4 @@ export interface ProductQuery {
|
|||||||
* 日期范围参数
|
* 日期范围参数
|
||||||
*/
|
*/
|
||||||
params?: any;
|
params?: any;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
export interface StudentVO extends BaseEntity {
|
export interface StudentVO extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
studentId: string | number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 学生名称
|
* 学生名称
|
||||||
*/
|
*/
|
||||||
@ -29,9 +34,9 @@ export interface StudentVO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
studentBirthday: string;
|
studentBirthday: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StudentForm {
|
export interface StudentForm {
|
||||||
/**
|
/**
|
||||||
* 编号
|
* 编号
|
||||||
*/
|
*/
|
||||||
@ -72,10 +77,9 @@ export interface StudentForm {
|
|||||||
*/
|
*/
|
||||||
version?: number;
|
version?: number;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StudentQuery extends PageQuery {
|
|
||||||
|
|
||||||
|
export interface StudentQuery extends PageQuery {
|
||||||
/**
|
/**
|
||||||
* 学生名称
|
* 学生名称
|
||||||
*/
|
*/
|
||||||
@ -90,7 +94,4 @@ export interface StudentQuery extends PageQuery {
|
|||||||
* 日期范围参数
|
* 日期范围参数
|
||||||
*/
|
*/
|
||||||
params?: any;
|
params?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import { TenantForm, TenantQuery, TenantVO } from './types';
|
import { TenantForm, TenantQuery, TenantVO } from './types';
|
||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
|
import { genKeyPair } from '@/api/genKeyPair';
|
||||||
|
const encryptHeader = import.meta.env.VITE_APP_ENCRYPT_HEADER;
|
||||||
|
|
||||||
// 查询租户列表
|
// 查询租户列表
|
||||||
export function listTenant(query: TenantQuery): AxiosPromise<TenantVO[]> {
|
export function listTenant(query: TenantQuery): AxiosPromise<TenantVO[]> {
|
||||||
@ -21,13 +23,25 @@ export function getTenant(tenantId: string | number): AxiosPromise<TenantVO> {
|
|||||||
|
|
||||||
// 新增租户
|
// 新增租户
|
||||||
export function addTenant(data: TenantForm) {
|
export function addTenant(data: TenantForm) {
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
|
genKeyPair((uuid, public_key) => {
|
||||||
|
request({
|
||||||
url: '/system/tenant',
|
url: '/system/tenant',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
[encryptHeader]: uuid,
|
||||||
|
publicKey: public_key
|
||||||
},
|
},
|
||||||
data: data
|
data: data
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ import request from '@/utils/request';
|
|||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
import { UserForm, UserQuery, UserVO, UserInfoVO } from './types';
|
import { UserForm, UserQuery, UserVO, UserInfoVO } from './types';
|
||||||
import { parseStrEmpty } from '@/utils/ruoyi';
|
import { parseStrEmpty } from '@/utils/ruoyi';
|
||||||
|
import { genKeyPair } from '@/api/genKeyPair';
|
||||||
|
const encryptHeader = import.meta.env.VITE_APP_ENCRYPT_HEADER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户列表
|
* 查询用户列表
|
||||||
@ -72,13 +74,25 @@ export const resetUserPwd = (userId: string | number, version: number, password:
|
|||||||
version,
|
version,
|
||||||
password
|
password
|
||||||
};
|
};
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
|
genKeyPair((uuid, public_key) => {
|
||||||
|
request({
|
||||||
url: '/system/user/resetPwd',
|
url: '/system/user/resetPwd',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
headers: {
|
headers: {
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
[encryptHeader]: uuid,
|
||||||
|
publicKey: public_key
|
||||||
},
|
},
|
||||||
data: data
|
data: data
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,13 +146,25 @@ export const updateUserPwd = (oldPassword: string, newPassword: string) => {
|
|||||||
oldPassword,
|
oldPassword,
|
||||||
newPassword
|
newPassword
|
||||||
};
|
};
|
||||||
return request({
|
return new Promise((resolve, reject) => {
|
||||||
|
genKeyPair((uuid, public_key) => {
|
||||||
|
request({
|
||||||
url: '/system/user/profile/updatePwd',
|
url: '/system/user/profile/updatePwd',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
headers: {
|
headers: {
|
||||||
isEncrypt: true
|
isEncrypt: true,
|
||||||
|
[encryptHeader]: uuid,
|
||||||
|
publicKey: public_key
|
||||||
},
|
},
|
||||||
data: data
|
data: data
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
resolve(res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ export interface TableVO extends BaseEntity {
|
|||||||
parentMenuName?: any;
|
parentMenuName?: any;
|
||||||
tree: boolean;
|
tree: boolean;
|
||||||
crud: boolean;
|
crud: boolean;
|
||||||
|
editColumns: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TableQuery extends PageQuery {
|
export interface TableQuery extends PageQuery {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 439 KiB |
@ -50,12 +50,13 @@ const values = computed(() => {
|
|||||||
const unmatch = computed(() => {
|
const unmatch = computed(() => {
|
||||||
if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false;
|
if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false;
|
||||||
// 传入值为非数组
|
// 传入值为非数组
|
||||||
|
let unmatch = false; // 添加一个标志来判断是否有未匹配项
|
||||||
values.value.forEach((item) => {
|
values.value.forEach((item) => {
|
||||||
if (!props.options.some((v) => v.value === item)) {
|
if (!props.options.some((v) => v.value === item)) {
|
||||||
return true; // 如果有未匹配项,将标志设置为true
|
unmatch = true; // 如果有未匹配项,将标志设置为true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false; // 返回标志的值
|
return unmatch; // 返回标志的值
|
||||||
});
|
});
|
||||||
|
|
||||||
const unmatchArray = computed(() => {
|
const unmatchArray = computed(() => {
|
||||||
|
@ -44,6 +44,7 @@ import { listByIds, delOss } from '@/api/system/oss';
|
|||||||
import { OssVO } from '@/api/system/oss/types';
|
import { OssVO } from '@/api/system/oss/types';
|
||||||
import { propTypes } from '@/utils/propTypes';
|
import { propTypes } from '@/utils/propTypes';
|
||||||
import { globalHeaders } from '@/utils/request';
|
import { globalHeaders } from '@/utils/request';
|
||||||
|
import { compressAccurately } from 'image-conversion';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: {
|
modelValue: {
|
||||||
@ -60,7 +61,14 @@ const props = defineProps({
|
|||||||
isShowTip: {
|
isShowTip: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
}
|
},
|
||||||
|
// 是否支持压缩,默认否
|
||||||
|
compressSupport: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
// 压缩目标大小,单位KB。默认300KB以上文件才压缩,并压缩至300KB以内
|
||||||
|
compressTargetSize: propTypes.number.def(300)
|
||||||
});
|
});
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
@ -89,7 +97,9 @@ watch(
|
|||||||
list = val as OssVO[];
|
list = val as OssVO[];
|
||||||
} else {
|
} else {
|
||||||
const res = await listByIds(val);
|
const res = await listByIds(val);
|
||||||
list = res.data;
|
//list = res.data;
|
||||||
|
// 处理 val 为字符串的情况,封装成一个 OssVO 对象
|
||||||
|
list = [{ name: val, url: val }];
|
||||||
}
|
}
|
||||||
// 然后将数组转为对象数组
|
// 然后将数组转为对象数组
|
||||||
fileList.value = list.map((item) => {
|
fileList.value = list.map((item) => {
|
||||||
@ -138,8 +148,16 @@ const handleBeforeUpload = (file: any) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//压缩图片,开启压缩并且大于指定的压缩大小时才压缩
|
||||||
|
if (props.compressSupport && file.size / 1024 > props.compressTargetSize) {
|
||||||
proxy?.$modal.loading('正在上传图片,请稍候...');
|
proxy?.$modal.loading('正在上传图片,请稍候...');
|
||||||
number.value++;
|
number.value++;
|
||||||
|
return compressAccurately(file, props.compressTargetSize);
|
||||||
|
} else {
|
||||||
|
proxy?.$modal.loading('正在上传图片,请稍候...');
|
||||||
|
number.value++;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 文件个数超出
|
// 文件个数超出
|
||||||
|
201
src/components/RoleSelect/index.vue
Normal file
201
src/components/RoleSelect/index.vue
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog v-model="roleDialog.visible.value" :title="roleDialog.title.value" width="80%" append-to-body>
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="角色名称" prop="roleName">
|
||||||
|
<el-input v-model="queryParams.roleName" placeholder="请输入角色名称" clearable style="width: 180px" @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="权限字符" prop="roleKey">
|
||||||
|
<el-input v-model="queryParams.roleKey" placeholder="请输入权限字符" clearable style="width: 180px" @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<template #header>
|
||||||
|
<el-tag v-for="role in selectRoleList" :key="role.roleId" closable style="margin: 2px" @close="handleCloseTag(role)">
|
||||||
|
{{ role.roleName }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<vxe-table
|
||||||
|
ref="tableRef"
|
||||||
|
height="400px"
|
||||||
|
border
|
||||||
|
show-overflow
|
||||||
|
:data="roleList"
|
||||||
|
:loading="loading"
|
||||||
|
:row-config="{ keyField: 'roleId' }"
|
||||||
|
:checkbox-config="{ reserve: true, checkRowKeys: roleIds }"
|
||||||
|
highlight-current-row
|
||||||
|
@checkbox-all="handleCheckboxAll"
|
||||||
|
@checkbox-change="handleCheckboxChange"
|
||||||
|
>
|
||||||
|
<vxe-column type="checkbox" width="50" align="center" />
|
||||||
|
<vxe-column v-if="false" key="roleId" label="角色编号" />
|
||||||
|
<vxe-column field="roleName" title="角色名称" />
|
||||||
|
<vxe-column field="roleKey" title="权限字符" />
|
||||||
|
<vxe-column field="roleSort" title="显示顺序" width="100" />
|
||||||
|
<vxe-column title="状态" align="center" width="100">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="sys_normal_disable" :value="scope.row.status"></dict-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
<vxe-column field="createTime" title="创建时间" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-if="total > 0"
|
||||||
|
v-model:total="total"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="roleDialog.closeDialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="Role" lang="ts">
|
||||||
|
import { listRole } from '@/api/system/role';
|
||||||
|
import { RoleVO, RoleQuery } from '@/api/system/role/types';
|
||||||
|
import { VxeTableInstance } from 'vxe-table';
|
||||||
|
import useDialog from '@/hooks/useDialog';
|
||||||
|
import { parseTime } from "@/utils/ruoyi";
|
||||||
|
|
||||||
|
interface PropType {
|
||||||
|
modelValue?: RoleVO[];
|
||||||
|
}
|
||||||
|
const prop = withDefaults(defineProps<PropType>(), {
|
||||||
|
modelValue: () => []
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
|
||||||
|
|
||||||
|
const roleIds = computed(() => prop.modelValue.map((item) => item.roleId as string));
|
||||||
|
|
||||||
|
const roleList = ref<RoleVO[]>();
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
||||||
|
const selectRoleList = ref<RoleVO[]>([]);
|
||||||
|
|
||||||
|
const roleDialog = useDialog({
|
||||||
|
title: '角色选择'
|
||||||
|
});
|
||||||
|
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const tableRef = ref<VxeTableInstance<RoleVO>>();
|
||||||
|
|
||||||
|
const queryParams = ref<RoleQuery>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
roleName: '',
|
||||||
|
roleKey: '',
|
||||||
|
status: ''
|
||||||
|
});
|
||||||
|
const confirm = () => {
|
||||||
|
emit('update:modelValue', [...selectRoleList.value]);
|
||||||
|
roleDialog.closeDialog();
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 查询角色列表
|
||||||
|
*/
|
||||||
|
const getList = () => {
|
||||||
|
loading.value = true;
|
||||||
|
listRole(proxy?.addDateRange(queryParams.value, dateRange.value)).then((res) => {
|
||||||
|
roleList.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索按钮操作
|
||||||
|
*/
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 重置 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
dateRange.value = ['', ''];
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCheckboxChange = (checked) => {
|
||||||
|
const row = checked.row;
|
||||||
|
if (checked.checked) {
|
||||||
|
selectRoleList.value.push(row);
|
||||||
|
} else {
|
||||||
|
selectRoleList.value = selectRoleList.value.filter((item) => {
|
||||||
|
return item.roleId !== row.roleId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleCheckboxAll = (checked) => {
|
||||||
|
const rows = roleList.value;
|
||||||
|
if (checked.checked) {
|
||||||
|
rows.forEach((row) => {
|
||||||
|
if (!selectRoleList.value.some((item) => item.roleId === row.roleId)) {
|
||||||
|
selectRoleList.value.push(row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
selectRoleList.value = selectRoleList.value.filter((item) => {
|
||||||
|
return !rows.some((row) => row.roleId === item.roleId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseTag = (user: RoleVO) => {
|
||||||
|
const roleId = user.roleId;
|
||||||
|
// 使用split删除用户
|
||||||
|
const index = selectRoleList.value.findIndex((item) => item.roleId === roleId);
|
||||||
|
const rows = selectRoleList.value[index];
|
||||||
|
tableRef.value?.setCheckboxRow(rows, false);
|
||||||
|
selectRoleList.value.splice(index, 1);
|
||||||
|
};
|
||||||
|
watch(
|
||||||
|
() => prop.modelValue,
|
||||||
|
(newVal, oldValue) => {
|
||||||
|
Object.assign(selectRoleList.value, newVal);
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
defineExpose({
|
||||||
|
open: roleDialog.openDialog,
|
||||||
|
close: roleDialog.closeDialog
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
</script>
|
261
src/components/UserSelect/index.vue
Normal file
261
src/components/UserSelect/index.vue
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog v-model="userDialog.visible.value" :title="userDialog.title.value" width="80%" append-to-body>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<!-- 部门树 -->
|
||||||
|
<el-col :lg="4" :xs="24" style="">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-input v-model="deptName" placeholder="请输入部门名称" prefix-icon="Search" clearable />
|
||||||
|
<el-tree
|
||||||
|
ref="deptTreeRef"
|
||||||
|
class="mt-2"
|
||||||
|
node-key="id"
|
||||||
|
:data="deptOptions"
|
||||||
|
:props="{ label: 'label', children: 'children' }"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
:filter-node-method="filterNode"
|
||||||
|
highlight-current
|
||||||
|
default-expand-all
|
||||||
|
@node-click="handleNodeClick"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="20" :xs="24">
|
||||||
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
|
||||||
|
<el-form-item label="用户名称" prop="userName">
|
||||||
|
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 200px" @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.phonenumber"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
clearable
|
||||||
|
style="width: 200px"
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
|
||||||
|
<el-card shadow="hover">
|
||||||
|
<template #header>
|
||||||
|
<el-tag v-for="user in selectUserList" :key="user.userId" closable style="margin: 2px" @close="handleCloseTag(user)">
|
||||||
|
{{ user.userName }}
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<vxe-table
|
||||||
|
ref="tableRef"
|
||||||
|
height="400px"
|
||||||
|
border
|
||||||
|
show-overflow
|
||||||
|
:data="userList"
|
||||||
|
:loading="loading"
|
||||||
|
:row-config="{ keyField: 'userId' }"
|
||||||
|
:checkbox-config="{ reserve: true, checkRowKeys: userIds }"
|
||||||
|
highlight-current-row
|
||||||
|
@checkbox-all="handleCheckboxAll"
|
||||||
|
@checkbox-change="handleCheckboxChange"
|
||||||
|
>
|
||||||
|
<vxe-column type="checkbox" width="50" align="center" />
|
||||||
|
<vxe-column key="userId" title="用户编号" align="center" field="userId" />
|
||||||
|
<vxe-column key="userName" title="用户名称" align="center" field="userName" />
|
||||||
|
<vxe-column key="nickName" title="用户昵称" align="center" field="nickName" />
|
||||||
|
<vxe-column key="deptName" title="部门" align="center" field="deptName" />
|
||||||
|
<vxe-column key="phonenumber" title="手机号码" align="center" field="phonenumber" width="120" />
|
||||||
|
<vxe-column key="status" title="状态" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<dict-tag :options="sys_normal_disable" :value="scope.row.status"></dict-tag>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
|
||||||
|
<vxe-column title="创建时间" align="center" width="160">
|
||||||
|
<template #default="scope">
|
||||||
|
<span>{{ scope.row.createTime }}</span>
|
||||||
|
</template>
|
||||||
|
</vxe-column>
|
||||||
|
</vxe-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
:total="total"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="userDialog.closeDialog">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirm">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import api from '@/api/system/user';
|
||||||
|
import { UserQuery, UserVO } from '@/api/system/user/types';
|
||||||
|
import { DeptVO } from '@/api/system/dept/types';
|
||||||
|
import { VxeTableInstance } from 'vxe-table';
|
||||||
|
import useDialog from '@/hooks/useDialog';
|
||||||
|
|
||||||
|
interface PropType {
|
||||||
|
modelValue?: UserVO[];
|
||||||
|
}
|
||||||
|
const prop = withDefaults(defineProps<PropType>(), {
|
||||||
|
modelValue: () => []
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
const { sys_normal_disable } = toRefs<any>(proxy?.useDict('sys_normal_disable'));
|
||||||
|
|
||||||
|
const userIds = computed(() => prop.modelValue.map((item) => item.userId as string));
|
||||||
|
|
||||||
|
const userList = ref<UserVO[]>();
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
||||||
|
const deptName = ref('');
|
||||||
|
const deptOptions = ref<DeptVO[]>([]);
|
||||||
|
const selectUserList = ref<UserVO[]>([]);
|
||||||
|
|
||||||
|
const deptTreeRef = ref<ElTreeInstance>();
|
||||||
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
|
const tableRef = ref<VxeTableInstance<UserVO>>();
|
||||||
|
|
||||||
|
const userDialog = useDialog({
|
||||||
|
title: '用户选择'
|
||||||
|
});
|
||||||
|
|
||||||
|
const queryParams = ref<UserQuery>({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userName: '',
|
||||||
|
phonenumber: '',
|
||||||
|
status: '',
|
||||||
|
deptId: '',
|
||||||
|
roleId: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
/** 通过条件过滤节点 */
|
||||||
|
const filterNode = (value: string, data: any) => {
|
||||||
|
if (!value) return true;
|
||||||
|
return data.label.indexOf(value) !== -1;
|
||||||
|
};
|
||||||
|
/** 根据名称筛选部门树 */
|
||||||
|
watchEffect(
|
||||||
|
() => {
|
||||||
|
deptTreeRef.value?.filter(deptName.value);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
flush: 'post' // watchEffect会在DOM挂载或者更新之前就会触发,此属性控制在DOM元素更新后运行
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const confirm = () => {
|
||||||
|
emit('update:modelValue', [...selectUserList.value]);
|
||||||
|
userDialog.closeDialog();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查询部门下拉树结构 */
|
||||||
|
const getTreeSelect = async () => {
|
||||||
|
const res = await api.deptTreeSelect();
|
||||||
|
deptOptions.value = res.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 查询用户列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await api.listUser(proxy?.addDateRange(queryParams.value, dateRange.value));
|
||||||
|
loading.value = false;
|
||||||
|
userList.value = res.rows;
|
||||||
|
total.value = res.total;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 节点单击事件 */
|
||||||
|
const handleNodeClick = (data: DeptVO) => {
|
||||||
|
queryParams.value.deptId = data.id;
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
dateRange.value = ['', ''];
|
||||||
|
queryFormRef.value?.resetFields();
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
queryParams.value.deptId = undefined;
|
||||||
|
deptTreeRef.value?.setCurrentKey(undefined);
|
||||||
|
handleQuery();
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCheckboxChange = (checked) => {
|
||||||
|
const row = checked.row;
|
||||||
|
if (checked.checked) {
|
||||||
|
selectUserList.value.push(row);
|
||||||
|
} else {
|
||||||
|
selectUserList.value = selectUserList.value.filter((item) => {
|
||||||
|
return item.userId !== row.userId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleCheckboxAll = (checked) => {
|
||||||
|
const rows = userList.value;
|
||||||
|
if (checked.checked) {
|
||||||
|
rows.forEach((row) => {
|
||||||
|
if (!selectUserList.value.some((item) => item.userId === row.userId)) {
|
||||||
|
selectUserList.value.push(row);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
selectUserList.value = selectUserList.value.filter((item) => {
|
||||||
|
return !rows.some((row) => row.userId === item.userId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleCloseTag = (user: UserVO) => {
|
||||||
|
const userId = user.userId;
|
||||||
|
const index = selectUserList.value.findIndex((item) => item.userId === userId);
|
||||||
|
const rows = selectUserList.value[index];
|
||||||
|
tableRef.value?.setCheckboxRow(rows, false);
|
||||||
|
selectUserList.value.splice(index, 1);
|
||||||
|
};
|
||||||
|
watch(
|
||||||
|
() => prop.modelValue,
|
||||||
|
(newVal, oldValue) => {
|
||||||
|
Object.assign(selectUserList.value, newVal);
|
||||||
|
},
|
||||||
|
{ deep: true }
|
||||||
|
);
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getTreeSelect();
|
||||||
|
getList();
|
||||||
|
});
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
open: userDialog.openDialog,
|
||||||
|
close: userDialog.closeDialog
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
31
src/hooks/useDialog.ts
Normal file
31
src/hooks/useDialog.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { Ref,ref } from 'vue';
|
||||||
|
|
||||||
|
interface Options {
|
||||||
|
title?: string;
|
||||||
|
}
|
||||||
|
interface Return {
|
||||||
|
title: Ref<string>;
|
||||||
|
visible: Ref<boolean>;
|
||||||
|
openDialog: () => void;
|
||||||
|
closeDialog: () => void;
|
||||||
|
}
|
||||||
|
export default (ops?: Options): Return => {
|
||||||
|
const visible = ref(false);
|
||||||
|
const title = ref(ops.title || '');
|
||||||
|
|
||||||
|
const openDialog = () => {
|
||||||
|
visible.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeDialog = () => {
|
||||||
|
visible.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
visible,
|
||||||
|
|
||||||
|
openDialog,
|
||||||
|
closeDialog
|
||||||
|
};
|
||||||
|
};
|
12
src/main.ts
12
src/main.ts
@ -25,12 +25,24 @@ import './permission';
|
|||||||
// 国际化
|
// 国际化
|
||||||
import i18n from '@/lang/index';
|
import i18n from '@/lang/index';
|
||||||
|
|
||||||
|
// vxeTable
|
||||||
|
import VXETable from 'vxe-table';
|
||||||
|
import 'vxe-table/lib/style.css';
|
||||||
|
VXETable.config({
|
||||||
|
zIndex: 999999
|
||||||
|
});
|
||||||
|
|
||||||
|
// 修改 el-dialog 默认点击遮照为不关闭
|
||||||
|
import { ElDialog } from 'element-plus';
|
||||||
|
ElDialog.props.closeOnClickModal.default = false;
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
app.use(ElementIcons);
|
app.use(ElementIcons);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(store);
|
app.use(store);
|
||||||
app.use(i18n);
|
app.use(i18n);
|
||||||
|
app.use(VXETable);
|
||||||
app.use(plugins);
|
app.use(plugins);
|
||||||
// 自定义指令
|
// 自定义指令
|
||||||
directive(app);
|
directive(app);
|
||||||
|
2
src/types/env.d.ts
vendored
2
src/types/env.d.ts
vendored
@ -14,9 +14,11 @@ interface ImportMetaEnv {
|
|||||||
VITE_APP_MONITRO_ADMIN: string;
|
VITE_APP_MONITRO_ADMIN: string;
|
||||||
VITE_APP_POWERJOB_ADMIN: string;
|
VITE_APP_POWERJOB_ADMIN: string;
|
||||||
VITE_APP_ENV: string;
|
VITE_APP_ENV: string;
|
||||||
|
VITE_APP_ENCRYPT: string;
|
||||||
VITE_APP_RSA_PUBLIC_KEY: string;
|
VITE_APP_RSA_PUBLIC_KEY: string;
|
||||||
VITE_APP_RSA_PRIVATE_KEY: string;
|
VITE_APP_RSA_PRIVATE_KEY: string;
|
||||||
VITE_APP_CLIENT_ID: string;
|
VITE_APP_CLIENT_ID: string;
|
||||||
|
VITE_APP_ENCRYPT_HEADER: string;
|
||||||
VITE_APP_WEBSOCKET: string;
|
VITE_APP_WEBSOCKET: string;
|
||||||
}
|
}
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
1
src/types/global.d.ts
vendored
1
src/types/global.d.ts
vendored
@ -69,6 +69,7 @@ declare global {
|
|||||||
/** 乐观锁 */
|
/** 乐观锁 */
|
||||||
version?: number;
|
version?: number;
|
||||||
createBy?: any;
|
createBy?: any;
|
||||||
|
createDept?: any;
|
||||||
createTime?: string;
|
createTime?: string;
|
||||||
updateBy?: any;
|
updateBy?: any;
|
||||||
updateTime?: any;
|
updateTime?: any;
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
import JSEncrypt from 'jsencrypt';
|
import JSEncrypt from 'encryptlong';
|
||||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||||
|
|
||||||
const publicKey = import.meta.env.VITE_APP_RSA_PUBLIC_KEY;
|
|
||||||
|
|
||||||
// 前端不建议存放私钥 不建议解密数据 因为都是透明的意义不大
|
// 前端不建议存放私钥 不建议解密数据 因为都是透明的意义不大
|
||||||
const privateKey = import.meta.env.VITE_APP_RSA_PRIVATE_KEY;
|
const privateKey = import.meta.env.VITE_APP_RSA_PRIVATE_KEY;
|
||||||
|
|
||||||
// 加密
|
// 加密
|
||||||
export const encrypt = (txt: string) => {
|
export const encrypt = (txt: string, publicKey: string) => {
|
||||||
const encryptor = new JSEncrypt();
|
const encryptor = new JSEncrypt();
|
||||||
encryptor.setPublicKey(publicKey); // 设置公钥
|
encryptor.setPublicKey(publicKey); // 设置公钥
|
||||||
return encryptor.encrypt(txt); // 对数据进行加密
|
return encryptor.encryptLong(txt); // 对数据进行加密
|
||||||
};
|
};
|
||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
|
@ -10,6 +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 { ElLoading, ElMessage, ElMessageBox, ElNotification } from 'element-plus';
|
||||||
|
|
||||||
const encryptHeader = 'encrypt-key';
|
const encryptHeader = 'encrypt-key';
|
||||||
let downloadLoadingInstance: LoadingInstance;
|
let downloadLoadingInstance: LoadingInstance;
|
||||||
@ -76,12 +77,18 @@ service.interceptors.request.use(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (import.meta.env.VITE_APP_ENCRYPT === 'true') {
|
||||||
// 当开启参数加密
|
// 当开启参数加密
|
||||||
if (isEncrypt && (config.method === 'post' || config.method === 'put')) {
|
if (isEncrypt && (config.method === 'post' || config.method === 'put')) {
|
||||||
// 生成一个 AES 密钥
|
// 根据 AES 密钥进行加密
|
||||||
const aesKey = generateAesKey();
|
const publicKey = (config.headers || {}).publicKey;
|
||||||
config.headers[encryptHeader] = encrypt(encryptBase64(aesKey));
|
console.log('publicKey', publicKey);
|
||||||
config.data = typeof config.data === 'object' ? encryptWithAes(JSON.stringify(config.data), aesKey) : encryptWithAes(config.data, aesKey);
|
config.data =
|
||||||
|
typeof config.data === 'object'
|
||||||
|
? encrypt(encodeURIComponent(JSON.stringify(config.data)), publicKey)
|
||||||
|
: encrypt(encodeURIComponent(config.data), publicKey);
|
||||||
|
delete config.headers['publicKey'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// FormData数据去请求头Content-Type
|
// FormData数据去请求头Content-Type
|
||||||
if (config.data instanceof FormData) {
|
if (config.data instanceof FormData) {
|
||||||
@ -97,6 +104,7 @@ service.interceptors.request.use(
|
|||||||
// 响应拦截器
|
// 响应拦截器
|
||||||
service.interceptors.response.use(
|
service.interceptors.response.use(
|
||||||
(res: AxiosResponse) => {
|
(res: AxiosResponse) => {
|
||||||
|
if (import.meta.env.VITE_APP_ENCRYPT === 'true') {
|
||||||
// 加密后的 AES 秘钥
|
// 加密后的 AES 秘钥
|
||||||
const keyStr = res.headers[encryptHeader];
|
const keyStr = res.headers[encryptHeader];
|
||||||
// 加密
|
// 加密
|
||||||
@ -111,6 +119,7 @@ service.interceptors.response.use(
|
|||||||
// 将结果 (得到的是 JSON 字符串) 转为 JSON
|
// 将结果 (得到的是 JSON 字符串) 转为 JSON
|
||||||
res.data = JSON.parse(decryptData);
|
res.data = JSON.parse(decryptData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// 未设置状态码则默认成功状态
|
// 未设置状态码则默认成功状态
|
||||||
const code = res.data.code || HttpStatus.SUCCESS;
|
const code = res.data.code || HttpStatus.SUCCESS;
|
||||||
// 获取错误信息
|
// 获取错误信息
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img alt="logo" src="@/assets/images/ruoyi-flex-logo.png">
|
<img alt="logo" src="@/assets/images/ruoyi-flex-logo.png">
|
||||||
</p>
|
</p>
|
||||||
<h1 align="center">Ruoyi-Flex V5.1.0</h1>
|
<h1 align="center">Ruoyi-Flex V5.2.0-SNAPSHOT</h1>
|
||||||
<h2 align="center">Ruoyi-Flex是基于JDK21、Spring Boot V3.2.X+平台 前后端分离的Java快速开发框架</h2>
|
<h2 align="center">Ruoyi-Flex是基于JDK21、Spring Boot V3.2.X+平台 前后端分离的Java快速开发框架</h2>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -299,7 +299,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Index" lang="ts">
|
<script setup name="Index" lang="ts">
|
||||||
const version = ref('5.1.0')
|
const version = ref('5.2.0-SNAPSHOT')
|
||||||
const goTarget = (url: string) => {
|
const goTarget = (url: string) => {
|
||||||
window.open(url, '__blank');
|
window.open(url, '__blank');
|
||||||
};
|
};
|
||||||
|
@ -73,7 +73,7 @@ const userStore = useUserStore();
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const loginForm = ref<LoginData>({
|
const loginForm = ref<LoginData>({
|
||||||
tenantId: 0,
|
tenantId: 1,
|
||||||
username: 'superadmin',
|
username: 'superadmin',
|
||||||
password: 'admin123',
|
password: 'admin123',
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
|
@ -30,6 +30,12 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['mf:product:add']">新增</el-button>
|
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['mf:product:add']">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Top" @click="handleImport()" v-hasPermi="['mf:product:import']">导入</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport()" v-hasPermi="['mf:product:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
<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>
|
||||||
@ -69,13 +75,13 @@
|
|||||||
<!-- 添加或修改产品树对话框 -->
|
<!-- 添加或修改产品树对话框 -->
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||||
<el-form ref="productFormRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="productFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="父产品id" prop="parentId">
|
<el-form-item label="上级编号" prop="parentId">
|
||||||
<el-tree-select
|
<el-tree-select
|
||||||
v-model="form.parentId"
|
v-model="form.parentId"
|
||||||
:data="productOptions"
|
:data="productOptions"
|
||||||
:props="{ value: 'productId', label: 'productName', children: 'children' }"
|
:props="{ value: 'productId', label: 'productName', children: 'children' }"
|
||||||
value-key="productId"
|
value-key="productId"
|
||||||
placeholder="请选择父产品id"
|
placeholder="请选择上级编号"
|
||||||
check-strictly
|
check-strictly
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -105,50 +111,105 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 导入对话框 -->
|
||||||
|
<el-dialog v-model="upload.open" :title="upload.title" width="400px" append-to-body>
|
||||||
|
<el-upload
|
||||||
|
ref="uploadRef"
|
||||||
|
:limit="1"
|
||||||
|
accept=".xlsx, .xls"
|
||||||
|
:headers="upload.headers"
|
||||||
|
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||||||
|
:disabled="upload.isUploading"
|
||||||
|
:on-progress="handleFileUploadProgress"
|
||||||
|
:on-success="handleFileSuccess"
|
||||||
|
:auto-upload="false"
|
||||||
|
drag
|
||||||
|
>
|
||||||
|
<el-icon class="el-icon--upload">
|
||||||
|
<i-ep-upload-filled />
|
||||||
|
</el-icon>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
<template #tip>
|
||||||
|
<div class="text-center el-upload__tip">
|
||||||
|
<div class="el-upload__tip">
|
||||||
|
<el-checkbox v-model="upload.updateSupport" />
|
||||||
|
是否更新已经存在的产品树数据
|
||||||
|
</div>
|
||||||
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
|
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板 </el-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||||
|
<el-button @click="upload.open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Product" lang="ts">
|
<script setup lang="ts">
|
||||||
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mf/product";
|
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mf/product";
|
||||||
import { ProductVO, ProductQuery, ProductForm } from '@/api/mf/product/types';
|
import { ProductVO, ProductQuery, ProductForm } from '@/api/mf/product/types';
|
||||||
|
import { globalHeaders } from '@/utils/request';
|
||||||
|
|
||||||
type ProductOption = {
|
type ProductOption = {
|
||||||
productId: number;
|
productId: number;
|
||||||
productName: string;
|
productName: string;
|
||||||
children?: ProductOption[];
|
children?: ProductOption[];
|
||||||
};
|
};
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
|
|
||||||
const { sys_student_status } = toRefs<any>(proxy?.useDict('sys_student_status'));
|
const { sys_student_status } = toRefs<any>(proxy?.useDict('sys_student_status'));
|
||||||
|
|
||||||
const productList = ref<ProductVO[]>([]);
|
const productList = ref<ProductVO[]>([]);
|
||||||
const productOptions = ref<ProductOption[]>([]);
|
const productOptions = ref<ProductOption[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
const isExpandAll = ref(true);
|
const isExpandAll = ref(true);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const productFormRef = ref<ElFormInstance>();
|
const productFormRef = ref<ElFormInstance>();
|
||||||
const productTableRef = ref<ElTableInstance>()
|
const productTableRef = ref<ElTableInstance>()
|
||||||
|
const uploadRef = ref<ElUploadInstance>();
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
/*** 导入参数 */
|
||||||
|
const upload = reactive<ImportOption>({
|
||||||
|
// 是否显示弹出层(导入)
|
||||||
|
open: false,
|
||||||
|
// 弹出层标题(导入)
|
||||||
|
title: '',
|
||||||
|
// 是否禁用上传
|
||||||
|
isUploading: false,
|
||||||
|
// 是否更新已经存在的用户数据
|
||||||
|
updateSupport: 1,
|
||||||
|
// 设置上传的请求头部
|
||||||
|
headers: globalHeaders(),
|
||||||
|
// 上传的地址
|
||||||
|
url: import.meta.env.VITE_APP_BASE_API + '/mf/product/importData'
|
||||||
|
});
|
||||||
|
|
||||||
|
const dialog = reactive<DialogOption>({
|
||||||
visible: false,
|
visible: false,
|
||||||
title: ''
|
title: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const initFormData: ProductForm = {
|
const initFormData: ProductForm = {
|
||||||
productId: undefined,
|
productId: undefined,
|
||||||
parentId: undefined,
|
parentId: undefined,
|
||||||
productName: undefined,
|
productName: undefined,
|
||||||
orderNum: undefined,
|
orderNum: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
version: 0,
|
version: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const data = reactive<PageData<ProductForm, ProductQuery>>({
|
const data = reactive<PageData<ProductForm, ProductQuery>>({
|
||||||
form: {...initFormData},
|
form: {...initFormData},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
productName: undefined,
|
productName: undefined,
|
||||||
@ -158,7 +219,7 @@ const data = reactive<PageData<ProductForm, ProductQuery>>({
|
|||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
parentId: [
|
parentId: [
|
||||||
{ required: true, message: "父产品id不能为空", trigger: "blur" }
|
{ required: true, message: "上级编号不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
productName: [
|
productName: [
|
||||||
{ required: true, message: "产品名称不能为空", trigger: "blur" }
|
{ required: true, message: "产品名称不能为空", trigger: "blur" }
|
||||||
@ -170,12 +231,12 @@ const data = reactive<PageData<ProductForm, ProductQuery>>({
|
|||||||
{ required: true, message: "产品状态不能为空", trigger: "change" }
|
{ required: true, message: "产品状态不能为空", trigger: "change" }
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
/** 查询产品树列表 */
|
/** 查询产品树列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await listProduct(queryParams.value);
|
const res = await listProduct(queryParams.value);
|
||||||
const data = proxy?.handleTree<ProductVO>(res.data, 'productId', 'parentId');
|
const data = proxy?.handleTree<ProductVO>(res.data, 'productId', 'parentId');
|
||||||
@ -183,42 +244,42 @@ const getList = async () => {
|
|||||||
productList.value = data;
|
productList.value = data;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 查询产品树下拉树结构 */
|
/** 查询产品树下拉树结构 */
|
||||||
const getTreeselect = async () => {
|
const getTreeselect = async () => {
|
||||||
const res = await listProduct();
|
const res = await listProduct();
|
||||||
productOptions.value = [];
|
productOptions.value = [];
|
||||||
const data: ProductOption = { productId: 0, productName: '顶级节点', children: [] };
|
const data: ProductOption = { productId: 0, productName: '顶级节点', children: [] };
|
||||||
data.children = proxy?.handleTree<ProductOption>(res.data, 'productId', 'parentId');
|
data.children = proxy?.handleTree<ProductOption>(res.data, 'productId', 'parentId');
|
||||||
productOptions.value.push(data);
|
productOptions.value.push(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
const cancel = () => {
|
const cancel = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 表单重置
|
// 表单重置
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
form.value = {...initFormData}
|
form.value = {...initFormData}
|
||||||
productFormRef.value?.resetFields();
|
productFormRef.value?.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value?.resetFields();
|
queryFormRef.value?.resetFields();
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
const handleAdd = (row?: ProductVO) => {
|
const handleAdd = (row?: ProductVO) => {
|
||||||
reset();
|
reset();
|
||||||
getTreeselect();
|
getTreeselect();
|
||||||
if (row != null && row.productId) {
|
if (row != null && row.productId) {
|
||||||
@ -228,24 +289,66 @@ const handleAdd = (row?: ProductVO) => {
|
|||||||
}
|
}
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '添加产品树';
|
dialog.title = '添加产品树';
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 展开/折叠操作 */
|
/** 导出按钮操作 */
|
||||||
const handleToggleExpandAll = () => {
|
const handleExport = () => {
|
||||||
|
proxy?.download(
|
||||||
|
'mf/product/export',
|
||||||
|
{
|
||||||
|
...queryParams.value
|
||||||
|
},
|
||||||
|
`product.xlsx`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 导入按钮操作 */
|
||||||
|
const handleImport = () => {
|
||||||
|
upload.title = '产品树导入';
|
||||||
|
upload.open = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 下载模板操作 */
|
||||||
|
const importTemplate = () => {
|
||||||
|
proxy?.download('mf/product/importTemplate', {}, `product_template.xlsx`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**文件上传中处理 */
|
||||||
|
const handleFileUploadProgress = () => {
|
||||||
|
upload.isUploading = true;
|
||||||
|
};
|
||||||
|
/** 文件上传成功处理 */
|
||||||
|
const handleFileSuccess = (response: any, file: UploadFile) => {
|
||||||
|
upload.open = false;
|
||||||
|
upload.isUploading = false;
|
||||||
|
uploadRef.value?.handleRemove(file);
|
||||||
|
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
|
||||||
|
dangerouslyUseHTMLString: true
|
||||||
|
});
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 提交上传文件 */
|
||||||
|
function submitFileForm() {
|
||||||
|
uploadRef.value?.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 展开/折叠操作 */
|
||||||
|
const handleToggleExpandAll = () => {
|
||||||
isExpandAll.value = !isExpandAll.value;
|
isExpandAll.value = !isExpandAll.value;
|
||||||
toggleExpandAll(productList.value, isExpandAll.value)
|
toggleExpandAll(productList.value, isExpandAll.value)
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 展开/折叠操作 */
|
/** 展开/折叠操作 */
|
||||||
const toggleExpandAll = (data: ProductVO[], status: boolean) => {
|
const toggleExpandAll = (data: ProductVO[], status: boolean) => {
|
||||||
data.forEach((item) => {
|
data.forEach((item) => {
|
||||||
productTableRef.value?.toggleRowExpansion(item, status)
|
productTableRef.value?.toggleRowExpansion(item, status)
|
||||||
if (item.children && item.children.length > 0) toggleExpandAll(item.children, status)
|
if (item.children && item.children.length > 0) toggleExpandAll(item.children, status)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row: ProductVO) => {
|
const handleUpdate = async (row: ProductVO) => {
|
||||||
reset();
|
reset();
|
||||||
await getTreeselect();
|
await getTreeselect();
|
||||||
if (row != null) {
|
if (row != null) {
|
||||||
@ -255,10 +358,10 @@ const handleUpdate = async (row: ProductVO) => {
|
|||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '修改产品树';
|
dialog.title = '修改产品树';
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
productFormRef.value?.validate(async (valid: boolean) => {
|
productFormRef.value?.validate(async (valid: boolean) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
@ -272,18 +375,18 @@ const submitForm = () => {
|
|||||||
getList();
|
getList();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row: ProductVO) => {
|
const handleDelete = async (row: ProductVO) => {
|
||||||
await proxy?.$modal.confirm('是否确认删除产品树编号为"' + row.productId + '"的数据项?');
|
await proxy?.$modal.confirm('是否确认删除产品树编号为"' + row.productId + '"的数据项?');
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
await delProduct(row.productId).finally(() => loading.value = false);
|
await delProduct(row.productId).finally(() => loading.value = false);
|
||||||
await getList();
|
await getList();
|
||||||
proxy?.$modal.msgSuccess('删除成功');
|
proxy?.$modal.msgSuccess('删除成功');
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['mf:student:remove']">删除</el-button>
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['mf:student:remove']">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Top" @click="handleImport()" v-hasPermi="['mf:student:import']">导入</el-button>
|
||||||
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['mf:student:export']">导出</el-button>
|
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['mf:student:export']">导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -45,7 +48,7 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="编号" align="center" prop="studentId" v-if="false" />
|
<el-table-column label="编号" align="center" prop="studentId" v-if="true" />
|
||||||
<el-table-column label="学生名称" align="center" prop="studentName" />
|
<el-table-column label="学生名称" align="center" prop="studentName" />
|
||||||
<el-table-column label="年龄" align="center" prop="studentAge" />
|
<el-table-column label="年龄" align="center" prop="studentAge" />
|
||||||
<el-table-column label="爱好" align="center" prop="studentHobby">
|
<el-table-column label="爱好" align="center" prop="studentHobby">
|
||||||
@ -89,7 +92,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-card>
|
</el-card>
|
||||||
<!-- 添加或修改学生信息表对话框 -->
|
<!-- 添加或修改学生信息表对话框 -->
|
||||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="780px" append-to-body>
|
||||||
<el-form ref="studentFormRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="studentFormRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="学生名称" prop="studentName">
|
<el-form-item label="学生名称" prop="studentName">
|
||||||
<el-input v-model="form.studentName" placeholder="请输入学生名称" />
|
<el-input v-model="form.studentName" placeholder="请输入学生名称" />
|
||||||
@ -145,27 +148,87 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 导入对话框 -->
|
||||||
|
<el-dialog v-model="upload.open" :title="upload.title" width="400px" append-to-body>
|
||||||
|
<el-upload
|
||||||
|
ref="uploadRef"
|
||||||
|
:limit="1"
|
||||||
|
accept=".xlsx, .xls"
|
||||||
|
:headers="upload.headers"
|
||||||
|
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
||||||
|
:disabled="upload.isUploading"
|
||||||
|
:on-progress="handleFileUploadProgress"
|
||||||
|
:on-success="handleFileSuccess"
|
||||||
|
:auto-upload="false"
|
||||||
|
drag
|
||||||
|
>
|
||||||
|
<el-icon class="el-icon--upload">
|
||||||
|
<i-ep-upload-filled />
|
||||||
|
</el-icon>
|
||||||
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
|
<template #tip>
|
||||||
|
<div class="text-center el-upload__tip">
|
||||||
|
<div class="el-upload__tip">
|
||||||
|
<el-checkbox v-model="upload.updateSupport" />
|
||||||
|
是否更新已经存在的学生信息表数据
|
||||||
|
</div>
|
||||||
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
|
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline" @click="importTemplate">下载模板 </el-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitFileForm">确 定</el-button>
|
||||||
|
<el-button @click="upload.open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Student" lang="ts">
|
<script setup lang="ts">
|
||||||
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from '@/api/mf/student';
|
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from '@/api/mf/student';
|
||||||
import { StudentVO, StudentQuery, StudentForm } from '@/api/mf/student/types';
|
import { StudentVO, StudentQuery, StudentForm } from '@/api/mf/student/types';
|
||||||
|
import { globalHeaders } from '@/utils/request';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
const { sys_student_status, sys_user_gender, sys_student_hobby } = toRefs<any>(proxy?.useDict('sys_student_status', 'sys_user_gender', 'sys_student_hobby'));
|
const { sys_student_status, sys_user_gender, sys_student_hobby } = toRefs<any>(proxy?.useDict('sys_student_status', 'sys_user_gender', 'sys_student_hobby'));
|
||||||
|
|
||||||
|
// 表格数据
|
||||||
const studentList = ref<StudentVO[]>([]);
|
const studentList = ref<StudentVO[]>([]);
|
||||||
const buttonLoading = ref(false);
|
const buttonLoading = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
|
// 选中数组
|
||||||
const ids = ref<Array<string | number>>([]);
|
const ids = ref<Array<string | number>>([]);
|
||||||
|
// 非单个禁用
|
||||||
const single = ref(true);
|
const single = ref(true);
|
||||||
|
// 非多个禁用
|
||||||
const multiple = ref(true);
|
const multiple = ref(true);
|
||||||
|
// 总条数
|
||||||
const total = ref(0);
|
const total = ref(0);
|
||||||
|
|
||||||
const queryFormRef = ref<ElFormInstance>();
|
const queryFormRef = ref<ElFormInstance>();
|
||||||
const studentFormRef = ref<ElFormInstance>();
|
const studentFormRef = ref<ElFormInstance>();
|
||||||
|
const uploadRef = ref<ElUploadInstance>();
|
||||||
|
|
||||||
|
/*** 导入参数 */
|
||||||
|
const upload = reactive<ImportOption>({
|
||||||
|
// 是否显示弹出层(导入)
|
||||||
|
open: false,
|
||||||
|
// 弹出层标题(导入)
|
||||||
|
title: '',
|
||||||
|
// 是否禁用上传
|
||||||
|
isUploading: false,
|
||||||
|
// 是否更新已经存在的用户数据
|
||||||
|
updateSupport: 1,
|
||||||
|
// 设置上传的请求头部
|
||||||
|
headers: globalHeaders(),
|
||||||
|
// 上传的地址
|
||||||
|
url: import.meta.env.VITE_APP_BASE_API + '/mf/student/importData'
|
||||||
|
});
|
||||||
|
|
||||||
const dialog = reactive<DialogOption>({
|
const dialog = reactive<DialogOption>({
|
||||||
visible: false,
|
visible: false,
|
||||||
@ -260,17 +323,17 @@ const handleSelectionChange = (selection: StudentVO[]) => {
|
|||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
reset();
|
reset();
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "添加学生信息表";
|
dialog.title = '添加学生信息表';
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
const handleUpdate = async (row?: StudentVO) => {
|
const handleUpdate = async (row?: StudentVO) => {
|
||||||
reset();
|
reset();
|
||||||
const _studentId = row?.studentId || ids.value[0]
|
const _studentId = row?.studentId || ids.value[0];
|
||||||
const res = await getStudent(_studentId);
|
const res = await getStudent(_studentId);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = "修改学生信息表";
|
dialog.title = '修改学生信息表';
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
@ -279,11 +342,11 @@ const submitForm = () => {
|
|||||||
if (valid) {
|
if (valid) {
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.studentId) {
|
if (form.value.studentId) {
|
||||||
await updateStudent(form.value).finally(() => buttonLoading.value = false);
|
await updateStudent(form.value).finally(() => (buttonLoading.value = false));
|
||||||
} else {
|
} else {
|
||||||
await addStudent(form.value).finally(() => buttonLoading.value = false);
|
await addStudent(form.value).finally(() => (buttonLoading.value = false));
|
||||||
}
|
}
|
||||||
proxy?.$modal.msgSuccess("修改成功");
|
proxy?.$modal.msgSuccess('操作成功');
|
||||||
dialog.visible = false;
|
dialog.visible = false;
|
||||||
await getList();
|
await getList();
|
||||||
}
|
}
|
||||||
@ -299,6 +362,7 @@ const handleDelete = async (row?: StudentVO) => {
|
|||||||
await getList();
|
await getList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
const handleExport = () => {
|
const handleExport = () => {
|
||||||
proxy?.download('mf/student/export', {
|
proxy?.download('mf/student/export', {
|
||||||
@ -306,6 +370,37 @@ const handleExport = () => {
|
|||||||
}, `student_${new Date().getTime()}.xlsx`)
|
}, `student_${new Date().getTime()}.xlsx`)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 导入按钮操作 */
|
||||||
|
const handleImport = () => {
|
||||||
|
upload.title = '学生信息表导入';
|
||||||
|
upload.open = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 下载模板操作 */
|
||||||
|
const importTemplate = () => {
|
||||||
|
proxy?.download('mf/student/importTemplate', {}, `student_template.xlsx`);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**文件上传中处理 */
|
||||||
|
const handleFileUploadProgress = () => {
|
||||||
|
upload.isUploading = true;
|
||||||
|
};
|
||||||
|
/** 文件上传成功处理 */
|
||||||
|
const handleFileSuccess = (response: any, file: UploadFile) => {
|
||||||
|
upload.open = false;
|
||||||
|
upload.isUploading = false;
|
||||||
|
uploadRef.value?.handleRemove(file);
|
||||||
|
ElMessageBox.alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', {
|
||||||
|
dangerouslyUseHTMLString: true
|
||||||
|
});
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** 提交上传文件 */
|
||||||
|
function submitFileForm() {
|
||||||
|
uploadRef.value?.submit();
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
9
src/views/monitor/easyretry/index.vue
Normal file
9
src/views/monitor/easyretry/index.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<i-frame v-model:src="url"></i-frame>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
const url = ref(import.meta.env.VITE_APP_EASYRETRY_ADMIN);
|
||||||
|
</script>
|
@ -63,7 +63,7 @@ import { to } from 'await-to-js';
|
|||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const registerForm = ref<RegisterForm>({
|
const registerForm = ref<RegisterForm>({
|
||||||
tenantId: '',
|
tenantId: 1,
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
confirmPassword: '',
|
confirmPassword: '',
|
||||||
@ -91,7 +91,8 @@ const registerRules: ElFormRules = {
|
|||||||
],
|
],
|
||||||
password: [
|
password: [
|
||||||
{ required: true, trigger: 'blur', message: '请输入您的密码' },
|
{ required: true, trigger: 'blur', message: '请输入您的密码' },
|
||||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
|
||||||
|
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, trigger: 'blur', message: '请再次输入您的密码' },
|
{ required: true, trigger: 'blur', message: '请再次输入您的密码' },
|
||||||
|
@ -1,21 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
:leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
||||||
<div v-show="showSearch" class="mb-[10px]">
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="68px">
|
||||||
<el-form-item label="文件名" prop="fileName">
|
<el-form-item label="文件名" prop="fileName">
|
||||||
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable style="width: 200px"
|
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable style="width: 200px" @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="原名" prop="originalName">
|
<el-form-item label="原名" prop="originalName">
|
||||||
<el-input v-model="queryParams.originalName" placeholder="请输入原名" clearable style="width: 200px"
|
<el-input v-model="queryParams.originalName" placeholder="请输入原名" clearable style="width: 200px" @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="文件后缀" prop="fileSuffix">
|
<el-form-item label="文件后缀" prop="fileSuffix">
|
||||||
<el-input v-model="queryParams.fileSuffix" placeholder="请输入文件后缀" clearable style="width: 200px"
|
<el-input v-model="queryParams.fileSuffix" placeholder="请输入文件后缀" clearable style="width: 200px" @keyup.enter="handleQuery" />
|
||||||
@keyup.enter="handleQuery" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间">
|
<el-form-item label="创建时间">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
@ -150,6 +146,7 @@
|
|||||||
import { listOss, delOss } from '@/api/system/oss';
|
import { listOss, delOss } from '@/api/system/oss';
|
||||||
import ImagePreview from '@/components/ImagePreview/index.vue';
|
import ImagePreview from '@/components/ImagePreview/index.vue';
|
||||||
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
|
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
|
||||||
|
import { parseTime } from '@/utils/ruoyi';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
@ -214,11 +211,10 @@ const getList = async () => {
|
|||||||
showTable.value = true;
|
showTable.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
function checkFileSuffix(fileSuffix: string[]) {
|
function checkFileSuffix(fileSuffix: string | string[]) {
|
||||||
let arr = ['png', 'jpg', 'jpeg'];
|
const arr = [".png", ".jpg", ".jpeg"];
|
||||||
return arr.some((type) => {
|
const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
|
||||||
return fileSuffix.indexOf(type) > -1;
|
return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
:show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true" />
|
||||||
<el-table-column v-if="columns[2].visible" key="nickName" label="用户昵称" align="center" prop="nickName"
|
<el-table-column v-if="columns[2].visible" key="nickName" label="用户昵称" align="center" prop="nickName"
|
||||||
:show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true" />
|
||||||
<el-table-column v-if="columns[3].visible" key="deptName" label="部门" align="center" prop="deptName"
|
<el-table-column v-if="columns[3].visible" key="deptName" label="部门" align="center" prop="dept.deptName"
|
||||||
:show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true" />
|
||||||
<el-table-column v-if="columns[4].visible" key="phonenumber" label="手机号码" align="center"
|
<el-table-column v-if="columns[4].visible" key="phonenumber" label="手机号码" align="center"
|
||||||
prop="phonenumber" width="120" />
|
prop="phonenumber" width="120" />
|
||||||
@ -425,7 +425,8 @@ const initData: PageData<UserForm, UserQuery> = {
|
|||||||
max: 20,
|
max: 20,
|
||||||
message: '用户密码长度必须介于 5 和 20 之间',
|
message: '用户密码长度必须介于 5 和 20 之间',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
},
|
||||||
|
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
||||||
],
|
],
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
@ -539,7 +540,12 @@ const handleResetPwd = async (row: UserVO) => {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
inputPattern: /^.{5,20}$/,
|
inputPattern: /^.{5,20}$/,
|
||||||
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间'
|
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间',
|
||||||
|
inputValidator: (value) => {
|
||||||
|
if (/<|>|"|'|\||\\/.test(value)) {
|
||||||
|
return "不能包含非法字符:< > \" ' \\\ |"
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
if (!err && res) {
|
if (!err && res) {
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<svg-icon icon-class="tree" />所属部门
|
<svg-icon icon-class="tree" />所属部门
|
||||||
<div v-if="state.user.deptName" class="pull-right">{{ state.user.deptName }} / {{ state.postGroup }}</div>
|
<div v-if="state.user.dept" class="pull-right">{{ state.user.dept?.deptName }} / {{ state.postGroup }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<svg-icon icon-class="peoples" />所属角色
|
<svg-icon icon-class="peoples" />所属角色
|
||||||
|
@ -44,7 +44,8 @@ const rules = ref({
|
|||||||
max: 20,
|
max: 20,
|
||||||
message: '长度在 6 到 20 个字符',
|
message: '长度在 6 到 20 个字符',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
},
|
||||||
|
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
||||||
],
|
],
|
||||||
confirmPassword: [
|
confirmPassword: [
|
||||||
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
||||||
|
@ -182,7 +182,7 @@ const close = () => {
|
|||||||
proxy?.$tab.closeOpenPage(obj);
|
proxy?.$tab.closeOpenPage(obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
onActivated(async ()=>{
|
||||||
const tableId = route.params && (route.params.tableId as string);
|
const tableId = route.params && (route.params.tableId as string);
|
||||||
if (tableId) {
|
if (tableId) {
|
||||||
// 获取表详细信息
|
// 获取表详细信息
|
||||||
@ -194,5 +194,5 @@ const close = () => {
|
|||||||
const response = await getDictOptionselect();
|
const response = await getDictOptionselect();
|
||||||
dictOptions.value = response.data;
|
dictOptions.value = response.data;
|
||||||
}
|
}
|
||||||
})();
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
<el-select v-model="infoForm.tplCategory" @change="tplSelectChange">
|
<el-select v-model="infoForm.tplCategory" @change="tplSelectChange">
|
||||||
<el-option label="单表(增删改查)" value="crud" />
|
<el-option label="单表(增删改查)" value="crud" />
|
||||||
<el-option label="树表(增删改查)" value="tree" />
|
<el-option label="树表(增删改查)" value="tree" />
|
||||||
|
<el-option label="主子表(增删改查)" value="sub" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -94,7 +95,6 @@
|
|||||||
<el-radio v-model="infoForm.genType" label="1">自定义路径</el-radio>
|
<el-radio v-model="infoForm.genType" label="1">自定义路径</el-radio>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col v-if="infoForm.genType == '1'" :span="24">
|
<el-col v-if="infoForm.genType == '1'" :span="24">
|
||||||
<el-form-item prop="genPath">
|
<el-form-item prop="genPath">
|
||||||
<template #label>
|
<template #label>
|
||||||
@ -120,6 +120,14 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="number" prop="editColumns" class="label-right-align">
|
||||||
|
<template #label>编辑页列数</template>
|
||||||
|
<el-input-number v-model="infoForm.editColumns" class="full-width-input" controls-position="right"
|
||||||
|
:min="1" :max="4" :precision="0" :step="1"></el-input-number>
|
||||||
|
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<template v-if="info.tplCategory == 'tree'">
|
<template v-if="info.tplCategory == 'tree'">
|
||||||
|
Loading…
Reference in New Issue
Block a user