mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 18:29:20 +08:00
refactor(account): 公司账户管理添加账户表单优化
1. 移除登录账号字段(手机号作为唯一标识) 2. 手机号改为必填,放在第一位(密码之前) 3. 职位改为可选,默认 undefined 4. 移除头像图片ID字段 5. 更新相关 DTO 类型定义
This commit is contained in:
@@ -5,34 +5,26 @@
|
|||||||
export namespace AccountDTO {
|
export namespace AccountDTO {
|
||||||
/** 创建账户参数 */
|
/** 创建账户参数 */
|
||||||
export interface CreateAccountDTO {
|
export interface CreateAccountDTO {
|
||||||
/** 登录账号 */
|
|
||||||
loginCode: string;
|
|
||||||
/** 密码 */
|
/** 密码 */
|
||||||
password: string;
|
password: string;
|
||||||
|
/** 手机号 */
|
||||||
|
phone: string;
|
||||||
/** 真实姓名 */
|
/** 真实姓名 */
|
||||||
realName: string;
|
realName: string;
|
||||||
/** 手机号 */
|
|
||||||
phone?: string;
|
|
||||||
/** 头像图片ID */
|
|
||||||
avatarImageId?: number;
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
departmentId: number;
|
departmentId: number;
|
||||||
/** 岗位ID */
|
/** 岗位ID */
|
||||||
positionId: number;
|
positionId?: number;
|
||||||
/** 备注信息 */
|
/** 备注信息 */
|
||||||
remark?: string;
|
remark?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新账户参数 */
|
/** 更新账户参数 */
|
||||||
export interface UpdateAccountDTO {
|
export interface UpdateAccountDTO {
|
||||||
/** 登录账号 */
|
|
||||||
loginCode?: string;
|
|
||||||
/** 手机号 */
|
/** 手机号 */
|
||||||
phone?: string;
|
phone?: string;
|
||||||
/** 真实姓名 */
|
/** 真实姓名 */
|
||||||
realName?: string;
|
realName?: string;
|
||||||
/** 头像图片ID */
|
|
||||||
avatarImageId?: number;
|
|
||||||
/** 部门ID */
|
/** 部门ID */
|
||||||
departmentId?: number;
|
departmentId?: number;
|
||||||
/** 岗位ID */
|
/** 岗位ID */
|
||||||
|
|||||||
+18
-50
@@ -60,13 +60,11 @@ interface PositionSelectOption {
|
|||||||
|
|
||||||
// 表单数据
|
// 表单数据
|
||||||
const formData = ref<AccountDTO.CreateAccountDTO & { status?: number }>({
|
const formData = ref<AccountDTO.CreateAccountDTO & { status?: number }>({
|
||||||
loginCode: '',
|
|
||||||
password: '',
|
password: '',
|
||||||
realName: '',
|
|
||||||
phone: '',
|
phone: '',
|
||||||
avatarImageId: undefined,
|
realName: '',
|
||||||
departmentId: 0,
|
departmentId: 0,
|
||||||
positionId: 0,
|
positionId: undefined,
|
||||||
remark: '',
|
remark: '',
|
||||||
status: 0,
|
status: 0,
|
||||||
});
|
});
|
||||||
@@ -96,13 +94,11 @@ const statusOptions = [
|
|||||||
// 重置表单
|
// 重置表单
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
loginCode: '',
|
|
||||||
password: '',
|
password: '',
|
||||||
realName: '',
|
|
||||||
phone: '',
|
phone: '',
|
||||||
avatarImageId: undefined,
|
realName: '',
|
||||||
departmentId: 0,
|
departmentId: 0,
|
||||||
positionId: 0,
|
positionId: undefined,
|
||||||
remark: '',
|
remark: '',
|
||||||
status: 0,
|
status: 0,
|
||||||
};
|
};
|
||||||
@@ -215,7 +211,7 @@ function handleDepartmentChange(value: number[]) {
|
|||||||
formData.value.positionId &&
|
formData.value.positionId &&
|
||||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||||
) {
|
) {
|
||||||
formData.value.positionId = 0;
|
formData.value.positionId = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,13 +224,11 @@ async function open(accountData?: AccountVO.AccountInfoVO | null) {
|
|||||||
|
|
||||||
if (accountData) {
|
if (accountData) {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
loginCode: accountData.loginCode,
|
|
||||||
password: '', // 编辑时密码为空
|
password: '', // 编辑时密码为空
|
||||||
realName: accountData.realName,
|
|
||||||
phone: accountData.phone || '',
|
phone: accountData.phone || '',
|
||||||
avatarImageId: accountData.avatarImageId,
|
realName: accountData.realName,
|
||||||
departmentId: accountData.departmentId || 0,
|
departmentId: accountData.departmentId || 0,
|
||||||
positionId: accountData.positionId || 0,
|
positionId: accountData.positionId || undefined,
|
||||||
remark: accountData.remark || '',
|
remark: accountData.remark || '',
|
||||||
status: accountData.status,
|
status: accountData.status,
|
||||||
};
|
};
|
||||||
@@ -289,7 +283,7 @@ watch(
|
|||||||
formData.value.positionId &&
|
formData.value.positionId &&
|
||||||
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
!positionOptions.value.some((item) => item.value === formData.value.positionId)
|
||||||
) {
|
) {
|
||||||
formData.value.positionId = 0;
|
formData.value.positionId = undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -309,21 +303,14 @@ defineExpose({
|
|||||||
:wrapper-col="{ span: 18 }"
|
:wrapper-col="{ span: 18 }"
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="登录账号"
|
label="手机号"
|
||||||
name="loginCode"
|
name="phone"
|
||||||
:rules="[
|
:rules="[
|
||||||
{ required: true, message: '请输入登录账号' },
|
{ required: true, message: '请输入手机号' },
|
||||||
{ min: 4, max: 20, message: '登录账号长度为4-20个字符' },
|
{ pattern: /^1[3-9]\d{9}$/, message: '请输入有效的手机号' },
|
||||||
{
|
|
||||||
pattern: /^[a-zA-Z0-9_]+$/,
|
|
||||||
message: '登录账号只能包含字母、数字和下划线',
|
|
||||||
},
|
|
||||||
]"
|
]"
|
||||||
>
|
>
|
||||||
<Input
|
<Input v-model:value="formData.phone" placeholder="请输入手机号" />
|
||||||
v-model:value="formData.loginCode"
|
|
||||||
placeholder="请输入登录账号"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
@@ -354,18 +341,6 @@ defineExpose({
|
|||||||
<Input v-model:value="formData.realName" placeholder="请输入真实姓名" />
|
<Input v-model:value="formData.realName" placeholder="请输入真实姓名" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="备注" name="remark">
|
|
||||||
<Input v-model:value="formData.remark" placeholder="请输入备注" />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label="手机号"
|
|
||||||
name="phone"
|
|
||||||
:rules="[{ pattern: /^1[3-9]\d{9}$/, message: '请输入有效的手机号' }]"
|
|
||||||
>
|
|
||||||
<Input v-model:value="formData.phone" placeholder="请输入手机号" />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="所属部门"
|
label="所属部门"
|
||||||
name="departmentId"
|
name="departmentId"
|
||||||
@@ -383,26 +358,19 @@ defineExpose({
|
|||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item
|
<Form.Item label="职位" name="positionId">
|
||||||
label="职位"
|
|
||||||
name="positionId"
|
|
||||||
:rules="[{ required: true, message: '请选择职位' }]"
|
|
||||||
>
|
|
||||||
<Select
|
<Select
|
||||||
v-model:value="formData.positionId"
|
v-model:value="formData.positionId"
|
||||||
:loading="positionOptionsLoading"
|
:loading="positionOptionsLoading"
|
||||||
:options="positionOptions"
|
:options="positionOptions"
|
||||||
placeholder="请选择职位"
|
placeholder="请选择职位(可选)"
|
||||||
:disabled="positionOptionsLoading"
|
:disabled="positionOptionsLoading"
|
||||||
|
allow-clear
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item label="头像图片ID" name="avatarImageId">
|
<Form.Item label="备注" name="remark">
|
||||||
<Input
|
<Input v-model:value="formData.remark" placeholder="请输入备注" />
|
||||||
v-model:value="formData.avatarImageId"
|
|
||||||
type="number"
|
|
||||||
placeholder="请输入头像图片ID"
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item v-if="isEdit" label="状态" name="status">
|
<Form.Item v-if="isEdit" label="状态" name="status">
|
||||||
|
|||||||
Reference in New Issue
Block a user