|
@@ -117,7 +117,7 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="角色" prop="role">
|
|
|
- <el-select v-model="formData.role" placeholder="请选择">
|
|
|
+ <el-select v-model="formData.role" multiple placeholder="请选择">
|
|
|
<el-option v-for="item in roleList" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -177,7 +177,21 @@ const queryParams = reactive<UserPageQuery>({
|
|
|
|
|
|
const total = ref(0) // 数据总数
|
|
|
const pageData = ref<UserPageVO[]>() // 用户分页数据
|
|
|
-const roleList = ref<OptionType[]>() // 角色下拉数据源
|
|
|
+// const roleList = ref<OptionType[]>() // 角色下拉数据源
|
|
|
+const roleList = ref([
|
|
|
+ {
|
|
|
+ label: '管理员',
|
|
|
+ value: '1'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '医生',
|
|
|
+ value: '2'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '患者',
|
|
|
+ value: '3'
|
|
|
+ }
|
|
|
+]) // 角色下拉数据源
|
|
|
|
|
|
// 弹窗对象
|
|
|
const dialog = reactive({
|
|
@@ -224,6 +238,7 @@ function handleQuery() {
|
|
|
loading.value = true
|
|
|
UserAPI.getPage(queryParams)
|
|
|
.then((data) => {
|
|
|
+ console.log(data.records, '用户数据data.records')
|
|
|
pageData.value = data.records
|
|
|
total.value = data.total
|
|
|
})
|
|
@@ -250,7 +265,7 @@ function openDialog(row?: UserPageVO) {
|
|
|
dialog.title = '修改用户'
|
|
|
let tempData = deepClone(row)
|
|
|
formData.value = tempData
|
|
|
- formData.value.role = tempData.roles[0]
|
|
|
+ formData.value.role = tempData.roles
|
|
|
} else {
|
|
|
dialog.title = '新增用户'
|
|
|
}
|
|
@@ -271,7 +286,7 @@ function resetForm() {
|
|
|
avatar: '',
|
|
|
sex: '',
|
|
|
ctime: '',
|
|
|
- status: '',
|
|
|
+ status: '1',
|
|
|
note: '',
|
|
|
roles: []
|
|
|
}
|
|
@@ -285,7 +300,8 @@ function handleSubmit() {
|
|
|
if (valid) {
|
|
|
loading.value = true
|
|
|
const userId = formData.value.id
|
|
|
- formData.value.roles = [formData.value.role!]
|
|
|
+ console.log(formData.value.role, 'formData.value.role')
|
|
|
+ formData.value.roles = formData.value.role
|
|
|
if (userId) {
|
|
|
UserAPI.update(formData.value)
|
|
|
.then(() => {
|
|
@@ -367,7 +383,7 @@ function getUserRoleStr(roles: string[]) {
|
|
|
}
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- roleList.value = await loadRoleOptions()
|
|
|
+ // roleList.value = await loadRoleOptions()
|
|
|
handleQuery()
|
|
|
})
|
|
|
</script>
|