refactor: 前端表单重置优化

This commit is contained in:
Charles7c 2023-09-24 11:41:32 +08:00
commit e947312f24
17 changed files with 45 additions and 113 deletions

View File

@ -1,3 +1,19 @@
## [v1.1.2](https://github.com/Charles7c/continew-admin/compare/v1.1.1...v1.1.2) (2023-09-24)
### 💎 功能优化
- 优化后端程序启动成功输出内容 ([6322859](https://github.com/Charles7c/continew-admin/commit/63228598d9fcd6e5d00172c12418a371d4c96766))
- 配置子级菜单图标 ([5544836](https://github.com/Charles7c/continew-admin/commit/55448364a39085debb776463f5e95a15b186c447))
### 🐛 问题修复
- 修复生产环境和开发环境样式不一致的问题 ([be8732d](https://github.com/Charles7c/continew-admin/commit/be8732d812e021631864b0ff6225b4da24cafcee))
- 排除路径配置放开 /error ([0428fe7](https://github.com/Charles7c/continew-admin/commit/0428fe776224afb64601901cef4d3100e5d30bd6))
- 修复初始数据缺失字段列表的问题 ([d5138e1](https://github.com/Charles7c/continew-admin/commit/d5138e1e43bdc8b347e061890131ac2646b2dd3c))
- 修复系统日志表索引缺失导致查询耗时较长的问题 ([ac43833](https://github.com/Charles7c/continew-admin/commit/ac438337219f5a160d49b255805774da36ab865c))
- 修复部分菜单数据 component 信息配置错误 ([11ea072](https://github.com/Charles7c/continew-admin/commit/11ea072d600f24fe97fe8145208e821712b84839))
- 修复图标 SVG 内容格式错误 ([20f1e8a](https://github.com/Charles7c/continew-admin/commit/20f1e8aecc737b28ab869d363957513d868b4ab7))
## [v1.1.1](https://github.com/Charles7c/continew-admin/compare/v1.1.0...v1.1.1) (2023-09-06)
### 💎 功能优化

View File

@ -66,7 +66,7 @@ public class UserRequest extends BaseRequest {
* 邮箱
*/
@Schema(description = "邮箱", example = "123456789@qq.com")
@Pattern(regexp = RegexConsts.EMAIL, message = "邮箱格式错误")
@Pattern(regexp = "^$|" + RegexConsts.EMAIL, message = "邮箱格式错误")
@Length(max = 255, message = "邮箱长度不能超过 {max} 个字符")
private String email;
@ -74,7 +74,7 @@ public class UserRequest extends BaseRequest {
* 手机号码
*/
@Schema(description = "手机号码", example = "13811111111")
@Pattern(regexp = RegexConsts.MOBILE, message = "手机号码格式错误")
@Pattern(regexp = "^$|" + RegexConsts.MOBILE, message = "手机号码格式错误")
private String phone;
/**

View File

@ -83,7 +83,7 @@ public class GenConfigDO implements Serializable {
*/
@Schema(description = "前端路径", example = "D:/continew-admin/continew-admin-ui/src/views/system/user")
@Length(max = 255, message = "前端路径不能超过 {max} 个字符")
@Pattern(regexp = "^(?=.*src\\/views)(?!.*\\/views\\/?$).*", message = "前端路径配置错误")
@Pattern(regexp = "^$|^(?=.*src\\/views)(?!.*\\/views\\/?$).*", message = "前端路径配置错误")
private String frontendPath;
/**

View File

@ -5,10 +5,10 @@ const BASE_URL = '/system/dept';
export interface DataRecord {
id?: number;
name: string;
name?: string;
parentId?: number;
description?: string;
sort: number;
sort?: number;
status?: number;
isSystem?: boolean;
createUserString?: string;

View File

@ -5,11 +5,11 @@ const BASE_URL = '/system/dict/item';
export interface DataRecord {
id?: number;
label: string;
value: string;
label?: string;
value?: string;
color?: string;
sort?: number;
description: string;
description?: string;
dictId?: number;
createUser?: string;
createTime?: string;

View File

@ -5,10 +5,10 @@ const BASE_URL = '/system/dict';
export interface DataRecord {
id?: number;
name: string;
code: string;
name?: string;
code?: string;
description?: string;
isSystem: boolean;
isSystem?: boolean;
createUser?: string;
createTime?: string;
updateUser?: string;

View File

@ -5,18 +5,18 @@ const BASE_URL = '/system/menu';
export interface DataRecord {
id?: number;
title: string;
title?: string;
parentId?: number;
type: number;
type?: number;
path?: string;
name?: string;
component?: string;
icon?: string;
isExternal: boolean;
isCache: boolean;
isHidden: boolean;
isExternal?: boolean;
isCache?: boolean;
isHidden?: boolean;
permission?: string;
sort: number;
sort?: number;
status?: number;
createUserString?: string;
createTime?: string;

View File

@ -5,12 +5,12 @@ const BASE_URL = '/system/role';
export interface DataRecord {
id?: number;
name: string;
name?: string;
code?: string;
sort?: number;
description?: string;
menuIds?: Array<number>;
dataScope: number;
dataScope?: number;
deptIds?: Array<number>;
status?: number;
isSystem?: boolean;

View File

@ -5,9 +5,9 @@ const BASE_URL = '/system/user';
export interface DataRecord {
id?: number;
username: string;
nickname: string;
gender: number;
username?: string;
nickname?: string;
gender?: number;
email?: string;
phone?: string;
description?: string;

View File

@ -359,9 +359,7 @@
);
const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({
// TODO
});
const dataDetail = ref<DataRecord>({});
const total = ref(0);
const ids = ref<Array<number>>([]);
const title = ref('');
@ -440,9 +438,7 @@
* 重置表单
*/
const reset = () => {
form.value = {
// TODO index.vue
};
form.value = {};
proxy.$refs.formRef?.resetFields();
};

View File

@ -321,17 +321,7 @@
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({
name: '',
sort: 0,
description: '',
status: 1,
createUserString: '',
createTime: '',
updateUserString: '',
updateTime: '',
parentName: '',
});
const dataDetail = ref<DataRecord>({});
const ids = ref<Array<number>>([]);
const title = ref('');
const single = ref(true);
@ -423,13 +413,7 @@
*/
const reset = () => {
form.value = {
id: undefined,
name: '',
parentId: undefined,
description: '',
sort: 999,
status: 1,
disabled: false,
};
proxy.$refs.formRef?.resetFields();
};

View File

@ -351,13 +351,7 @@
* 重置表单
*/
const reset = () => {
form.value = {
id: undefined,
name: '',
code: '',
description: '',
isSystem: false,
};
form.value = {};
proxy.$refs.formRef?.resetFields();
};

View File

@ -262,12 +262,8 @@
*/
const reset = () => {
form.value = {
id: undefined,
label: '',
value: '',
color: '#165DFF',
sort: 999,
description: '',
dictId: dictId.value,
};
proxy.$refs.formRef?.resetFields();

View File

@ -448,20 +448,11 @@
*/
const reset = () => {
form.value = {
id: undefined,
title: '',
parentId: undefined,
type: 1,
path: undefined,
name: undefined,
component: undefined,
icon: undefined,
isExternal: false,
isCache: false,
isHidden: false,
permission: undefined,
sort: 999,
status: 1,
};
proxy.$refs.formRef?.resetFields();
};

View File

@ -443,19 +443,7 @@
);
const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({
name: '',
code: '',
status: 1,
dataScope: 1,
createUserString: '',
createTime: '',
updateUserString: '',
updateTime: '',
description: '',
menuIds: undefined,
deptIds: undefined,
});
const dataDetail = ref<DataRecord>({});
const total = ref(0);
const ids = ref<Array<number>>([]);
const title = ref('');
@ -603,16 +591,8 @@
proxy.$refs.menuRef?.expandAll(menuExpandAll.value);
proxy.$refs.deptRef?.expandAll(deptExpandAll.value);
form.value = {
id: undefined,
name: '',
code: undefined,
dataScope: 4,
description: '',
sort: 999,
status: 1,
menuIds: [],
deptIds: [],
disabled: false,
};
proxy.$refs.formRef?.resetFields();
};

View File

@ -532,22 +532,7 @@
const { dis_enable_status_enum } = proxy.useDict('dis_enable_status_enum');
const dataList = ref<DataRecord[]>([]);
const dataDetail = ref<DataRecord>({
username: '',
nickname: '',
gender: 1,
phone: undefined,
email: undefined,
status: 1,
pwdResetTime: '',
createUserString: '',
createTime: '',
updateUserString: '',
updateTime: '',
description: '',
roleIds: undefined,
deptId: undefined,
});
const dataDetail = ref<DataRecord>({});
const total = ref(0);
const ids = ref<Array<number>>([]);
const title = ref('');
@ -700,17 +685,7 @@
*/
const reset = () => {
form.value = {
id: undefined,
username: '',
nickname: '',
gender: 1,
email: undefined,
phone: undefined,
description: '',
status: 1,
deptId: undefined,
roleIds: [] as Array<number>,
disabled: false,
};
proxy.$refs.formRef?.resetFields();
};

View File

@ -82,7 +82,7 @@ CREATE TABLE IF NOT EXISTS `sys_role_dept` (
CREATE TABLE IF NOT EXISTS `sys_user` (
`id` bigint(20) UNSIGNED AUTO_INCREMENT COMMENT 'ID',
`username` varchar(64) NOT NULL COMMENT '用户名',
`nickname` varchar(30) DEFAULT NULL COMMENT '昵称',
`nickname` varchar(30) NOT NULL COMMENT '昵称',
`password` varchar(32) DEFAULT NULL COMMENT '密码',
`gender` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '性别0未知12',
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',