zx 3 years ago
parent 8707cd17da
commit 3a5739de88

@ -23,9 +23,12 @@ Component({
],
//列表
dataList: [],
copyShow: false,
copyData: {},
total: 0
total: 0,
isSelectAll: false,
result: [],
fileName: '',
reportShow: false,
reportOption: []
},
methods: {
getApi() {
@ -137,6 +140,140 @@ Component({
url: '/subPackages/pages/detail/index?id=' + id
})
},
loadMore() {
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 pageIndex = this.data.iPageIndex + 1;
this.setData({iPageIndex: pageIndex});
app.globalData.request({
action: 'getList', //数据列表
token: 't%2BrswgjvzGM=',
sTimeType: this.data.sTimeType,
sStartTime: this.data.sStartTime,
sEndTime: this.data.sEndTime,
sQuDao: qdList.join(',') || '',
sQingGan: qgList.join(',') || '',
iPageIndex: this.data.iPageIndex,
iPageSize: this.data.iPageSize,
sType: 'BrandDataHot',
isSourcetype: 0, //1返回渠道 0不返回
iTimeType: this.data.iTimeType, //0发布时间 1入库时间
sCrisis: wjList.join(',') || '',
sRele: wx.getStorageSync('sRele') || '',
}).then(res => {
let arr = [...this.data.dataList, ...res]
this.setData({dataList: arr})
});
},
//单选
onChange(event) {
this.setData({
result: event.detail,
})
},
changeSelectAll(event) {
let listId = [];
let isSelectAllList = [];
if (event.detail.length != 0) {
this.data.dataList.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.toISOString().replace(/\D/g, '');
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.toISOString().replace(/\D/g, '');
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,
sRele: wx.getStorageSync('sRele') || '',
sQuDao: qdList.join(',') || '',
sQingGan: qgList.join(',') || '',
sCrisis: wjList.join(',') || '',
sType: 'BrandDataHot',
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(() => {});
}
},
lifetimes: {
attached() {

@ -45,37 +45,56 @@
</view>
<view class="tdl-content">
<view style="color: #333333;font-size: 12px">共{{total}}条信息数据</view>
<view class="tdl-item" wx:for="{{dataList}}" wx:key="index">
<view class="top-time">
<view class="top-time-item">{{item._source.sourcetime}}</view>
<view style="line-height: 12rpx;">
<van-tag wx:if="{{item._source.crisis == 1}}" color="#FFE9A8" text-color="#FFBF00">低级危机</van-tag>
<van-tag wx:if="{{item._source.crisis == 2}}" color="#FFDFCF" text-color="#FF6E25">中级危机</van-tag>
<van-tag wx:if="{{item._source.crisis == 3}}" color="#FFF0F1" text-color="#FF4852">高级危机</van-tag>
<van-tag wx:if="{{item._source.affections == 1}}" color="#F0F8FF" text-color="#0084FF">正面</van-tag>
<van-tag wx:if="{{item._source.affections == 3}}" color="#FFFBF0" text-color="#FDCD42">中性</van-tag>
<van-tag wx:if="{{item._source.affections == 2}}" color="#FFF0F1" text-color="#FF4852">负面</van-tag>
<van-checkbox-group value="{{ result }}" bind:change="onChange">
<view class="tdl-item" wx:for="{{dataList}}" wx:key="index">
<view class="top-time">
<view style="display: flex;width: 200px;height: 25px;line-height: 20px;">
<van-checkbox name="{{item._id}}" shape="square" class="van-checkbox"></van-checkbox>
<view class="top-time-item">{{item._source.sourcetime}}</view>
</view>
<view style="line-height: 12rpx;">
<van-tag wx:if="{{item._source.crisis == 1}}" color="#FFE9A8" text-color="#FFBF00">低级危机</van-tag>
<van-tag wx:if="{{item._source.crisis == 2}}" color="#FFDFCF" text-color="#FF6E25">中级危机</van-tag>
<van-tag wx:if="{{item._source.crisis == 3}}" color="#FFF0F1" text-color="#FF4852">高级危机</van-tag>
<van-tag wx:if="{{item._source.affections == 1}}" color="#F0F8FF" text-color="#0084FF">正面</van-tag>
<van-tag wx:if="{{item._source.affections == 3}}" color="#FFFBF0" text-color="#FDCD42">中性</van-tag>
<van-tag wx:if="{{item._source.affections == 2}}" color="#FFF0F1" text-color="#FF4852">负面</van-tag>
</view>
</view>
</view>
<view class="middle-title" data-id='{{item}}' bindtap="toEventDetail" style="margin-top: 16rpx;">
{{item._source.title}}
</view>
<view class="bottom-source">
<view>来源:{{item._source.source}}</view>
<view style="margin-left: 64rpx;">作者:{{item._source.user_author}}</view>
</view>
</view>
<view class="middle-title" data-id='{{item}}' bindtap="toEventDetail" style="margin-top: 16rpx;">
{{item._source.title}}
</view>
<view class="bottom-source">
<view>来源:{{item._source.source}}</view>
<view style="margin-left: 64rpx;">作者:{{item._source.user_author}}</view>
</view>
</view>
</van-checkbox-group>
<van-button custom-class="bottom-button" bind:click="loadMore">点击加载更多</van-button>
</view>
<van-dialog use-slot title="复制成功" show="{{copyShow}}">
<view style="padding: 32rpx">
<view style="font-size: 17px;font-weight: 600;color: #D0D0D0;line-height: 24px;margin-bottom: 24rpx">已复制到剪贴板,快去分享吧</view>
<view>发布时间:{{copyData.sourcetime}}</view>
<!-- <view>车型:{{copyData.sourcetime}}</view> -->
<view>来源:{{copyData.source}}</view>
<view>标题:{{copyData.title}}</view>
<view style="word-break: break-all">链接:{{copyData.url}}</view>
<view>调性:{{copyData.affections == 1?'正面':copyData.affections == 2?'中性':'负面'}}</view>
<view>作者:{{copyData.user_author}}</view>
<view class="tdl-footer" style="display: flex;justify-content: flex-start;">
<view style="margin-top: 3%">
<van-checkbox-group value="{{ isSelectAll }}" bind:change="changeSelectAll">
<van-checkbox name="0" shape="square" class="van-checkbox">全选</van-checkbox>
</van-checkbox-group>
</view>
<view style="width: 75%;margin-left: 24rpx;">
<van-button bind:click="openReport" custom-style="width: 45%" color="#0084FF" class="theme-add-btn" plain>生成数据</van-button>
</view>
</view>
<van-dialog use-slot title="导出选项" show="{{reportShow}}" bind:confirm="report" show-cancel-button>
<scroll-view scroll-y style="height: 750rpx;margin: 32rpx">
<view>文件名称</view>
<view style="color:#999999;font-size: 14px;margin:24rpx">{{fileName}}</view>
<view>导出数量</view>
<view style="color:#999999;margin: 24rpx;font-size: 14px;">共导出 <span style="color: #0084FF">{{result.length}}</span> 条数据以xlsx格式导出</view>
<view>导出字段</view>
<view class="filter" >
<view wx:for="{{reportOption}}" wx:key="index">
<view data-data="{{item}}" data-index="{{index}}" wx:if="{{item.checked == 0}}" class="more-item" style="width: 162rpx" bindtap="fieldChange">{{item.name}}</view>
<view data-data="{{item}}" data-index="{{index}}" wx:else class="more-item-active" style="width: 162rpx" bindtap="fieldChange">{{item.name}}</view>
</view>
</view>
</scroll-view>
</van-dialog>
</view>

@ -62,4 +62,27 @@
line-height: 72rpx;
font-size: 12px;
color: #0084FF;
}
.bottom-button {
width: 92%
}
.tdl-footer {
position: fixed;
bottom: 0;
background: #FFF;
width: 100%;
padding: 16rpx 0rpx 24rpx 0rpx;
margin-left: 64rpx;
}
/* 按钮 */
.theme-add-btn {
font-weight: bold;
line-height: 88rpx;
font-size: 28rpx;
}
.theme-add {
margin: 12px;
background-color: #006BFF;
}

@ -330,7 +330,7 @@ Page({
openReport() {
let d = new Date();
let date = d.toISOString().replace(/\D/g, '');
this.setData({fileName: "事件数据" + date})
this.setData({fileName: "主题数据" + date})
this.setData({
reportShow: true
})
@ -376,7 +376,7 @@ Page({
sType: 'ZhuTiFenXiBl',
sGuid: this.data.Guid,
sField: JSON.stringify(sField), //导出字段
sFileName: "事件数据" + date, //文件名称
sFileName: "主题数据" + date, //文件名称
sCheckedIds: this.data.result.join(',') || '', //数据id
iNum: this.data.result.length, //导出条数
iTimeType: this.data.iTimeType, //0发布时间 1入库时间

Loading…
Cancel
Save