<template>
  <div>
    <el-dialog
        v-model="state.dialog.isShowDialog"
        :close-on-click-modal="false"
        destroy-on-close
        :title="state.title"
        draggable
        width="60%"
    >
      <div>
        <div class="uscon">
          <iframe class="iframe" :src="state.url" frameborder="0"></iframe>
        </div>
      </div>
      <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="state.dialog.isShowDialog = false">
          关闭
        </el-button>
      </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts" name="systemlogDialog">
import { reactive, ref } from "vue";
// 定义子组件向父组件传值/事件
const emit = defineEmits(["refresh"]);

// 定义变量内容
const state = reactive<any>({
  dialog: {
    isShowDialog: false,
  },
  title:"",
  url: "",
});

// 打开弹窗
const openDialog = async (row: any) => {
  let url = import.meta.env.VITE_API_URL + "upload/" + row.pdfUrl;
  state.url = url;
  state.title = row.pdfUrl;
  state.dialog.isShowDialog = true;
};
// 关闭弹窗
const closeDialog = () => {
  state.dialog.isShowDialog = false;
};
// 取消
const onCancel = () => {
  closeDialog();
};
// 提交
const onSubmit = async () => {
  // if (state.dialog.type === 'add') { }
};

// 暴露变量
defineExpose({
  openDialog,
});
</script>
<style lang="scss">
.nofoot {
  .el-drawer__footer {
    padding-top: 0;
  }
}
.uscon {
  max-height: 800px;
  min-height: 600px;
}
.foot {
  padding-bottom: 10px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.iframe {
  width: 100%;
  height: 99%;
  max-height: 800px;
  min-height: 600px;
  border: none;
  margin: 0;
  padding: 0;
}
</style>
