
<template>
  <div>
    <vxe-drawer
      show-confirm-button
      show-cancel-button
      v-model="showPopup"
      :title="pageTilte"
      width="100%"
      height="100%"
      :loading="loading"
    >
      <iframe 
        id="iframeId" 
        ref="iframeRef"
        :src="frmUrl" 
        frameborder="0" 
        style="width: 100%; height: 100%;"
      ></iframe>
    </vxe-drawer>
  </div>
</template>


<script lang="ts" setup>
import { ref, onMounted,nextTick } from "vue";
import { useUserStoreWithOut } from "/@/store/modules/user";
import { defHttp } from '/@/utils/http/axios';
import { getToken } from '/@/utils/auth';

const user = useUserStoreWithOut();
const showPopup = ref(false);
const frmUrl = ref("");
const loading = ref(false);
const pageTilte = ref("");
const iframeRef = ref<HTMLIFrameElement>(); 

const iniPage = async (data) => {
  pageTilte.value = data.projectName;
  showPopup.value = true;
  frmUrl.value = `${import.meta.env.VITE_APP_JFLOW_CORE_ADDR}/#/WF/MyFlow?FlowNo=087&Token=${user.getJflowToken}&tid=${data.id}`;
  const setSourctUrl = '/api/jflow/setCCWorkId';
  await defHttp.get({
    url: setSourctUrl,
    params: {"targetId":data.id,"targetKey":"targetKey","token":getToken()},
  });

}

// 暴露方法
defineExpose({ iniPage });
</script>
