From d048c7eb44ccaa504b7b4f462d83dbaa25928d8f Mon Sep 17 00:00:00 2001
From: zhangxiaoxu123 <819527061@qq.com>
Date: 星期六, 31 十二月 2022 21:26:27 +0800
Subject: [PATCH] 发票下载
---
src/assets/js/ByUtils.js | 68 +++++++++++++++++++++++++++++++++
1 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/src/assets/js/ByUtils.js b/src/assets/js/ByUtils.js
index 47c1026..b885c52 100644
--- a/src/assets/js/ByUtils.js
+++ b/src/assets/js/ByUtils.js
@@ -265,7 +265,7 @@
}).then((response) => {
//vm.$loading().close();
let data = response.data;
- if (data && data.code==0) {
+ if (data && data.code==0) {
callBackFunction(data);
} else {
if(data.message=='-9999'){
@@ -294,6 +294,72 @@
})
},
+ exportData(vm, url, data, successCallBackFunction) {
+ if (StringUtil.isNullOrEmpty(url)) {
+ vm.$alert('璇锋眰鍦板潃涓嶈兘涓虹┖', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ return;
+ }
+ let callBackFunction = function (data) {
+ vm.$message({message: data.message, type: 'success'});
+ try {
+ vm.showDialog(false);
+ } catch (e) {
+ }
+ try {
+ vm.loadData();
+ } catch (e) {
+ }
+ }
+ if (successCallBackFunction) {
+ callBackFunction = successCallBackFunction;
+ }
+ // var token = "";
+ // if(this.getUser()){
+ // token = this.getUser().token;
+ // }
+ // vm.$loading();
+ vm.$axios({
+ // headers: {
+ // 'Content-Type': "application/json;charset=UTF-8"
+ // },
+ withCredentials: false,
+ responseType: "blob",
+ url: url,
+ method: 'post',
+ data: data
+ }).then((response) => {
+ //vm.$loading().close();
+ let data = response.data;
+ console.log(response,'response');
+ if (data) {
+ callBackFunction(data);
+ } else {
+ if(data.message=='-9999'){
+ vm.$router.push({'path': '/login'});
+ vm.$alert('浼氳瘽缁撴潫锛岃閲嶆柊鐧诲綍', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ }else{
+ let a = '';
+ if(response.data){
+ if(response.data.msg){
+ a=response.data.msg
+ }else {
+ a='鏈嶅姟鍣ㄦ晠闅�'
+ }
+ }else {
+ a="鏁版嵁閿欒"
+ }
+ vm.$alert(a , {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
+ }
+ }
+ }).catch((e) => {
+ //vm.$loading().close();
+ vm.$alert('鎿嶄綔鍑虹幇寮傚父锛�' + e, {'title': '閿欒', 'type': 'error', 'center': true, 'showClose': false,callback:action=> {
+ // byUtils.setUser(null);
+ // vm.$router.push({'path': '/login'});
+ }});
+ })
+ },
+
postData4(vm, url, data, successCallBackFunction) {
if (StringUtil.isNullOrEmpty(url)) {
vm.$alert('璇锋眰鍦板潃涓嶈兘涓虹┖', {'title': '鎻愮ず', 'type': 'warning', 'center': true, 'showClose': false});
--
Gitblit v1.9.1