qsh 4 days ago
parent 72341a96a5
commit b09ba1547c
  1. 5
      src/api/system/user/index.ts
  2. 11
      src/views/Basic/User/UserForm.vue
  3. 28
      src/views/Basic/User/index.vue
  4. 5
      src/views/Profile/components/BasicInfo.vue

@ -62,10 +62,11 @@ export const resetUserPwd = (id: number, password: string) => {
}
// 用户状态修改
export const updateUserStatus = (id: number, status: number) => {
export const updateUserStatus = (id: number, status: number, retireDate: string) => {
const data = {
id,
status
status,
retireDate
}
return request.put({ url: '/admin-api/system/user/update-status', data: data })
}

@ -85,6 +85,11 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="微信号" prop="wxAlias">
<el-input v-model="formData.wxAlias" placeholder="请输入微信号" />
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="入职日期" prop="hireDate">
<el-date-picker
@ -140,7 +145,8 @@ const formData = ref({
status: CommonStatusEnum.ENABLE,
roleIds: [],
hireDate: '',
isNewUserConfirm: false
isNewUserConfirm: false,
wxAlias: ''
})
const formRules = ref<any>({
username: [{ required: true, message: '登录账号不能为空', trigger: 'blur' }],
@ -228,7 +234,8 @@ const resetForm = () => {
status: CommonStatusEnum.ENABLE,
roleIds: [],
hireDate: formatDate(new Date(), 'YYYY-MM-DD'),
isNewUserConfirm: false
isNewUserConfirm: false,
wxAlias: ''
}
formRef.value?.resetFields()
}

@ -50,6 +50,7 @@
<el-table-column label="用户姓名" prop="nickname" />
<el-table-column label="部门" key="deptName" prop="deptName" />
<el-table-column label="手机号码" prop="mobile" width="120" />
<el-table-column label="微信号" prop="wxAlias" min-width="80" />
<el-table-column label="状态" key="status" width="180">
<template #default="scope">
<el-switch
@ -63,12 +64,8 @@
/>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="createTime"
width="180"
:formatter="dateFormatter"
/>
<el-table-column label="入职日期" prop="hireDate" width="120" :formatter="dateFormatter" />
<el-table-column label="离职日期" prop="" width="120" :formatter="dateFormatter" />
<el-table-column label="操作" width="200">
<template #default="scope">
<el-button
@ -183,9 +180,24 @@ const handleStatusChange = async (row: UserApi.UserVO) => {
try {
//
const text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?')
let result = { value: '' }
if (text == '启用') {
await message.confirm('确认要"' + text + '""' + row.username + '"用户吗?')
} else {
result = await message.prompt(
'请输入年月日,如2024-01-01',
'确认要"' + text + '""' + row.username + '"用户吗?'
)
const regex = /^\d{4}-\d{2}-\d{2}$/
if (!regex.test(result.value)) {
message.error('请输入离职日期')
throw new Error()
}
}
//
await UserApi.updateUserStatus(row.id, row.status)
await UserApi.updateUserStatus(row.id, row.status, result.value)
message.success('修改成功')
//
await getList()
} catch {

@ -59,6 +59,11 @@ const schema = reactive<FormSchema[]>([
label: t('profile.user.email'),
component: 'Input'
},
{
field: 'wxAlias',
label: '微信号',
component: 'Input'
},
{
field: 'sex',
label: t('profile.user.sex'),

Loading…
Cancel
Save