|
|
|
@ -1,36 +1,48 @@
|
|
|
|
|
/*
|
|
|
|
|
* @Author: your name
|
|
|
|
|
* @Date: 2021-10-27 15:29:37
|
|
|
|
|
* @LastEditTime: 2021-11-19 14:04:51
|
|
|
|
|
* @LastEditTime: 2021-11-21 16:36:03
|
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
|
* @Description: In User Settings Edit
|
|
|
|
|
* @FilePath: /data-show/src/views/IndustryDataExport/tableEvent.js
|
|
|
|
|
*/
|
|
|
|
|
import moment from "moment";
|
|
|
|
|
function rowSelection(that) {
|
|
|
|
|
return {
|
|
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
|
|
that.selectedRowKeys = selectedRowKeys.toString();
|
|
|
|
|
that.selectedRows = selectedRows;
|
|
|
|
|
that.secIds = selectedRowKeys;
|
|
|
|
|
export function rowSelection() {
|
|
|
|
|
let a = null;
|
|
|
|
|
if (!this.form.token) {
|
|
|
|
|
a = null
|
|
|
|
|
} else {
|
|
|
|
|
a = {
|
|
|
|
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
|
|
|
this.sk = selectedRowKeys;
|
|
|
|
|
this.selectedRowKeys = selectedRowKeys.toString();
|
|
|
|
|
this.selectedRows = selectedRows;
|
|
|
|
|
this.secIds = selectedRowKeys;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// onSelect: (record, selected, selectedRows) => {
|
|
|
|
|
// },
|
|
|
|
|
// onSelectAll: (selected, selectedRows, changeRows) => {
|
|
|
|
|
// },
|
|
|
|
|
},
|
|
|
|
|
onSelect:(record, selected) => {
|
|
|
|
|
if(!selected) {
|
|
|
|
|
this.tableAll = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectedRowKeys: this.sk,
|
|
|
|
|
onSelectAll: () => {
|
|
|
|
|
this.tableAll = true;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return a
|
|
|
|
|
}
|
|
|
|
|
import { getExcel } from "@/api/comm"
|
|
|
|
|
export default {
|
|
|
|
|
// 初始化页面
|
|
|
|
|
initDoc() {
|
|
|
|
|
this.title = this.$route.query.title || '行业数据'
|
|
|
|
|
if(this.title === '品牌-行业数据') {
|
|
|
|
|
if (this.title === '品牌-行业数据') {
|
|
|
|
|
this.btnUrl = 'btn_brand_c_toppt'
|
|
|
|
|
} else if(this.title === '车型-行业数据') {
|
|
|
|
|
} else if (this.title === '车型-行业数据') {
|
|
|
|
|
this.btnUrl = 'btn_model_toexcel'
|
|
|
|
|
} else if(this.title === '事件-行业数据') {
|
|
|
|
|
} else if (this.title === '事件-行业数据') {
|
|
|
|
|
this.btnUrl = 'btn_event_toexcel'
|
|
|
|
|
}
|
|
|
|
|
Promise.all([
|
|
|
|
@ -66,9 +78,7 @@ export default {
|
|
|
|
|
} else {
|
|
|
|
|
this.gValue = 0;
|
|
|
|
|
}
|
|
|
|
|
if (this.form.token) {
|
|
|
|
|
this.rowSelection = rowSelection(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getList();
|
|
|
|
|
this.getTable();
|
|
|
|
|
});
|
|
|
|
@ -107,8 +117,8 @@ export default {
|
|
|
|
|
handlerExport() {
|
|
|
|
|
this.getToExcelField(this.form.sType, this.form.token).then(() => {
|
|
|
|
|
this.execlForm.sFileName = this.form.sBrand + '洞察-' + this.getDatetimeSs();
|
|
|
|
|
this.execlForm.sCheckedIds = this.secIds.toString();
|
|
|
|
|
this.execlForm.iNum = this.secIds.length;
|
|
|
|
|
this.execlForm.sCheckedIds = this.tableAll ? '' : this.secIds.toString();
|
|
|
|
|
this.execlForm.iNum = this.tableAll ? this.totalNum : this.secIds.length;
|
|
|
|
|
this.modalObj.visible = true;
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
@ -199,7 +209,15 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
// 导出数据
|
|
|
|
|
exportExcel() {
|
|
|
|
|
if (this.execlForm.iNum) {
|
|
|
|
|
if(this.execlForm.iNum === 0) {
|
|
|
|
|
this.$message.warning('请选择下载数据');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(this.checkedIds.length === 0) {
|
|
|
|
|
this.$message.warning('请选择下载字段');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.execlForm.iNum && this.checkedIds.length > 0) {
|
|
|
|
|
this.mergeForm();
|
|
|
|
|
getExcel(this.execlForm).then(() => {
|
|
|
|
|
this.$notification.open({
|
|
|
|
@ -207,6 +225,7 @@ export default {
|
|
|
|
|
description: '请前往个人中心查看下载进度',
|
|
|
|
|
placement: 'bottomRight',
|
|
|
|
|
});
|
|
|
|
|
this.modalObj.visible = false;
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
@ -261,15 +280,15 @@ export default {
|
|
|
|
|
).valueOf();
|
|
|
|
|
return (
|
|
|
|
|
current >
|
|
|
|
|
moment(
|
|
|
|
|
new Date(selectV + this.offsetDays),
|
|
|
|
|
"YYYY-MM-DD"
|
|
|
|
|
) ||
|
|
|
|
|
moment(
|
|
|
|
|
new Date(selectV + this.offsetDays),
|
|
|
|
|
"YYYY-MM-DD"
|
|
|
|
|
) ||
|
|
|
|
|
current <
|
|
|
|
|
moment(
|
|
|
|
|
new Date(selectV - this.offsetDays),
|
|
|
|
|
"YYYY-MM-DD"
|
|
|
|
|
)
|
|
|
|
|
moment(
|
|
|
|
|
new Date(selectV - this.offsetDays),
|
|
|
|
|
"YYYY-MM-DD"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|