  // 智能表格列配置 - 使用 hideInTable 控制显示
  // 所有字段都会生成，但非核心字段默认隐藏，用户可通过列设置显示

  const columns = ref<ColumnItem[]>([
  <% var coreFieldCount = 0; %>
  <% for(field in table.fields) { %>
    <% if(field.propertyName != 'tenantId' && field.propertyName != 'deleted' && field.propertyName != 'version'){ %>
    <%
      // 定义核心字段优先级
      var priority = 0;
      var isCoreField = false;

      if(field.keyFlag) {
        priority = 10;
        isCoreField = true;
      } else if(field.propertyName == 'name' || field.propertyName == 'title') {
        priority = 9;
        isCoreField = true;
      } else if(field.propertyName == 'code') {
        priority = 8;
        isCoreField = true;
      } else if(field.propertyName == 'status') {
        priority = 7;
        isCoreField = true;
      } else if(field.propertyName == 'sort') {
        priority = 6;
        isCoreField = true;
      } else if(field.propertyName == 'createTime') {
        priority = 5;
        isCoreField = true;
      } else if(field.propertyName == 'updateTime') {
        priority = 3;
        isCoreField = false; // 更新时间默认隐藏
      } else if(field.propertyType == 'String' && (field.propertyName.contains('remark') || field.propertyName.contains('description') || field.propertyName.contains('content'))) {
        priority = 1;
        isCoreField = false; // 长文本字段默认隐藏
      } else {
        priority = 4;
        isCoreField = false; // 其他字段默认隐藏
      }

      // 限制核心字段数量（最多6个）
      if(isCoreField && coreFieldCount >= 6) {
        isCoreField = false;
      }
      if(isCoreField) {
        coreFieldCount = coreFieldCount + 1;
      }
    %>
    {
      title: '${field.comment!field.propertyName}',
      dataIndex: '${field.propertyName}',
      key: '${field.propertyName}',
      align: 'center',
      <% if(!isCoreField){ %>
      hideInTable: true, // 非核心字段默认隐藏，可通过列设置显示
      <% } %>
      <% if(field.keyFlag){ %>
      width: 90,
      <% } else if(field.propertyName == 'createTime' || field.propertyName == 'updateTime'){ %>
      width: 120,
      sorter: true,
      ellipsis: true,
      customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
      <% } else if(field.propertyType == 'String' && (field.propertyName.contains('remark') || field.propertyName.contains('description') || field.propertyName.contains('content'))){ %>
      width: 200,
      ellipsis: true
      <% } else if(field.propertyType == 'String'){ %>
      width: 150,
      ellipsis: true
      <% } else if(field.propertyName == 'status'){ %>
      width: 80
      <% } else if(field.propertyName == 'sort'){ %>
      width: 80
      <% } else { %>
      width: 120
      <% } %>
    },
    <% } %>
  <% } %>
    {
      title: '操作',
      key: 'action',
      width: 180,
      fixed: 'right',
      align: 'center',
      hideInSetting: true // 操作列不允许隐藏
    }
  ]);
