exportUtils.js
926 Bytes
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-05-17 10:24:24
*/
export default {
methods:{
/**
* @description: downloadTxt
* @param {*} text
* @param {*} fileName
* @author: renchao
*/
downloadTxt(text, fileName){
let element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
element.setAttribute('download', fileName)
element.style.display = 'none'
element.click()
},
/**
* @description: createTextContent
* @param {*} jzdInfo
* @author: renchao
*/
createTextContent(jzdInfo){
var textContent = "";
for(var i = 0;i < jzdInfo.length;i++){
textContent += jzdInfo[i].jzdh +","+jzdInfo[i].sxh+"," +
jzdInfo[i].x+","+jzdInfo[i].y+"\n"
}
return textContent;
},
}
}