<template>
  <BasicModal v-bind="$attrs" @register="registerModal" title="文件内容查看" :centered="true" width="80%" :useWrapper="true" :footer="null">
    <div style="background-color: #ececec; padding: 5px">
        <div :style="{ overflow: 'hidden', height: '85vh' }">
          <ShowFileCotent ref="refShowFileCotent"  :loading="loading"/>
        </div>
    </div>
  </BasicModal>
</template>

<script lang="ts" setup>
  import { ref, nextTick } from 'vue';
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import ShowFileCotent from './ShowFileContent.vue';

  const refShowFileCotent = ref();
  const loading = ref(false);

  const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {  
    const { showFooter, record } = data || {}; 
    const { filePath, fileId } = record || {};  
    setModalProps({  
        confirmLoading: false,  
        showCancelBtn: !!showFooter,  
        showOkBtn: !!showFooter,  
    }); 

    if (filePath) {
        refShowFileCotent.value.setDocFile(record);  
    } else if (fileId) {
        refShowFileCotent.value.setDocFileById(fileId);  
    }  
}); 

</script>

<style lang="less" scoped>
  :deep(.ant-input-number) {
    width: 100%;
  }

  :deep(.ant-calendar-picker) {
    width: 100%;
  }
</style>
