零推广,时间参数bug

master
wyj2080 6 years ago
parent 0c826cfd1e
commit 2230fac9f6

@ -135,8 +135,11 @@
let regionId = this.regionId; let regionId = this.regionId;
if(regionId === 0){ if(regionId === 0){
this.orgList = this.organizationalList.filter(item => item.level === 2); this.orgList = this.organizationalList.filter(item => item.level === 2);
this.customerList = this.organizationalList.filter(item => item.level === 3);
}else{ }else{
this.orgList = this.organizationalList.filter(item => item.parentId === regionId && item.level === 2); this.orgList = this.organizationalList.filter(item => item.parentId === regionId && item.level === 2);
let orgIds = this.orgList.map(item => item.id);
this.customerList = this.organizationalList.filter(item => orgIds.indexOf(item.parentId) !== -1 && item.level === 3);
} }
this.insertAllOption(); this.insertAllOption();
this.orgId = 0; this.orgId = 0;
@ -146,9 +149,10 @@
orgSelect: function(){ orgSelect: function(){
let orgId = this.orgId; let orgId = this.orgId;
if(orgId === 0){ if(orgId === 0){
this.customerList = this.organizationalList.filter(item => item.level === 1); let orgIds = this.orgList.map(item => item.id);
this.customerList = this.organizationalList.filter(item => orgIds.indexOf(item.parentId) !== -1 && item.level === 3);
}else{ }else{
this.customerList = this.organizationalList.filter(item => item.parentId === orgId && item.level === 1); this.customerList = this.organizationalList.filter(item => item.parentId === orgId && item.level === 3);
} }
this.insertAllOption(); this.insertAllOption();
this.customerId = 0; this.customerId = 0;
@ -172,19 +176,23 @@
}, },
//广 //广
exportZeroExtend: function(){ exportZeroExtend: function(){
let start = this.$moment(this.dateRange[0]).format("YYYY-MM-DD"); let title = "0推广店铺";
let end = this.$moment(this.dateRange[1]).format("YYYY-MM-DD"); if(this.dateRange[0]){
let start = this.$moment(this.dateRange[0]).format("YYYY-MM-DD");
let end = this.$moment(this.dateRange[1]).format("YYYY-MM-DD");
title += "" + start + "至" + end + "";
}
this.originAllData = []; this.originAllData = [];
let that = this; let that = this;
let request = { let request = {
userId: that.userId, userId: that.userId,
pageNum : that.pageNum, pageNum : 1,
pageSize : that.totalSize, pageSize : that.totalSize,
regionId : that.regionId === 0 ? null : that.regionId, regionId : that.regionId === 0 ? null : that.regionId,
companyId : that.orgId === 0 ? null : that.orgId, companyId : that.orgId === 0 ? null : that.orgId,
customerId : that.customerId === 0 ? null : that.customerId, customerId : that.customerId === 0 ? null : that.customerId,
startTime : this.formartDate(that.startDate, "YYYY-MM-DD"), startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"),
endTime : this.formartDate(that.endDate, "YYYY-MM-DD", true), endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true),
}; };
zeroExtend.getMainRequest(request,function (data) { zeroExtend.getMainRequest(request,function (data) {
if(data.data.code !== "0000"){ if(data.data.code !== "0000"){
@ -205,10 +213,12 @@
// //
const list = that.originAllData; //datatableDatalist const list = that.originAllData; //datatableDatalist
const data = that.formatJson(filterVal, list); const data = that.formatJson(filterVal, list);
export_json_to_excel(tHeader, data, "0推广店铺" + start + "至" + end + ""); export_json_to_excel(tHeader, data, title);
}); });
} }
if(data && data.length === 0){
that.$Message.info("暂无数据");
}
}); });
}, },
formatJson(filterVal, jsonData) { formatJson(filterVal, jsonData) {
@ -225,8 +235,8 @@
regionId : that.regionId === 0 ? null : that.regionId, regionId : that.regionId === 0 ? null : that.regionId,
companyId : that.orgId === 0 ? null : that.orgId, companyId : that.orgId === 0 ? null : that.orgId,
customerId : that.customerId === 0 ? null : that.customerId, customerId : that.customerId === 0 ? null : that.customerId,
startTime : this.formartDate(that.startDate, "YYYY-MM-DD"), startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"),
endTime : this.formartDate(that.endDate, "YYYY-MM-DD", true), endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true),
}; };
// //
this.spinShow = true; this.spinShow = true;
@ -264,9 +274,9 @@
data = data.data.results; data = data.data.results;
if(data){ if(data){
that.organizationalList = data; that.organizationalList = data;
that.regionList = that.organizationalList.filter(item => item.level === 3); that.regionList = that.organizationalList.filter(item => item.level === 1);
that.orgList = that.organizationalList.filter(item => item.level === 2); that.orgList = that.organizationalList.filter(item => item.level === 2);
that.customerList = that.organizationalList.filter(item => item.level === 1); that.customerList = that.organizationalList.filter(item => item.level === 3);
} }
// //
that.insertAllOption(); that.insertAllOption();

Loading…
Cancel
Save