<template>
  <div class="order-list">
    <BasicTable @register="registerTable">
      <template #action="{ record }">
        <TableAction
          :actions="[
            {
              label: '详情',
              onClick: toDetail.bind(null, record),
            },
          ]"
        />
      </template>
    </BasicTable>
  </div>
</template>

<script lang="ts">
  export default {
    name: 'OrderList',
  }
</script>
<script setup lang="ts">
  import moment from 'moment/moment'
  import { computed, ref } from 'vue'
  import { Card } from 'ant-design-vue'
  import { useRouter } from 'vue-router'
  import { tableColumns, tableFormSchema } from './data'
  import { BasicTable, useTable, TableAction } from '/@/components/Table'
  import { getChatMessagePage } from '/@/api/clue'

  const [registerTable] = useTable({
    bordered: true,
    useSearchForm: true,
    columns: tableColumns,
    showIndexColumn: true,
    showTableSetting: false,
    api: getChatMessagePage,
    formConfig: {
      labelWidth: 120,
      schemas: tableFormSchema,
    },
    // beforeFetch: (arg) => {
    //   const { orderTime } = arg
    //   if (orderTime) {
    //     arg.orderTimeFrom = moment(orderTime[0]).format('YYYY-MM-DD 00:00:00')
    //     arg.orderTimeTo = moment(orderTime[1]).format('YYYY-MM-DD 23:59:59')
    //     delete arg.orderTime
    //   }
    // },
    actionColumn: {
      width: 160,
      title: '操作',
      fixed: 'right',
      dataIndex: 'action',
      slots: { customRender: 'action' },
    },
  })

   
  const router = useRouter()
  function toDetail(record: any) {
    const { miId, userMarriageInformationType } = record
    router.push({
      query: { miId, type: userMarriageInformationType },
      path: '/message/chatInfo',
    })
  }
</script>
<style scoped lang="less">
  .order-list {
    width: 60vw;
    min-width: 900px;
  }
</style>
