Compare commits

...

28 Commits

Author SHA1 Message Date
数据小王子
5683c89c0e 完善上传图片组件:编辑图片报错问题,感谢@秦白起 2024-05-07 10:40:11 +08:00
数据小王子
e19be90529
!4 代码生成页面的编辑页列数允许多列
Merge pull request !4 from 晨曦/0416
2024-04-16 12:35:45 +00:00
晨曦
ba1a2279f8 编辑页允许多列 2024-04-16 17:58:03 +08:00
数据小王子
7f8bec5bfc 演示模块增加导入功能 2024-04-12 21:30:40 +08:00
数据小王子
09a3c478ed
!2 增加动态加密,dockerfile部署文件
Merge pull request !2 from Duke_yzl/master
2024-04-09 00:28:45 +00:00
yuzl6
cac8820983 修改动态请求加密,增加dockerfile部署文件 2024-04-08 22:28:24 +08:00
数据小王子
dd072c51cb 引入另一个任务调度框架:EasyRetry 2024-04-08 21:14:39 +08:00
数据小王子
403372207c 依赖升级 2024-04-08 14:34:14 +08:00
数据小王子
d3e71c0855
!1 代码生成模块的编辑功能编辑问题修复
Merge pull request !1 from eonie/fix-code-gen-edit
2024-04-04 02:49:35 +00:00
jiawei
4baabd03c8 fix: #I9CWNS 前端缓存导致代码生成功能只能修改一次 2024-04-02 10:49:07 +08:00
数据小王子
a859ba4778 代码生成添加主子表选项 2024-03-24 17:26:25 +08:00
数据小王子
1882be13d3 优化 支持全局开启或关闭接口加密功能 2024-03-07 11:25:20 +08:00
数据小王子
8036aa44a3 优化 密码校验策略增加非法字符限制 2024-03-07 10:49:44 +08:00
数据小王子
aa5d5abdf5 修改 el-dialog 默认点击遮照为不关闭 2024-03-07 10:33:20 +08:00
数据小王子
403292b771 导入parseTime 2024-03-07 10:18:36 +08:00
数据小王子
91c843f098 修复文件预览大写后缀不展示的问题 2024-03-07 10:14:28 +08:00
数据小王子
81bfda2564 完善useDialog.ts 2024-03-07 09:02:14 +08:00
数据小王子
d47ce6d41f 增加全局用户选择组件 2024-03-05 17:22:26 +08:00
数据小王子
d9082f6f41 增加全局角色选择组件 2024-03-05 17:18:20 +08:00
数据小王子
d53d02a4d7 增加useDialog 2024-03-05 17:14:53 +08:00
数据小王子
9e9773fa82 引入vxe-table依赖支持 2024-03-05 16:50:16 +08:00
数据小王子
0112faf3ba 图片上传组件增加压缩功能支持,可自行开关 2024-03-05 16:46:22 +08:00
数据小王子
ce275d9590 修复DictTag错误 2024-03-05 16:39:19 +08:00
数据小王子
7fb42fd344 依赖升级 2024-03-05 16:35:37 +08:00
数据小王子
17628d285b 修复用户模块的部门名称显示问题 2024-03-05 16:00:21 +08:00
数据小王子
5b437124bc 修复eslint 警告 2024-03-05 15:38:41 +08:00
数据小王子
1c7271ce12 依赖升级 2024-03-05 14:54:30 +08:00
数据小王子
b842e849a5 修改版本号:V5.2.0-SNAPSHOT 2024-02-23 15:22:43 +08:00
37 changed files with 1437 additions and 543 deletions

View File

@ -16,8 +16,14 @@ VITE_APP_MONITRO_ADMIN = 'http://localhost:9090/admin/applications'
# powerjob 控制台地址
VITE_APP_POWERJOB_ADMIN = 'http://localhost:7700/'
# easyretry 控制台地址
VITE_APP_EASYRETRY_ADMIN = 'http://localhost:8800/easy-retry'
VITE_APP_PORT = 80
VITE_APP_ENCRYPT_HEADER = 'encrypt-key'
# 接口加密功能开关(如需关闭 后端也必须对应关闭)
VITE_APP_ENCRYPT = true
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换

