perf: dept

This commit is contained in:
xingyu 2022-11-17 23:05:39 +08:00
parent bc97bd30a0
commit 5725d4862b
3 changed files with 22 additions and 15 deletions

View File

@ -42,7 +42,6 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
/** /**
* grid options * grid options
*/ */
console.info(config?.allSchemas.tableSchema)
const gridOptions = reactive<VxeGridProps>({ const gridOptions = reactive<VxeGridProps>({
loading: true, loading: true,
size: currentSize as any, size: currentSize as any,

View File

@ -42,7 +42,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
}, },
{ {
title: '负责人', title: '负责人',
field: 'leaderUserId' field: 'leaderUserId',
table: {
slots: {
default: 'leaderUserId_default'
}
}
}, },
{ {
title: '联系电话', title: '联系电话',

View File

@ -14,6 +14,9 @@
<XButton title="展开所有" @click="xGrid?.setAllTreeExpand(true)" /> <XButton title="展开所有" @click="xGrid?.setAllTreeExpand(true)" />
<XButton title="关闭所有" @click="xGrid?.clearTreeExpand()" /> <XButton title="关闭所有" @click="xGrid?.clearTreeExpand()" />
</template> </template>
<template #leaderUserId_default="{ row }">
<span>{{ userNicknameFormat(row) }}</span>
</template>
<template #actionbtns_default="{ row }"> <template #actionbtns_default="{ row }">
<!-- 操作修改 --> <!-- 操作修改 -->
<XTextButton <XTextButton
@ -200,21 +203,21 @@ const handleDelete = async (rowId: number) => {
await deleteData(xGrid, rowId) await deleteData(xGrid, rowId)
} }
//const userNicknameFormat = (row) => { const userNicknameFormat = (row) => {
// if (!row && !row.row && !row.row.leaderUserId) { if (!row || !row.leaderUserId || row.leaderUserId == null) {
// return '' return '未设置'
// } }
// for (const user of userOption.value) { for (const user of userOption.value) {
// if (row.row.leaderUserId === user.id) { if (row.leaderUserId === user.id) {
// return user.nickname return user.nickname
// } }
// } }
// return '' + row.row.leaderUserId + '' return '未知【' + row.leaderUserId + '】'
//} }
//
// ========== ========== // ========== ==========
onMounted(async () => { onMounted(async () => {
await getTree()
await getUserList() await getUserList()
await getTree()
}) })
</script> </script>