导出文件为excle

时间:2022-05-11 23:47:45
   handleOutPut() {
        const searchData=this.state.searchData;
        let url = commonData.baseMerchantUrl + "/order/merchant/list/export?";
            const keys = Object.keys( searchData );
            let flag = true;
            keys.forEach( ( item, index ) => {
                if( searchData[ item ] !== "" && searchData !== null) {
                    flag = false;
                    if( keys.length - 1 !== index ) {
                        url = url + item + '=' + searchData[ item ] + '&';
                    } else {
                        url = url + item + '=' + searchData[ item ];
                    }
                }
            } );
            if(flag){
                url+="pageSize=-1"
            }
            else{
                url+="&pageSize=-1"
            }
            console.log(url)
            window.open( url );


    }

  



导出文件为excle