假设有一个名为sections的数组,包含了所有的section实体类数据。你可以使用数组的find方法根据sectionid找到对应的section实体类对象,然后将其name属性展示在科室码处。

以下是一个示例代码:

export const columns: BasicColumn[] = [{
  title: '科室码',
  dataIndex: 'sectionid',
  customRender: ({ text }: { text: any }) => {
    const section = sections.find((item) => item.sectionid === text);
    return section ? section.name : '';
  },
}];

在这个示例中,我们使用了customRender属性来自定义科室码列的渲染方式。通过传入的text参数,我们使用数组的find方法找到与sectionid匹配的section实体类对象,并返回其name属性。如果找不到匹配的对象,则返回一个空字符串。

请确保sections数组中包含了所有的section实体类数据,并根据你的实际情况进行相应的调整

export const columns BasicColumn = title 科室码 dataIndex sectionid 如何根据sectionid作为id获取section实体类的数据并将实体类的name属性展示在科室码处

原文地址: https://www.cveoy.top/t/topic/iKOb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录