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

master
MrZhai 3 years ago
parent 6f7e4ec2d2
commit 72a3dcff0e

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -340,6 +340,7 @@
:on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove"
:limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed"
accept=".jpg,.png"
:on-change="uploadOnchange"
@ -362,6 +363,7 @@
:on-preview="uploadHandlePreview"
:on-remove="uploadHandleRemove"
:limit="1"
:headers="headers"
:on-exceed="uploadHandleExceed"
accept=".jpg,.png"
:on-change="uploadOnchange"
@ -421,6 +423,7 @@ export default {
specification: "",
},
loading: false,
headers: {},
classesDisplay: false,
selectedOptions: [],
selectedOptions2: [],
@ -506,6 +509,11 @@ export default {
this.inputQuery.enterpriseId = this.enterpriseId;
this.uploadUrl = BASE_URL + "/udiwms/upload/register/file";
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: {
draggable,

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

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

Loading…
Cancel
Save