zx 3 years ago
parent 3daca3b190
commit d508801b17

@ -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(() => {});
}
})

@ -44,36 +44,54 @@
</van-dropdown-menu>
</view>
<view style="color: #333333;font-size: 12px;margin-top: 20rpx">共{{total}}条信息数据</view>
<view class="tdl-item" style="margin-top: 16rpx;" wx:for="{{brandDataList}}" 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" style="margin-top: 16rpx;" wx:for="{{brandDataList}}" 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 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}}
</van-checkbox-group>
<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 class="bottom-source">
<view>来源:{{item._source.source}}</view>
<view style="margin-left: 64rpx;">作者:{{item._source.user_author}}</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="{{copyShow}}">
<view style="margin: 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>
<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,3 +62,22 @@
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;
}
Loading…
Cancel
Save