<script setup lang="ts">
import { columns, querySchema } from './data'
import FloorTree from "../components/floor-tree.vue"
import { Page, type VbenFormProps } from '@vben/common-ui'
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table'
import { paymentReviewList } from '#/api/property/costManagement/paymentReview'

const formOptions: VbenFormProps = {
  commonConfig: {
    labelWidth: 30,
    componentProps: {
      allowClear: true,
    },
  },
  schema: querySchema(),
  wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
}

const gridOptions: VxeGridProps = {
  checkboxConfig: {
    highlight: true,
    reserve: true,
  },
  columns,
  height: 'auto',
  keepSource: true,
  pagerConfig: {},
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues = {}) => {
        return await paymentReviewList({
          pageNum: page.currentPage,
          pageSize: page.pageSize,
          ...formValues,
        })
      },
    },
  },
  rowConfig: {
    keyField: 'id',
  },
  id: 'property-paymentReview-index'
}

const [BasicTable, tableApi] = useVbenVxeGrid({
  formOptions,
  gridOptions,
});
</script>

<template>
  <Page :auto-content-height="true">
    <div class="flex h-full gap-[8px]">
      <FloorTree class="w-[260px]"></FloorTree>
      <BasicTable class="flex-1 overflow-hidden" table-title="用水环比分析列表" />
    </div>
  </Page>
</template>
