import { VxeGridProps } from 'vxe-table';
import { VxeGridPropTypes } from 'vxe-table/types/grid';
<%_ if (fields.find(field => field.fieldIsEnum)) { _%>
  <%_ if (enableTranslation) { _%>
import { useI18n } from '@/hooks/web/useI18n';
  <% } else { _%>
import { allEnumsDict } from '@/models/enumerations/all-enums';
  <%_ } _%>
<%_ } _%>
<%_
const { tableColumns, searchFormFields, tableImportStatements } = (bcEntityData || {tableColumns: [], searchFormFields: [], tableImportStatements: []});
_%>
<%_ if (tableImportStatements && tableImportStatements.size) { _%>
<%- Array.from(tableImportStatements).join('\n') %>
<%_ } _%>

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

const searchForm = (): any[] => [
    <%_
    searchFormFields.forEach(column => {
  _%>
  <%- column _%>
    <%_ });_%>
]

const columns = (): VxeGridPropTypes.Columns => [
<%_ if (!useCommonTable) { _%>
  <%_
      tableColumns.forEach(column => {
  _%>
  <%- column _%>
    <%_ });_%>
<%_ } _%>
];

const baseGridOptions = (): VxeGridProps => {
  return {
    rowConfig: {
      keyField: 'id',
      isHover: true,
    },
    border: true,
    showHeaderOverflow: true,
    showOverflow: true,
    keepSource: true,
    id: 'full_edit_1',
    height: 600,
    printConfig: {
      columns: [
        // { field: 'name' },
      ],
    },
    filterConfig: {
      remote: true,
    },
    columnConfig: {
      resizable: true,
    },
    sortConfig: {
      trigger: 'cell',
      remote: true,
      orders: ['asc', 'desc', null],
      multiple: true,
      defaultSort: {
        field: 'id',
        order: 'desc',
      },
    },
    pagerConfig: {
      layouts: ['Sizes', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump', 'FullJump', 'Total'],
      pageSize: 15,
      pageSizes: [5, 10, 15, 20, 30, 50],
      total: 0,
      pagerCount: 5,
      currentPage: 1,
    },
    importConfig: {},
    exportConfig: {},
    checkboxConfig: {
      // labelField: 'id',
      reserve: true,
      highlight: true,
    },
    editRules: {},
    editConfig: {
      trigger: 'click',
      mode: 'row',
      showStatus: true,
    },
<%_ if (fieldsContainParentAndChildren) { _%>
    treeConfig: {
      children: 'children',
      indent: 20,
      line: false,
      expandAll: false,
      accordion: false,
      trigger: 'default',
    },
<%_ } _%>
  };
};

export default {
  searchForm,
  columns,
  baseGridOptions,
}
