|
@@ -13,8 +13,8 @@
|
13
|
13
|
<label class="common-screen-label">收益截止日期</label>
|
14
|
14
|
<el-date-picker v-model="closing_date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="small" style="width:150px" @change="onChangeClosingDate" />
|
15
|
15
|
</div>
|
16
|
|
- <!-- 花生账户 -->
|
17
|
|
- <selfChannel :reset="reset" title="账户" type="adqAccount" labelWidth @channelDefine="onChangeAccountHS" />
|
|
16
|
+ <!-- 花生mp账号 -->
|
|
17
|
+ <selfChannel :reset="reset" title="账号" type="mpAccountHS" labelWidth @channelDefine="onChangeAccountHS" />
|
18
|
18
|
</div>
|
19
|
19
|
</div>
|
20
|
20
|
<!-- S 新增区间筛选项 -->
|
|
@@ -110,7 +110,7 @@ export default {
|
110
|
110
|
paid: ['', ''], // 消耗(范围)
|
111
|
111
|
reset: false,
|
112
|
112
|
closing_date: '', // 收益截止日期
|
113
|
|
- account_id_hs: '', // 花生账户
|
|
113
|
+ app_id: '', // 花生mp账号
|
114
|
114
|
sort_field: 'date', // 排序字段 默认 时间 & 降序
|
115
|
115
|
sort_type: 'desc', // 升序/降序
|
116
|
116
|
updateTime: '', // 数据更新时间
|
|
@@ -123,29 +123,11 @@ export default {
|
123
|
123
|
this.handleGetUpdateTime()
|
124
|
124
|
},
|
125
|
125
|
methods: {
|
126
|
|
- // 获取"数据更新时间"
|
127
|
|
- async handleGetUpdateTime() {
|
128
|
|
- console.log('handleGetUpdateTime => ')
|
129
|
|
- try {
|
130
|
|
- const params = { type: '' }
|
131
|
|
-
|
132
|
|
- params.type = 'data_cycle_adq' // mock
|
133
|
|
-
|
134
|
|
- const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_uptime}`, { params })
|
135
|
|
- if (res && res.errno == 0) {
|
136
|
|
- this.updateTime = res.rst.uptime
|
137
|
|
- } else if (res.errno != 4002) {
|
138
|
|
- this.$message.warning(res.err)
|
139
|
|
- this.updateTime = ''
|
140
|
|
- }
|
141
|
|
- } catch (error) {
|
142
|
|
- this.updateTime = ''
|
143
|
|
- }
|
144
|
|
- },
|
|
126
|
+ // 重置
|
145
|
127
|
handleReset() {
|
146
|
128
|
this.reset = !this.reset
|
147
|
129
|
this.closing_date = ''
|
148
|
|
- this.account_id_hs = ''
|
|
130
|
+ this.app_id = ''
|
149
|
131
|
this.time = this.default_time
|
150
|
132
|
this.firstDayRoi = ['', ''] // 首日ROI(范围)
|
151
|
133
|
this.firstOrderCost = ['', ''] // 下单成本(范围)
|
|
@@ -157,15 +139,44 @@ export default {
|
157
|
139
|
this.init(1)
|
158
|
140
|
this.handleGetUpdateTime()
|
159
|
141
|
},
|
160
|
|
- changeTime (time) {//筛选时间变化
|
161
|
|
- if (!time || time && time.length == 0) {
|
162
|
|
- this.time = []
|
|
142
|
+ // 监听排序变化
|
|
143
|
+ onClickSort(sort_field, sort_type) {
|
|
144
|
+ // sort_type:升序asc、降序desc
|
|
145
|
+ if (this.sort_field === sort_field) {
|
|
146
|
+ if (this.sort_type === sort_type) {
|
|
147
|
+ // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
|
|
148
|
+ this.sort_field = 'date'
|
|
149
|
+ this.sort_type = 'desc'
|
|
150
|
+ } else {
|
|
151
|
+ // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
|
|
152
|
+ this.sort_type = sort_type
|
|
153
|
+ }
|
163
|
154
|
} else {
|
164
|
|
- this.time = time
|
|
155
|
+ // 点击的不是当前排序字段 => 设置排序字段和类型
|
|
156
|
+ this.sort_field = sort_field
|
|
157
|
+ this.sort_type = sort_type
|
165
|
158
|
}
|
|
159
|
+ // 后端排序 => 获取最新数据
|
166
|
160
|
this.init(1)
|
167
|
161
|
this.handleGetUpdateTime()
|
168
|
162
|
},
|
|
163
|
+ // 获取"数据更新时间"
|
|
164
|
+ async handleGetUpdateTime() {
|
|
165
|
+ console.log('handleGetUpdateTime => ')
|
|
166
|
+ try {
|
|
167
|
+ const params = { type: 'data_cycle_nur' }
|
|
168
|
+ const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_uptime}`, { params })
|
|
169
|
+ if (res && res.errno == 0) {
|
|
170
|
+ this.updateTime = res.rst.uptime
|
|
171
|
+ } else if (res.errno != 4002) {
|
|
172
|
+ this.$message.warning(res.err)
|
|
173
|
+ this.updateTime = ''
|
|
174
|
+ }
|
|
175
|
+ } catch (error) {
|
|
176
|
+ this.updateTime = ''
|
|
177
|
+ }
|
|
178
|
+ },
|
|
179
|
+ // 获取列表数据
|
169
|
180
|
async init(page, type) {
|
170
|
181
|
console.log('init => ')
|
171
|
182
|
try {
|
|
@@ -175,7 +186,7 @@ export default {
|
175
|
186
|
if (this.total == 0) return this.$message.warning('暂无数据可导出')
|
176
|
187
|
}
|
177
|
188
|
this.loading = true
|
178
|
|
- const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_dataCycleList}`, {
|
|
189
|
+ const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoardHS_dataCycleList}`, {
|
179
|
190
|
params: {
|
180
|
191
|
page: type == 'export' ? 1 : this.page,
|
181
|
192
|
page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size,
|
|
@@ -190,13 +201,11 @@ export default {
|
190
|
201
|
first_day_roi_min: this.firstDayRoi[0],
|
191
|
202
|
first_day_roi_max: this.firstDayRoi[1],
|
192
|
203
|
closing_date: this.closing_date,
|
193
|
|
- account_id_hs: this.account_id_hs,
|
|
204
|
+ app_id: this.app_id,
|
194
|
205
|
paid_min: this.paid[0],
|
195
|
206
|
paid_max: this.paid[1],
|
196
|
207
|
sort_field: this.sort_field,
|
197
|
208
|
sort_type: this.sort_type,
|
198
|
|
-
|
199
|
|
- order_type: 2, // mock
|
200
|
209
|
}
|
201
|
210
|
})
|
202
|
211
|
|
|
@@ -206,6 +215,19 @@ export default {
|
206
|
215
|
} else {
|
207
|
216
|
res.rst.data.list.head[0].fixed = 'left' // 第一列固定左侧
|
208
|
217
|
res.rst.data.overview.head[0].fixed = 'left' // 第一列固定左侧
|
|
218
|
+
|
|
219
|
+ res.rst.data.list.head.forEach(item => {
|
|
220
|
+ if (item.name && item.name.length > 6) { // 长字符宽度
|
|
221
|
+ item['min_width'] = item.name.length * 21
|
|
222
|
+ }
|
|
223
|
+ })
|
|
224
|
+
|
|
225
|
+ res.rst.data.overview.head.forEach(item => {
|
|
226
|
+ if (item.name && item.name.length > 6) { // 长字符宽度
|
|
227
|
+ item['min_width'] = item.name.length * 20
|
|
228
|
+ }
|
|
229
|
+ })
|
|
230
|
+
|
209
|
231
|
this.summaryTableCol = Object.freeze(res.rst.data.overview.head || [])
|
210
|
232
|
this.detailsTableCol = Object.freeze(res.rst.data.list.head || [])
|
211
|
233
|
await this.$nextTick()
|
|
@@ -235,44 +257,35 @@ export default {
|
235
|
257
|
this.total = 0;
|
236
|
258
|
this.pages = 0;
|
237
|
259
|
},
|
|
260
|
+ // 监听分页变化
|
238
|
261
|
handleCurrentChange (val) {
|
239
|
262
|
this.init(val)
|
240
|
263
|
this.handleGetUpdateTime()
|
241
|
264
|
},
|
|
265
|
+ // 筛选时间变化
|
|
266
|
+ changeTime(time) {
|
|
267
|
+ if (!time || time && time.length == 0) {
|
|
268
|
+ this.time = []
|
|
269
|
+ } else {
|
|
270
|
+ this.time = time
|
|
271
|
+ }
|
|
272
|
+ this.init(1)
|
|
273
|
+ this.handleGetUpdateTime()
|
|
274
|
+ },
|
242
|
275
|
// 监听“收益截止日期”筛选变化
|
243
|
276
|
onChangeClosingDate(val) {
|
244
|
277
|
this.closing_date = val || ''
|
245
|
278
|
this.init(1)
|
246
|
279
|
this.handleGetUpdateTime()
|
247
|
280
|
},
|
248
|
|
- // 监听“花生账户”筛选变化
|
|
281
|
+ // 监听“花生mp账号”筛选变化
|
249
|
282
|
onChangeAccountHS(val) {
|
250
|
|
- this.account_id_hs = val || ''
|
251
|
|
- this.init(1)
|
252
|
|
- this.handleGetUpdateTime()
|
253
|
|
- },
|
254
|
|
- // 监听排序变化
|
255
|
|
- onClickSort(sort_field, sort_type) {
|
256
|
|
- // sort_type:升序asc、降序desc
|
257
|
|
- if (this.sort_field === sort_field) {
|
258
|
|
- if (this.sort_type === sort_type) {
|
259
|
|
- // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
|
260
|
|
- this.sort_field = 'date'
|
261
|
|
- this.sort_type = 'desc'
|
262
|
|
- } else {
|
263
|
|
- // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
|
264
|
|
- this.sort_type = sort_type
|
265
|
|
- }
|
266
|
|
- } else {
|
267
|
|
- // 点击的不是当前排序字段 => 设置排序字段和类型
|
268
|
|
- this.sort_field = sort_field
|
269
|
|
- this.sort_type = sort_type
|
270
|
|
- }
|
271
|
|
- // 后端排序 => 获取最新数据
|
|
283
|
+ this.app_id = val || ''
|
272
|
284
|
this.init(1)
|
273
|
285
|
this.handleGetUpdateTime()
|
274
|
286
|
},
|
275
|
|
- exportEvent (data) {
|
|
287
|
+ // 导出
|
|
288
|
+ exportEvent(data) {
|
276
|
289
|
const tHeader = data.list.head.map(v => v.name)
|
277
|
290
|
const filterVal = data.list.head.map(v => v.column)
|
278
|
291
|
const tableDatas = [data.overview.list, ...data.list.list]
|
|
@@ -284,7 +297,7 @@ export default {
|
284
|
297
|
sheetName: '', // 表一的sheet名字
|
285
|
298
|
},
|
286
|
299
|
]
|
287
|
|
- this.$exportOrder({ excelDatas, name: `数据循环统计(导出时间:${this.$getDay(0)})` })
|
|
300
|
+ this.$exportOrder({ excelDatas, name: `花生数据循环统计(导出时间:${this.$getDay(0)})` })
|
288
|
301
|
}
|
289
|
302
|
}
|
290
|
303
|
}
|