<template>
  <div class="workbench-container">
    <div class="workbench-stats">
      <PanelCount ref="panelCount" @getSignSystemDocCount="getSignSystemDocCount" />
    </div>
    <div class="workbench-content">
      <div class="content-wrapper">
        <!-- PM/APM -->
        <!-- 阅片期 -->
        <div v-if="hasPermi(['trials:trials-panel:subject:readingPeriod:edit'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <clinicalDataPM />
          </el-card>
        </div>
        <!-- 一致性核查 -->
        <div v-if="hasPermi(['trials:trials-workbench:consistencyCheck'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <consistencyCheck />
          </el-card>
        </div>
        <!-- 重阅审批 -->
        <div v-if="hasPermi(['trials:trials-workbench:rereadApproval'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <RereadApproval />
          </el-card>
        </div>
        <!-- 阅片人筛选 -->
        <div v-if="hasPermi(['trials:trials-workbench:reviewerScreen'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ReviewerScreen />
          </el-card>
        </div>
        <!-- 中心调研 -->
        <div v-hasPermi="['trials:trials-workbench:attachments:site-research']" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <SiteResearch />
          </el-card>
        </div>
        <!-- 核对临床数据 -->
        <!-- SPM/CPM -->
        <!-- 阅片人审批 -->
        <div v-if="hasPermi(['trials:trials-workbench:reviewerApproval'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ReviewerApproval />
          </el-card>
        </div>
        <!-- 重阅审批 -->
        <div v-if="hasPermi(['trials:trials-workbench:spmRereadApproval'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <SpmRereadApproval />
          </el-card>
        </div>

        <!-- CRC -->
        <!-- 临床数据录入 -->
        <div v-if="hasPermi(['trials:trials-workbench:clinicalDataEntry'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <clinicalData />
          </el-card>
        </div>
        <!-- 临床数据确认 -->
        <div v-if="hasPermi(['trials:trials-workbench:clinicalDataEntry'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <clinicalDataConfirm />
          </el-card>
        </div>
        <!-- 影像质疑 -->
        <div v-if="hasPermi(['trials:trials-workbench:imageQuestion'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImageQuestion />
          </el-card>
        </div>

        <!-- 核查质疑 -->
        <div v-if="hasPermi(['trials:trials-workbenck:imageVerification'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImageVerification />
          </el-card>
        </div>
        <!-- 影像重传 -->
        <div v-if="hasPermi(['trials:trials-workbenck:imageReupload'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImageReupload />
          </el-card>
        </div>
        <!-- 加急影像提交 -->
        <div v-if="hasPermi(['trials:trials-workbenck:imageSubmission'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImageSubmission />
          </el-card>
        </div>
        <!-- IQC -->
        <!-- 影像质控 -->
        <div v-if="hasPermi(['trials:trials-workbenck:imageQC'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImageQualityControl />
          </el-card>
        </div>
        <!-- QC质疑 -->
        <div v-if="hasPermi(['trials:trials-workbenck:qcQuestion'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <QcQuestion />
          </el-card>
        </div>
        <!-- IR -->
        <!-- 影像待阅 -->
        <div v-if="hasPermi(['trials:trials-workbenck:imagesToRead'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <ImagesToRead />
          </el-card>
        </div>
        <!-- 医学反馈 -->
        <div v-if="hasPermi(['trials:trials-workbenck:medicalFeedback'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <MedicalFeedback />
          </el-card>
        </div>
        <!-- MIM -->
        <!-- 医学审核 -->
        <div v-if="hasPermi(['trials:trials-workbenck:medicalAudit'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <MedicalAudit />
          </el-card>
        </div>

        <div v-if="!hasPermi(['role:zys'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <NeedSignTrialDoc />
          </el-card>
        </div>

        <div v-if="isSignSystemDoc || hasPermi(['role:zys'])" class="item">
          <el-card :body-style="{ padding: '10px'}" style="height:100%">
            <NeedSignSysDoc @refreshStats="refreshStats" />
          </el-card>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import PanelCount from './components/panelCount'
