|
@@ -12,10 +12,10 @@
|
|
|
<el-button
|
|
|
:class="
|
|
|
'colorBtn ' +
|
|
|
- btnGroup[item.platform].class +
|
|
|
- (form.platform == item.platform
|
|
|
- ? ' ' + btnGroup[item.platform].class + 'act'
|
|
|
- : '')
|
|
|
+ btnGroup[item.platform].class +
|
|
|
+ (form.platform == item.platform
|
|
|
+ ? ' ' + btnGroup[item.platform].class + 'act'
|
|
|
+ : '')
|
|
|
"
|
|
|
v-for="item in pListData"
|
|
|
:key="item.platform"
|
|
@@ -56,7 +56,7 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="关键词">
|
|
|
- <el-input v-model="form.match" placeholder="检索关键词" clearable />
|
|
|
+ <el-input v-model="form.match" placeholder="检索关键词" clearable />
|
|
|
</el-form-item>
|
|
|
<el-form-item style="float: right">
|
|
|
<el-button type="primary" @click="onSubmit" :loading="load">
|
|
@@ -75,10 +75,12 @@
|
|
|
backgroundColor: '#f4f5f7',
|
|
|
color: '#606266',
|
|
|
}"
|
|
|
+ ref="table1"
|
|
|
align="center"
|
|
|
:data="tableData"
|
|
|
empty-text="暂无数据"
|
|
|
style="width: 100%"
|
|
|
+ @sort-change="sort_change"
|
|
|
>
|
|
|
<template v-for="(item, i) in agg" :key="i">
|
|
|
<el-table-column
|
|
@@ -87,6 +89,8 @@
|
|
|
show-overflow-tooltip
|
|
|
:prop="item.key"
|
|
|
:label="item.label"
|
|
|
+ :sortable="item.sortable"
|
|
|
+ :sort-orders="item.sortable ? ['descending', null] : []"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
{{
|
|
@@ -105,10 +109,12 @@
|
|
|
backgroundColor: '#f4f5f7',
|
|
|
color: '#606266',
|
|
|
}"
|
|
|
+ ref="table2"
|
|
|
align="center"
|
|
|
empty-text="暂无数据"
|
|
|
:data="tableList"
|
|
|
style="width: 100%"
|
|
|
+ @sort-change="sort_change"
|
|
|
>
|
|
|
<template v-for="(item, i) in list" :key="i">
|
|
|
<el-table-column
|
|
@@ -117,6 +123,8 @@
|
|
|
show-overflow-tooltip
|
|
|
:prop="item.key"
|
|
|
:label="item.label"
|
|
|
+ :sortable="item.sortable"
|
|
|
+ :sort-orders="item.sortable ? ['descending', null] : []"
|
|
|
>
|
|
|
<template #default="scope">
|
|
|
{{
|
|
@@ -153,6 +161,7 @@ import { platformList, platformlistData, platform } from "@/api/index";
|
|
|
import { formatter } from "@/utils/tool";
|
|
|
import config from "@/config/index";
|
|
|
let tableDataListOri = [];
|
|
|
+let sort = null;
|
|
|
export default {
|
|
|
name: "RealData",
|
|
|
data() {
|
|
@@ -191,7 +200,7 @@ export default {
|
|
|
form: {
|
|
|
platform: "",
|
|
|
dt: [],
|
|
|
- match: ""
|
|
|
+ match: "",
|
|
|
},
|
|
|
formRael: { platform: "", dt: [] },
|
|
|
tableData: [],
|
|
@@ -199,21 +208,21 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- platformList('?kh=1').then(res => {
|
|
|
+ platformList("?kh=1").then(res => {
|
|
|
const first = res[0] || { platform: "", dt: "" };
|
|
|
this.form = {
|
|
|
- dt: [first.dt,first.dt],
|
|
|
+ dt: [first.dt, first.dt],
|
|
|
platform: first.platform,
|
|
|
};
|
|
|
this.formRael = {
|
|
|
- dt: [first.dt,first.dt],
|
|
|
+ dt: [first.dt, first.dt],
|
|
|
platform: first.platform || "",
|
|
|
};
|
|
|
this.pListData = res || [];
|
|
|
this.onSubmit();
|
|
|
});
|
|
|
},
|
|
|
- computed: {
|
|
|
+ computed: {
|
|
|
agg() {
|
|
|
if (!this.formRael.platform) return [];
|
|
|
return config.tableCol.agg[this.formRael.platform];
|
|
@@ -241,10 +250,13 @@ export default {
|
|
|
let p = {
|
|
|
platform: item.platform,
|
|
|
dt: this.form.dt,
|
|
|
- match: this.form.match
|
|
|
+ match: this.form.match,
|
|
|
};
|
|
|
if (new Date(item.dt) - new Date(p.dt) < 0) p.dt = item.dt;
|
|
|
this.form = p;
|
|
|
+ this.$refs.table1.clearSort();
|
|
|
+ this.$refs.table2.clearSort();
|
|
|
+ sort = null;
|
|
|
this.onSubmit();
|
|
|
},
|
|
|
cChange(num) {
|
|
@@ -255,23 +267,31 @@ export default {
|
|
|
const startd = this.dateFormat(this.formRael.dt[0] || 0);
|
|
|
const starte = this.dateFormat(this.formRael.dt[1] || 0);
|
|
|
window.open(
|
|
|
- config.base.url2 + "/new-media/export?start=" + [startd.year, startd.month, startd.day].join("-") + "&end=" + [starte.year, starte.month, starte.day].join("-")
|
|
|
+ config.base.url2 +
|
|
|
+ "/new-media/export?start=" +
|
|
|
+ [startd.year, startd.month, startd.day].join("-") +
|
|
|
+ "&end=" +
|
|
|
+ [starte.year, starte.month, starte.day].join("-")
|
|
|
);
|
|
|
},
|
|
|
disabledDate(time) {
|
|
|
return time.getTime() > Date.now() - 86400000;
|
|
|
},
|
|
|
+ sort_change(type) {
|
|
|
+ sort = type.prop;
|
|
|
+ this.onSubmit();
|
|
|
+ },
|
|
|
onSubmit() {
|
|
|
const data = this.formatListData();
|
|
|
this.page = 0;
|
|
|
this.tableData = [];
|
|
|
- this.total = [];
|
|
|
+ this.total = 0;
|
|
|
this.load = true;
|
|
|
const l = ElLoading.default.service();
|
|
|
Promise.all([platform(data), platformlistData(data)])
|
|
|
.then(list => {
|
|
|
this.formRael = data;
|
|
|
- this.formRael.dt = [this.formRael.start,this.formRael.end];
|
|
|
+ this.formRael.dt = [this.formRael.start, this.formRael.end];
|
|
|
this.tableData = (list[0] || []).map((v, i) => {
|
|
|
v.index = i + 1;
|
|
|
return v;
|
|
@@ -314,12 +334,18 @@ export default {
|
|
|
formatListData() {
|
|
|
const startd = this.form.dt[0] ? this.dateFormat(this.form.dt[0]) : false;
|
|
|
const starte = this.form.dt[1] ? this.dateFormat(this.form.dt[1]) : false;
|
|
|
- return {
|
|
|
+ const p = {
|
|
|
platform: this.form.platform || this.pListData[0],
|
|
|
- start: startd ? [startd.year, startd.month, startd.day].join("-") : undefined,
|
|
|
- end: starte ? [starte.year, starte.month, starte.day].join("-") : undefined,
|
|
|
- match: this.form.match
|
|
|
+ start: startd
|
|
|
+ ? [startd.year, startd.month, startd.day].join("-")
|
|
|
+ : undefined,
|
|
|
+ end: starte
|
|
|
+ ? [starte.year, starte.month, starte.day].join("-")
|
|
|
+ : undefined,
|
|
|
+ match: this.form.match,
|
|
|
};
|
|
|
+ sort && (p.sort = sort);
|
|
|
+ return p;
|
|
|
},
|
|
|
},
|
|
|
components: {},
|
|
@@ -409,7 +435,13 @@ export default {
|
|
|
border-color: #fb7299;
|
|
|
color: #fff;
|
|
|
}
|
|
|
-.el-table th>.cell{
|
|
|
- white-space: nowrap;
|
|
|
+.el-table th > .cell {
|
|
|
+ white-space: nowrap;
|
|
|
+}
|
|
|
+.program .ascending{
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+.program .descending{
|
|
|
+ top: 0.25em;
|
|
|
}
|
|
|
</style>
|