Commit a180273a authored by 黄奎's avatar 黄奎

页面修改

parent 894fb62f
......@@ -37,9 +37,9 @@ export function UploadSelfFile(path, file, callback) {
})
var newPath = '/Upload/' + path + "/";
let url = uploadMsg.uploadUrl + "/Upload?filePath=" + newPath;
// if (isTrans && isTrans == 1) {
// url += "&isTrans=1"
// }
// if (isTrans && isTrans == 1) {
// url += "&isTrans=1"
// }
let formData = new FormData()
formData.append('myfile', file)
let xhr = new XMLHttpRequest()
......@@ -97,3 +97,29 @@ export function getFileExt(filename) {
var suffix = filename.substr(index + 1);
return suffix
}
/**
*
* 教育文件下载
*/
export function EduDownLoad(cmd, msg, fileName) {
return request({
url: cmd,
method: 'post',
data: msg,
headers:{
'Content-Type': 'application/octet-stream;charset=utf-8'
}
}).then(res => {
let blob = new Blob([res.data], {
type: "application/vnd.ms-excel;charset=utf-8"
})
let url = URL.createObjectURL(blob);
let link = document.createElement('a');
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
})
}
......@@ -442,7 +442,9 @@
GetClassBalanceSheet,
GetClassBalanceSheetToExcel
} from '../../api/finance/index';
import {
EduDownLoad,
} from '../../api/common/common';
export default {
props: {},
components: {},
......@@ -493,11 +495,7 @@
//导出单据
exportOrder() {
var msg = JSON.parse(JSON.stringify(this.msg));
this.GetLocalFile(
"/api/Finance/GetClassBalanceSheetToExcel",
msg,
"收支明细.xls"
);
EduDownLoad("/Finance/GetClassBalanceSheetToExcel",msg, "收支明细.xls")
},
//跳转到收款单
goShoukuan(type) {
......
......@@ -48,8 +48,9 @@ service.interceptors.request.use(
service.interceptors.response.use(
response => {
const res = response.data;
console.log(" response", response)
// TODO 确定后台的CODE码
if (response.status === 200 && response.config.responseType === "blob") {
if (response.status === 200 && response.headers["content-type"] === "application/octet-stream") {
// 文件类型特殊处理
return response;
} else if (res.Code != 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment