import type { DescItem } from '@/components/Descriptions';
<%_ if (fields.find(field => field.fieldIsEnum)) { _%>
  <%_ if (enableTranslation) { _%>
import { useI18n } from '@/hooks/web/useI18n';
  <% } else { _%>
import { allEnumsDict } from '@/models/enumerations/all-enums';
  <%_ } _%>
<%_ } _%>
<%_
const { detailFieldLines, detailImportStatements, detailShowInOneConfig } = (bcEntityData || { detailFieldLines: [], detailImportStatements: [], detailShowInOneConfig: {} });
_%>
<%_ if (detailImportStatements && detailImportStatements.size) { _%>
<%- Array.from(detailImportStatements).join('\n') %>
<%_ } _%>

// begcode-please-regenerate-this-file 如果您不希望重新生成代码时被覆盖，将please修改为don't ！！！

const fields = (hideColumns: string[] = []): DescItem[] => {
  return [
<%_
  detailFieldLines
        .filter(fieldLine => !(Object.keys(detailShowInOneConfig) || []).some(relationshipName => fieldLine.includes(`field: '${relationshipName}'`)))
        .forEach(column => {
_%>
    <%- column _%>
<%_ });_%>
  ].filter(item => !hideColumns.includes(item.field));
};
<%_
    Object.keys(detailShowInOneConfig).forEach(relationshipName => {
    const { formTableColumns, beforeReturn } = detailShowInOneConfig[relationshipName];
_%>
const <%= relationshipName %>Columns = (hideColumns: string[] = []) => {
<%_ if (beforeReturn) { _%>
<%- beforeReturn %>
<%_ } _%>
  return [
    <%_ formTableColumns.forEach(column => { _%>
    <%- column _%>
    <%_ }); _%>
  ].filter(item => !hideColumns.includes(item.field));
};
<%_
});
_%>

export default {
  fields,
<%_
Object.keys(detailShowInOneConfig).forEach(relationshipName => { _%>
  <%= relationshipName %>Columns,
<%_
});
_%>
};
