<template>
  <div>
    <BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" :showOkBtn="false" :showCancelBtn="false">
        <BasicTable @register="registerTable"></BasicTable>
    </BasicModal>
  </div>
</template>
<script lang="ts" setup>
    import { ref, computed, unref, nextTick  } from 'vue';
    import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
    import { BasicForm, useForm } from '/@/components/Form/index';
    import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
    import { useMessage } from '/@/hooks/web/useMessage';
    import { useI18n } from '/@/hooks/web/useI18n';
    import { getLngSupplierPage } from '/@/api/supplier/Supplier';

    const { t } = useI18n();
    const columns: BasicColumn[] = [
      { dataIndex: 'suCode', title: '审批人', align: 'left', sorter: true },
      { dataIndex: 'suName', title: '审批时间', align: 'left', sorter: true },
      { dataIndex: 'suSname', title: '通过/驳回', align: 'left', sorter: true },
      { dataIndex: 'dI', title: '驳回原因', align: 'left', sorter: true },
    ];

    const emit = defineEmits(['success', 'register']);
    const isUpdate = ref(true);
    const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {

        setModalProps({ confirmLoading: false });

        isUpdate.value = !!data?.isUpdate;
    });

    const [registerTable, {}] = useTable({
        title: t('审批状态'),
        api: getLngSupplierPage,
        columns,
        formConfig: {
          rowProps: {
            gutter: 16,
          },
          schemas: [],

          showResetButton: false,
          showSubmitButton: false
        },
        bordered: true,
        pagination: false,
        canResize: false,
        useSearchForm: false,
        showTableSetting: false,
        immediate: true, // 设置为不立即调用
        beforeFetch: (params) => {
          return { ...params,};
        },
    });
    const getTitle = computed(() => (!unref(isUpdate) ? t('审批状态') : t('')));
</script>
<style lang="less" scoped>
  :deep(.ant-table-title) {
    display: none !important;
  }
</style>
