diff --git a/Web/src/assets/style/lib/list.less b/Web/src/assets/style/lib/list.less index 146034f..3343e02 100644 --- a/Web/src/assets/style/lib/list.less +++ b/Web/src/assets/style/lib/list.less @@ -8,7 +8,7 @@ display: flex; align-items: center; &--item { - min-width: 100px; + min-width: 120px; margin-left: @padding-xl; >span { line-height: 20px; diff --git a/Web/src/pages/system/account/setting/info.vue b/Web/src/pages/system/account/setting/info.vue index 619913d..12f82ed 100644 --- a/Web/src/pages/system/account/setting/info.vue +++ b/Web/src/pages/system/account/setting/info.vue @@ -79,15 +79,15 @@ - + 保密 - + 男 - + 女 diff --git a/Web/src/pages/system/user/addForm.vue b/Web/src/pages/system/user/addForm.vue deleted file mode 100644 index 58bde42..0000000 --- a/Web/src/pages/system/user/addForm.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Web/src/pages/system/user/dataForm.vue b/Web/src/pages/system/user/dataForm.vue index 8407c31..91d05f0 100644 --- a/Web/src/pages/system/user/dataForm.vue +++ b/Web/src/pages/system/user/dataForm.vue @@ -65,9 +65,9 @@ export default { * 必要的方法 * 从外部调用打开本窗口 */ - async onOpen(record) { + async onOpen(params) { this.visible = true; - this.id = record.id; + this.id = params.record.id; this.$nextTick(() => { this.onInit(); }); diff --git a/Web/src/pages/system/user/editForm.vue b/Web/src/pages/system/user/editForm.vue deleted file mode 100644 index c14d8cd..0000000 --- a/Web/src/pages/system/user/editForm.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Web/src/pages/system/user/form.vue b/Web/src/pages/system/user/form.vue index 0929b91..902c9c9 100644 --- a/Web/src/pages/system/user/form.vue +++ b/Web/src/pages/system/user/form.vue @@ -1,4 +1,10 @@ + @@ -33,11 +39,17 @@ + + + 保密 + - 男 + + 男 - 女 + + 女 @@ -52,7 +64,7 @@ - + 员工信息 @@ -78,42 +90,44 @@ 附加信息 - - - 新增一项 - - - onChangeExtData(value, record, 'orgId')" - placeholder="请选择附加组织机构" - tree-default-expand-all - /> - - - onChangeExtData(value, record, 'posId')" - placeholder="请选择附加职位信息" - > - {{ item.name }} - - - - 删除 - - + + + + 新增一项 + + + onChangeExtData(value, record, 'orgId')" + placeholder="请选择附加组织机构" + tree-default-expand-all + /> + + + onChangeExtData(value, record, 'posId')" + placeholder="请选择附加职位信息" + > + {{ item.name }} + + + + 删除 + + + @@ -127,15 +141,28 @@ const compareToFirstPassword = (rule, value, callback) => { callback(); }; +/* 表单内容默认值 */ +const defaultForm = { + /* ... */ + sex: 0, + sysEmpParam: {}, +}; + export default { - props: ['mode'], + props: { + mode: { + type: String, + default: 'edit', + }, + }, data() { return { - form: { - sysEmpParam: {}, - }, + /** 表单数据 */ + form: {}, + /** 验证格式 */ rules: { + /* ... */ account: [{ required: true, min: 5, message: '请输入至少五个字符的账号', trigger: 'blur' }], name: [{ required: true, message: '请输入姓名', trigger: 'blur' }], password: [ @@ -146,7 +173,6 @@ export default { { required: true, message: '请确认密码', trigger: 'blur' }, { validator: compareToFirstPassword, trigger: 'blur' }, ], - sex: [{ required: true, message: '请选择性别' }], phone: [ { pattern: /^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0,1,3,6-8])|(18[0-9])|(19[8,9])|(166))[0-9]{8}$/, @@ -161,8 +187,11 @@ export default { 'sysEmpParam.posIdList': [{ required: true, message: '请选择职位信息' }], }, + /** 加载异步数据状态 */ loading: false, + /** 其他成员属性 */ + /* ... */ orgData: [], posData: [], @@ -188,13 +217,14 @@ export default { ], }; }, + methods: { /** * 必要的方法 * 在打开编辑页时允许填充数据 */ - onFillData(record, orgId) { - const form = this.$_.cloneDeep(record || {}); + onFillData(params) { + const form = this.$_.cloneDeep(params.record || {}); // 日期特殊处理 if (form.birthday) { form.birthday = this.$moment(form.birthday).format('YYYY-MM-DD'); @@ -223,10 +253,38 @@ export default { }); } - if (orgId) { + if (params.orgId) { form.sysEmpParam.orgId = orgId; } - this.form = form; + + /** 将默认数据覆盖到form */ + this.form = this.$_.cloneDeep({ + ...defaultForm, + ...form, + /** 在此处添加其他默认数据转换 */ + /* ... */ + }); + }, + + /** + * 必要方法 + * 验证表单并获取表单数据 + */ + onGetData() { + return new Promise((reslove, reject) => { + this.$refs.form.validate((valid) => { + if (valid) { + const record = this.$_.cloneDeep(this.form); + + /** 验证通过后可以对数据进行转换得到想要提交的格式 */ + /* ... */ + + reslove(record); + } else { + reject(); + } + }); + }); }, /** @@ -243,20 +301,32 @@ export default { */ onResetFields() { setTimeout(() => { - this.form = { - sysEmpParam: {}, - }; this.$refs.form.resetFields(); + + /** 在这里可以初始化当前组件中其他属性 */ + /* ... */ + this.form = { + ...defaultForm, + }; }, 300); }, - async onInit() { + /** + * 必要方法 + * 加载当前表单中所需要的异步数据 + */ + async onInit(params) { this.loading = true; + /** 可以在这里await获取一些异步数据 */ + /* ... */ this.orgData = await this.onLoadOrgData(); this.posData = await this.onLoadPosData(); this.loading = false; }, + /** 当前组件的其他方法 */ + /* ... */ + onLoadOrgData() { return this.$api.getOrgTree().then(({ data }) => { return data; diff --git a/Web/src/pages/system/user/index.vue b/Web/src/pages/system/user/index.vue index 48bafe8..2dcb3a0 100644 --- a/Web/src/pages/system/user/index.vue +++ b/Web/src/pages/system/user/index.vue @@ -1,28 +1,41 @@ - + + - - - 后端bug:生日不填写,在保存时会默认写入0001-01-01 - 权限问题,在这里需要用到组织架构以及职位的数据接口,所以必须配置该两项的菜单 - - - - + - - {{ item.value }} + + {{ item.value }} - 查询 + 查询 重置 @@ -66,7 +79,14 @@ {{ record.nickName || record.name }} {{ record.account }} - + @@ -75,11 +95,21 @@ 手机 - {{ record.phone }} + {{ record.phone || '未设置' }} + + + 邮箱 + {{ record.email || '未设置' }} - - onSetUserStatus(record, checked)" /> + + onSetUserStatus(record, checked)" + /> @@ -87,49 +117,96 @@ - - + + + + + + + + + + + \ No newline at end of file diff --git a/Web/src/pages/system/user/roleForm.vue b/Web/src/pages/system/user/roleForm.vue index 90f975b..f1fcaa8 100644 --- a/Web/src/pages/system/user/roleForm.vue +++ b/Web/src/pages/system/user/roleForm.vue @@ -45,9 +45,9 @@ export default { * 必要的方法 * 从外部调用打开本窗口 */ - async onOpen(record) { + async onOpen(params) { this.visible = true; - this.id = record.id; + this.id = params.record.id; this.$nextTick(() => { this.onInit(); });
{{ record.phone }}
{{ record.phone || '未设置' }}
{{ record.email || '未设置' }}