<template>
  <el-dialog
    :visible.sync="visible"
    :close-on-click-modal="false"
    :fullscreen="true"
    custom-class="upload-dialog"
    :before-close="beforeCloseStudyDig"
  >
    <span slot="title">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item v-show="rowData.SubjectCode">{{
          rowData.SubjectCode
        }}</el-breadcrumb-item>
        <!-- (${rowData.VisitNum})-->
        <el-breadcrumb-item v-show="rowData.VisitName">{{
          `${rowData.VisitName}`
        }}</el-breadcrumb-item>
      </el-breadcrumb>
    </span>
    <div class="base-modal-body">
      <!-- 已提交DICOM影像  -->
      <h4 class="box-title" v-if="rowData.SubmitState === 2">
        {{ $t("trials:trials-panel:hirVisit:label:subDicom") }}
      </h4>
      <el-card class="box-card" v-if="rowData.SubmitState === 2">
        <StudyInfo
          v-if="rowData.SubjectId"
          :data="rowData"
          @getList="getList"
          @setOpenWindow="setOpenWindow"
        />
      </el-card>
      <!-- 未提交DICOM影像  -->
      <h4 class="box-title" v-if="rowData.SubmitState < 2">
        {{ $t("trials:trials-panel:hirVisit:label:notSubDicom") }}
      </h4>
      <el-card class="box-card" v-if="rowData.SubmitState < 2">
        <currentStudy
          v-if="rowData.SubjectId"
          :data="rowData"
          @getList="getList"
          @setOpenWindow="setOpenWindow"
        />
      </el-card>
    </div>
  </el-dialog>
</template>
<script>
import StudyInfo from "./studyInfo.vue";
import currentStudy from "./current-study.vue";
export default {
  name: "visitInfo",
  components: { StudyInfo, currentStudy },
  props: {
    visible: {
      required: true,
      default: false,
    },
    rowData: {
      required: true,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      openWindow: null,
    };
  },
  methods: {
    getList() {},
    setOpenWindow() {},
    beforeCloseStudyDig() {
      this.$emit("update:visible", false);
    },
    setOpenWindow(window) {
      if (this.openWindow) {
        this.openWindow.close();
      }
      this.openWindow = window;
    },
  },
};
</script>