文件上传加头部参数

master
anthonywj 4 years ago
parent d01d1f43fd
commit 6f7e4ec2d2

@ -503,14 +503,14 @@ export const asyncRouterMap = [
authRule: ["thrsys/thrCorpsImport"] authRule: ["thrsys/thrCorpsImport"]
} }
}, },
{ // {
path: "thrCorpsExport", // path: "thrCorpsExport",
name: "往来单位导出", // name: "往来单位导出",
component: thrCorpsExport, // component: thrCorpsExport,
meta: { // meta: {
authRule: ["thrsys/thrCorpsExport"] // authRule: ["thrsys/thrCorpsExport"]
} // }
} // }
], ],
}, },

@ -1,5 +1,6 @@
import { getStore, setStore } from "../../utils/store"; import {getStore, setStore} from "../../utils/store";
import * as types from "../mutation-types"; import * as types from "../mutation-types";
import store from "@/store";
const state = { const state = {
sidebar: { sidebar: {
@ -16,16 +17,16 @@ const getters = {
// actions // actions
const actions = { const actions = {
ToggleSideBar({ commit }) { ToggleSideBar({commit}) {
commit(types.TOGGLE_SIDEBAR); commit(types.TOGGLE_SIDEBAR);
}, },
ShowSideBar({ commit }) { ShowSideBar({commit}) {
commit(types.SHOW_SIDEBAR); commit(types.SHOW_SIDEBAR);
}, },
addVisitedViews({ commit }, view) { addVisitedViews({commit}, view) {
commit(types.ADD_VISITED_VIEWS, view); commit(types.ADD_VISITED_VIEWS, view);
}, },
delVisitedViews({ commit, state }, view) { delVisitedViews({commit, state}, view) {
return new Promise(resolve => { return new Promise(resolve => {
commit(types.DEL_VISITED_VIEWS, view); commit(types.DEL_VISITED_VIEWS, view);
resolve([...state.visitedViews]); resolve([...state.visitedViews]);
@ -51,7 +52,7 @@ const mutations = {
}, },
[types.ADD_VISITED_VIEWS](state, view) { [types.ADD_VISITED_VIEWS](state, view) {
if (state.visitedViews.some(v => v.path === view.path)) return; if (state.visitedViews.some(v => v.path === view.path)) return;
state.visitedViews.push({ name: view.name, path: view.path }); state.visitedViews.push({name: view.name, path: view.path});
}, },
[types.DEL_VISITED_VIEWS](state, view) { [types.DEL_VISITED_VIEWS](state, view) {
let index; let index;
@ -65,9 +66,11 @@ const mutations = {
} }
}; };
export default { export default {
state, state,
getters, getters,
actions, actions,
mutations mutations,
}; };

@ -28,6 +28,7 @@
:action="uploadFileUrl" :action="uploadFileUrl"
multiple multiple
:limit="3" :limit="3"
:headers="headers"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
:file-list="fileList" :file-list="fileList"
@ -145,6 +146,7 @@ import {
import modifyDialog from "./BussinessTypeModify"; import modifyDialog from "./BussinessTypeModify";
import axios from "axios"; import axios from "axios";
import store from "@/store";
export default { export default {
data() { data() {
@ -197,6 +199,8 @@ export default {
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
uploadFileUrl: null, uploadFileUrl: null,
headers: {},
}; };
}, },
@ -359,6 +363,10 @@ export default {
let response = res.data.BASE_URL; let response = res.data.BASE_URL;
this.uploadFileUrl = response + "/udiwms/busstiness/file/upload"; this.uploadFileUrl = response + "/udiwms/busstiness/file/upload";
}); });
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
}, },
}, },
components: { components: {

@ -36,17 +36,17 @@
: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"
:file-list="fileList" :file-list="fileList"
> >
<el-button size="mini" type="primary">导入往来单位</el-button> <el-button size="mini" type="primary">导入往来单位</el-button>
</el-upload> </el-upload>
<!-- <el-button type="primary" icon="search" @click="jumpDl"--> <!-- <el-button type="primary" icon="search" @click="jumpDl"-->
<!-- v-if="this.thirdSysDetail.enabled && this.thirdSysDetail.fromType==1">模板下载--> <!-- v-if="this.thirdSysDetail.enabled && this.thirdSysDetail.fromType==1">模板下载-->
<!-- </el-button>--> <!-- </el-button>-->
<el-button type="primary" icon="search" @click="downloadCorps" <el-button type="primary" icon="search" @click="downloadCorps"
v-if="this.thirdSysDetail.enabled && this.thirdSysDetail.fromType==3"> v-if="this.thirdSysDetail.enabled && this.thirdSysDetail.fromType==3">
下载往来单位 下载往来单位
@ -151,15 +151,16 @@
</template> </template>
<script> <script>
import {filterLog, deleteLog} from "../../api/thrsys/thrCorpsImport"; import {filterLog, deleteLog} from "../../api/thrsys/thrCorpsImport";
import {getBasicThirdSys, filterDetailByKey} from "../../api/basic/basicThirdSys"; import {getBasicThirdSys, filterDetailByKey} from "../../api/basic/basicThirdSys";
import {downloadAll} from "../../api/thrsys/thrCorps"; import {downloadAll} from "../../api/thrsys/thrCorps";
import {selectIp} from "../../api/param/systemParamConfig"; import {selectIp} from "../../api/param/systemParamConfig";
import thrCorpsImportDetail from "./ThrCorpsImportDetail"; import thrCorpsImportDetail from "./ThrCorpsImportDetail";
import thrCorpSelect from "./ThrCorpSelect"; import thrCorpSelect from "./ThrCorpSelect";
import axios from "axios"; import axios from "axios";
import store from "@/store";
export default { export default {
data() { data() {
return { return {
filterQuery: { filterQuery: {
@ -174,6 +175,7 @@
thrCorpSelectVisible: false, thrCorpSelectVisible: false,
checked: false, checked: false,
list: [], list: [],
headers: {},
detailList: [], detailList: [],
thirdSys: [], thirdSys: [],
thirdSysDetail: null, thirdSysDetail: null,
@ -416,32 +418,36 @@
}, },
components: {thrCorpsImportDetail, thrCorpSelect}, components: {thrCorpsImportDetail, thrCorpSelect},
created() { created() {
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
this.getBasicThirdSys(); this.getBasicThirdSys();
// this.getList(); // this.getList();
}, },
}; };
</script> </script>
<style> <style>
.itemTag { .itemTag {
float: left; float: left;
text-align: left; text-align: left;
margin-top: 10px; margin-top: 10px;
width: 100px; width: 100px;
} }
.text { .text {
font-size: 13px; font-size: 13px;
font-family: "Microsoft YaHei"; font-family: "Microsoft YaHei";
} }
.el-row { .el-row {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
} }
.el-col { .el-col {
border-radius: 4px; border-radius: 4px;
flex-wrap: wrap; flex-wrap: wrap;
} }
</style> </style>

@ -37,6 +37,7 @@
multiple multiple
:limit="3" :limit="3"
:data="uploadData" :data="uploadData"
:headers="headers"
:show-file-list="false" :show-file-list="false"
:on-success="handleChange" :on-success="handleChange"
:file-list="fileList" :file-list="fileList"
@ -159,6 +160,7 @@
import thrProductsImportDetail from "./ThrProductsImportDetail"; import thrProductsImportDetail from "./ThrProductsImportDetail";
import thrProductsSelect from "./ThrProductsSelect"; import thrProductsSelect from "./ThrProductsSelect";
import axios from "axios"; import axios from "axios";
import store from "@/store";
export default { export default {
data() { data() {
@ -171,6 +173,7 @@
limit: 20, limit: 20,
thirdSysFk: null, thirdSysFk: null,
}, },
headers:{},
udiImportDetailVisible: false, udiImportDetailVisible: false,
thrProductsSelectVisible: false, thrProductsSelectVisible: false,
checked: false, checked: false,
@ -396,6 +399,10 @@
}, },
components: {thrProductsImportDetail,thrProductsSelect}, components: {thrProductsImportDetail,thrProductsSelect},
created() { created() {
this.headers = {
ADMIN_ID: store.getters.adminId,
ADMIN_TOKEN: store.getters.token,
};
this.getBasicThirdSys(); this.getBasicThirdSys();
// this.getList(); // this.getList();
}, },

Loading…
Cancel
Save