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
*/
console.info(config?.allSchemas.tableSchema)
const gridOptions = reactive<VxeGridProps>({
loading: true,
size: currentSize as any,

View File

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

View File

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