diff --git a/pages/insight/pages/brandInsight/brandDataList/index.js b/pages/insight/pages/brandInsight/brandDataList/index.js index a511328..400c193 100644 --- a/pages/insight/pages/brandInsight/brandDataList/index.js +++ b/pages/insight/pages/brandInsight/brandDataList/index.js @@ -22,6 +22,11 @@ Page({ copyShow: false, copyData: {}, total: 0, + isSelectAll: false, + result: [], + fileName: '', + reportShow: false, + reportOption: [] }, onShow() { this.setData({ @@ -123,6 +128,15 @@ Page({ }) this.setData({affList: res}) }); + app.globalData.request({ + action: 'getToExcelField', //获取导出字段 + sType: 'BrandData', + token: 't%2BrswgjvzGM=', + }).then(res => { + this.setData({ + reportOption: res + }) + }); }, changeSource(event) { let that = this; @@ -180,4 +194,97 @@ Page({ url: '/subPackages/pages/detail/index?id=' + id }) }, + //单选 + onChange(event) { + this.setData({ + result: event.detail, + }) + }, + changeSelectAll(event) { + let listId = []; + let isSelectAllList = []; + if (event.detail.length != 0) { + this.data.brandDataList.forEach((e) => { + listId.push(e._id); + }) + isSelectAllList.push(event.detail) + } else { + listId.splice(); + } + this.setData({ + result: listId, + isSelectAll: event.detail, + }); + }, + openReport() { + let d = new Date(); + let date = d.getFullYear().toString() + (d.getMonth() + 1) + d.getDate(); + this.setData({fileName: wx.getStorageSync('sBrand') + date}) + this.setData({ + reportShow: true + }) + }, + 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({ + reportOption: that.data.reportOption + }) + }, + report() { + let d = new Date(); + let date = d.getFullYear().toString() + (d.getMonth() + 1) + d.getDate(); + let qdList = []; + this.data.affList.forEach(ele => { + if(ele.isSelect && ele.key != -1) { + qdList.push(ele.key) + } + }); + let qgList = []; + this.data.qgList.forEach(ele => { + if(ele.isSelect && ele.key != -1) { + qgList.push(ele.key) + } + }); + let wjList = []; + this.data.wjList.forEach(ele => { + if(ele.isSelect && ele.key != -1) { + 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=', + sTimeType: this.data.sTimeType, + sStartTime: this.data.sStartTime, + sEndTime: this.data.sEndTime, + sBrand: wx.getStorageSync('sBrand') || '', + sQuDao: qdList.join(',') || '', + sQingGan: qgList.join(',') || '', + sCrisis: wjList.join(',') || '', + sType: 'BrandData', + sField: JSON.stringify(sField), //导出字段 + sFileName: "事件数据" + date, //文件名称 + sCheckedIds: this.data.result.join(',') || '', //数据id + iNum: this.data.result.length, //导出条数 + iTimeType: this.data.iTimeType, //0发布时间 1入库时间 + }, (res) => { + if (res.Code == 1) { + this.setData({ + reportShow: false + }) + wx.showModal({ + title: '数据生成中,请前往”我的“查看生成进度', + showCancel: false + }) + } + }).then(() => {}); + } }) \ No newline at end of file diff --git a/pages/insight/pages/brandInsight/brandDataList/index.wxml b/pages/insight/pages/brandInsight/brandDataList/index.wxml index 18f52eb..2c65264 100644 --- a/pages/insight/pages/brandInsight/brandDataList/index.wxml +++ b/pages/insight/pages/brandInsight/brandDataList/index.wxml @@ -44,36 +44,54 @@ 共{{total}}条信息数据 - - - {{item._source.sourcetime}} - - 低级危机 - 中级危机 - 高级危机 - 正面 - 中性 - 负面 + + + + + + {{item._source.sourcetime}} + + + 低级危机 + 中级危机 + 高级危机 + 正面 + 中性 + 负面 + + + + {{item._source.title}} + + + 来源:{{item._source.source}} + 作者:{{item._source.user_author}} - - {{item._source.title}} + + + + + 全选 + - - 来源:{{item._source.source}} - 作者:{{item._source.user_author}} + + 生成数据 - - - 已复制到剪贴板,快去分享吧 - 发布时间:{{copyData.sourcetime}} - - 来源:{{copyData.source}} - 标题:{{copyData.title}} - 链接:{{copyData.url}} - 调性:{{copyData.affections == 1?'正面':copyData.affections == 2?'中性':'负面'}} - 作者:{{copyData.user_author}} - + + + 文件名称 + {{fileName}} + 导出数量 + 共导出 {{result.length}} 条数据,以xlsx格式导出 + 导出字段 + + + {{item.name}} + {{item.name}} + + + \ No newline at end of file diff --git a/pages/insight/pages/brandInsight/brandDataList/index.wxss b/pages/insight/pages/brandInsight/brandDataList/index.wxss index 8b84ae3..c5629d7 100644 --- a/pages/insight/pages/brandInsight/brandDataList/index.wxss +++ b/pages/insight/pages/brandInsight/brandDataList/index.wxss @@ -61,4 +61,23 @@ line-height: 72rpx; font-size: 12px; color: #0084FF; +} + +.tdl-footer { + position: fixed; + bottom: 0; + background: #FFF; + width: 100%; + padding: 16rpx 0rpx 24rpx 0rpx; + /* margin-left: 16rpx; */ +} +/* 按钮 */ +.theme-add-btn { + font-weight: bold; + line-height: 88rpx; + font-size: 28rpx; +} +.theme-add { + margin: 12px; + background-color: #006BFF; } \ No newline at end of file