<template>
  <el-dialog v-model="visible" title="查看">
    <el-descriptions border :column="1">
      <el-descriptions-item label="发布人">
        {{ info.CREATOR }}
      </el-descriptions-item>
      <el-descriptions-item label="发布时间">
        {{ info.CREATTIME }}
      </el-descriptions-item>
      <el-descriptions-item label="内容">
        <div v-html="info.CONTENT" />
      </el-descriptions-item>
      <el-descriptions-item v-if="info.FILEPATH" label="附件">
        <el-button
          type="primary"
          text
          link
          @click="useDownloadFile(info.FILEPATH)"
        >
          下载
        </el-button>
      </el-descriptions-item>
    </el-descriptions>
    <template #footer>
      <el-button @click="visible = false">关闭</el-button>
    </template>
  </el-dialog>
</template>

<script setup>
import { useVModel } from "@vueuse/core";
import useDownloadFile from "@/assets/js/useDownloadFile.js";

const props = defineProps({
  visible: {
    type: Boolean,
    required: true,
    default: false,
  },
  info: {
    type: Object,
    required: true,
    default: () => {},
  },
});
const emits = defineEmits(["update:visible"]);
const visible = useVModel(props, "visible", emits);
</script>

<style scoped lang="scss"></style>
