chore: 选人组件样式

This commit is contained in:
dap 2025-01-08 18:28:02 +08:00
parent 160d4a0a82
commit eb7b7c33d2
2 changed files with 61 additions and 29 deletions

View File

@ -1,12 +1,15 @@
<!-- eslint-disable no-use-before-define --> <!-- eslint-disable no-use-before-define -->
<script setup lang="ts"> <script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui';
import type { VxeGridProps } from '#/adapter/vxe-table';
import type { User } from '#/api'; import type { User } from '#/api';
import { ref } from 'vue'; import { ref } from 'vue';
import { useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { useVbenModal, VbenAvatar } from '@vben/common-ui';
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'; import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { userList } from '#/api/system/user'; import { userList } from '#/api/system/user';
import DeptTree from '#/views/system/user/dept-tree.vue'; import DeptTree from '#/views/system/user/dept-tree.vue';
@ -91,21 +94,19 @@ const gridOptions: VxeGridProps = {
strict: true, strict: true,
}, },
columns: [ columns: [
{ type: props.mode === 'single' ? 'radio' : 'checkbox', width: 60 }, {
type: props.mode === 'single' ? 'radio' : 'checkbox',
width: 60,
resizable: false,
},
{ {
field: 'userName', field: 'userName',
title: '名称', title: '用户',
width: 80, headerAlign: 'left',
}, resizable: false,
{ slots: {
field: 'nickName', default: 'user',
title: '昵称', },
width: 140,
},
{
field: 'deptName',
title: '部门',
width: 120,
}, },
], ],
height: 'auto', height: 'auto',
@ -148,13 +149,9 @@ const gridOptions: VxeGridProps = {
keyField: 'userId', keyField: 'userId',
}, },
toolbarConfig: { toolbarConfig: {
// enabled: false,
custom: false,
//
zoom: false,
//
refresh: false,
}, },
showOverflow: false,
}; };
const [BasicTable, tableApi] = useVbenVxeGrid({ const [BasicTable, tableApi] = useVbenVxeGrid({
@ -199,6 +196,10 @@ const rightGridOptions: VxeGridProps = {
field: 'nickName', field: 'nickName',
title: '昵称', title: '昵称',
width: 200, width: 200,
resizable: false,
slots: {
default: 'user',
},
}, },
{ {
field: 'action', field: 'action',
@ -220,13 +221,9 @@ const rightGridOptions: VxeGridProps = {
keyField: 'userId', keyField: 'userId',
}, },
toolbarConfig: { toolbarConfig: {
// enabled: false,
custom: false,
//
zoom: false,
//
refresh: false,
}, },
showOverflow: false,
}; };
const [RightBasicTable, rightTableApi] = useVbenVxeGrid({ const [RightBasicTable, rightTableApi] = useVbenVxeGrid({
@ -288,7 +285,24 @@ function handleSubmit() {
@select="handleDeptQuery" @select="handleDeptQuery"
/> />
<div class="h-[600px] w-[450px]"> <div class="h-[600px] w-[450px]">
<BasicTable /> <BasicTable>
<template #user="{ row }">
<div class="flex items-center gap-2">
<VbenAvatar
:alt="row.nickName"
:src="row.avatar"
:class="{ 'bg-primary': !row.avatar }"
class="size-[32px] rounded-full text-white"
/>
<div class="flex flex-col items-baseline text-[12px]">
<div>{{ row.nickName }}</div>
<div class="opacity-50">
{{ row.phonenumber || '暂无手机号' }}
</div>
</div>
</div>
</template>
</BasicTable>
</div> </div>
<div class="flex h-[600px] flex-col"> <div class="flex h-[600px] flex-col">
<div class="flex w-full px-4"> <div class="flex w-full px-4">
@ -302,6 +316,24 @@ function handleSubmit() {
</div> </div>
</div> </div>
<RightBasicTable> <RightBasicTable>
<template #user="{ row }">
<div class="flex items-center gap-2 overflow-hidden">
<VbenAvatar
:alt="row.nickName"
:src="row.avatar"
:class="{ 'bg-primary': !row.avatar }"
class="size-[32px] rounded-full text-white"
/>
<div class="flex flex-col items-baseline text-[12px]">
<div class="overflow-ellipsis whitespace-nowrap">
{{ row.nickName }}
</div>
<div class="opacity-50">
{{ row.phonenumber || '暂无手机号' }}
</div>
</div>
</div>
</template>
<template #action="{ row }"> <template #action="{ row }">
<a-button size="small" @click="handleRemoveItem(row)"> <a-button size="small" @click="handleRemoveItem(row)">
移除 移除

View File

@ -207,7 +207,7 @@ const [ApplyModal, applyModalApi] = useVbenModal({
</Space> </Space>
</template> </template>
</BasicTable> </BasicTable>
<UserSelectModal mode="single" /> <UserSelectModal mode="multiple" />
<FlowInfoModal /> <FlowInfoModal />
<ApplyModal /> <ApplyModal />
</Page> </Page>