<template>
  <BasicModal
    :width="800"
    :footer="null"
    title="故障电梯分布详细数据"
    @register="registerInnerModal"
  >
    <BasicTable @register="registerTable"> </BasicTable>
  </BasicModal>
</template>
<script lang="ts" setup>
import { defineModel, defineExpose, ref } from "vue";
import { BasicTable, useTable } from "@/components/Table";
import { BasicModal, useModalInner } from "@/components/Modal";
import { elevatorFaultList } from "@/api/basicInfo/elevator";
import { columns } from "./trapped.data";
import dayjs from "dayjs";
const props = defineProps({
  loading: Boolean,
});

const commonObj = defineModel<any>("commonObj");

const [registerInnerModal, { modalLoading, closeModal }] = useModalInner(
  async (data: { passDate }) => {
    modalLoading(true);
    const { passDate } = data;
    await initEleList(passDate);
    modalLoading(false);
    // await reload();
  }
);
const openTableModal = (bool, passDate) => {
  console.log(passDate, "passDate");
  // passDate.value = passDate;
};
const initEleList = async (date) => {
  const res = await elevatorFaultList(date);
  setTableData(res.rows);
};
const [registerTable, { reload, setTableData }] = useTable({
  title: "",
  showIndexColumn: false,
  useSearchForm: false,
  showTableSetting: false,
  columns: columns,
});
defineExpose({ openTableModal });
</script>

<style lang="less" scoped>
/deep/.ant-card-body {
  padding: 0 !important;
}
</style>
