Commit cf17a9c9 authored by danfuman's avatar danfuman

修改

parent d77773bb
...@@ -36,6 +36,10 @@ service.interceptors.request.use(config => { ...@@ -36,6 +36,10 @@ service.interceptors.request.use(config => {
config.params = {}; config.params = {};
config.url = url; config.url = url;
} }
cancelPending(config)
config.cancelToken = new CancelToken(res => {
pending.push({'UrlPath': config.url, 'Cancel': res})
})
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) { if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
const requestObj = { const requestObj = {
url: config.url, url: config.url,
...@@ -65,6 +69,23 @@ service.interceptors.request.use(config => { ...@@ -65,6 +69,23 @@ service.interceptors.request.use(config => {
Promise.reject(error) Promise.reject(error)
}) })
//频繁发送请求时,返回慢的数据覆盖了返回快的数据
let pending = []
let CancelToken = axios.CancelToken
let cancelPending = (config) => {
pending.forEach((item, index) => {
if (config) {
if (item.UrlPath === config.url) {
item.Cancel() // 取消请求
pending.splice(index, 1) // 移除当前请求记录
};
} else {
item.Cancel() // 取消请求
pending.splice(index, 1) // 移除当前请求记录
}
})
}
// 响应拦截器 // 响应拦截器
service.interceptors.response.use(res => { service.interceptors.response.use(res => {
const apiList = ['/login', '/system/user/profile/updatePwd'] //需要提示错误的接口 const apiList = ['/login', '/system/user/profile/updatePwd'] //需要提示错误的接口
...@@ -99,6 +120,7 @@ service.interceptors.response.use(res => { ...@@ -99,6 +120,7 @@ service.interceptors.response.use(res => {
Notification.error({ title: msg }) Notification.error({ title: msg })
return Promise.reject('error') return Promise.reject('error')
} else { } else {
cancelPending(res.config)
return res.data return res.data
} }
},error => { },error => {
...@@ -114,7 +136,7 @@ service.interceptors.response.use(res => { ...@@ -114,7 +136,7 @@ service.interceptors.response.use(res => {
if(message=='数据正在处理,请勿重复提交'){ //重复提交,提示样式特殊处理 if(message=='数据正在处理,请勿重复提交'){ //重复提交,提示样式特殊处理
Message({ message: message, type: 'warning', duration: 5 * 1000 }) Message({ message: message, type: 'warning', duration: 5 * 1000 })
}else{ }else{
Message({ message: message, type: 'error', duration: 5 * 1000 }) // Message({ message: message, type: 'error', duration: 5 * 1000 })
} }
return Promise.reject(error) return Promise.reject(error)
} }
......
...@@ -220,7 +220,7 @@ ...@@ -220,7 +220,7 @@
}, },
methods: { methods: {
handleQuery(params){ handleQuery(params){
// this.isSkeleton = true this.isSkeleton = true
let data = this.getAreaList(params || this.queryParams) let data = this.getAreaList(params || this.queryParams)
if(data.cgbl){ if(data.cgbl){
if(data.cgbl === '100%'){ if(data.cgbl === '100%'){
...@@ -244,9 +244,13 @@ ...@@ -244,9 +244,13 @@
if(data.subjectMatters){ if(data.subjectMatters){
data.subjectMatters=[data.subjectMatters] data.subjectMatters=[data.subjectMatters]
} }
if(!data.endTime){
data.endTime=this.formatDate(new Date())
}
this.dataEXCEL=data; this.dataEXCEL=data;
bidPage(data).then(res=>{ bidPage(data).then(res=>{
this.tableData = res.code == 200 ? res.rows:[] this.tableData = res.code == 200 ? res.rows:[];
console.log(res.total)
this.tableDataTotal = res.total this.tableDataTotal = res.total
this.isSkeleton = false this.isSkeleton = false
this.tableLoading = false this.tableLoading = false
...@@ -272,33 +276,34 @@ ...@@ -272,33 +276,34 @@
"value": dataRegion[i].parentId, "value": dataRegion[i].parentId,
"children": [] "children": []
}); });
} else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 2) {
for (let j = 0; j < str.length; j++) {
if (str[j].id == dataRegion[i].parentId) {
str[j].children.push({
'id': dataRegion[i].id,
"label": dataRegion[i].regionName,
"short": dataRegion[i].short,
"value": dataRegion[i].parentId,
"children": []
});
}
}
} else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 3) {
for (let j = 0; j < str.length; j++) {
for (let k = 0; k < str[j].children.length; k++) {
if (str[j].children[k].id == dataRegion[i].parentId) {
str[j].children[k].children.push({
'id': dataRegion[i].id,
"label": dataRegion[i].regionName,
"short": dataRegion[i].short,
"value": dataRegion[i].parentId
// "children":[]
});
}
}
}
} }
// else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 2) {
// for (let j = 0; j < str.length; j++) {
// if (str[j].id == dataRegion[i].parentId) {
// str[j].children.push({
// 'id': dataRegion[i].id,
// "label": dataRegion[i].regionName,
// "short": dataRegion[i].short,
// "value": dataRegion[i].parentId,
// "children": []
// });
// }
// }
// } else if (dataRegion[i].regionLevel == x + 1 && x + 1 == 3) {
// for (let j = 0; j < str.length; j++) {
// for (let k = 0; k < str[j].children.length; k++) {
// if (str[j].children[k].id == dataRegion[i].parentId) {
// str[j].children[k].children.push({
// 'id': dataRegion[i].id,
// "label": dataRegion[i].regionName,
// "short": dataRegion[i].short,
// "value": dataRegion[i].parentId
// // "children":[]
// });
// }
// }
// }
// }
} }
} }
for (var i=0; i<str.length; i++) { for (var i=0; i<str.length; i++) {
......
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
width: 110px; width: 110px;
} }
::v-deep .el-cascader{ ::v-deep .el-cascader{
width: 220px; width: 200px;
.el-cascader__tags{ .el-cascader__tags{
flex-wrap: inherit; flex-wrap: inherit;
.el-tag{ .el-tag{
...@@ -376,6 +376,7 @@ ...@@ -376,6 +376,7 @@
} }
} }
::v-deep .el-select-dropdown{ ::v-deep .el-select-dropdown{
left: 0 !important;
.el-select-dropdown__item.hover{ .el-select-dropdown__item.hover{
color: #0081FF; color: #0081FF;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment