|
@@ -68,6 +68,10 @@
|
|
|
</el-form>
|
|
|
</el-card>
|
|
|
<br />
|
|
|
+ <div style="text-align: right;" >
|
|
|
+ <el-button size="small" type="primary" @click="onExport">导出</el-button>
|
|
|
+ </div>
|
|
|
+ <br />
|
|
|
<el-card class="box-card">
|
|
|
<bilateral-bar-chart
|
|
|
ref="chart"
|
|
@@ -131,11 +135,11 @@ export default {
|
|
|
rb: [],
|
|
|
cycle: "None",
|
|
|
date: [],
|
|
|
- area: undefined
|
|
|
+ area: undefined,
|
|
|
},
|
|
|
tableData: [],
|
|
|
radioList: [],
|
|
|
- areaList: []
|
|
|
+ areaList: [],
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
@@ -165,9 +169,9 @@ export default {
|
|
|
|
|
|
// 地区
|
|
|
audioAreaList().then(r => {
|
|
|
- console.log(r)
|
|
|
- this.areaList = r || [];
|
|
|
- this.form.area = this.areaList[0]
|
|
|
+ console.log(r);
|
|
|
+ this.areaList = r || [];
|
|
|
+ this.form.area = this.areaList[0];
|
|
|
});
|
|
|
|
|
|
this.onSubmit();
|
|
@@ -209,7 +213,7 @@ export default {
|
|
|
end: e,
|
|
|
range: this.form.cycle,
|
|
|
names: rb,
|
|
|
- area: this.form.area || undefined
|
|
|
+ area: this.form.area || undefined,
|
|
|
};
|
|
|
},
|
|
|
channelSelect(a) {
|
|
@@ -223,6 +227,32 @@ export default {
|
|
|
}
|
|
|
this.form.rb = l;
|
|
|
},
|
|
|
+ onExport() {
|
|
|
+ audioGet(this.formatListData()).then(r => {
|
|
|
+ // 生成数据
|
|
|
+ let strcsv =
|
|
|
+ "data:text/csv;charset=utf-8,\uFEFF广播,收听率,占有率\r\n";
|
|
|
+ (r || []).map(v => {
|
|
|
+ strcsv += [
|
|
|
+ v.name,
|
|
|
+ v.radio_rate*100 + '%',
|
|
|
+ v.market_rate *100 + '%',
|
|
|
+ "\r\n",
|
|
|
+ ].join(",");
|
|
|
+ });
|
|
|
+ // 导出
|
|
|
+ let link = document.createElement("a");
|
|
|
+ link.id = "download-csv";
|
|
|
+ link.setAttribute("href", encodeURI(strcsv));
|
|
|
+ link.setAttribute(
|
|
|
+ "download",
|
|
|
+ "收视率收听率分析" + ".csv"
|
|
|
+ );
|
|
|
+ // document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ link = undefined;
|
|
|
+ });
|
|
|
+ },
|
|
|
},
|
|
|
beforeUnmount: function () {},
|
|
|
components: { bilateralBarChart },
|