<template>
    <div>
        <br><h2 align="center" style="word-break:break-all">{{noticeTitle}}</h2><br>
        <hr><br>
        <div align="center">{{$t("module.systemNotice.author")}}{{createUserName}} &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp {{$t("module.systemNotice.releaseDate")}}{{createTime}}</div><br>
        <hr><br>
        <div class="ql-editor" v-html="noticeContent">{{noticeContent}}</div><br>
        <div>
            {{$t("module.systemNotice.attachment")}}
            <ul style="margin-left: 40px;margin-top: -18px;">
                <li v-for="item in attachmentList">
                    <a href="javascript:void(0)" @click="downloadAttachment(item.attachId)">{{item.fileName}}</a>
                </li>
            </ul>
        </div>
    </div>
</template>
<script>
    export default{
        components:{

        },
        props:{
            noticeId:{
                type: String,
                default(){
                    return ""
                }
            }
        },
        data(){
            return{
                attachmentList: [],
                noticeTitle: "",
                createUserName: "",
                createTime: "",
                noticeContent: "",
            }
        },
        computed:{

        },
        created:function(){
          this.init(); 
        },
        beforeMount:function(){

        },
        mounted:function(){

        },
        beforeDestroy:function(){

        },
        destroyed:function(){

        },
        methods:{
            init(){
                this.$emit("SetTitle", this.$t("module.systemNotice.notice"));
                this.$emit("SetPageSize", 800);
                $store.dispatch("GetNoticeInfo", this.noticeId).then(response => {
                    this.noticeTitle = response.dataResult.noticeTitle;
                    this.createUserName = response.dataResult.createUserName;
                    this.createTime = response.dataResult.createTime;
                    this.noticeContent = response.dataResult.noticeContent;
                
                });
                $store.dispatch("GetNoticeAttaList", this.noticeId).then(response => {
                    this.attachmentList = response.dataResult;
                });
            },
            downloadAttachment(attachId){
                this.DownloadFile({
                    url: `/sys/notice/attach/download/${attachId}`,
                    method: 'get',
                }, this).then(response => {

                })
            }
        },
        watch:{

        },
        directives:{

        }
    }
</script>
