<template>
  <div ref="container" style="width:100%;height:100%" class="dicom-container">
    <!-- 访视阅片 -->
    <div
      v-if="readingCategory === 1 && (CriterionType === 7 || ((CriterionType === 1 || CriterionType === 0) && readingVersionEnum === 1))"
      class="reading-wrapper">
      <VisitReview :reading-tool="readingTool" />
    </div>
    <div
      v-else-if="(isReadingTaskViewInOrder === 1 || ((isReadingTaskViewInOrder !== 1) && isShow)) && readingCategory === 1 && CriterionType !== 0"
      class="reading-wrapper">
      <el-tabs v-model="activeName" v-loading="loading" :before-leave="beforeLeave">
        <!-- 阅片 -->
        <el-tab-pane :label="$t('trials:reading:tabTitle:review')" name="read">
          <ReadPage v-if="tabs.includes('read')" :trial-id="trialId" :visit-task-id="visitTaskId"
            :subject-id="subjectId" :subject-code="subjectCode" :is-show="isShow"
            :question-form-change-state="questionFormChangeState" :question-form-change-num="questionFormChangeNum"
            :is-reading-show-subject-info="isReadingShowSubjectInfo"
            :is-reading-task-view-in-order="isReadingTaskViewInOrder" :is-exists-clinical-data="isExistsClinicalData"
            :is-exists-no-dicom-file="isExistsNoDicomFile" :is-exists-manual="isExistsManual"
            :isReadKeyFile="isReadKeyFile" :isHaveKeyFile="isHaveKeyFile"
            :ise-c-r-f-show-in-dicom-reading="IseCRFShowInDicomReading" @previewCD="previewCD" />
        </el-tab-pane>
        <!-- 报告 -->
        <el-tab-pane v-if="!IseCRFShowInDicomReading" :label="$t('trials:reading:tabTitle:report')" name="report">
          <ReportPage v-if="tabs.includes('report') && isShow" ref="reportPage"
            :question-form-change-state="questionFormChangeState" :visit-task-id="visitTaskId" />
        </el-tab-pane>
      </el-tabs>
    </div>
    <div
      v-else-if="(isReadingTaskViewInOrder === 1 || ((isReadingTaskViewInOrder !== 1) && isShow)) && readingCategory === 1 && CriterionType === 0"
      class="reading-wrapper">
      <el-tabs v-model="activeName" v-loading="loading" :before-leave="beforeLeaveCustomize">
        <!-- 阅片 -->
        <el-tab-pane :label="$t('trials:reading:tabTitle:review')" name="read">
          <CustomizeReadPage v-if="tabs.includes('read')" :trial-id="trialId"
            :trial-reading-criterion-id="TrialReadingCriterionId" :visit-task-id="visitTaskId" :subject-id="subjectId"
            :subject-code="subjectCode" :is-show="isShow" :is-reading-show-subject-info="isReadingShowSubjectInfo"
            :is-reading-task-view-in-order="isReadingTaskViewInOrder"
            :ise-c-r-f-show-in-dicom-reading="IseCRFShowInDicomReading" :is-exists-clinical-data="isExistsClinicalData"
            :is-exists-no-dicom-file="isExistsNoDicomFile" :is-exists-manual="isExistsManual"
            :isReadKeyFile="isReadKeyFile" :isHaveKeyFile="isHaveKeyFile" @previewCD="previewCD" />
        </el-tab-pane>
        <!-- 报告 -->
        <el-tab-pane v-if="!IseCRFShowInDicomReading" :label="$t('trials:reading:tabTitle:report')" name="report">
          <CustomizeReportPage v-if="isShow" ref="reportPage" :visit-task-id="visitTaskId" />
        </el-tab-pane>
      </el-tabs>
    </div>
    <!-- 全局阅片 -->
    <GlobalReview v-else-if="isShow && readingCategory === 2" :trial-id="trialId" :subject-id="subjectId"
      :visit-task-id="visitTaskId" :reading-category="readingCategory" :subject-code="subjectCode"
      :task-blind-name="taskBlindName" :is-reading-show-subject-info="isReadingShowSubjectInfo"
      :is-reading-show-previous-results="isReadingShowPreviousResults" :is-exists-clinical-data="isExistsClinicalData"
      :imageToolType="1" />
    <!-- 裁判阅片 -->
    <AdReview v-else-if="isShow && readingCategory === 4" :trial-id="trialId" :subject-id="subjectId"
      :visit-task-id="visitTaskId" :reading-category="readingCategory" :subject-code="subjectCode"
      :task-blind-name="taskBlindName" :is-reading-show-subject-info="isReadingShowSubjectInfo"
      :is-reading-show-previous-results="isReadingShowPreviousResults" :is-exists-clinical-data="isExistsClinicalData"
      :imageToolType="1" />

    <!-- 肿瘤学阅片 -->
    <OncologyReview v-else-if="isShow && readingCategory === 5" :trial-id="trialId" :subject-id="subjectId"
      :visit-task-id="visitTaskId" :reading-category="readingCategory" :subject-code="subjectCode"
      :task-blind-name="taskBlindName" :is-reading-show-subject-info="isReadingShowSubjectInfo"
      :is-reading-show-previous-results="isReadingShowPreviousResults" :is-exists-clinical-data="isExistsClinicalData"
      :imageToolType="1" />

    <el-dialog :visible.sync="dialogVisible" :custom-class="isFullscreen ? 'full-dialog-container' : 'dialog-container'"
      :show-close="false" :close-on-click-modal="false" :fullscreen="isFullscreen">
      <span slot="title" class="dialog-footer">
        <!-- 当前阅片任务存在临床数据，请查看。若已查看，请点击“确认” -->
        <span v-if="!closeCDVisible">{{ $t('trials:reading:dagTitle:msg1') }}</span>
        <div style="position: absolute;right: 20px;top: 10px;">
          <svg-icon :icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
            style="cursor: pointer;font-size: 20px;" @click="isFullscreen = !isFullscreen" />
          <svg-icon v-if="closeCDVisible" icon-class="dClose" style="cursor: pointer;font-size: 25px;margin-left: 10px;"
            @click="dialogVisible = false" />
        </div>
      </span>
      <div style="height: 100%;margin:0;display: flex;flex-direction: column;">
        <ClinicalData v-if="dialogVisible" style="flex: 1" :trial-id="trialId" :subject-id="subjectId"
          :visit-task-id="cdVisitTaskId" :is-reading-show-subject-info="isReadingShowSubjectInfo" />
        <div v-if="!closeCDVisible" style="text-align:right">
          <!-- 确认 -->
          <el-button type="primary" @click="handleConfirmCD">{{ $t('trials:reading:button:confirm') }}</el-button>
        </div>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="tipVisible" :show-close="false" :close-on-click-modal="false" width="500px">
      <span slot="title" class="dialog-footer">
        <!-- 提示 -->
        {{ $t('trials:iRecist:warnning:msg44') }}
      </span>
      <div>
        <div>
          <!-- 您确定当前访视的整体评估结果为PD。根据《独立影像评估章程》，该访视进入iRECIST阅片环节。请对新病灶进行重新评估： -->
          {{ $t('trials:iRecist:warnning:msg45') }}
        </div>
        <div style="color: #f44336;font-size: 12px;margin: 5px;">
          <!-- （1）新病灶可转为：新靶病灶、新非靶病灶、其它既往新病灶。 -->
          {{ $t('trials:iRecist:warnning:msg46') }}
        </div>
        <div style="color: #f44336;font-size: 12px;margin: 5px;">
          <!-- （2）新靶病灶：状态为明确的新病灶才能转换为新靶病灶。新靶病灶的选择规则与RECIST1.1相同；如果当前病灶已有标记，但不符合新靶病灶的要求，请清除标记，重新标注。 -->
          {{ $t('trials:iRecist:warnning:msg47') }}
        </div>
        <div style="color: #f44336;font-size: 12px;margin: 5px;">
          <!-- （3）新非靶病灶：状态为明确的新病灶才能转换为新非靶病灶。新靶病灶的选择规则与RECIST1.1相同。 -->
          {{ $t('trials:iRecist:warnning:msg48') }}
        </div>
        <div style="color: #f44336;font-size: 12px;margin: 5px;">
          <!-- （4）其它既往新病灶：系统会自动将状态为疑似、消失的新病灶，转换为其它既往新病灶，无需修改。 -->
          {{ $t('trials:iRecist:warnning:msg49') }}
        </div>
      </div>

      <span slot="footer" class="dialog-footer">
        <!-- 确认 -->
        <el-button type="primary" @click="tipVisible = false">{{ $t('trials:reading:button:confirm') }}</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="dialogBodyPartVisible"
      :custom-class="isFullscreen ? 'full-dialog-container' : 'dialog-container'" :show-close="false"
      :close-on-click-modal="false" :fullscreen="isFullscreen">
      <span slot="title" class="dialog-footer">
        <!-- <span>{{ $t('trials:reading:dagTitle:msg1') }}</span> -->
        <div style="position: absolute;right: 20px;top: 10px;">
          <svg-icon :icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
            style="cursor: pointer;font-size: 20px;" @click="isFullscreen = !isFullscreen" />
          <svg-icon icon-class="dClose" style="cursor: pointer;font-size: 25px;margin-left: 10px;"
            @click="dialogBodyPartVisible = false" />
        </div>
      </span>
      <div style="height: 100%;margin:0;display: flex;flex-direction: column;">
        <el-table :data="BodyPart" style="width: 100%">
          <el-table-column prop="StudyCode" :label="$t('trials:reading:table:StudyCode')">
          </el-table-column>
          <el-table-column prop="Modalities" :label="$t('trials:reading:table:Modalities')">
          </el-table-column>
          <el-table-column prop="BodyPart" :label="$t('trials:reading:table:BodyPart')">
            <template slot-scope="scope">
              <span>{{ Array.isArray(scope.row.BodyPart) ? scope.row.BodyPart.join(" | ") : '' }}</span>
            </template>
          </el-table-column>
        </el-table>
        <div style="text-align:right;margin-top: 10px;" v-if="!IsViewStudyPart">
          <!-- 确认 -->
          <el-button type="primary" @click="handleConfirmBP">{{ $t('trials:reading:button:confirm')
          }}</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getNextTask, readClinicalData, verifyDefaultQuestionBeAnswer, viewstudyPart } from '@/api/trials'
