修改页面导出名称以及去除登录页用户名密码自动回显

main
jinna 2 years ago
parent 1de81e72f9
commit 9a8e89f73b
  1. 4
      src/page/login/userlogin.vue
  2. 39
      src/views/customer/index.vue
  3. 7
      src/views/order/index.vue
  4. 7
      src/views/statistics/index.vue

@ -88,9 +88,9 @@
//ID //ID
roleId: "", roleId: "",
// //
username: "zt_manager", username: "",
// //
password: "123456", password: "",
// //
type: "account", type: "account",
// //

@ -229,10 +229,43 @@ export default {
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(() => { }).then(() => {
NProgress.start(); // NProgress.start();
exportBlob(`/api/weChatUser/export?${this.website.tokenHeader}=${getToken()}${this.query.phone ? '&phone=' + this.query.phone : ''}${this.query.username ? '&username=' + this.query.username : ''}`).then(res => { exportBlob(`/api/weChatUser/export?${this.website.tokenHeader}=${getToken()}${this.query.phone ? '&phone=' + this.query.phone : ''}${this.query.username ? '&username=' + this.query.username : ''}`).then(res => {
downloadXls(res.data, `用户数据${dateNow()}.xlsx`); // const contentDisposition = res.headers['content-disposition']
NProgress.done(); // const fileNameRegexp = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
// const matches = fileNameRegexp.exec(contentDisposition);
// const filename = (matches != null && matches[1] ? decodeURIComponent(matches[1].replace(/['"]/g, '')) : '.xlsx');
// downloadXls(res.data,filename);
// NProgress.done();
if (!res || !res.data) {
this.$message({
type: "error",
message: "导出失败!",
});
return;
}
let blob = new Blob([res.data]); //response.data
const contentDisposition = res.headers['content-disposition']
const fileNameRegexp = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = fileNameRegexp.exec(contentDisposition);
const filename = (matches != null && matches[1] ? decodeURIComponent(matches[1].replace(/['"]/g, '')) : '微信用户.xlsx');
let downloadFilename = filename; //
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
//ie
window.navigator.msSaveOrOpenBlob(blob, downloadFilename);
} else {
//,
let url = window.URL.createObjectURL(blob);
let downloadElement = document.createElement("a");
downloadElement.style.display = "none";
downloadElement.href = url;
downloadElement.download = downloadFilename;
document.body.appendChild(downloadElement);
downloadElement.click();
document.body.removeChild(downloadElement);
window.URL.revokeObjectURL(url);
}
this.$message({ type: "success", message: "导出成功!" });
}) })
}); });
}, },

@ -778,7 +778,6 @@ export default {
orderNo:this.form.orderNumber ? this.form.orderNumber : '' orderNo:this.form.orderNumber ? this.form.orderNumber : ''
} }
exportList(params).then((res) => { exportList(params).then((res) => {
console.log(res);
if (!res || !res.data) { if (!res || !res.data) {
this.$message({ this.$message({
type: "error", type: "error",
@ -787,7 +786,11 @@ export default {
return; return;
} }
let blob = new Blob([res.data]); //response.data let blob = new Blob([res.data]); //response.data
let downloadFilename = "订单" + ".xlsx"; // const contentDisposition = res.headers['content-disposition']
const fileNameRegexp = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = fileNameRegexp.exec(contentDisposition);
const filename = (matches != null && matches[1] ? decodeURIComponent(matches[1].replace(/['"]/g, '')) : '订单.xlsx');
let downloadFilename = filename; //
if (window.navigator && window.navigator.msSaveOrOpenBlob) { if (window.navigator && window.navigator.msSaveOrOpenBlob) {
//ie //ie
window.navigator.msSaveOrOpenBlob(blob, downloadFilename); window.navigator.msSaveOrOpenBlob(blob, downloadFilename);

@ -669,7 +669,12 @@ export default {
return; return;
} }
let blob = new Blob([res.data]);//response.data let blob = new Blob([res.data]);//response.data
let downloadFilename = '统计' + '.xlsx';// const contentDisposition = res.headers['content-disposition']
const fileNameRegexp = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
const matches = fileNameRegexp.exec(contentDisposition);
const filename = (matches != null && matches[1] ? decodeURIComponent(matches[1].replace(/['"]/g, '')) : '统计.xlsx');
// console.log(filename)
let downloadFilename = filename;//
if (window.navigator && window.navigator.msSaveOrOpenBlob) { if (window.navigator && window.navigator.msSaveOrOpenBlob) {
//ie //ie
window.navigator.msSaveOrOpenBlob(blob, downloadFilename) window.navigator.msSaveOrOpenBlob(blob, downloadFilename)

Loading…
Cancel
Save