上传文件组件增加请求头信息

master
MrZhai 3 years ago
parent 6f7e4ec2d2
commit 72a3dcff0e

@ -18,6 +18,7 @@
:action="uploadUrl" :action="uploadUrl"
:on-success="handleSuccess" :on-success="handleSuccess"
:on-error="handleError" :on-error="handleError"
:headers="headers"
:data="uploadData" :data="uploadData"
:name="uploadData.uploadName" :name="uploadData.uploadName"
:accept="uploadData.exts" :accept="uploadData.exts"
@ -148,6 +149,7 @@ export default {
uploadVisible: false, uploadVisible: false,
isIcon: true, // or isIcon: true, // or
total: 0, total: 0,
headers: {},
lists: [], lists: [],
tagLists: [], tagLists: [],
uploadData: { uploadData: {
@ -410,6 +412,10 @@ export default {
if (this.token && this.token !== "" && this.token !== "undefined") { if (this.token && this.token !== "" && this.token !== "undefined") {
this.uploadData.token = this.token; this.uploadData.token = this.token;
} }
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
computed: {} computed: {}
}; };

@ -22,6 +22,7 @@
:action="uploadFileUrl" :action="uploadFileUrl"
multiple multiple
:limit="3" :limit="3"
:headers="headers"
:data="uploadData" :data="uploadData"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
@ -134,6 +135,7 @@
}, },
corpImportDetailVisible: false, corpImportDetailVisible: false,
checked: false, checked: false,
headers: {},
list: [], list: [],
detailList: [], detailList: [],
thirdSys: [], thirdSys: [],
@ -278,6 +280,10 @@
created() { created() {
this.getBasicThirdSys(); this.getBasicThirdSys();
this.getList(); this.getList();
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -472,7 +472,7 @@
if (response.code == 20000) { if (response.code == 20000) {
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功,后台正在生成Excel文件,请稍后刷新查看!", message: "导出成功,后台正在生成udi文件,请稍后刷新查看!",
}); });
} else { } else {
this.$message({ this.$message({

@ -663,7 +663,7 @@ export default {
if (response.code == 20000) { if (response.code == 20000) {
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功,后台正在生成Excel文件,请稍后刷新查看!", message: "导出成功,后台正在生成udi文件,请稍后刷新查看!",
}); });
} else { } else {
this.$message({ this.$message({

@ -23,6 +23,7 @@
:action="uploadFileUrl" :action="uploadFileUrl"
multiple multiple
:limit="3" :limit="3"
:headers="headers"
:data="uploadData" :data="uploadData"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
@ -125,6 +126,7 @@
import {filterDetail, filterLog, deleteLog, downloadSmp} from "../../api/basic/udiinfolog"; import {filterDetail, filterLog, deleteLog, downloadSmp} from "../../api/basic/udiinfolog";
import {getBasicThirdSys} from "../../api/basic/basicThirdSys"; import {getBasicThirdSys} from "../../api/basic/basicThirdSys";
import udiInfoImportDetail from "./UdiInfoImportDetail"; import udiInfoImportDetail from "./UdiInfoImportDetail";
import store from "@/store";
export default { export default {
data() { data() {
@ -139,6 +141,7 @@
}, },
udiImportDetailVisible: false, udiImportDetailVisible: false,
checked: false, checked: false,
headers: {},
list: [], list: [],
detailList: [], detailList: [],
thirdSys: [], thirdSys: [],
@ -302,6 +305,10 @@
created() { created() {
this.getBasicThirdSys(); this.getBasicThirdSys();
this.getList(); this.getList();
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -99,6 +99,7 @@
import axios from "axios"; import axios from "axios";
import {filterLog, downloadLog, deleteLog} from "../../api/basic/udiInfoExport"; import {filterLog, downloadLog, deleteLog} from "../../api/basic/udiInfoExport";
import udiInfoSelect from "./UdIInfoSelect"; import udiInfoSelect from "./UdIInfoSelect";
import store from "@/store";
export default { export default {
data() { data() {
@ -178,7 +179,6 @@
this.udiImportDetailVisible = true; this.udiImportDetailVisible = true;
}, },
downloadExcel(row) { downloadExcel(row) {
axios.get("./config.json").then(res => { axios.get("./config.json").then(res => {
let baseUrl = res.data.BASE_URL; let baseUrl = res.data.BASE_URL;
let href = baseUrl + "/udiwms/products/exportLog/download" + "?genKey=" + row.genKey; let href = baseUrl + "/udiwms/products/exportLog/download" + "?genKey=" + row.genKey;
@ -196,10 +196,7 @@
a.click(); a.click();
this.getList(); this.getList();
}); });
}); });
}, },
cancelDialog(val) { cancelDialog(val) {

@ -386,6 +386,7 @@
:data="{type:'image1'}" :data="{type:'image1'}"
:auto-upload="true" :auto-upload="true"
:show-file-list="false" :show-file-list="false"
:headers="headers"
> >
<div> <div>
<el-button slot="trigger" size="small" type="primary" <el-button slot="trigger" size="small" type="primary"
@ -418,6 +419,7 @@
:data="{type:'image1'}" :data="{type:'image1'}"
:auto-upload="true" :auto-upload="true"
:show-file-list="false" :show-file-list="false"
:headers="headers"
> >
<div> <div>
<el-button slot="trigger" size="small" type="primary" <el-button slot="trigger" size="small" type="primary"
@ -453,6 +455,7 @@
:data="{type:'image1'}" :data="{type:'image1'}"
:auto-upload="true" :auto-upload="true"
:show-file-list="false" :show-file-list="false"
:headers="headers"
> >
<div> <div>
<el-button slot="trigger" size="small" type="primary" <el-button slot="trigger" size="small" type="primary"
@ -485,6 +488,7 @@
:data="{type:'image1'}" :data="{type:'image1'}"
:auto-upload="true" :auto-upload="true"
:show-file-list="false" :show-file-list="false"
:headers="headers"
> >
<div> <div>
<el-button slot="trigger" size="small" type="primary" <el-button slot="trigger" size="small" type="primary"
@ -851,6 +855,7 @@ export default {
filePath3: "", filePath3: "",
filePath4: "", filePath4: "",
}, },
headers: {},
classesDisplay: false, classesDisplay: false,
selectedOptions: [], selectedOptions: [],
options: regionDataPlus, options: regionDataPlus,
@ -985,6 +990,11 @@ export default {
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file"; this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image1&name="; this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image1&name=";
this.certFileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name="; this.certFileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image2&name=";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
components: { components: {
draggable, draggable,

@ -29,6 +29,7 @@
:action="uploadFileUrl" :action="uploadFileUrl"
multiple multiple
:limit="1" :limit="1"
:headers="headers"
:data="uploadData" :data="uploadData"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
@ -276,6 +277,7 @@ import {
} from "../../api/basic/invWarehouse"; } from "../../api/basic/invWarehouse";
import {formatDate} from "@/utils/date"; import {formatDate} from "@/utils/date";
import axios from "axios"; import axios from "axios";
import store from "@/store";
const formJson = { const formJson = {
id: null, id: null,
@ -298,6 +300,7 @@ export default {
advanceType: null, advanceType: null,
isDefault: null isDefault: null
}, },
headers: {},
mergeList: [], mergeList: [],
node: null, node: null,
defaultProps: { defaultProps: {
@ -568,7 +571,7 @@ export default {
this.loading = false; this.loading = false;
const eleLink = document.createElement('a'); const eleLink = document.createElement('a');
var timestamp = formatDate(new Date(), "yyyy-MM-dd_hh:mm") var timestamp = formatDate(new Date(), "yyyy-MM-dd_hh:mm")
eleLink.download = "仓库信息导出" + timestamp + ".json"; eleLink.download = "仓库信息导出" + timestamp + ".udi";
eleLink.style.display = 'none'; eleLink.style.display = 'none';
eleLink.href = url; eleLink.href = url;
document.body.appendChild(eleLink) document.body.appendChild(eleLink)
@ -594,6 +597,10 @@ export default {
let response = res.data.BASE_URL; let response = res.data.BASE_URL;
this.uploadFileUrl = response + "/spms/inv/warehouse/uploadJson"; this.uploadFileUrl = response + "/spms/inv/warehouse/uploadJson";
}); });
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}, },
filters: { filters: {

@ -260,7 +260,7 @@
if (response.code == 20000) { if (response.code == 20000) {
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功,后台正在生成Excel文件,请稍后刷新查看!", message: "导出成功,后台正在生成udi文件,请稍后刷新查看!",
}); });
} else { } else {
this.$message({ this.$message({

@ -39,8 +39,8 @@
:data="uploadData" :data="uploadData"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
:file-list="fileList" :file-list="fileList"
:headers="headers"
> >
<el-button size="mini" type="primary">导入业务单据</el-button> <el-button size="mini" type="primary">导入业务单据</el-button>
</el-upload> </el-upload>
@ -176,6 +176,7 @@
}, },
udiImportDetailVisible: false, udiImportDetailVisible: false,
checked: false, checked: false,
headers: {},
list: [], list: [],
detailList: [], detailList: [],
thirdSys: [], thirdSys: [],
@ -417,6 +418,10 @@
this.getBasicThirdSys(); this.getBasicThirdSys();
this.getBusType(); this.getBusType();
this.getList(); this.getList();
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -405,7 +405,7 @@ export default {
if (response.code == 20000) { if (response.code == 20000) {
this.$message({ this.$message({
type: "success", type: "success",
message: "导出成功,后台正在生成Excel文件,请稍后刷新查看!", message: "导出成功,后台正在生成udi文件,请稍后刷新查看!",
}); });
this.$emit("cancelDialog", true); this.$emit("cancelDialog", true);
} else { } else {

@ -26,6 +26,7 @@
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
:file-list="fileList" :file-list="fileList"
:headers="headers"
> >
<el-button size="mini" type="primary">导入产品信息</el-button> <el-button size="mini" type="primary">导入产品信息</el-button>
</el-upload> </el-upload>
@ -140,6 +141,7 @@ export default {
udiImportDetailVisible: false, udiImportDetailVisible: false,
thrProductsSelectVisible: false, thrProductsSelectVisible: false,
checked: false, checked: false,
headers: {},
list: [], list: [],
detailList: [], detailList: [],
thirdSys: [], thirdSys: [],
@ -350,6 +352,10 @@ export default {
created() { created() {
this.getBasicThirdSys(); this.getBasicThirdSys();
// this.getList(); // this.getList();
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -244,6 +244,7 @@
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jasper" accept=".jasper"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -380,6 +381,7 @@ export default {
page: 1, page: 1,
limit: 20 limit: 20
}, },
headers: {},
list: [], list: [],
total: 0, total: 0,
moduleQuery: { moduleQuery: {
@ -856,6 +858,10 @@ export default {
this.getPDFModuleNameList(); this.getPDFModuleNameList();
this.getModuleList(); this.getModuleList();
this.uploadUrl = BASE_URL + "/udiwms/upload/pdf/template"; this.uploadUrl = BASE_URL + "/udiwms/upload/pdf/template";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
} }
}; };
</script> </script>

@ -181,6 +181,7 @@
ref="uploadJasper" ref="uploadJasper"
:action="this.uploadUrl" :action="this.uploadUrl"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jasper" accept=".jasper"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -207,6 +208,7 @@
class="upload-demo" class="upload-demo"
ref="uploadJrxml" ref="uploadJrxml"
:action="this.uploadJrxmlUrl" :action="this.uploadJrxmlUrl"
:headers="headers"
:limit="1" :limit="1"
:on-exceed="uploadJrxmlHandleExceed" :on-exceed="uploadJrxmlHandleExceed"
accept=".jrxml" accept=".jrxml"
@ -332,6 +334,7 @@ export default {
page: 1, page: 1,
limit: 20 limit: 20
}, },
headers: {},
list: [], list: [],
total: 0, total: 0,
moduleQuery: { moduleQuery: {
@ -809,6 +812,10 @@ export default {
this.getModuleList(); this.getModuleList();
this.uploadUrl = BASE_URL + "/udiwms/upload/pdf/template/jasper"; this.uploadUrl = BASE_URL + "/udiwms/upload/pdf/template/jasper";
this.uploadJrxmlUrl = BASE_URL + "/udiwms/upload/pdf/template/jrxml"; this.uploadJrxmlUrl = BASE_URL + "/udiwms/upload/pdf/template/jrxml";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
} }
}; };
</script> </script>

@ -382,6 +382,7 @@
:action="this.uploadUrl" :action="this.uploadUrl"
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:headers="headers"
:limit="1" :limit="1"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
@ -546,6 +547,7 @@ export default {
checkCompanyNameStatus: false, checkCompanyNameStatus: false,
licenseUrl: null, licenseUrl: null,
}, },
headers: {},
uploadUrl: null, uploadUrl: null,
fileUrl: null, fileUrl: null,
isTimer: false, isTimer: false,
@ -610,6 +612,10 @@ export default {
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file"; this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image1&name="; this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image1&name=";
// this.getData(); // this.getData();
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
methods: { methods: {
onSubmit(formName) { onSubmit(formName) {

@ -64,6 +64,7 @@
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -116,6 +117,7 @@ export default {
loading: false, loading: false,
uploadUrl: "", uploadUrl: "",
fileList: [], fileList: [],
headers: {},
}; };
}, },
components: { components: {
@ -203,6 +205,10 @@ export default {
}, },
created() { created() {
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file"; this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -340,6 +340,7 @@
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -362,6 +363,7 @@
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -421,6 +423,7 @@ export default {
specification: "", specification: "",
}, },
loading: false, loading: false,
headers: {},
classesDisplay: false, classesDisplay: false,
selectedOptions: [], selectedOptions: [],
selectedOptions2: [], selectedOptions2: [],
@ -506,6 +509,11 @@ export default {
this.inputQuery.enterpriseId = this.enterpriseId; this.inputQuery.enterpriseId = this.enterpriseId;
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file"; this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image4&name="; this.fileUrl = BASE_URL + "/udiwms/image/register/file/getImage?type=image4&name=";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
components: { components: {
draggable, draggable,

@ -64,6 +64,7 @@
:on-preview="uploadHandlePreview" :on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove" :on-remove="uploadHandleRemove"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -115,6 +116,7 @@ export default {
loading: false, loading: false,
uploadUrl: "", uploadUrl: "",
fileList: [], fileList: [],
headers: {},
}; };
}, },
components: { components: {
@ -202,6 +204,10 @@ export default {
}, },
created() { created() {
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file"; this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

@ -76,6 +76,7 @@
ref="upload" ref="upload"
:action="this.uploadUrl" :action="this.uploadUrl"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -106,6 +107,7 @@
ref="upload2" ref="upload2"
:action="this.uploadUrl" :action="this.uploadUrl"
:limit="1" :limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed" :on-exceed="uploadHandleExceed"
accept=".jpg,.png" accept=".jpg,.png"
:on-change="uploadOnchange" :on-change="uploadOnchange"
@ -180,6 +182,7 @@ export default {
fileList2: [], fileList2: [],
hiddenAdd: false, hiddenAdd: false,
hiddenAdd2: false, hiddenAdd2: false,
headers: {},
}; };
}, },
components: { components: {
@ -319,6 +322,11 @@ export default {
this.hiddenAdd = false; this.hiddenAdd = false;
} }
} }
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}; };
</script> </script>

Loading…
Cancel
Save