jinhui.wang

请求方法调用变更,bug修复

1 import request from '@/utils/request' 1 import request from '@/utils/request'
2 -import axios from 'axios';
3 import settings from "@/settings" 2 import settings from "@/settings"
4 -import { getToken } from '@/utils/auth'
5 3
6 //模板下载 4 //模板下载
7 export function downLoadTemplate(template) { 5 export function downLoadTemplate(template) {
...@@ -21,17 +19,12 @@ export function importFlightDestination(file, date) { ...@@ -21,17 +19,12 @@ export function importFlightDestination(file, date) {
21 let formData = new FormData(); 19 let formData = new FormData();
22 formData.append("file", file); 20 formData.append("file", file);
23 formData.append("beginDate", date); 21 formData.append("beginDate", date);
24 - return axios({ 22 + return request({
25 method: 'post', 23 method: 'post',
26 url: settings.baseURL + '/flightDestination/importFlightDestination', 24 url: settings.baseURL + '/flightDestination/importFlightDestination',
27 - headers: { 'Authorization': 'Bearer ' + getToken() }, 25 + // headers: { 'Authorization': 'Bearer ' + getToken() },
28 data: formData 26 data: formData
29 }) 27 })
30 - // return request({
31 - // url: '/flightDestination/importFlightDestination',
32 - // method: 'post',
33 - // data: formData
34 - // })
35 } 28 }
36 29
37 //URSA目的地批量导入 30 //URSA目的地批量导入
...@@ -43,17 +36,12 @@ export function importUrsaDestination(file, date) { ...@@ -43,17 +36,12 @@ export function importUrsaDestination(file, date) {
43 let formData = new FormData(); 36 let formData = new FormData();
44 formData.append("file", file); 37 formData.append("file", file);
45 formData.append("beginDate", date); 38 formData.append("beginDate", date);
46 - return axios({ 39 + return request({
47 method: 'post', 40 method: 'post',
48 url: settings.baseURL + '/ursaDestination/importUrsaDestination', 41 url: settings.baseURL + '/ursaDestination/importUrsaDestination',
49 - headers: { 'Authorization': 'Bearer ' + getToken() }, 42 + // headers: { 'Authorization': 'Bearer ' + getToken() },
50 data: formData 43 data: formData
51 }) 44 })
52 - // return request({
53 - // url: '/ursaDestination/importUrsaDestination',
54 - // method: 'post',
55 - // data: formData
56 - // })
57 } 45 }
58 46
59 //航班目的地查询 47 //航班目的地查询
......
...@@ -23,10 +23,7 @@ router.beforeEach((to, from, next) => { ...@@ -23,10 +23,7 @@ router.beforeEach((to, from, next) => {
23 }) 23 })
24 }) 24 })
25 }).catch(err => { 25 }).catch(err => {
26 - store.dispatch('LogOut').then(() => { 26 +
27 - Message.error(err)
28 - next({ path: '/' })
29 - })
30 }) 27 })
31 } else { 28 } else {
32 next() 29 next()
......
...@@ -42,6 +42,7 @@ module.exports = { ...@@ -42,6 +42,7 @@ module.exports = {
42 /** 42 /**
43 * logout 43 * logout
44 */ 44 */
45 + loginURL: 'http://47.103.140.98/test/login',
45 logoutURL: 'http://47.103.140.98/test/login', 46 logoutURL: 'http://47.103.140.98/test/login',
46 47
47 /** 48 /**
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
24 <el-row> 24 <el-row>
25 <el-col :span="6"> 25 <el-col :span="6">
26 <el-form-item label="生效日期" prop="beginDate" :rules="rules"> 26 <el-form-item label="生效日期" prop="beginDate" :rules="rules">
27 - <el-date-picker class="formItem" v-model="formData.beginDate" type="date" 27 + <el-date-picker class="formItem" v-model="formData.beginDate" type="date" placeholder="选择日期"
28 - placeholder="选择日期" value-format="yyyy-MM-dd" clearable> 28 + value-format="yyyy-MM-dd" clearable>
29 </el-date-picker> 29 </el-date-picker>
30 </el-form-item> 30 </el-form-item>
31 </el-col> 31 </el-col>
...@@ -155,29 +155,18 @@ export default { ...@@ -155,29 +155,18 @@ export default {
155 //上传excel 155 //上传excel
156 const file = option.file; 156 const file = option.file;
157 importFlightDestination(file, this.formData.beginDate).then((res) => { 157 importFlightDestination(file, this.formData.beginDate).then((res) => {
158 - if (res.data.code != 200) { 158 + if (res.code != 200) {
159 - if (res.data.code == 603) { 159 + if (res.code == 603) {
160 this.$alert(res.msg, "提示", { 160 this.$alert(res.msg, "提示", {
161 confirmButtonText: "确定", 161 confirmButtonText: "确定",
162 type: "warning", 162 type: "warning",
163 }); 163 });
164 - } else if (res.data.code === 201) { 164 + } else if (res.code === 201) {
165 - this.msgWarning(res.data.msg); 165 + this.msgWarning(res.msg);
166 this.errorData = res.data.data; 166 this.errorData = res.data.data;
167 this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightToArea' } }) 167 this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightToArea' } })
168 - } else if (res.data.code === 301) {
169 - this.$confirm('登录状态已过期,需重新登录', '系统提示', {
170 - closeOnClickModal: false,
171 - showCancelButton: false,
172 - confirmButtonText: '重新登录',
173 - type: 'warning'
174 - }).then(
175 - this.$store.dispatch('LogOut').then(() => {
176 - window.location.href = settings.loginURL;//wsso系统跳转
177 - })
178 - )
179 } else { 168 } else {
180 - this.msgWarning(res.data.msg); 169 + this.msgWarning(res.msg);
181 } 170 }
182 } else { 171 } else {
183 this.msgSuccess("导入成功"); 172 this.msgSuccess("导入成功");
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
25 <el-row> 25 <el-row>
26 <el-col :span="6"> 26 <el-col :span="6">
27 <el-form-item label="生效日期" prop="beginDate" :rules="rules"> 27 <el-form-item label="生效日期" prop="beginDate" :rules="rules">
28 - <el-date-picker class="formItem" v-model="formData.beginDate" type="date" 28 + <el-date-picker class="formItem" v-model="formData.beginDate" type="date" placeholder="选择日期"
29 - placeholder="选择日期" value-format="yyyy-MM-dd" clearable> 29 + value-format="yyyy-MM-dd" clearable>
30 </el-date-picker> 30 </el-date-picker>
31 </el-form-item> 31 </el-form-item>
32 </el-col> 32 </el-col>
...@@ -162,29 +162,18 @@ export default { ...@@ -162,29 +162,18 @@ export default {
162 //上传excel 162 //上传excel
163 const file = option.file; 163 const file = option.file;
164 importUrsaDestination(file, this.formData.beginDate).then((res) => { 164 importUrsaDestination(file, this.formData.beginDate).then((res) => {
165 - if (res.data.code != 200) { 165 + if (res.code != 200) {
166 - if (res.data.code == 603) { 166 + if (res.code == 603) {
167 - this.$alert(res.data.msg, "提示", { 167 + this.$alert(res.msg, "提示", {
168 confirmButtonText: "确定", 168 confirmButtonText: "确定",
169 type: "warning", 169 type: "warning",
170 }); 170 });
171 - } else if (res.data.code === 201) { 171 + } else if (res.code === 201) {
172 - this.msgWarning(res.data.msg); 172 + this.msgWarning(res.msg);
173 - this.errorData = res.data.data; 173 + this.errorData = res.data;
174 this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightInformationImport' } }) 174 this.$router.push({ name: 'UpDateResult', params: { data: this.errorData, from: 'FlightInformationImport' } })
175 - } else if (res.data.code === 301) {
176 - this.$confirm('登录状态已过期,需重新登录', '系统提示', {
177 - closeOnClickModal: false,
178 - showCancelButton: false,
179 - confirmButtonText: '重新登录',
180 - type: 'warning'
181 - }).then(
182 - this.$store.dispatch('LogOut').then(() => {
183 - window.location.href = settings.loginURL;//wsso系统跳转
184 - })
185 - )
186 } else { 175 } else {
187 - this.msgWarning(res.data.msg); 176 + this.msgWarning(res.msg);
188 } 177 }
189 } else { 178 } else {
190 this.msgSuccess("导入成功"); 179 this.msgSuccess("导入成功");
...@@ -211,6 +200,7 @@ export default { ...@@ -211,6 +200,7 @@ export default {
211 this.selection() 200 this.selection()
212 }, 201 },
213 upload() { 202 upload() {
203 + console.log(1)
214 this.$refs.selectForm.validateField('beginDate') 204 this.$refs.selectForm.validateField('beginDate')
215 } 205 }
216 }, 206 },
......