reportDownloads.vue
6.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
<el-row>
<el-col :span="24">
<el-card :body-style="{ padding: '16px' }">
<div class="reportContainer box-card">
<div class="reportTips">
数据日报{{ reportDay }}已生成
</div>
<div class="selectContainer">
<div>选择日期</div>
<div class="daySelect2">
<!-- <el-date-picker v-model="dateValue"
type="date"
:picker-options="pickerOptions"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
placeholder="选择日期" /> -->
<el-date-picker v-model="dateValue"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions"
value-format="yyyy-MM-dd" />
</div>
<!-- <el-button type="primary"
@click="exportDailyReport"
:loading="exportDailyReportBtn"
class="exportBtn">导出日报</el-button> -->
<auth-button category="Button" :show-btn-ids="['90706']" />
</div>
<div class="inputTargetBtn">
<div @click="goCheck" v-if="checkBtnFlag"><i class="el-icon-chat-round"></i>查看企微推送对象</div>
<!-- <div @click="outputVisible = true" v-if="editBtnFlag"><i class="el-icon-edit"></i>编辑单店信息</div> -->
</div>
</div>
</el-card>
</el-col>
<outputValueDialog v-if="outputVisible"
:is-show.sync="outputVisible" />
</el-row>
</template>
<script>
import outputValueDialog from './outputValueDialog'
import dayjs from 'dayjs'
import { mapActions, mapState } from 'vuex'
import { rangePickerOptions_30day2 } from '@/common/format'
import { Util } from '@/common/util'
export default {
name: 'ReportDownloadsCom',
components: {
outputValueDialog
},
data() {
return {
userInfo: this.$store.state.d2admin.user.info,
reportDay: dayjs().subtract(1, 'day').format('YYYY年MM月DD日'),
// pickerOptions: {
// // 不能超过当前日期和业务开始日期
// disabledDate(time) {
// return time.getTime() > Date.now() - 8.64e7 || time.getTime() <
// new Date('2020-10-01').getTime() -
// 1 * 24 * 60 * 60 * 1000
// }
// },
pickerOptions: rangePickerOptions_30day2,
// dateValue: dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
dateValue: '',
outputVisible: false,
exportDailyReportBtn: false,
checkBtnFlag: false, // 查看企微推送对象权限
editBtnFlag: false, // 编辑单店信息权限
}
},
computed: {
...mapState({
dowloadList: (state) => state.d2admin.user.dowloadList
}),
specialAccout() {
return this.userInfo?.loginAccount?.loginAccout == '18123663366'
}
},
mounted() {
this.$nextTick(() => {
const $store = this.$store.getters['d2admin/auth/curBtns']
const btnId = '90702' // 查看企微推送对象权限ID
const editStoreBtnId = '90705' // 编辑单店信息权限ID
const _item = $store?.find(i => (i.authId === btnId))
const _editItem = $store?.find(i => (i.authId === editStoreBtnId))
if (_item) this.checkBtnFlag = true
if (_editItem) this.editBtnFlag = true
})
},
methods: {
...mapActions('d2admin/user', ['actionSetDownloadList']),
exportDailyReport() {
if (!this.dateValue) return this.$message.warning('请选择日期')
// this.exportDailyReportBtn = true
// console.log(downLoadFile)
// return
// getExportDailyReport({ endDateStr: this.dateValue }).then((result) => {
// // if (result.code == 0) {
// // console.log(downLoadFile)
// // console.log(result)
// downLoadFile(result)
// // }
// }).catch((err) => {
// console.log(err)
// }).finally((result) => {
// this.exportDailyReportBtn = false
// })
var params = {}
// params.endDateStr = this.dateValue
params.startDateStr = Util.dateFormate(this.dateValue[0], 'YYYY-MM-DD')
params.endDateStr = Util.dateFormate(this.dateValue[1], 'YYYY-MM-DD')
params.method = 'dj.api.smartcarlife.workbench.exportDailyReport.async'
const list = [
...this.dowloadList,
{
name: '日报',
// uuid: JSON.parse(res).data,
// ifSuccess: false
exportParam: JSON.stringify(params),
status: 'waiting',
timeid: new Date().getTime()
}
]
this.actionSetDownloadList({ list, type: 'dowloadList' })
},
// 查看企微推送对象
goCheck(row) {
// console.log('goCheck')
// return
this.$router.push({
name: 'outputValue'
})
// console.log('row', row)
}
}
}
</script>
<style lang="scss">
.reportContainer {
display: flex;
height: 30px;
font-size: 14px;
.reportTips {
font-size: 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
padding-right: 25px;
border-right: 1px solid #dcdfe6;
}
.selectContainer {
display: flex;
align-items: center;
padding-left: 25px;
.exportBtn {
font-size: 12px;
padding: 8px 10px;
}
}
.daySelect {
margin: 0 8px;
.el-input__inner {
height: 30px;
}
.el-input__icon {
line-height: 30px;
}
}
.daySelect2 {
margin: 0 8px;
}
.inputTargetBtn {
display: flex;
margin-left: auto;
line-height: 30px;
cursor: pointer;
.el-icon-edit,
.el-icon-chat-round {
margin-right: 5px;
}
}
}
</style>