diff --git a/src/views/system/comment/index.vue b/src/views/system/comment/index.vue index b6452d0..107c74c 100644 --- a/src/views/system/comment/index.vue +++ b/src/views/system/comment/index.vue @@ -10,7 +10,7 @@ - + - + { + listJdComment(this.addDateRange(this.jdQueryParams, this.jdDateRange)).then(response => { this.jdList = response.rows this.jdTotal = response.total this.jdLoading = false @@ -353,24 +345,9 @@ export default { this.jdQueryParams.pageNum = 1 this.getJdList() }, - handleJdProductTypeChange(value) { - // 当产品类型改变时,自动设置对应的productId - if (value && this.jdProductTypeMap[value]) { - this.jdQueryParams.productId = this.jdProductTypeMap[value] - } else { - this.jdQueryParams.productId = null - } - }, resetJdQuery() { this.jdDateRange = [] - this.jdQueryParams = { - pageNum: 1, - pageSize: 10, - productId: null, - productType: null, - userName: null, - isUse: null - } + this.resetForm('jdQueryParams') this.handleJdQuery() }, handleJdDateRangeChange(value) { @@ -392,26 +369,14 @@ export default { }).catch(() => {}) }, handleJdExport() { - // 构建导出参数,只传递productId,不传递productType - const exportParams = { ...this.jdQueryParams } - if (exportParams.productType && this.jdProductTypeMap[exportParams.productType]) { - exportParams.productId = this.jdProductTypeMap[exportParams.productType] - } - delete exportParams.productType - this.download('jarvis/comment/jd/export', exportParams, `jd_comment_${new Date().getTime()}.xlsx`) + this.download('jarvis/comment/jd/export', { + ...this.jdQueryParams + }, `jd_comment_${new Date().getTime()}.xlsx`) }, // 淘宝评论相关 getTbList() { this.tbLoading = true - // 构建查询参数,只传递productId,不传递productType - const queryParams = { ...this.tbQueryParams } - // 如果选择了产品类型,转换为productId - if (queryParams.productType && this.tbProductTypeMap[queryParams.productType]) { - queryParams.productId = this.tbProductTypeMap[queryParams.productType] - } - // 删除productType,只使用productId查询 - delete queryParams.productType - listTbComment(this.addDateRange(queryParams, this.tbDateRange)).then(response => { + listTbComment(this.addDateRange(this.tbQueryParams, this.tbDateRange)).then(response => { this.tbList = response.rows this.tbTotal = response.total this.tbLoading = false @@ -421,24 +386,9 @@ export default { this.tbQueryParams.pageNum = 1 this.getTbList() }, - handleTbProductTypeChange(value) { - // 当产品类型改变时,自动设置对应的productId - if (value && this.tbProductTypeMap[value]) { - this.tbQueryParams.productId = this.tbProductTypeMap[value] - } else { - this.tbQueryParams.productId = null - } - }, resetTbQuery() { this.tbDateRange = [] - this.tbQueryParams = { - pageNum: 1, - pageSize: 10, - productId: null, - productType: null, - userName: null, - isUse: null - } + this.resetForm('tbQueryParams') this.handleTbQuery() }, handleTbDateRangeChange(value) { @@ -460,13 +410,9 @@ export default { }).catch(() => {}) }, handleTbExport() { - // 构建导出参数,只传递productId,不传递productType - const exportParams = { ...this.tbQueryParams } - if (exportParams.productType && this.tbProductTypeMap[exportParams.productType]) { - exportParams.productId = this.tbProductTypeMap[exportParams.productType] - } - delete exportParams.productType - this.download('jarvis/taobaoComment/export', exportParams, `tb_comment_${new Date().getTime()}.xlsx`) + this.download('jarvis/taobaoComment/export', { + ...this.tbQueryParams + }, `tb_comment_${new Date().getTime()}.xlsx`) }, // 统计信息相关 getStatistics() {