import { h, resolveComponent } from 'vue';
import { DescItem } from '@begcode/components';
<%_ 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: DescItem[] = [
<%_ if (!useCommonTable) { _%>
  <%_
      detailFieldLines.filter(fieldLine => !(Object.keys(detailShowInOneConfig) || []).some(relationshipName => fieldLine.includes(`field: '${relationshipName}'`)))
        .forEach(column => {
  _%>
  <%- column _%>
    <%_ });_%>
<%_ } _%>
];
<%_
    Object.keys(detailShowInOneConfig).forEach(relationshipName => {
    const { formTableColumns, beforeReturn } = detailShowInOneConfig[relationshipName];
_%>
const <%= relationshipName %>Columns = () => {
<%_ if (beforeReturn) { _%>
<%- beforeReturn %>
<%_ } _%>
  return [
    <%_ formTableColumns.forEach(column => { _%>
    <%- column _%>
    <%_ }); _%>
  ];
};
<%_
});
_%>

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