import React from 'react';
import List from '../../../components/List'
import AdjunctList from '../../../components/Adjunct'
import axiosRequest from "../../../utils/request";


const Adjunct = (props) => {
    const {data} = props;
    // const downlaod = (src) => {
    //     const iframe = document.createElement('iframe');
    //     iframe.style.display = 'none';
    //     iframe.src = "javascript: '<script>location.href=\"" + src + "\"<\/script>'";
    //     document.getElementsByTagName('body')[0].appendChild(iframe);
    // }
    const download = (uuid) => {

        axiosRequest({
            method: 'post',
            url: '/idtAppServiceV6/oApp/downloadLargeFile',
            body: {
                uuid
            },
        }).then(res => {

        })
    }
    const listData = [
        {title: '附件', line: data.length > 0, content:
                <div>
                    {data.length > 0 ? data.map((item, index) => (
                        <AdjunctList key={index} data={item} onClick={() => download(item.UUID)}/>
                    )) : '无'}
                </div>
        },
    ]
    return (
        <div>
            <List listData={listData}/>
        </div>
    );
};

export default Adjunct;
