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

defineProps({
  detailData: {
    type: Array,
    default: () => []
  },
  basicInfoData: {
    type: Object
  },
  baseProjSetYear: {
    type: String,
    default: ''
  },
  dictionaryList: {
    type: Array,
    default: () => []
  }
})
</script>

<template>
  <template v-if="detailData?.length">
    <el-descriptions
      v-for="(item,index) in detailData"
      :key="index"
      :column="2"
      border
      class="mb-16"
    >
      <template v-if="['05','06','07','00'].includes(basicInfoData?.baseProjSetProg)">
        <el-descriptions-item label="标段名称">
          {{ item?.baseBidName ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="采购方式">
          {{ dictionaryList?.filter(i => i.type === 'PURCHASE_METHOD').find(i=>i.value===item?.baseProjPurchaseWay)?.label ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="预算执行确认书编号">
          {{ item?.basePurchaseCode ||'-' }}
        </el-descriptions-item>
      </template>
      <template v-if="['05','06','07','00'].includes(basicInfoData?.baseProjSetProg)||baseProjSetYear*1<2023">
        <el-descriptions-item label="采购代理机构">
          {{ item?.basePurchasingAgencies ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="采购代理机构统一社会信用代码">
          {{ item?.baseUnifiedCreditCode ||'-' }}
        </el-descriptions-item>
      </template>
      <template v-if="['05','06','07','00'].includes(basicInfoData?.baseProjSetProg)">
        <el-descriptions-item label="中标（成交）时间">
          {{ item?.baseWinningBidTime ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="中标（成交）金额">
          {{ item?.baseProjPurchaseAmount ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="中标（成交）供应商名称">
          {{ item?.baseConsDeprt ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="中标（成交）供应商统一社会信用代码">
          {{ item?.baseConsDeprtUsci ||'-' }}
        </el-descriptions-item>
      </template>
      <template v-if="['05','06','07','00'].includes(basicInfoData?.baseProjSetProg)||baseProjSetYear*1<2023">
        <el-descriptions-item label="项目款支付时间">
          {{ item?.basePaymentTime ||'-' }}
        </el-descriptions-item>
        <el-descriptions-item label="项目款支付金额">
          {{ item?.paymentProgress ||'-' }}万元
        </el-descriptions-item>
      </template>
      <template v-if="['05','06','07','00']?.includes(basicInfoData?.baseProjSetProg)">
        <el-descriptions-item label="招标（采购）文件">
          <p v-for="(file,fileIndex) in item?.purchaseFile&&JSON.parse(item?.purchaseFile)" :key="fileIndex" class="mb-4">
            <accessory :file-name="file.originalFileName" :file-id="file.id" />
          </p>
        </el-descriptions-item>
        <el-descriptions-item label="中标（成交）通知">
          <p v-for="(file,fileIndex) in item?.biddingFile&&JSON.parse(item?.biddingFile)" :key="fileIndex" class="mb-4">
            <accessory :file-name="file.originalFileName" :file-id="file.id" />
          </p>
        </el-descriptions-item>
        <el-descriptions-item label="采购合同">
          <p v-for="(file,fileIndex) in item?.purchaseContract&&JSON.parse(item?.purchaseContract)" :key="fileIndex" class="mb-4">
            <accessory :file-name="file.originalFileName" :file-id="file.id" />
          </p>
        </el-descriptions-item>
      </template>
    </el-descriptions>
  </template>
  <no-data v-else />
</template>
