|
@@ -120,7 +120,7 @@
|
|
|
:size="searchSize"
|
|
|
type="primary"
|
|
|
style="float: right; margin-left: 5px"
|
|
|
- @click="downloadInvoice"
|
|
|
+ @click="download"
|
|
|
>
|
|
|
下载发票数据
|
|
|
</el-button>
|
|
@@ -217,6 +217,7 @@ import { listCol, statusList } from "./columns";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { invoiceTypeList } from '@/assets/js/statusList';
|
|
|
import InvoiceModal from "./components/invoice-modal.vue"
|
|
|
+import urlConfig from "@/apis/url-config";
|
|
|
|
|
|
|
|
|
|
|
@@ -264,6 +265,8 @@ export default {
|
|
|
visible: false,
|
|
|
isDetail: false,
|
|
|
modelId: 0,
|
|
|
+ //全局url
|
|
|
+ fileUrl: urlConfig.baseURL,
|
|
|
parmValue: {
|
|
|
create_start:"", // 创建开始时间
|
|
|
create_end:"", // 创建结束时间
|
|
@@ -295,7 +298,6 @@ export default {
|
|
|
},
|
|
|
// 表格 - 列参数
|
|
|
columns: listCol,
|
|
|
-
|
|
|
resultValue: "", //处理结果
|
|
|
};
|
|
|
},
|
|
@@ -332,13 +334,54 @@ export default {
|
|
|
this.visible = false
|
|
|
this.searchList()
|
|
|
},
|
|
|
- downloadInvoice(){
|
|
|
- if(this.selected.length === 0){
|
|
|
- this.$message.warning('至少选择一个发票申请')
|
|
|
- return
|
|
|
+ async download() {
|
|
|
+ let model = JSON.parse(JSON.stringify(this.parmValue));
|
|
|
+ if (!this.loading) {
|
|
|
+ this.loading = true;
|
|
|
+ let httpType = `aplication/zip`;
|
|
|
+ axios({
|
|
|
+ method: "post",
|
|
|
+ url: this.fileUrl + "admin/invoiceInfo/invoiceDown",
|
|
|
+ responseType: "blob",
|
|
|
+ data: model,
|
|
|
+ headers: {
|
|
|
+ // 'Content-Type': 'multipart/form-data',
|
|
|
+ // Accept: "application/vnd.ms-excel"
|
|
|
+ Accept: httpType,
|
|
|
+ },
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res && res.status == 200 && res.data) {
|
|
|
+ let url = window.URL.createObjectURL(
|
|
|
+ new Blob([res.data], {
|
|
|
+ type: httpType,
|
|
|
+ })
|
|
|
+ );
|
|
|
+ let link = document.createElement("a");
|
|
|
+ link.style.display = "none";
|
|
|
+ link.href = url;
|
|
|
+ let excelName = "发票数据.xlsx";
|
|
|
+ link.setAttribute("download", excelName);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ link.remove();
|
|
|
+ window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
|
+ this.$message.success(`导出成功!`);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ }, 500);
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.message);
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false;
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
- const ids = this.selected.map(({id}) => id)
|
|
|
},
|
|
|
onBatchApprovalInvoice(){
|
|
|
if(this.selected.length === 0){
|