Skip to content

Commit

Permalink
refactor: 前端表单重置优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Sep 24, 2023
2 parents 243ac01 + 6582efe commit e947312
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 113 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

### 💎 功能优化
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ public class UserRequest extends BaseRequest {
* 邮箱
*/
@Schema(description = "邮箱", example = "[email protected]")
@Pattern(regexp = RegexConsts.EMAIL, message = "邮箱格式错误")
@Pattern(regexp = "^$|" + RegexConsts.EMAIL, message = "邮箱格式错误")
@Length(max = 255, message = "邮箱长度不能超过 {max} 个字符")
private String email;

/**
* 手机号码
*/
@Schema(description = "手机号码", example = "13811111111")
@Pattern(regexp = RegexConsts.MOBILE, message = "手机号码格式错误")
@Pattern(regexp = "^$|" + RegexConsts.MOBILE, message = "手机号码格式错误")
private String phone;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/api/system/dept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/api/system/dict-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/api/system/dict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions continew-admin-ui/src/api/system/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions continew-admin-ui/src/api/system/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions continew-admin-ui/src/api/system/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions continew-admin-ui/src/views/system/announcement/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -440,9 +438,7 @@
* 重置表单
*/
const reset = () => {
form.value = {
// TODO 待补充需要重置的字段默认值,详情请参考其他模块 index.vue
};
form.value = {};
proxy.$refs.formRef?.resetFields();
};
Expand Down
18 changes: 1 addition & 17 deletions continew-admin-ui/src/views/system/dept/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -423,13 +413,7 @@
*/
const reset = () => {
form.value = {
id: undefined,
name: '',
parentId: undefined,
description: '',
sort: 999,
status: 1,
disabled: false,
};
proxy.$refs.formRef?.resetFields();
};
Expand Down
8 changes: 1 addition & 7 deletions continew-admin-ui/src/views/system/dict/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,7 @@
* 重置表单
*/
const reset = () => {
form.value = {
id: undefined,
name: '',
code: '',
description: '',
isSystem: false,
};
form.value = {};
proxy.$refs.formRef?.resetFields();
};
Expand Down
4 changes: 0 additions & 4 deletions continew-admin-ui/src/views/system/dict/item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,8 @@
*/
const reset = () => {
form.value = {
id: undefined,
label: '',
value: '',
color: '#165DFF',
sort: 999,
description: '',
dictId: dictId.value,
};
proxy.$refs.formRef?.resetFields();
Expand Down
9 changes: 0 additions & 9 deletions continew-admin-ui/src/views/system/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down
22 changes: 1 addition & 21 deletions continew-admin-ui/src/views/system/role/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -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();
};
Expand Down
27 changes: 1 addition & 26 deletions continew-admin-ui/src/views/system/user/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -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();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:未知,1:男,2:女)',
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
Expand Down

0 comments on commit e947312

Please sign in to comment.