master
xy 2 years ago
parent 0032b68b7f
commit 05bee624ad

@ -244,7 +244,7 @@
ref="xyTable" ref="xyTable"
:border="true" :border="true"
:action="index" :action="index"
:req-opt="select" :req-opt="tableSelect"
:destroy-req-opt="select" :destroy-req-opt="select"
:table-item="table" :table-item="table"
@detail=" @detail="
@ -327,6 +327,7 @@ export default {
}, },
], ],
}, },
selectQuery: [],
form: [], form: [],
table: [], table: [],
customForm: { customForm: {
@ -400,6 +401,13 @@ export default {
console.warn(err); console.warn(err);
} }
} }
if (this.$route.meta.params?.select) {
try {
this.selectQuery = JSON.parse(decodeURIComponent(this.$route.meta.params?.select));
} catch (err) {
console.warn(err);
}
}
const res = await show({ id: this.customForm.customFormId }, false); const res = await show({ id: this.customForm.customFormId }, false);
@ -587,6 +595,14 @@ export default {
? this.form.find((i) => i.field === field)._params ? this.form.find((i) => i.field === field)._params
: []; : [];
}; };
},
tableSelect () {
let filter = [...this.select.filter,...this.selectQuery]
return {
...this.select,
filter
}
} }
}, },
created() { created() {

@ -14,14 +14,18 @@
<p>累计查询下载数</p> <p>累计查询下载数</p>
<div> <div>
{{ chartData.total_down }} <p>{{ chartData.total_down }}</p>
<span>周同比</span>
<i class="el-icon-caret-top"></i>
</div> </div>
</div> </div>
<div class="compare compare-week"> <div class="compare compare-week">
<p>本周查询下载数</p> <p>本周查询下载数</p>
<div> <div>
{{ chartData.week_down }} <p>{{ chartData.week_down }}</p>
<span>周同比</span>
<i class="el-icon-caret-bottom"></i>
</div> </div>
</div> </div>
</div> </div>
@ -71,6 +75,7 @@ export default {
total_down: 0, total_down: 0,
week_down: 0, week_down: 0,
}, },
chartDownData: [],
select: { select: {
start_date: this.$moment().startOf("week").format("YYYY-MM-DD"), start_date: this.$moment().startOf("week").format("YYYY-MM-DD"),
end_date: this.$moment().endOf("week").format("YYYY-MM-DD"), end_date: this.$moment().endOf("week").format("YYYY-MM-DD"),
@ -121,8 +126,12 @@ export default {
}) })
.catch(); .catch();
}, },
async init() { async loadChartDown () {
let res = await getChartDown(this.select); let res = await getChartDown(this.select);
this.chartDownData = res;
},
async init() {
this.line = echarts.init(document.getElementById("chart-panel")); this.line = echarts.init(document.getElementById("chart-panel"));
this.line.setOption({ this.line.setOption({
@ -130,7 +139,7 @@ export default {
xAxis: { xAxis: {
type: "category", type: "category",
boundaryGap: false, boundaryGap: false,
data: res.map((i) => i.date), data: this.chartDownData.map((i) => i.date),
}, },
yAxis: { yAxis: {
type: "value", type: "value",
@ -146,7 +155,7 @@ export default {
series: [ series: [
{ {
name: "下载数量", name: "下载数量",
data: res.map((i) => i.total), data: this.chartDownData.map((i) => i.total),
type: "line", type: "line",
smooth: true, smooth: true,
areaStyle: { areaStyle: {
@ -171,9 +180,13 @@ export default {
this.loadData(); this.loadData();
}, },
mounted() { mounted() {
this.loadChartDown().then(res => {
this.init(); this.init();
})
window.onresize = () => {}; window.onresize = () => {
this.init();
};
}, },
destroyed() { destroyed() {
window.onresize = null; window.onresize = null;
@ -266,11 +279,33 @@ export default {
font-weight: 600; font-weight: 600;
color: #666; color: #666;
padding: 4px 0; padding: 8px 0;
} }
& > div { & > div {
display: flex;
align-items: flex-end;
justify-content: space-evenly;
font-weight: 900; font-weight: 900;
font-size: 18px; font-size: 18px;
padding: 0 10px;
& > span {
color: #999;
zoom: .75;
padding-left: 12px;
}
.el-icon-caret-bottom {
color: red;
padding-left: 6px;
}
.el-icon-caret-top {
color: green;
padding-left: 6px;
}
} }
& + .compare { & + .compare {
@ -283,6 +318,7 @@ export default {
margin-left: 60px; margin-left: 60px;
.select-panel { .select-panel {
width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -297,6 +333,7 @@ export default {
} }
#chart-panel { #chart-panel {
width: 100%;
height: 320px; height: 320px;
} }
} }

Loading…
Cancel
Save