diff --git a/pages/insight/pages/themeList/index.js b/pages/insight/pages/themeList/index.js index ddc905e..28bd431 100644 --- a/pages/insight/pages/themeList/index.js +++ b/pages/insight/pages/themeList/index.js @@ -43,10 +43,10 @@ Page({ //导出字段 reportOption: [], reportShow: false, - fieldList: [], copyShow: false, copyData: {}, result: [], + fileName: '', }, onLoad: function (options) { this.setData({ @@ -151,16 +151,8 @@ Page({ sType: 'BrandData', token: 't%2BrswgjvzGM=', }).then(res => { - let option = []; - res.forEach(ele => { - let obj = { - name: ele.name, - value: ele.field - }; - option.push(obj) - }); this.setData({ - reportOption: option + reportOption: res }) }); }, @@ -336,6 +328,9 @@ Page({ }) }, openReport() { + let d = new Date(); + let date = d.getFullYear().toString() + (d.getMonth() + 1) + d.getDate(); + this.setData({fileName: "事件数据" + date}) this.setData({ reportShow: true }) @@ -361,6 +356,12 @@ Page({ wjList.push(ele.key) } }); + let sField = {}; + this.data.reportOption.forEach(ele => { + if(ele.checked == 1 || ele.checked == "1") { + sField[ele.field] = 1; + } + }) app.globalData.request({ action: 'toExcel', //导出 token: 't%2BrswgjvzGM=', @@ -374,10 +375,10 @@ Page({ sTitleType: this.data.sTitleType, sType: 'ZhuTiFenXiBl', sGuid: this.data.Guid, - sField: this.data.fieldList.join(','), //导出字段 + sField: JSON.stringify(sField), //导出字段 sFileName: "事件数据" + date, //文件名称 - sCheckedIds: '', //数据id - iNum: this.data.selectedNumber, //导出条数 + sCheckedIds: this.data.result.join(',') || '', //数据id + iNum: this.data.result.length, //导出条数 iTimeType: this.data.iTimeType, //0发布时间 1入库时间 }, (res) => { if (res.Code == 1) { @@ -392,8 +393,11 @@ Page({ }).then(() => {}); }, fieldChange(event) { + let index = event.currentTarget.dataset.index; + var that = this; + that.data.reportOption[index].checked = that.data.reportOption[index].checked==0?1:0 this.setData({ - fieldList: event.detail + reportOption: that.data.reportOption }) }, toEventDetail(e) { diff --git a/pages/insight/pages/themeList/index.wxml b/pages/insight/pages/themeList/index.wxml index 897c310..334fc34 100644 --- a/pages/insight/pages/themeList/index.wxml +++ b/pages/insight/pages/themeList/index.wxml @@ -114,13 +114,19 @@ 数据看板 - - - - - {{item.name}} - - + + + 文件名称 + {{fileName}} + 导出数量 + 共导出 {{result.length}} 条数据,以xlsx格式导出 + 导出字段 + + + {{item.name}} + {{item.name}} + +