<template>
  <div class="mainView">
    <div class="article">
      <div class="infoBox" v-if="showInfoBox">
        <el-row>
          <el-col :span="12">
            <span class="title">索引号：</span>
            <span>{{ pageData.indexNumber }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title"
              >主题{{ queryData.type == "zcwj" ? "词" : "分类" }}：</span
            >
            <span>{{ pageData.subjectWord }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">发布机构：</span>
            <span>{{ pageData.informationSource }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">成文日期：</span>
            <span>{{ pageData.publishDate }}</span>
          </el-col>
          <el-col :span="24">
            <span class="title">标题：</span>
            <span>{{ pageData.documentName }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">发文字号：</span>
            <span>{{ pageData.documentNumber }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">是否有效：</span>
            <span>{{ pageData.validityStatus == "0" ? "无效" : "有效" }}</span>
          </el-col>
        </el-row>
      </div>
      <!-- 行政处罚 -->
      <div class="infoBox penalizeBox" v-if="queryData.type == 'xzcf'">
        <el-row>
          <el-col :span="12">
            <span class="title code">统一社会信用代码：</span>
            <span>{{ pageData.creditCode }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">案件类型：</span>
            <span>{{ pageData.caseTypeId }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">被处罚对象：</span>
            <span>{{ pageData.punishedEntity }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">处罚机关：</span>
            <span>{{ pageData.punishingAuthority }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">处罚时间：</span>
            <span>{{ pageData.punishmentTime }}</span>
          </el-col>
        </el-row>
      </div>
      <!-- 行政许可 -->
      <div class="infoBox penalizeBox" v-if="queryData.type == 'xzxk'">
        <el-row>
          <el-col :span="12">
            <span class="title code">统一社会信用代码：</span>
            <span>{{ pageData.creditCode }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">企业名称：</span>
            <span>{{ pageData.punishedEntity }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">法定代表人姓名：</span>
            <span>{{ pageData.legalRepresentative }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">许可机关：</span>
            <span>{{ pageData.licensor }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title title2">行政许可决定书文号：</span>
            <span>{{ pageData.licenseNumber }}</span>
          </el-col>
          <el-col :span="12">
            <span class="title">有效期：</span>
            <span>{{
              pageData.validityStart.substring(0, 10) +
              "-" +
              pageData.validityEnd.substring(0, 10)
            }}</span>
          </el-col>
        </el-row>
      </div>

      <div class="contentBox">
        <h2>{{ pageData.documentName }}</h2>
        <div class="articleInfo">
          <span class="tag"
            >发布时间：{{ pageData.publishDate || pageData.publishTime }}</span
          >
        </div>
        <div class="content" v-html="pageData.announcementContent"></div>
        <div class="fileDownload" v-if="pageData.fileList.length">
          <p class="title">附件下载:</p>
          <div
            class="fileBox"
            :key="file.url"
            v-for="(file, index) in pageData.fileList"
          >
            <span>{{ index + 1 }}.</span>
            <span class="fileName" @click="downloadRes(file.url, file.name)">
              {{ file.name }}</span
            >
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { articleDetails } from "@/mixins/articlePublic.js";

const { queryData, pageData, showInfoBox, downloadRes } = articleDetails();
</script>
<style scoped lang="less">
@import url("@/style/article/index.less");
</style>
