import { Button } from 'antd';
import { message } from "antd/lib/index";
import React from 'react';
import FormPage from '../../components/FormPage';
import config from '../../config';
export default {
// getFileDown(params) {
// const { record} = params ? params : {};
// if (record && record.Nav_Files) {
// // return {
// // content:
// record.Nav_Files.map(t=>{
// if(t.Nav_File)
// {
// const imgSrc = config.serviceHost('api/PF/File/GetFile?id=' + t.Nav_File.FILE_ID)
// return (
//
// {t.Nav_File.Nav_File.FILE_NAME}
//
// );
// // return
// //
// //
// }
// })
// // }
// }
// },
singleFileDown(params) {
const { record, dispatch } = params ? params : {};
//下载单个文件
const handlerDown = (url, name) => {
const link = document.createElement("a");
link.href = url;
link.download = name;
link.click();
};
//下载多个文件
const allLoad=(excelList)=> {
for(let i=0;i{
iframe.remove();
}, 5 * 60 * 1000);
}
}
const confirmRevert = (event) => {
if (record && record.Nav_Files) {
let excelList=[];
for (let i = 0; i < record.Nav_Files.length; i++) {
let tempFile = record.Nav_Files[i].Nav_ImgFile;
if (tempFile) {
// const urls = config.serviceHost('api/PF/File/GetFile?id=' + tempFile.FILE_ID);
// const name = tempFile.FILE_NAME;
// fetch(urls).then(res => res.blob()).then(blob => {
// const a = document.createElement('a');
// document.body.appendChild(a)
// a.style.display = 'none'
// // 使用获取到的blob对象创建的url
// const url = window.URL.createObjectURL(blob);
// a.href = url;
// // 指定下载的文件名
// a.download = name;
// a.click();
// document.body.removeChild(a)
// // 移除blob对象的url
// window.URL.revokeObjectURL(url);
// });
var hrefs = config.picServerHost + tempFile.Nav_File.FILE_PATH;
excelList.push(hrefs);
}
}
if(excelList&&excelList.length>0){
allLoad(excelList);
}
}
};
//const isReturn = record.STATUS >2;disabled={isReturn}
return {
content:
}
},
allFileDown(params) {
const { record, dispatch,getSelectedRecords } = params ? params : {};
//下载多个文件
const allLoad=(excelList)=> {
for(let i=0;i{
iframe.remove();
}, 5 * 60 * 1000);
}
}
const confirmRevert=()=>{
//下载多个文件
let DetailCheck = getSelectedRecords();
if (DetailCheck && DetailCheck.length > 0) {
let excelList=[];
for (let i = 0; i < DetailCheck.length; i++) {
let files=DetailCheck[i].Nav_Files;
if(files.length>0)
{
for (let index = 0; index < files.length; index++) {
let element = files[index].Nav_ImgFile;
if(element)
{
var hrefs = config.picServerHost + element.Nav_File.FILE_PATH;
excelList.push(hrefs);
}
}
}
}
if(excelList&&excelList.length>0){
allLoad(excelList);
}
}
}
return {
content:
}
}
};