From 2230fac9f6b9d50813e401c3c169a52ebaba3972 Mon Sep 17 00:00:00 2001 From: wyj2080 <1603068044@qq.com> Date: Wed, 22 Apr 2020 15:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=B6=E6=8E=A8=E5=B9=BF=EF=BC=8C=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=8F=82=E6=95=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ZeroExtendDetail.vue | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/pages/ZeroExtendDetail.vue b/src/pages/ZeroExtendDetail.vue index 7eb23f6..d7aba7f 100644 --- a/src/pages/ZeroExtendDetail.vue +++ b/src/pages/ZeroExtendDetail.vue @@ -135,8 +135,11 @@ let regionId = this.regionId; if(regionId === 0){ this.orgList = this.organizationalList.filter(item => item.level === 2); + this.customerList = this.organizationalList.filter(item => item.level === 3); }else{ 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.orgId = 0; @@ -146,9 +149,10 @@ orgSelect: function(){ let orgId = this.orgId; 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{ - 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.customerId = 0; @@ -172,19 +176,23 @@ }, //零推广导出 exportZeroExtend: function(){ - let start = this.$moment(this.dateRange[0]).format("YYYY-MM-DD"); - let end = this.$moment(this.dateRange[1]).format("YYYY-MM-DD"); + let title = "0推广店铺"; + 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 = []; let that = this; let request = { userId: that.userId, - pageNum : that.pageNum, + pageNum : 1, pageSize : that.totalSize, regionId : that.regionId === 0 ? null : that.regionId, companyId : that.orgId === 0 ? null : that.orgId, customerId : that.customerId === 0 ? null : that.customerId, - startTime : this.formartDate(that.startDate, "YYYY-MM-DD"), - endTime : this.formartDate(that.endDate, "YYYY-MM-DD", true), + startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"), + endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true), }; zeroExtend.getMainRequest(request,function (data) { if(data.data.code !== "0000"){ @@ -205,10 +213,12 @@ // 数据 const list = that.originAllData; //把data里的tableData存到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) { @@ -225,8 +235,8 @@ regionId : that.regionId === 0 ? null : that.regionId, companyId : that.orgId === 0 ? null : that.orgId, customerId : that.customerId === 0 ? null : that.customerId, - startTime : this.formartDate(that.startDate, "YYYY-MM-DD"), - endTime : this.formartDate(that.endDate, "YYYY-MM-DD", true), + startTime : this.formartDate(that.dateRange[0], "YYYY-MM-DD"), + endTime : this.formartDate(that.dateRange[1], "YYYY-MM-DD", true), }; //加载遮罩 this.spinShow = true; @@ -264,9 +274,9 @@ data = data.data.results; if(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.customerList = that.organizationalList.filter(item => item.level === 1); + that.customerList = that.organizationalList.filter(item => item.level === 3); } //插入全部选项 that.insertAllOption();