最终版
This commit is contained in:
parent
b92f635cac
commit
d560f26ea1
|
@ -39,21 +39,6 @@
|
|||
<p><strong>性别:</strong>{{ userInfo.gender }}</p>
|
||||
<p><strong>权限:</strong>{{ userInfo.permission }}</p>
|
||||
</div>
|
||||
<button type="button" class="el-button el-button--primary" @click="doctorFormVisible = true" v-if="userInfo.permission === '医生管理员'">新增医生用户</button>
|
||||
<el-dialog title="新增医生用户" v-model="doctorFormVisible" @close="resetDoctorForm">
|
||||
<el-form ref="doctorForm" :model="doctorForm" :rules="doctorRules" label-width="80px" @submit.native.prevent="submitDoctorForm">
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model="doctorForm.username"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input type="password" v-model="doctorForm.pwd"></el-input>
|
||||
</el-form-item>
|
||||
<!-- 可以根据需要添加其他字段 -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitDoctorForm">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
<router-view />
|
||||
</template>
|
||||
|
@ -68,45 +53,6 @@ const doctorFormVisible = ref(false);
|
|||
const showUserInfoDialog = () => {
|
||||
userInfoDialogVisible.value = true;
|
||||
};
|
||||
const resetDoctorForm = () => {
|
||||
doctorForm.value = {
|
||||
username: '',
|
||||
password: '' // 重置密码字段
|
||||
// 重置其他字段
|
||||
};
|
||||
};
|
||||
const doctorRules = {
|
||||
username: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
||||
],
|
||||
pwd: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
{ min: 6, message: '密码长度不能少于6位', trigger: 'blur' }
|
||||
]
|
||||
// 可以根据需要添加其他验证规则
|
||||
};
|
||||
const doctorForm = ref({
|
||||
username: '',
|
||||
pwd: ''
|
||||
// 可以根据需要添加其他字段
|
||||
});
|
||||
const submitDoctorForm = () => {
|
||||
// 这里应该调用后端API来注册新医生用户
|
||||
axiosInstance.post('/user/register', doctorForm.value)
|
||||
.then(response => {
|
||||
// 处理成功响应
|
||||
console.log('医生用户注册成功', response);
|
||||
// 可以在这里关闭对话框,清空表单等
|
||||
doctorFormVisible.value = false; // 关闭对话框
|
||||
resetDoctorForm(); // 清空表单
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误响应
|
||||
console.error('医生用户注册失败', error);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const roleDisplay = computed(() => {
|
||||
switch (sessionStorage.getItem('permission')) {
|
||||
case '0':
|
||||
|
|
Loading…
Reference in New Issue