<%_ const { formFieldLines, showInOneConfig, formImportStatements } = bcEntityData;

_%>
<%_ if (fields.find(field => field.fieldIsEnum)) { _%>
  <%_ if (enableTranslation) { _%>
import { useI18n } from '@/hooks/web/useI18n';
  <% } else { _%>
import { allEnumsDict } from '@/models/enumerations/all-enums';
  <%_ } _%>
<%_ } _%>
import { FormSchema } from '@/components/Form';
import apiService from '@/api-service/index';
<%_ if (formImportStatements && formImportStatements.size) { _%>
<%- Array.from(formImportStatements).join('\n') %>
<%_ } _%>

<%_
let apiModuleName = this._.camelCase(clientRootFolder || microserviceName);
const prefixApi = apiModuleName ? apiModuleName + '.' : '';
_%>
const <%= entityInstance %>Service = apiService.<%= prefixApi %><%= entityInstance %>Service;
<%_
Object.keys(showInOneConfig).forEach(relationshipName => {
    const { relationship } = showInOneConfig[relationshipName];
    const relationshipOtherEntity = relationship.otherEntity;
    const relationApiModuleName = this._.camelCase(relationship.otherEntity.clientRootFolder || relationship.otherEntity.microserviceName);
_%>
const <%= relationshipOtherEntity.persistInstance%>Service = apiService.<%= relationApiModuleName ? relationApiModuleName + '.' : ''%><%= relationshipOtherEntity.entityInstance %>Service;
<%_ }); _%>

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

const fields = (relationshipApis: any): FormSchema[] => {
<%_ if (fields.find(field => field.fieldIsEnum)) { _%>
  <%_ if (enableTranslation) { _%>
  const { getEnumDict } = useI18n();
  <%_ } _%>
<%_ } _%>
  return [
<%_
formFieldLines.forEach(column => {
_%>
    <%- column _%>
<%_ });_%>
  ];
};
<%_
  Object.keys(showInOneConfig).forEach(relationshipName => {
  const { formTableColumns, beforeReturn } = showInOneConfig[relationshipName];
_%>
const <%= relationshipName %>Columns = () => {
<%_ if (beforeReturn) { _%>
<%- beforeReturn %>
<%_ } _%>
  return [
    <%_
        formTableColumns.forEach(column => {
    _%>
      <%- column _%>
    <%_ }); _%>
  ];
};
<%_
});
_%>
export default {
  fields,
<%_
Object.keys(showInOneConfig).forEach(relationshipName => { _%>
  <%= relationshipName %>Columns,
<%_
});
_%>
};
