<script setup name="empMaterials">
import Accessory from '@/components/accessory/index.vue'

defineProps({
  detailData: {
    type: Object,
    default: () => {}
  },
  basicInfoData: {
    type: Object
  },
  approvalInfoData: {
    type: Object
  },
  baseProjSetYear: {
    type: String,
    default: ''
  }
})
const column1 = [
  {
    label: '核心业务',
    prop: 'businessName',
    key: 'businessName'
  },
  {
    label: '实际成效指标',
    prop: 'name',
    key: 'name'
  },
  {
    label: '数值',
    prop: 'nums',
    key: 'nums'
  },
  {
    label: '单位',
    prop: 'unit',
    key: 'unit'
  }
]
</script>

<template>
  <el-descriptions :column="2" border>
    <el-descriptions-item label="是否完成日志数据归集" :span="2">
      {{ detailData.baseLogAggregation==='1'?'是':'否' }}
    </el-descriptions-item>
    <el-descriptions-item label="实际成效指标" :span="2">
      <table-list
        :pagination="false"
        style="width: 100%"
        :column="column1"
        :data="detailData.baseBusinessMetrics&&JSON.parse(detailData.baseBusinessMetrics)||[]"
        :empty-temp="false"
      />
    </el-descriptions-item>
    <el-descriptions-item v-if="(['05','06','07','00'].includes(basicInfoData?.baseProjSetProg)&&basicInfoData?.baseConstructionType?.includes('01'))||!basicInfoData?.baseConstructionType?.includes('01')" label="信息安全等级保护测评报告" :span="2">
      <template v-if="detailData?.baseInforLevelFile&&JSON.parse(detailData?.baseInforLevelFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseInforLevelFile&&JSON.parse(detailData?.baseInforLevelFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item v-if="!['01','02','03'].includes(basicInfoData?.baseProjSetProg)||baseProjSetYear*1<2023" label="商业密码应用评估报告" :span="2">
      <template v-if="detailData?.basePasswAssessFile&&JSON.parse(detailData?.basePasswAssessFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.basePasswAssessFile&&JSON.parse(detailData?.basePasswAssessFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item label="第三方验收测试报告" :span="2">
      <template v-if="detailData?.baseThirdAcceptFile&&JSON.parse(detailData?.baseThirdAcceptFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseThirdAcceptFile&&JSON.parse(detailData?.baseThirdAcceptFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item v-if="!['01','02','03','04'].includes(basicInfoData?.baseProjSetProg)||baseProjSetYear*1<2023" label="用户使用报告" :span="2">
      <template v-if="detailData?.baseUserConsFile&&JSON.parse(detailData?.baseUserConsFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseUserConsFile&&JSON.parse(detailData?.baseUserConsFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item label="监理总结报告" :span="2">
      <template v-if="detailData?.baseEstaSummFile&&JSON.parse(detailData?.baseEstaSummFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseEstaSummFile&&JSON.parse(detailData?.baseEstaSummFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item v-if="!['01','02','03','04'].includes(basicInfoData?.baseProjSetProg)||baseProjSetYear*1<2023" label="运维总结报告" :span="2">
      <template v-if="detailData?.baseOperatMaintenSummFile&&JSON.parse(detailData?.baseOperatMaintenSummFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseOperatMaintenSummFile&&JSON.parse(detailData?.baseOperatMaintenSummFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item v-if="basicInfoData?.baseProjSetProg==='07'" label="终验意见" :span="2">
      <template v-if="detailData?.baseFinalExpertOpinionFile&&JSON.parse(detailData?.baseFinalExpertOpinionFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseFinalExpertOpinionFile&&JSON.parse(detailData?.baseFinalExpertOpinionFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item label="项目延期申请表" :span="2">
      <template v-if="detailData?.baseEngineerPostpoFile&&JSON.parse(detailData?.baseEngineerPostpoFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseEngineerPostpoFile&&JSON.parse(detailData?.baseEngineerPostpoFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item label="变更报告" :span="2">
      <template v-if="detailData?.baseEngineerAlterFile&&JSON.parse(detailData?.baseEngineerAlterFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseEngineerAlterFile&&JSON.parse(detailData?.baseEngineerAlterFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
    <el-descriptions-item label="变更批复文件" :span="2">
      <template v-if="detailData?.baseChanFile&&JSON.parse(detailData?.baseChanFile)?.length">
        <p v-for="(file,fileIndex) in detailData?.baseChanFile&&JSON.parse(detailData?.baseChanFile)" :key="fileIndex" class="mb-4">
          <accessory :file-name="file.originalFileName" :file-id="file.id" />
        </p>
      </template>
      <span v-else>-</span>
    </el-descriptions-item>
  </el-descriptions>
</template>