import VisitReview from './../dicoms3D/components/VisitReview'
import ReadPage from './components/ReadPage'
import CustomizeReadPage from './customize/CustomizeReadPage'
import ReportPage from './components/ReportPage'
import CustomizeReportPage from './customize/CustomizeReportPage'
import GlobalReview from '@/views/trials/trials-panel/reading/global-review'
import AdReview from '@/views/trials/trials-panel/reading/ad-review'
import OncologyReview from '@/views/trials/trials-panel/reading/oncology-review'
import ClinicalData from '@/views/trials/trials-panel/reading/clinical-data'
import DicomEvent from './components/DicomEvent'
import store from '@/store'
// import { getToken } from '@/utils/auth'
import { changeURLStatic } from '@/utils/history.js'
import requestPoolManager from '@/utils/request-pool'
import { mapGetters } from 'vuex'
export default {
  name: 'Reading',
  components: {
    VisitReview,
    ReadPage,
    ReportPage,
    GlobalReview,
    AdReview,
    OncologyReview,
    ClinicalData,
    CustomizeReadPage,
    CustomizeReportPage
  },
  data() {
    return {
      isClinicalDataShow: false,
      activeName: '',
      tabs: [],
      trialId: '',
      subjectCode: '',
      subjectId: '',
      visitTaskId: '',
      loading: false,
      readingCategory: null,
      isReadingShowSubjectInfo: false,
      isReadingShowPreviousResults: false,
      isExistsClinicalData: false,
      isExistsNoDicomFile: false,
      isNeedReadClinicalData: false,
      isReadClinicalData: false,
      digitPlaces: 2,
      isReadingTaskViewInOrder: null,
      firstTaskReadingCategory: null,
      criterionType: null,
      readingTool: 0,
      dialogVisible: false,
      TrialReadingCriterionId: null,
      isNewSubject: null,
      isShow: false,
      IseCRFShowInDicomReading: false,
      isQualityIssueSaved: false,
      questionFormChangeState: false,
      questionFormChangeNum: 0,
      isFullscreen: false,
      tipVisible: false,
      closeCDVisible: false,
      cdVisitTaskId: '',
      readingVersionEnum: null,
      dialogBodyPartVisible: false,
      isReadKeyFile: true,
      isHaveKeyFile: false,
      IsViewStudyPart: true
    }
  },
  computed: {
    ...mapGetters(['BodyPart'])
  },
  mounted() {
    requestPoolManager.resetRequestPool()
    requestPoolManager.setSortType(0)
    DicomEvent.$on('questionFormChange', (v) => {
      if (this.questionFormChangeNum !== 0) {
        this.questionFormChangeState = v
      }
      this.questionFormChangeNum++
    })
    DicomEvent.$on('getNextTask', () => {
      store.dispatch('reading/setActiveSeries', {})
      store.dispatch('reading/setLastCanvasTaskId', '')
      this.isQualityIssueSaved = false
      this.firstTaskReadingCategory = this.readingCategory
      if (this.isReadingTaskViewInOrder !== 1) {
        // 清除缓存visitTaskList
        store.dispatch('reading/resetVisitTasks')
      }
      this.getTaskInfo(1)
    })
    DicomEvent.$on('previewCD', (taskId) => {
      this.closeCDVisible = true
      this.isFullscreen = false
      this.dialogVisible = true
      this.cdVisitTaskId = taskId
    })
    DicomEvent.$on('previewBP', (taskId) => {
      this.isFullscreen = false
      this.dialogBodyPartVisible = true
    })
    this.activeName = this.$router.currentRoute.query.tabName ? this.$router.currentRoute.query.tabName : 'read'
    this.tabs.push(this.activeName)
    this.trialId = this.$router.currentRoute.query.trialId
    this.subjectCode = this.$router.currentRoute.query.subjectCode
    this.subjectId = this.$router.currentRoute.query.subjectId
    this.visitTaskId = this.$router.currentRoute.query.visitTaskId
    // this.isReadingTaskViewInOrder = parseInt(this.$router.currentRoute.query.isReadingTaskViewInOrder)
    // this.criterionType = this.$router.currentRoute.query.criterionType
    this.readingTool = this.$router.currentRoute.query.readingTool ? Number(this.$router.currentRoute.query.readingTool) : 0
    this.TrialReadingCriterionId = this.$router.currentRoute.query.TrialReadingCriterionId
    // this.isNewSubject = this.$router.currentRoute.query.isNewSubject

    // if (this.isNewSubject && this.isReadingTaskViewInOrder !== 0) {
    //   // 已开始受试者${this.subjectCode}阅片任务
    //   var msg = this.$t('trials:reading:warnning:msg1')
    //   msg = msg.replace('xxx', this.subjectCode)
    //   this.$message.success(msg)
    //   changeURLStatic('isNewSubject', '')
    // }
    if (this.$router.currentRoute.query.TokenKey) {
      store.dispatch('user/setToken', this.$router.currentRoute.query.TokenKey)
      changeURLStatic('TokenKey', '')
    }
    store.dispatch('reading/resetVisitTasks')
    this.getTaskInfo()
    window.addEventListener('beforeunload', this.handleWindowClose)
    window.addEventListener('storage', (event) => {
      if (event.key === 'closePage') {
        if (this.$router.currentRoute.query.pageType && this.$router.currentRoute.query.pageType === 'History') {
          window.close()
        }
      }
    });
  },
  beforeDestroy() {
    DicomEvent.$off('getNextTask')
    DicomEvent.$off('previewCD')
    DicomEvent.$off('previewBP')
    DicomEvent.$emit('resetOpenWindow')
    window.removeEventListener('beforeunload', this.handleWindowClose)
  },
  methods: {
    getTaskInfo(flag = 0) {
      this.loading = true
      var param = {
        subjectId: this.subjectId,
        trialId: this.trialId,
        subjectCode: this.subjectCode,
        visitTaskId: this.$router.currentRoute.query.visitTaskId,
        trialReadingCriterionId: this.$router.currentRoute.query.TrialReadingCriterionId
      }

      getNextTask(param).then(async res => {
        this.isShow = false
        this.visitTaskId = res.Result.VisitTaskId
        // DicomEvent.$emit('getCustomTableQuestionAnswer', res.Result.VisitTaskId)
        // if (this.subjectId !== res.Result.SubjectId) {
        //   store.dispatch('reading/resetVisitTasks')
        //   var token = getToken()
        //   window.location.href = `/readingDicoms?TrialReadingCriterionId=${this.TrialReadingCriterionId}&trialId=${this.trialId}&subjectCode=${res.Result.SubjectCode}&subjectId=${res.Result.SubjectId}&isReadingTaskViewInOrder=${this.isReadingTaskViewInOrder}&criterionType=${this.criterionType}&readingTool=${this.readingTool}&TokenKey=${token}&isNewSubject=1`
        //   return
        // } else if (!this.isReadingTaskViewInOrder || res.Result.ReadingCategory !== 1) {
        //   store.dispatch('reading/resetVisitTasks')
        //   if (this.firstTaskReadingCategory) {
        //     const token = getToken()
        //     window.location.href = `/readingDicoms?TrialReadingCriterionId=${this.TrialReadingCriterionId}&trialId=${this.trialId}&subjectCode=${res.Result.SubjectCode}&subjectId=${res.Result.SubjectId}&isReadingTaskViewInOrder=${this.isReadingTaskViewInOrder}&criterionType=${this.criterionType}&readingTool=${this.readingTool}&TokenKey=${token}`
        //     return
        //   }
        // }
        this.subjectId = res.Result.SubjectId
        localStorage.setItem('subjectId', res.Result.SubjectId)
        this.subjectCode = res.Result.SubjectCode
        localStorage.setItem('subjectCode', res.Result.SubjectCode)
        this.taskBlindName = res.Result.TaskBlindName
        this.isReadingShowSubjectInfo = res.Result.IsReadingShowSubjectInfo
        this.isReadingShowPreviousResults = res.Result.IsReadingShowPreviousResults
        this.isExistsNoDicomFile = res.Result.IsExistsNoDicomFile
        this.isExistsClinicalData = res.Result.IsExistsClinicalData
        this.isExistsManual = res.Result.ExistsManual
        this.isReadKeyFile = res.Result.IsReadKeyFile
        this.isHaveKeyFile = res.Result.IsHaveKeyFile
        this.isReadClinicalData = res.Result.IsReadClinicalData
        this.IsViewStudyPart = res.Result.IsViewStudyPart
        this.isNeedReadClinicalData = res.Result.IsNeedReadClinicalData
        this.CriterionType = res.Result.CriterionType
        this.digitPlaces = res.Result.DigitPlaces
        this.IseCRFShowInDicomReading = res.Result.IseCRFShowInDicomReading
        this.isReadingTaskViewInOrder = res.Result.IsReadingTaskViewInOrder
        localStorage.setItem('isReadingTaskViewInOrder', this.isReadingTaskViewInOrder)
        localStorage.setItem('CriterionType', res.Result.CriterionType)
        localStorage.setItem('digitPlaces', res.Result.DigitPlaces)
        localStorage.setItem('IsExistUnprocessedFeedback', res.Result.IsExistUnprocessedFeedback)
        localStorage.setItem('taskInfo', JSON.stringify(res.Result))
        sessionStorage.setItem('taskInfo', JSON.stringify(res.Result))
        this.readingCategory = res.Result.ReadingCategory
        this.readingVersionEnum = res.Result.ReadingVersionEnum
        this.questionFormChangeState = false
        this.questionFormChangeNum = 0
        if (this.isExistsClinicalData && this.isNeedReadClinicalData && !this.isReadClinicalData) {
          this.isFullscreen = false
          this.dialogVisible = true
          this.cdVisitTaskId = this.visitTaskId
        }
        if ((this.CriterionType === 19 || this.CriterionType === 20) && !this.IsViewStudyPart && this.readingCategory !== 4) {
          this.isFullscreen = false
          this.dialogBodyPartVisible = true
        }
        if (res.Result.ReadingCategory === 1) {
          this.activeName = 'read'
          this.tabs = [this.activeName]
        }
        if (this.firstTaskReadingCategory === 1 && res.Result.ReadingCategory === 1 && this.isReadingTaskViewInOrder !== 0 && flag) {
          this.activeName = 'read'
          this.tabs = [this.activeName]
          this.$nextTick(() => {
            DicomEvent.$emit('getNextVisitInfo')
            DicomEvent.$emit('getReportInfo')
            DicomEvent.$emit('resetOpenWindow')
          })
        }
        this.$nextTick(() => {
          this.isShow = true
          this.loading = false
          if (res.Result.IsFirstChangeTask && res.Result.ReadingTaskState === 0) {
            this.tipVisible = true
          }
        })
      }).catch(() => {
        store.dispatch('reading/setCurrentReadingTaskState', 2)
        this.loading = false
      })
    },
    beforeLeaveCustomize(activeName, oldActiveName) {
      if (oldActiveName === 'read') {
        this.isShow = true
        DicomEvent.$emit('getReportInfo', true)
        this.$nextTick(() => {
          this.$refs.reportPage.setScrollTop(1)
        })
      } else {
        // this.isShow = false
      }
      return Promise.resolve(true)
    },
    myConfirm(msg) {
      return new Promise(resolve => {
        this.$confirm(msg, {
          type: 'warning',
          showCancelButton: true
        }).then(() => {
          // this.tabs.push(activeName)
          // this.$nextTick(() => {
          //   this.$refs.reportPage.setScrollTop(1)
          // })
          resolve(true)
        }).catch(() => {
          resolve(false)
        })
      })
    },
    async beforeLeave(activeName, oldActiveName) {
      if (oldActiveName === 'read') {
        this.tabs.push(activeName)
        this.$nextTick(() => {
          this.$refs.reportPage.setScrollTop(1)
        })
        return Promise.resolve(true)
        // if (this.questionFormChangeState) {
        //   try {
        //     var msg = this.$t('trials:reading:warnning:msg201')
        //     var isgo = await this.myConfirm(msg)
        //     if (isgo) {
        //       // console.log(this.$refs['questions'])
        //       // this.$refs['questions'].handleSave()
        //       this.tabs.push(activeName)
        //       this.$nextTick(() => {
        //         this.$refs.reportPage.setScrollTop(1)
        //       })
        //       return Promise.resolve(true)
        //     } else {
        //       return Promise.reject(false)
        //     }
        //   } catch (e) {
        //     console.log(e)
        //   }
        // } else {
        //   this.tabs.push(activeName)
        //   return Promise.resolve(true)
        // }
        // var list = null
        // DicomEvent.$emit('getAllUnSaveLesions', val => {
        //   list = val
        // })
        // if (list.length > 0) {
        //   var arr = []
        //   list.map(i => {
        //     arr.push(i.lessionName)
        //   })
        //   // 请先保存${arr.join('、')}病灶信息！
        //   var msg = this.$t('trials:reading:warnning:msg2')
        //   msg = msg.replace('xxx', arr.join('、'))
        //   var isgo = await this.myConfirm(msg)
        //   if (isgo) {
        //     this.tabs.push(activeName)
        //     this.$nextTick(() => {
        //       this.$refs.reportPage.setScrollTop(1)
        //     })
        //     return Promise.resolve(true)
        //   } else {
        //     return Promise.reject(false)
        //   }
        // } else {
        //   this.tabs.push(activeName)
        //   return Promise.resolve(true)
        // }
        // this.tabs.push(activeName)
        // return Promise.resolve(true)
      } else {
        console.log(activeName)
        if (!this.tabs.includes(activeName)) {
          this.tabs.push(activeName)
        }
        // return true
        return Promise.resolve(true)
      }
    },
    verifyVisitTaskQuestions() {
      return new Promise((resolve, reject) => {
        this.loading = true
        verifyDefaultQuestionBeAnswer({ visitTaskId: this.visitTaskId }).then(res => {
          this.loading = false
          this.isQualityIssueSaved = true
          resolve()
        }).catch(() => {
          this.loading = false
          this.isQualityIssueSaved = false
          reject()
        })
      })
    },
    async handleConfirmCD() {
      this.loading = true
      var visitTaskId = this.visitTaskId
      try {
        await readClinicalData({ visitTaskId })
        this.loading = false
        this.dialogVisible = false
        this.isReadClinicalData = true
      } catch (e) {
        this.loading = false
      }
    },
    async handleConfirmBP() {
      this.loading = true
      var visitTaskId = this.visitTaskId
      try {
        await viewstudyPart({ visitTaskId })
        this.loading = false
        this.dialogBodyPartVisible = false
        this.IsViewStudyPart = true
      } catch (e) {
        this.loading = false
      }
    },
    previewCD() {
      this.closeCDVisible = true
      this.isFullscreen = false
      this.dialogVisible = true
      this.cdVisitTaskId = this.visitTaskId
    },
    handleWindowClose() {
      DicomEvent.$emit('resetOpenWindow')
    }
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-message-box__headerbtn {
  display: none;
}

.dicom-container {
  .reading-wrapper {
    width: 100%;
    height: 100%;
    padding: 0 5px;
    box-sizing: border-box;
    background-color: #000;

    ::v-deep .el-tabs {
      box-sizing: border-box;
      height: 100%;
      display: flex;
      flex-direction: column;

      .el-tabs__item {
        color: #fff;
      }

      .el-tabs__header {
        height: 50px;
        margin: 0px;
        box-sizing: border-box;
      }

      .el-tabs__content {
        flex: 1;
        margin: 0px;
        box-sizing: border-box;
      }

      .el-tabs__item {
        color: #fff;
      }

      .el-tab-pane {
        height: 100%;
      }

    }

    ::v-deep .hot-keys-label {
      color: #dfdfdf !important;
    }

    ::v-deep .shortcut-key-input span {
      color: #dfdfdf !important;
    }

    // ::v-deep .el-dialog{
    //   background: #1e1e1e;
    //   ::v-deep .el-dialog__body{
    //     padding: 10px;
    //   }

    // }
    ::v-deep .el-dialog {
      background: #1e1e1e;
      border: 1px solid #ddd;
      color: #ddd;

      .el-dialog__title {
        color: #fff;
      }

      .el-input .el-input__inner {
        background-color: transparent;
        color: #ddd;
        border: 1px solid #5e5e5e;
      }

      .el-input.is-disabled .el-input__inner {
        background-color: #646464a1;
      }

      .el-form-item__label {
        color: #dfdfdf
      }
    }

    ::v-deep .el-dialog.cd-dialog-container {
      .el-input.is-disabled .el-input__inner {
        background-color: rgb(245, 247, 250);
        color: #666;
        border: 1px solid #dcdfe6;
      }
    }

  }

  ::v-deep .dialog-container {
    margin-top: 50px !important;
    width: 75%;
    height: 80%;
  }

  ::v-deep .el-dialog__body {
    padding: 20px;
    height: calc(100% - 70px);
  }

  .el-dialog__header {
    position: relative;
  }
}

::v-deep .el-radio__input.is-disabled.is-checked .el-radio__inner {
  background-color: #428bca;
  border-color: #428bca;
}

.full-dialog-container {
  ::v-deep .is-fullscreen .el-dialog__body {
    height: calc(100% - 70px);
  }
}
</style>
