Vue3 重构:REVIEW 用户管理

This commit is contained in:
YunaiV 2023-03-28 23:50:32 +08:00
parent c9e63c320e
commit 7ab8aa7168
2 changed files with 16 additions and 11 deletions

View File

@ -8,12 +8,12 @@
<el-input v-model="formData.nickname" :disabled="true" />
</el-form-item>
<el-form-item label="角色">
<el-select v-model="formData.roleIds" multiple placeholder="请选择">
<el-select v-model="formData.roleIds" multiple placeholder="请选择角色">
<el-option
v-for="item in roleOptions"
:key="parseInt(item.id)"
:key="item.id"
:label="item.name"
:value="parseInt(item.id)"
:value="item.id"
/>
</el-select>
</el-form-item>
@ -28,6 +28,7 @@
</template>
<script setup lang="ts">
// TODO el-dialog Dialog
import { assignUserRoleApi, PermissionAssignUserRoleReqVO } from '@/api/system/permission'
interface Props {
@ -86,5 +87,3 @@ const submit = async () => {
}
}
</script>
<style></style>

View File

@ -269,6 +269,7 @@
import type { ElTree } from 'element-plus'
import { handleTree, defaultProps } from '@/utils/tree'
// vue3apiApi
// TODO 使 DeptApi
import { getSimpleDeptList as getSimpleDeptListApi } from '@/api/system/dept'
import { getSimplePostList as getSimplePostListApi, PostVO } from '@/api/system/post'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
@ -279,16 +280,15 @@ import {
updateUserStatusApi,
UserVO
} from '@/api/system/user'
import { parseTime } from './utils'
import AddForm from './AddForm.vue'
import ImportForm from './ImportForm.vue'
import RoleForm from './RoleForm.vue'
import { parseTime } from './utils' // TODO 使 formatTime
import AddForm from './AddForm.vue' // TODO UserForm
import ImportForm from './ImportForm.vue' // TODO UserImportForm
import RoleForm from './RoleForm.vue' // TODO UserAssignRoleForm
import { getUserApi, getUserPageApi } from '@/api/system/user'
import { getSimpleRoleList as getSimpleRoleListApi } from '@/api/system/role'
import { listUserRolesApi } from '@/api/system/permission'
import { CommonStatusEnum } from '@/utils/constants'
import download from '@/utils/download'
const message = useMessage() //
const { t } = useI18n() //
@ -304,10 +304,11 @@ const queryParams = reactive({
const showSearch = ref(true)
const showAddDialog = ref(false)
// -
// - // TODO vue getIntDictOptions getIntDictOptions
const statusDictDatas = getDictOptions(DICT_TYPE.COMMON_STATUS)
// ========== ==========
// TODO handleDeptNodeClick
const deptName = ref('')
watch(
() => deptName.value,
@ -375,6 +376,7 @@ const resetQuery = () => {
//
const addEditFormRef = ref()
//
// TODO openForm tree position
const handleAdd = () => {
addEditFormRef?.value.resetForm()
//
@ -389,6 +391,7 @@ const handleImport = () => {
}
//
// TODO await
const exportLoading = ref(false)
const handleExport = () => {
message
@ -432,6 +435,7 @@ const handleCommand = (command: string, index: number, row: UserVO) => {
}
//
// TODO await
const handleStatusChange = (row: UserVO) => {
let text = row.status === CommonStatusEnum.ENABLE ? '启用' : '停用'
message
@ -466,6 +470,7 @@ const handleUpdate = (row: UserVO) => {
}
//
// TODO await
const handleDelete = (row: UserVO) => {
const ids = row.id
message
@ -481,6 +486,7 @@ const handleDelete = (row: UserVO) => {
}
//
// TODO await
const handleResetPwd = (row: UserVO) => {
message.prompt('请输入"' + row.username + '"的新密码', t('common.reminder')).then(({ value }) => {
resetUserPwdApi(row.id, value)