<template>
    <lj-win-common title="附件" ref="baseWin">
        <div slot="header_right"></div>
        <div slot="header_sub"></div>
        <div slot="body">
            <div class="lj-divider" style="height: 2px;"></div>
            <div v-for="(item,key) in dataListDic " :key="key">
                <div class="taskinfo_dt">
                    <span style="margin:5px 10px 30px;font-size:14px;">{{key}}</span>
                </div>
                <div style="width: 90%;margin: 0 auto;">
					<template v-for="(file) in item">
                        <lj-fj :fileName="file.fileName"  :md5="file.filemd5" :fileType="file.fileType" :fileSize="file.filekb" :fileid="file.fileid" />
                    </template>
				</div>
            </div>
        </div>
    </lj-win-common>
</template>

<script>
	import LjWinCommon from 'components/lj-win-common';
    import LjFj from "components/lj-fj";

	export default {
		components: {
			LjWinCommon,
            LjFj,
		},
		data() {
			return {
                fjdata:{},
				dataList: [],
                dataListDic:{},
                
			}
		},
		created() {
            this.fjdata = $lj.getPageParam();
		},
		mounted() {
            this.refresh();
		},
		methods: {
			refresh() {
                let self = this;
                this.dataList = [];
                this.dataListDic = {};

                var RequestBody = {
                    token: $lj.getStorage("token"),
                    fjdata: this.fjdata
                }


                $lj.postLJRequest('GetFjFile', RequestBody, function(ret) {
                    if (ret) {
                        if (ret.FjFileList) {
                            self.dataList = ret.FjFileList;
                            self.dataList.forEach(element => {
                                let key = element.ClassName;
                                if(!self.dataListDic[key]){
                                    self.$set(self.dataListDic, key, []);
                                }

                                self.dataListDic[key].push(element);
                            });
                        }

                        $lj.toast("加载完成!");

                    }
                })

            },
		},
        watch: {

        },
        computed:{
            Dlist(parm){
                return function(parm){
                    return this.dataListDic[parm];

                }
            }
        }
	}

</script>

<style>
	.taskinfo_dt {
	    background-color: #1E90FF;
	    width: 100%;
	    padding: 0 5px;
	    border-top-left-radius: 20px;
	    border-top-right-radius: 20px;
	    border-bottom-right-radius: 0px;
	    border-bottom-left-radius: 0px;
    }

</style>