zx 3 years ago
parent 31e2f770c6
commit 3daca3b190

@ -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) {

@ -114,13 +114,19 @@
<van-button bind:click="toThemeBoard" custom-style="width: 45%" color="#0084FF" class="theme-add-btn">数据看板</van-button>
</view>
</view>
<van-dialog use-slot title="生成数据" show="{{reportShow}}" bind:confirm="report" show-cancel-button>
<scroll-view scroll-y style="height: 380rpx;">
<van-checkbox-group value="{{ fieldList }}" bind:change="fieldChange">
<van-checkbox wx:for="{{reportOption}}" wx:key="key" name="{{item.value}}" shape="square">
{{item.name}}
</van-checkbox>
</van-checkbox-group>
<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>
<van-dialog use-slot title="复制成功" show="{{copyShow}}">

Loading…
Cancel
Save