View File

@ -13,6 +13,9 @@ VITE_APP_MONITRO_ADMIN = '/admin/applications'
# powerjob 控制台地址
VITE_APP_POWERJOB_ADMIN = '/powerjob'
# easyretry 控制台地址
VITE_APP_EASYRETRY_ADMIN = '/easy-retry'
# 生产环境
VITE_APP_BASE_API = '/prod-api'
@ -21,6 +24,9 @@ VITE_BUILD_COMPRESS = gzip
VITE_APP_PORT = 80
VITE_APP_ENCRYPT_HEADER = 'encrypt-key'
# 接口加密功能开关(如需关闭 后端也必须对应关闭)
VITE_APP_ENCRYPT = true
# 接口加密传输 RSA 公钥与后端解密私钥对应 如更换需前后端一同更换
VITE_APP_RSA_PUBLIC_KEY = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
# 接口响应解密 RSA 私钥与后端加密公钥对应 如更换需前后端一同更换

2
.gitignore vendored
View File

@ -24,6 +24,8 @@ package-lock.json
yarn.lock
pnpm-lock.yaml
*开发日志.txt
# 编译生成的文件
auto-imports.d.ts
components.d.ts

9
Dockerfile Normal file
View 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/

View File

@ -1,7 +1,7 @@
<p align="center">
<img alt="logo" src="https://gitee.com/dataprince/ruoyi-flex/raw/master/image/ruoyi-flex-logo.png">
</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>

29
default.conf Normal file
View 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;
}
}

View File

@ -1,6 +1,6 @@
{
"name": "ruoyiflex-elementplus-ts",
"version": "5.1.0",
"version": "5.2.0-SNAPSHOT",
"description": "Ruoyi-Flex多租户管理系统",
"author": "数据小王子",
"license": "MIT",
@ -24,12 +24,14 @@
"@vueuse/core": "10.7.2",
"animate.css": "4.1.1",
"await-to-js": "3.0.0",
"axios": "1.6.5",
"axios": "1.6.8",
"crypto-js": "4.2.0",
"echarts": "5.4.3",
"element-plus": "2.5.3",
"echarts": "5.5.0",
"element-plus": "2.6.2",
"encryptlong": "^3.1.4",
"file-saver": "2.0.5",
"fuse.js": "7.0.0",
"image-conversion": "^2.1.1",
"js-cookie": "3.0.5",
"jsencrypt": "3.3.2",
"nprogress": "0.2.0",
@ -38,53 +40,54 @@
"pinia": "2.1.7",
"screenfull": "6.0.2",
"vform3-builds": "3.0.10",
"vue": "3.4.13",
"vue": "3.4.21",
"vue-cropper": "1.1.1",
"vue-i18n": "9.9.0",
"vue-router": "4.2.5",
"vue-types": "5.1.1"
"vue-i18n": "9.10.2",
"vue-router": "4.3.0",
"vue-types": "5.1.1",
"vxe-table": "4.5.21"
},
"devDependencies": {
"@iconify/json": "2.2.168",
"@intlify/unplugin-vue-i18n": "2.0.0",
"@types/crypto-js": "4.2.1",
"@iconify/json": "2.2.193",
"@intlify/unplugin-vue-i18n": "3.0.1",
"@types/crypto-js": "4.2.2",
"@types/file-saver": "2.0.7",
"@types/js-cookie": "3.0.6",
"@types/node": "18.14.2",
"@types/node": "18.18.2",
"@types/nprogress": "0.2.3",
"@types/path-browserify": "1.0.2",
"@typescript-eslint/eslint-plugin": "6.18.1",
"@typescript-eslint/parser": "6.18.1",
"@unocss/preset-attributify": "0.58.3",
"@unocss/preset-icons": "0.58.3",
"@unocss/preset-uno": "0.58.3",
"@vue/compiler-sfc": "3.4.13",
"@typescript-eslint/eslint-plugin": "7.3.1",
"@typescript-eslint/parser": "7.3.1",
"@unocss/preset-attributify": "0.58.6",
"@unocss/preset-icons": "0.58.6",
"@unocss/preset-uno": "0.58.6",
"@vue/compiler-sfc": "3.4.21",
"autoprefixer": "10.4.18",
"@vitejs/plugin-vue": "5.0.3",
"autoprefixer": "10.4.16",
"eslint": "8.56.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-define-config": "2.1.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.20.1",
"eslint-plugin-vue": "9.23.0",
"fast-glob": "3.3.2",
"husky": "8.0.3",
"postcss": "8.4.33",
"prettier": "3.2.2",
"sass": "1.69.7",
"typescript": "5.3.3",
"unocss": "0.58.3",
"unplugin-auto-import": "0.17.3",
"unplugin-icons": "0.18.2",
"husky": "9.0.11",
"postcss": "8.4.36",
"prettier": "3.2.5",
"sass": "1.72.0",
"typescript": "5.4.3",
"unocss": "0.58.6",
"unplugin-auto-import": "0.17.5",
"unplugin-icons": "0.18.5",
"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-svg-icons": "2.0.1",
"vitest": "1.2.0",
"vue-eslint-parser": "9.4.0",
"vue-tsc": "1.8.27",
"vite": "5.0.12"
"vite": "5.2.6",
"vitest": "1.4.0",
"vue-eslint-parser": "9.4.2",
"vue-tsc": "2.0.6"
}
}