import NeedSignTrialDoc from './components/needSignTrialDoc'
import SiteResearch from './components/siteResearch'
import NeedSignSysDoc from './components/needSignSysDoc'
import consistencyCheck from './components/consistencyCheck'
import clinicalData from './components/clinicalData'
import clinicalDataConfirm from './components/clinicalDataConfirm'
import clinicalDataPM from './components/clinicalDataPM'
import RereadApproval from './components/rereadApproval'
import ReviewerScreen from './components/reviewerScreen'
import ReviewerApproval from './components/reviewerApproval'
import SpmRereadApproval from './components/spmRereadApproval'
import ImageQuestion from './components/imageQuestion'
import ImageVerification from './components/imageVerification'
import ImageReupload from './components/imageReupload'
import ImageSubmission from './components/imageSubmission'
import ImageQualityControl from './components/imageQualityControl'
import QcQuestion from './components/qcQuestion'
import ImagesToRead from './components/imagesToRead'
import MedicalFeedback from './components/medicalFeedback'
import MedicalAudit from './components/medicalAudit'
export default {
  name: 'WorkBench',
  components: { clinicalDataConfirm, clinicalDataPM, PanelCount, NeedSignTrialDoc, SiteResearch, NeedSignSysDoc, consistencyCheck, clinicalData, RereadApproval, ReviewerScreen, ReviewerApproval, SpmRereadApproval, ImageQuestion, ImageVerification, ImageReupload, ImageSubmission, ImageQualityControl, QcQuestion, ImagesToRead, MedicalFeedback, MedicalAudit },
  data() {
    return {
      isSignSystemDoc: false
    }
  },
  methods: {
    getSignSystemDocCount(count) {
      this.isSignSystemDoc = count > 0
    },
    refreshStats() {
      this.$refs['panelCount'].getData()
    }
  }
}
</script>

<style lang="scss">
.workbench-container{
  ::-webkit-scrollbar {
    width: 7px;
    height: 7px;
  }
  ::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: #d0d0d0;
  }
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background-color: #fff;
  overflow-x: hidden;

  .workbench-stats{
    height: 120px;
  }
  .workbench-content{
    flex: 1;
    overflow-y: auto;
    .content-wrapper{
      width: 100%;
      height: 100%;
      display: flex;
      flex-flow: wrap;
      padding: 5px;
      .item{
        width: 50%;
        height: 500px;
        padding: 5px;
        box-sizing: border-box;
        .el-card__body{
          height: 100%;
        }
      }
    }
  }
  .table-row__p {
    color: #53646f;
    font-size: 13px;
    font-weight: 400;
    line-height: 18px;
    margin-bottom: 0px;
  }
  .table-row__span {
    color: #9eabb4;
    font-weight: 300;
    font-size: 12px;
  }
  .el-row{
    .el-col{
      padding:5px;
    }
  }
  .status:before{
    content: '';
    margin-bottom: 0;
    width: 9px;
    height: 9px;
    display: inline-block;
    margin-right: 7px;
    border-radius: 50%;
  }
  .status--red:before{
    background-color: #e36767;
  }

  .status--red{
    color: #e36767;
  }

  .status--blue:before{
    background-color: #3fd2ea;
  }

  .status--blue{
    color: #3fd2ea;
  }

  .status--yellow:before{
    background-color: #ecce4e;
  }

  .status--yellow{
    color: #ecce4e;
  }

  .status--green{
    color: #6cdb56;
  }
  .status--green:before{
    background-color: #6cdb56;
  }

  .status--grey{
    color: #9eabb4;
  }
  .status--grey:before{
    background-color: #9eabb4;
  }
  .chart-wrapper {
    background: #fff;
    padding: 16px 16px 0;
    margin-bottom: 32px;
  }
}
</style>
