mirror of
https://gitee.com/xiongmao1988/rax-medical.git
synced 2025-08-24 13:04:57 +08:00
用户管理
This commit is contained in:
parent
375fd80a31
commit
4a41099f6d
|
@ -62,6 +62,26 @@
|
||||||
<CommonPagination :total="total" @paginationChange="paginationChange"/>
|
<CommonPagination :total="total" @paginationChange="paginationChange"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<el-dialog v-model="psDialogVisible" title="密码重置" width="500" draggable>
|
||||||
|
<el-form ref="formRef" :model="formData" :rules="rules" label-width="60">
|
||||||
|
<el-form-item label="密码" prop="password" label-width="100">
|
||||||
|
<el-input v-model="formData.password" type="password" show-password
|
||||||
|
placeholder="8~16位字母或数字(区分大小写)"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="确认密码" prop="confirmPassword" label-width="100">
|
||||||
|
<el-input v-model="formData.confirmPassword" type="password" show-password
|
||||||
|
placeholder="确认密码"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button @click="psDialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="sbPs">
|
||||||
|
确定
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
<el-dialog v-model="isFormDialog" :title="formDialogTitle" width="750px">
|
<el-dialog v-model="isFormDialog" :title="formDialogTitle" width="750px">
|
||||||
<DoctorForm ref="doctorFormRef" :type="formDialogTitle === '添加' ? 'add' : 'edit'" @close="isFormDialog = false"
|
<DoctorForm ref="doctorFormRef" :type="formDialogTitle === '添加' ? 'add' : 'edit'" @close="isFormDialog = false"
|
||||||
@save="doctorFormSave"/>
|
@save="doctorFormSave"/>
|
||||||
|
@ -72,13 +92,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang='ts' setup>
|
<script lang='ts' setup>
|
||||||
import {ref} from 'vue'
|
import {reactive, ref} from 'vue'
|
||||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||||
import {exportData, tableRemoveRow} from '@/utils/table-util'
|
import {exportData, tableRemoveRow} from '@/utils/table-util'
|
||||||
import CommonPagination from '@/components/common-pagination.vue'
|
import CommonPagination from '@/components/common-pagination.vue'
|
||||||
import DoctorForm from './form/doctor-form.vue'
|
import DoctorForm from './form/doctor-form.vue'
|
||||||
import ImportDialog from '@/components/import-dialog.vue'
|
import ImportDialog from '@/components/import-dialog.vue'
|
||||||
import {deleteU, modifyPw, updateUserInfo, userPage} from "@/api/user";
|
import {deleteU, modifyPw, updateUserInfo, userPage} from "@/api/user";
|
||||||
|
import {REGEXP} from "@/enum/log-enum";
|
||||||
|
|
||||||
const tableRef = ref()
|
const tableRef = ref()
|
||||||
const doctorFormRef = ref()
|
const doctorFormRef = ref()
|
||||||
|
@ -86,6 +107,7 @@ const importDialogRef = ref()
|
||||||
const isSearch = ref(true)
|
const isSearch = ref(true)
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const isFormDialog = ref(false)
|
const isFormDialog = ref(false)
|
||||||
|
const psDialogVisible = ref(false)
|
||||||
const formDialogTitle = ref('')
|
const formDialogTitle = ref('')
|
||||||
const queryParams = ref({
|
const queryParams = ref({
|
||||||
userName: ''
|
userName: ''
|
||||||
|
@ -94,6 +116,36 @@ const tableData = ref([] as any)
|
||||||
let current = 0
|
let current = 0
|
||||||
let size = 10
|
let size = 10
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
|
const formRef = ref()
|
||||||
|
const formData = ref()
|
||||||
|
|
||||||
|
const validatePassword = (rule: any, value: any, callback: any) => {
|
||||||
|
if (!(new RegExp(REGEXP.PASSWORD).test(value))) {
|
||||||
|
callback("8~16位字母或数字(区分大小写)")
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateConsistent = (rule: any, value: any, callback: any) => {
|
||||||
|
if (formData.value.password != formData.value.confirmPassword) {
|
||||||
|
callback('两次密码不一致')
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const rules = ref({
|
||||||
|
password: [
|
||||||
|
{required: true, message: '请输入密码', trigger: ['blur', 'change']},
|
||||||
|
{validator: validatePassword, trigger: ['blur', 'change']},
|
||||||
|
],
|
||||||
|
confirmPassword: [
|
||||||
|
{required: true, message: '请输入密码', trigger: ['blur', 'change']},
|
||||||
|
{validator: validatePassword, trigger: ['blur', 'change']},
|
||||||
|
{validator: validateConsistent, trigger: ['blur', 'change']}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
queryData()
|
queryData()
|
||||||
|
|
||||||
|
@ -170,24 +222,33 @@ const enableChange = (e: any) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const resetPassword = (e: any) => {
|
const resetPassword = (e: any) => {
|
||||||
ElMessageBox.prompt('是否确定要重置密码?', '系统提醒', {
|
formData.value = {
|
||||||
type: 'warning',
|
password: '',
|
||||||
draggable: true,
|
confirmPassword: '',
|
||||||
// inputPattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[^\da-zA-Z\s]).{9,15}$/,
|
username: e.username
|
||||||
inputErrorMessage: "密码至少包含字母、数字、特殊字符,不少于9位,最多15位"
|
}
|
||||||
}).then((inputVal) => {
|
psDialogVisible.value = true
|
||||||
|
formRef.value.resetFields()
|
||||||
|
}
|
||||||
|
|
||||||
|
const sbPs = () => {
|
||||||
|
formRef.value.validate((valid: any, fields: any) => {
|
||||||
|
if (valid) {
|
||||||
modifyPw({
|
modifyPw({
|
||||||
username: e.username,
|
username: formData.value.username,
|
||||||
password: inputVal.value
|
password: formData.value.password
|
||||||
}).then((res: any) => {
|
}).then((res: any) => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
ElMessage.success('重置成功!')
|
ElMessage.success('重置成功!')
|
||||||
|
psDialogVisible.value = false
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.msg)
|
ElMessage.error(res.msg)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const editData = (e: any) => {
|
const editData = (e: any) => {
|
||||||
isFormDialog.value = true
|
isFormDialog.value = true
|
||||||
formDialogTitle.value = '修改'
|
formDialogTitle.value = '修改'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user