18
src/api/genKeyPair.ts Normal file
View 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);
});
}

View File

@ -2,9 +2,11 @@ import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { LoginData, LoginResult, VerifyCodeResult, TenantInfo } from './types';
import { UserInfo } from '@/api/system/user/types';
import { genKeyPair } from '@/api/genKeyPair';
// pc端固定客户端授权id
const clientId = import.meta.env.VITE_APP_CLIENT_ID;
const encryptHeader = import.meta.env.VITE_APP_ENCRYPT_HEADER;
/**
* @param data {LoginData}
@ -16,14 +18,26 @@ export function login(data: LoginData): AxiosPromise<LoginResult> {
clientId: data.clientId || clientId,
grantType: data.grantType || 'password'
};
return request({
return new Promise((resolve, reject) => {
genKeyPair((uuid, public_key) => {
request({
url: '/auth/login',
headers: {
isToken: false,
isEncrypt: true
isEncrypt: true,
[encryptHeader]: uuid,
publicKey: public_key
},
method: 'post',
data: params
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
});
}
@ -34,14 +48,26 @@ export function register(data: any) {
clientId: clientId,
grantType: 'password'
};
return request({
return new Promise((resolve, reject) => {
genKeyPair((uuid, public_key) => {
request({
url: '/auth/register',
headers: {
isToken: false,
isEncrypt: true
isEncrypt: true,
[encryptHeader]: uuid,
publicKey: public_key
},
method: 'post',
data: params
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
});
}

View File

@ -1,8 +1,8 @@
export interface ProductVO extends BaseEntity {
/**
* id
*
*/
parentId: string | number;
productId: string | number;
/**
*
@ -19,20 +19,20 @@ export interface ProductVO extends BaseEntity {
*/
status: string;
/**
*
*/
children: ProductVO[];
}
/**
*
*/
children: ProductVO[];
}
export interface ProductForm {
export interface ProductForm {
/**
* id
*
*/
productId?: string | number;
/**
* id
*
*/
parentId?: string | number;
@ -56,9 +56,9 @@ export interface ProductForm {
*/
version?: number;
}
}
export interface ProductQuery {
export interface ProductQuery {
/**
*
*/
@ -73,4 +73,4 @@ export interface ProductQuery {
*
*/
params?: any;
}
}

View File

@ -1,4 +1,9 @@
export interface StudentVO extends BaseEntity {
/**
*
*/
studentId: string | number;
/**
*
*/
@ -29,9 +34,9 @@ export interface StudentVO extends BaseEntity {
*/
studentBirthday: string;
}
}
export interface StudentForm {
export interface StudentForm {
/**
*
*/
@ -72,10 +77,9 @@ export interface StudentForm {
*/
version?: number;
}
export interface StudentQuery extends PageQuery {
}
export interface StudentQuery extends PageQuery {
/**
*
*/
@ -90,7 +94,4 @@ export interface StudentQuery extends PageQuery {
*
*/
params?: any;
}
}

View File

@ -1,6 +1,8 @@
import request from '@/utils/request';
import { TenantForm, TenantQuery, TenantVO } from './types';
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[]> {
@ -21,13 +23,25 @@ export function getTenant(tenantId: string | number): AxiosPromise<TenantVO> {
// 新增租户
export function addTenant(data: TenantForm) {
return request({
return new Promise((resolve, reject) => {
genKeyPair((uuid, public_key) => {
request({
url: '/system/tenant',
method: 'post',
headers: {
isEncrypt: true
isEncrypt: true,
[encryptHeader]: uuid,
publicKey: public_key
},
data: data
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
});
}

View File

@ -4,6 +4,8 @@ import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserForm, UserQuery, UserVO, UserInfoVO } from './types';
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,
password
};
return request({
return new Promise((resolve, reject) => {
genKeyPair((uuid, public_key) => {
request({
url: '/system/user/resetPwd',
method: 'put',
headers: {
isEncrypt: true
isEncrypt: true,
[encryptHeader]: uuid,
publicKey: public_key
},
data: data
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
});
};
@ -132,13 +146,25 @@ export const updateUserPwd = (oldPassword: string, newPassword: string) => {
oldPassword,
newPassword
};
return request({
return new Promise((resolve, reject) => {
genKeyPair((uuid, public_key) => {
request({
url: '/system/user/profile/updatePwd',
method: 'put',
headers: {
isEncrypt: true
isEncrypt: true,
[encryptHeader]: uuid,
publicKey: public_key
},
data: data
})
.then((res) => {
resolve(res);
})
.catch((error) => {
reject(error);
});
});
});
};

View File

@ -25,6 +25,7 @@ export interface TableVO extends BaseEntity {
parentMenuName?: any;
tree: boolean;
crud: boolean;
editColumns: number;
}
export interface TableQuery extends PageQuery {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 439 KiB

View File

@ -50,12 +50,13 @@ const values = computed(() => {
const unmatch = computed(() => {
if (props.options?.length == 0 || props.value === '' || props.value === null || typeof props.value === 'undefined') return false;
//
let unmatch = false; //
values.value.forEach((item) => {
if (!props.options.some((v) => v.value === item)) {
return true; // true
unmatch = true; // true
}
});
return false; //
return unmatch; //
});
const unmatchArray = computed(() => {

View File

@ -44,6 +44,7 @@ import { listByIds, delOss } from '@/api/system/oss';
import { OssVO } from '@/api/system/oss/types';
import { propTypes } from '@/utils/propTypes';
import { globalHeaders } from '@/utils/request';
import { compressAccurately } from 'image-conversion';
const props = defineProps({
modelValue: {
@ -60,7 +61,14 @@ const props = defineProps({
isShowTip: {
type: Boolean,
default: true
}
},
//
compressSupport: {
type: Boolean,
default: false
},
// KB300KB300KB
compressTargetSize: propTypes.number.def(300)
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -89,7 +97,9 @@ watch(
list = val as OssVO[];
} else {
const res = await listByIds(val);
list = res.data;
//list = res.data;
// val OssVO
list = [{ name: val, url: val }];
}
//
fileList.value = list.map((item) => {
@ -138,8 +148,16 @@ const handleBeforeUpload = (file: any) => {
return false;
}
}
//
if (props.compressSupport && file.size / 1024 > props.compressTargetSize) {
proxy?.$modal.loading('正在上传图片,请稍候...');
number.value++;
return compressAccurately(file, props.compressTargetSize);
} else {
proxy?.$modal.loading('正在上传图片,请稍候...');
number.value++;
}
};
//

View 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>

View 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' // watchEffectDOMDOM
}
);
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
View 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
};
};

View File

@ -25,12 +25,24 @@ import './permission';
// 国际化
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);
app.use(ElementIcons);
app.use(router);
app.use(store);
app.use(i18n);
app.use(VXETable);
app.use(plugins);
// 自定义指令
directive(app);

2
src/types/env.d.ts vendored
View File

@ -14,9 +14,11 @@ interface ImportMetaEnv {
VITE_APP_MONITRO_ADMIN: string;
VITE_APP_POWERJOB_ADMIN: string;
VITE_APP_ENV: string;
VITE_APP_ENCRYPT: string;
VITE_APP_RSA_PUBLIC_KEY: string;
VITE_APP_RSA_PRIVATE_KEY: string;
VITE_APP_CLIENT_ID: string;
VITE_APP_ENCRYPT_HEADER: string;
VITE_APP_WEBSOCKET: string;
}
interface ImportMeta {

View File

@ -69,6 +69,7 @@ declare global {
/** 乐观锁 */
version?: number;
createBy?: any;
createDept?: any;
createTime?: string;
updateBy?: any;
updateTime?: any;

View File

@ -1,16 +1,14 @@
import JSEncrypt from 'jsencrypt';
import JSEncrypt from 'encryptlong';
// 密钥对生成 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;
// 加密
export const encrypt = (txt: string) => {
export const encrypt = (txt: string, publicKey: string) => {
const encryptor = new JSEncrypt();
encryptor.setPublicKey(publicKey); // 设置公钥
return encryptor.encrypt(txt); // 对数据进行加密
return encryptor.encryptLong(txt); // 对数据进行加密
};
// 解密

View File

@ -10,6 +10,7 @@ import FileSaver from 'file-saver';
import { getLanguage } from '@/lang';
import { encryptBase64, encryptWithAes, generateAesKey, decryptWithAes, decryptBase64 } from '@/utils/crypto';
import { encrypt, decrypt } from '@/utils/jsencrypt';
import { ElLoading, ElMessage, ElMessageBox, ElNotification } from 'element-plus';
const encryptHeader = 'encrypt-key';
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')) {
// 生成一个 AES 密钥
const aesKey = generateAesKey();
config.headers[encryptHeader] = encrypt(encryptBase64(aesKey));
config.data = typeof config.data === 'object' ? encryptWithAes(JSON.stringify(config.data), aesKey) : encryptWithAes(config.data, aesKey);
// 根据 AES 密钥进行加密
const publicKey = (config.headers || {}).publicKey;
console.log('publicKey', publicKey);
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
if (config.data instanceof FormData) {
@ -97,6 +104,7 @@ service.interceptors.request.use(
// 响应拦截器
service.interceptors.response.use(
(res: AxiosResponse) => {
if (import.meta.env.VITE_APP_ENCRYPT === 'true') {
// 加密后的 AES 秘钥
const keyStr = res.headers[encryptHeader];
// 加密
@ -111,6 +119,7 @@ service.interceptors.response.use(
// 将结果 (得到的是 JSON 字符串) 转为 JSON
res.data = JSON.parse(decryptData);
}
}
// 未设置状态码则默认成功状态
const code = res.data.code || HttpStatus.SUCCESS;
// 获取错误信息

View File

@ -5,7 +5,7 @@
<p align="center">
<img alt="logo" src="@/assets/images/ruoyi-flex-logo.png">
</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是基于JDK21Spring Boot V3.2.X+平台 前后端分离的Java快速开发框架</h2>
</el-col>
</el-row>
@ -299,7 +299,7 @@
</template>
<script setup name="Index" lang="ts">
const version = ref('5.1.0')
const version = ref('5.2.0-SNAPSHOT')
const goTarget = (url: string) => {
window.open(url, '__blank');
};

View File

@ -73,7 +73,7 @@ const userStore = useUserStore();
const router = useRouter();
const loginForm = ref<LoginData>({
tenantId: 0,
tenantId: 1,
username: 'superadmin',
password: 'admin123',
rememberMe: false,

View File

@ -30,6 +30,12 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd()" v-hasPermi="['mf:product:add']">新增</el-button>
</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-button type="info" plain icon="Sort" @click="handleToggleExpandAll">展开/折叠</el-button>
</el-col>
@ -69,13 +75,13 @@
<!-- 添加或修改产品树对话框 -->
<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-item label="父产品id" prop="parentId">
<el-form-item label="上级编号" prop="parentId">
<el-tree-select
v-model="form.parentId"
:data="productOptions"
:props="{ value: 'productId', label: 'productName', children: 'children' }"
value-key="productId"
placeholder="请选择父产品id"
placeholder="请选择上级编号"
check-strictly
/>
</el-form-item>
@ -105,50 +111,105 @@
</div>
</template>
</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>仅允许导入xlsxlsx格式文件</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>
</template>
<script setup name="Product" lang="ts">
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mf/product";
import { ProductVO, ProductQuery, ProductForm } from '@/api/mf/product/types';
<script setup lang="ts">
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mf/product";
import { ProductVO, ProductQuery, ProductForm } from '@/api/mf/product/types';
import { globalHeaders } from '@/utils/request';
type ProductOption = {
type ProductOption = {
productId: number;
productName: string;
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 productOptions = ref<ProductOption[]>([]);
const buttonLoading = ref(false);
const showSearch = ref(true);
const isExpandAll = ref(true);
const loading = ref(false);
const productList = ref<ProductVO[]>([]);
const productOptions = ref<ProductOption[]>([]);
const buttonLoading = ref(false);
const showSearch = ref(true);
const isExpandAll = ref(true);
const loading = ref(false);
const queryFormRef = ref<ElFormInstance>();
const productFormRef = ref<ElFormInstance>();
const productTableRef = ref<ElTableInstance>()
const queryFormRef = ref<ElFormInstance>();
const productFormRef = ref<ElFormInstance>();
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,
title: ''
});
});
const initFormData: ProductForm = {
const initFormData: ProductForm = {
productId: undefined,
parentId: undefined,
productName: undefined,
orderNum: undefined,
status: undefined,
version: 0,
};
};
const data = reactive<PageData<ProductForm, ProductQuery>>({
const data = reactive<PageData<ProductForm, ProductQuery>>({
form: {...initFormData},
queryParams: {
productName: undefined,
@ -158,7 +219,7 @@ const data = reactive<PageData<ProductForm, ProductQuery>>({
},
rules: {
parentId: [
{ required: true, message: "父产品id不能为空", trigger: "blur" }
{ required: true, message: "上级编号不能为空", trigger: "blur" }
],
productName: [
{ required: true, message: "产品名称不能为空", trigger: "blur" }
@ -170,12 +231,12 @@ const data = reactive<PageData<ProductForm, ProductQuery>>({
{ 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;
const res = await listProduct(queryParams.value);
const data = proxy?.handleTree<ProductVO>(res.data, 'productId', 'parentId');
@ -183,42 +244,42 @@ const getList = async () => {
productList.value = data;
loading.value = false;
}
};
};
/** 查询产品树下拉树结构 */
const getTreeselect = async () => {
/** 查询产品树下拉树结构 */
const getTreeselect = async () => {
const res = await listProduct();
productOptions.value = [];
const data: ProductOption = { productId: 0, productName: '顶级节点', children: [] };
data.children = proxy?.handleTree<ProductOption>(res.data, 'productId', 'parentId');
productOptions.value.push(data);
};
};
//
const cancel = () => {
//
const cancel = () => {
reset();
dialog.visible = false;
};
};
//
const reset = () => {
//
const reset = () => {
form.value = {...initFormData}
productFormRef.value?.resetFields();
};
};
/** 搜索按钮操作 */
const handleQuery = () => {
/** 搜索按钮操作 */
const handleQuery = () => {
getList();
};
};
/** 重置按钮操作 */
const resetQuery = () => {
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
};
};
/** 新增按钮操作 */
const handleAdd = (row?: ProductVO) => {
/** 新增按钮操作 */
const handleAdd = (row?: ProductVO) => {
reset();
getTreeselect();
if (row != null && row.productId) {
@ -228,24 +289,66 @@ const handleAdd = (row?: ProductVO) => {
}
dialog.visible = true;
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;
toggleExpandAll(productList.value, isExpandAll.value)
};
};
/** 展开/折叠操作 */
const toggleExpandAll = (data: ProductVO[], status: boolean) => {
/** 展开/折叠操作 */
const toggleExpandAll = (data: ProductVO[], status: boolean) => {
data.forEach((item) => {
productTableRef.value?.toggleRowExpansion(item, status)
if (item.children && item.children.length > 0) toggleExpandAll(item.children, status)
})
};
};
/** 修改按钮操作 */
const handleUpdate = async (row: ProductVO) => {
/** 修改按钮操作 */
const handleUpdate = async (row: ProductVO) => {
reset();
await getTreeselect();
if (row != null) {
@ -255,10 +358,10 @@ const handleUpdate = async (row: ProductVO) => {
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = '修改产品树';
};
};
/** 提交按钮 */
const submitForm = () => {
/** 提交按钮 */
const submitForm = () => {
productFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
@ -272,18 +375,18 @@ const submitForm = () => {
getList();
}
});
};
};
/** 删除按钮操作 */
const handleDelete = async (row: ProductVO) => {
/** 删除按钮操作 */
const handleDelete = async (row: ProductVO) => {
await proxy?.$modal.confirm('是否确认删除产品树编号为"' + row.productId + '"的数据项?');
loading.value = true;
await delProduct(row.productId).finally(() => loading.value = false);
await getList();
proxy?.$modal.msgSuccess('删除成功');
};
};
onMounted(() => {
onMounted(() => {
getList();
});
});
</script>

View File

@ -36,6 +36,9 @@
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['mf:student:remove']">删除</el-button>
</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-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['mf:student:export']">导出</el-button>
</el-col>
@ -45,7 +48,7 @@
<el-table v-loading="loading" :data="studentList" @selection-change="handleSelectionChange">
<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="studentAge" />
<el-table-column label="爱好" align="center" prop="studentHobby">
@ -89,7 +92,7 @@
/>
</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-item label="学生名称" prop="studentName">
<el-input v-model="form.studentName" placeholder="请输入学生名称" />
@ -145,27 +148,87 @@
</div>
</template>
</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>仅允许导入xlsxlsx格式文件</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>
</template>
<script setup name="Student" lang="ts">
<script setup lang="ts">
import { listStudent, getStudent, delStudent, addStudent, updateStudent } from '@/api/mf/student';
import { StudentVO, StudentQuery, StudentForm } from '@/api/mf/student/types';
import { globalHeaders } from '@/utils/request';
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 studentList = ref<StudentVO[]>([]);
const buttonLoading = ref(false);
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 queryFormRef = 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>({
visible: false,
@ -260,17 +323,17 @@ const handleSelectionChange = (selection: StudentVO[]) => {
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = "添加学生信息表";
dialog.title = '添加学生信息表';
};
/** 修改按钮操作 */
const handleUpdate = async (row?: StudentVO) => {
reset();
const _studentId = row?.studentId || ids.value[0]
const _studentId = row?.studentId || ids.value[0];
const res = await getStudent(_studentId);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = "修改学生信息表";
dialog.title = '修改学生信息表';
};
/** 提交按钮 */
@ -279,11 +342,11 @@ const submitForm = () => {
if (valid) {
buttonLoading.value = true;
if (form.value.studentId) {
await updateStudent(form.value).finally(() => buttonLoading.value = false);
await updateStudent(form.value).finally(() => (buttonLoading.value = false));
} 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;
await getList();
}
@ -299,6 +362,7 @@ const handleDelete = async (row?: StudentVO) => {
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download('mf/student/export', {
@ -306,6 +370,37 @@ const handleExport = () => {
}, `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(() => {
getList();
});

View 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>

View File

@ -63,7 +63,7 @@ import { to } from 'await-to-js';
const router = useRouter();
const registerForm = ref<RegisterForm>({
tenantId: '',
tenantId: 1,
username: '',
password: '',
confirmPassword: '',
@ -91,7 +91,8 @@ const registerRules: ElFormRules = {
],
password: [
{ 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: [
{ required: true, trigger: 'blur', message: '请再次输入您的密码' },

View File

@ -1,21 +1,17 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter"
:leave-active-class="proxy?.animate.searchAnimate.leave">
<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="fileName">
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable style="width: 200px"
@keyup.enter="handleQuery" />
<el-input v-model="queryParams.fileName" placeholder="请输入文件名" clearable style="width: 200px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="原名" prop="originalName">
<el-input v-model="queryParams.originalName" placeholder="请输入原名" clearable style="width: 200px"
@keyup.enter="handleQuery" />
<el-input v-model="queryParams.originalName" placeholder="请输入原名" clearable style="width: 200px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="文件后缀" prop="fileSuffix">
<el-input v-model="queryParams.fileSuffix" placeholder="请输入文件后缀" clearable style="width: 200px"
@keyup.enter="handleQuery" />
<el-input v-model="queryParams.fileSuffix" placeholder="请输入文件后缀" clearable style="width: 200px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
@ -150,6 +146,7 @@
import { listOss, delOss } from '@/api/system/oss';
import ImagePreview from '@/components/ImagePreview/index.vue';
import { OssForm, OssQuery, OssVO } from '@/api/system/oss/types';
import { parseTime } from '@/utils/ruoyi';
const router = useRouter();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -214,11 +211,10 @@ const getList = async () => {
showTable.value = true;
};
function checkFileSuffix(fileSuffix: string[]) {
let arr = ['png', 'jpg', 'jpeg'];
return arr.some((type) => {
return fileSuffix.indexOf(type) > -1;
});
function checkFileSuffix(fileSuffix: string | string[]) {
const arr = [".png", ".jpg", ".jpeg"];
const suffixArray = Array.isArray(fileSuffix) ? fileSuffix : [fileSuffix];
return suffixArray.some(suffix => arr.includes(suffix.toLowerCase()));
}
/** 取消按钮 */

View File

@ -114,7 +114,7 @@
:show-overflow-tooltip="true" />
<el-table-column v-if="columns[2].visible" key="nickName" label="用户昵称" align="center" prop="nickName"
: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" />
<el-table-column v-if="columns[4].visible" key="phonenumber" label="手机号码" align="center"
prop="phonenumber" width="120" />
@ -425,7 +425,8 @@ const initData: PageData<UserForm, UserQuery> = {
max: 20,
message: '用户密码长度必须介于 5 和 20 之间',
trigger: 'blur'
}
},
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
],
email: [
{
@ -539,7 +540,12 @@ const handleResetPwd = async (row: UserVO) => {
cancelButtonText: '取消',
closeOnClickModal: false,
inputPattern: /^.{5,20}$/,
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间'
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间',
inputValidator: (value) => {
if (/<|>|"|'|\||\\/.test(value)) {
return "不能包含非法字符:< > \" ' \\\ |"
}
}
})
);
if (!err && res) {

View File

@ -27,7 +27,7 @@
</li>
<li class="list-group-item">
<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 class="list-group-item">
<svg-icon icon-class="peoples" />所属角色

View File

@ -44,7 +44,8 @@ const rules = ref({
max: 20,
message: '长度在 6 到 20 个字符',
trigger: 'blur'
}
},
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
],
confirmPassword: [
{ required: true, message: '确认密码不能为空', trigger: 'blur' },

View File

@ -182,7 +182,7 @@ const close = () => {
proxy?.$tab.closeOpenPage(obj);
};
(async () => {
onActivated(async ()=>{
const tableId = route.params && (route.params.tableId as string);
if (tableId) {
//
@ -194,5 +194,5 @@ const close = () => {
const response = await getDictOptionselect();
dictOptions.value = response.data;
}
})();
});
</script>

View File

@ -7,6 +7,7 @@
<el-select v-model="infoForm.tplCategory" @change="tplSelectChange">
<el-option label="单表(增删改查)" value="crud" />
<el-option label="树表(增删改查)" value="tree" />
<el-option label="主子表(增删改查)" value="sub" />
</el-select>
</el-form-item>
</el-col>
@ -94,7 +95,6 @@
<el-radio v-model="infoForm.genType" label="1">自定义路径</el-radio>
</el-form-item>
</el-col>
<el-col v-if="infoForm.genType == '1'" :span="24">
<el-form-item prop="genPath">
<template #label>
@ -120,6 +120,14 @@
</el-input>
</el-form-item>
</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>
<template v-if="info.tplCategory == 'tree'">