| | |
| | | |
| | | <script> |
| | | import {exportCode} from '@/api/GetItem' |
| | | import func from "@/util/func"; |
| | | export default { |
| | | name: "MasterTransfer", |
| | | props:['visible','tableHeadData','codeClassifyOid','tableData','selectRow'], |
| | |
| | | if(this.selectRow.length<=0){ |
| | | this.$message.warning('请选择要导出的模板') |
| | | }else { |
| | | //已选择多选 |
| | | const selectList=[] |
| | | //已选择属性 |
| | | let exportArr={} |
| | | const ids = this.selectRow.map(item => item.oid).join(',') |
| | | this.selectRow.forEach(item=>{ |
| | |
| | | item.oid |
| | | ) |
| | | }) |
| | | //已选择属性 |
| | | this.value.map(index => this.tableHeadData[index].prop).forEach((item, index) => { |
| | | exportArr[`attrIdIndexMap[${index}]`] = item |
| | | }) |
| | | exportCode({codeClassifyOid:this.codeClassifyOid,'conditionMap[oid]':ids,...exportArr}).then(res=>{ |
| | | console.log(res) |
| | | // console.log('res',res) |
| | | if(res){ |
| | | const fileNames = res.headers['content-disposition'].split(";"); |
| | | let characterSet = fileNames[2].split("filename*=")[1]; |
| | | let fileName = decodeURI(fileNames[1].split("filename=")[1],characterSet); // 下载的文件名 |
| | | let blob = new Blob([res.data], { |
| | | type: res.data.type + ";charset=utf-8", |
| | | }); |
| | | func.downloadFileByBlob(blob,fileName); |
| | | window.URL.revokeObjectURL(src); //释放掉blob对象 |
| | | } |
| | | }) |
| | | |
| | | } |
| | | }; |
| | | }, |