mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-11-04 08:06:12 +08:00 
			
		
		
		
	perf: dept
This commit is contained in:
		@ -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,
 | 
			
		||||
 | 
			
		||||
@ -42,7 +42,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '负责人',
 | 
			
		||||
      field: 'leaderUserId'
 | 
			
		||||
      field: 'leaderUserId',
 | 
			
		||||
      table: {
 | 
			
		||||
        slots: {
 | 
			
		||||
          default: 'leaderUserId_default'
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      title: '联系电话',
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user