对接标准/译文获取申请

This commit is contained in:
范强强
2024-03-29 09:42:28 +08:00
parent 417b490039
commit 9ec0d610b1
@@ -182,6 +182,7 @@
import standardsAndTranslationModal from './components/standardTranslationAcquisitionRequestModal'; import standardsAndTranslationModal from './components/standardTranslationAcquisitionRequestModal';
import detailModal from './components/detailModal'; import detailModal from './components/detailModal';
import exportDialog from './components/exportDialog'; import exportDialog from './components/exportDialog';
import axios from '@/common/axiosV2'
export default { export default {
name: 'StandardTranslationAcquisitionRequest', name: 'StandardTranslationAcquisitionRequest',
@@ -335,23 +336,36 @@ export default {
this.$refs.selections.clearSelection() this.$refs.selections.clearSelection()
}) })
}, },
exportName(name) { exportName (name) {
const params = { const params = {
...this.StandardApplyForEOPage, ...this.StandardApplyForEOPage,
exportFileName: name, exportFileName: name,
ids: this.selectedList.length > 0 ? this.selectedList.join(',') : '', ids: this.selectedList.length > 0 ? this.selectedList.join(',') : '',
}; };
axios({
const url = '/api/lawss/standardApplyFor/exportStandardApplyForEOExcel?' url: '/api/lawss/standardApplyFor/exportStandardApplyForEOExcel',
const formattedParams = Object.keys(params).map((key) => `${key}=${params[key]}`).join('&') method: 'get',
responseType: 'blob',
const link = document.createElement('a') params: params
link.href = `${url}${formattedParams}` }).then(res => {
link.download = name + '.xlsx' const blob = new Blob([ res ], { type: 'application/vnd.ms-excel' });
// 浏览器兼容,Google和火狐支持a标签的downloadIE不支持
document.body.appendChild(link) if (window.navigator && window.navigator.msSaveBlob) {
link.click() // IE浏览器、微软浏览器
document.body.removeChild(link) /* 经过测试,微软浏览器Microsoft Edge下载文件时必须要重命名文件才可以打开,
IE可不重命名,以防万一,所以都写上比较好 */
window.navigator.msSaveBlob(blob, name + '.xlsx');
} else {
// 其他浏览器
const link = document.createElement('a'); // 创建a标签
link.style.display = 'none';
const objectUrl = URL.createObjectURL(blob);
link.href = objectUrl;
link.download = name + '.xlsx';
link.click();
URL.revokeObjectURL(objectUrl);
}
})
}, },
exportList () { exportList () {
this.$refs.exportDialogRef.openModel() this.$refs.exportDialogRef.openModel()