yudao-init/src/views/report/completionStatusIntrBM/index.vue

209 lines
4.8 KiB
Vue
Raw Normal View History

2024-06-17 13:40:30 +08:00
<template>
<div>
<div class="containerTop">
2024-06-19 08:48:48 +08:00
<bm-search-bar-complete
@getSearch="getSearch"
@handleExport="handleExport"
/>
</div>
<div class="containerBottom">
<div class="smallTitle">凯盛玻璃控股指标完成情况</div>
<bm-bar-complete
2024-06-17 13:40:30 +08:00
:chartHeight="chartHeight"
:legendList="legendList"
:chartMsg="chartMsg"
:chartId="chartId"
:chartNum="chartNum"
/>
<base-table
:table-props="tableProps"
:page="listQuery.current"
:limit="listQuery.size"
:table-data="tableData"
:max-height="tableH"
/>
</div>
</div>
</template>
<script>
2024-06-19 08:48:48 +08:00
import BmSearchBarComplete from "./components/bmSearchBarComplete.vue";
import BmBarComplete from "./components/bmBarComplete.vue";
2024-06-17 13:40:30 +08:00
const tableProps = [
{
prop: "factory",
label: "指标名称",
// filter: (val) => factoryList[val],
},
{
prop: "unit",
label: "单位",
},
{
prop: "time1",
2024-06-19 08:48:48 +08:00
label: "时间1",
2024-06-17 13:40:30 +08:00
},
{
prop: "time2",
2024-06-19 08:48:48 +08:00
label: "时间2",
2024-06-17 13:40:30 +08:00
},
];
export default {
name: "CompletionStatusIntrBM",
data() {
return {
tableProps,
listQuery: {
current: 1,
size: 1000,
},
tableData: [
2024-06-19 08:48:48 +08:00
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
2024-06-17 13:40:30 +08:00
],
2024-06-19 08:48:48 +08:00
chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2,
2024-06-17 13:40:30 +08:00
legendList: [
2024-06-19 08:48:48 +08:00
{ id: 1, name: "2023年4月", type: 1, color: "#288AFF33" },
{ id: 2, name: "2024年4月", type: 1, color: "#288AFF" },
2024-06-17 13:40:30 +08:00
],
chartMsg: {
2024-06-19 08:48:48 +08:00
color: ["#288AFF33", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"],
2024-06-17 13:40:30 +08:00
yName: "单位/MW",
series: [
{
2024-06-19 08:48:48 +08:00
name: "2023年4月",
data: [5505, 6578, 5500],
2024-06-17 13:40:30 +08:00
type: "bar",
barWidth: 20,
label: {
show: true,
2024-06-19 08:48:48 +08:00
position: "top",
color: "#2789FF",
2024-06-17 13:40:30 +08:00
},
},
{
2024-06-19 08:48:48 +08:00
name: "2024年4月",
data: [3503, 3456, 4500],
2024-06-17 13:40:30 +08:00
type: "bar",
barWidth: 20,
2024-06-19 08:48:48 +08:00
barGap: "-100%",
2024-06-17 13:40:30 +08:00
label: {
show: true,
2024-06-19 08:48:48 +08:00
position: "top",
2024-06-17 13:40:30 +08:00
color: "#288AFF",
},
},
],
},
chartId: "completionStatusIntrBMChart",
chartNum: 1,
};
},
components: {
2024-06-19 08:48:48 +08:00
BmBarComplete,
BmSearchBarComplete,
2024-06-17 13:40:30 +08:00
},
computed: {
isOpen() {
return this.$store.getters.sidebar.opened;
},
},
watch: {
// 监听左侧菜单栏是否展开
isOpen(val) {
if (this.$route.name === "CompletionStatusIntrBM") {
this.chartNum++;
}
},
},
created() {
2024-06-19 08:48:48 +08:00
this.tableH = this.tableHeight(269) / 2;
this.chartHeight = this.tableHeight(269) / 2;
2024-06-17 13:40:30 +08:00
window.addEventListener("resize", this._setTableHeight);
},
destroyed() {
window.removeEventListener("resize", this._setTableHeight);
},
activated() {
// 图重新加载,为了防止窗口变化后尺寸图显示不佳,数据不更新
if (this.$route.name === "CompletionStatusIntrBM") {
this.chartNum++;
}
},
methods: {
_setTableHeight() {
2024-06-19 08:48:48 +08:00
this.tableH = this.tableHeight(269) / 2;
this.chartHeight = this.tableHeight(269) / 2;
2024-06-17 13:40:30 +08:00
if (this.$route.name === "CompletionStatusIntrBM") {
this.chartNum++;
}
},
getSearch(val) {
console.log(val);
2024-06-19 08:48:48 +08:00
console.log("=========================");
2024-06-17 13:40:30 +08:00
},
handleExport() {
2024-06-19 08:48:48 +08:00
console.log("导出");
2024-06-17 13:40:30 +08:00
},
},
};
</script>
<style lang="scss" scoped>
2024-06-19 08:48:48 +08:00
.containerTop {
height: 64px;
}
2024-06-17 13:40:30 +08:00
.containerTop,
.containerBottom {
2024-06-19 08:48:48 +08:00
position: relative;
2024-06-17 13:40:30 +08:00
background-color: #fff;
border-radius: 8px;
padding: 16px;
}
.containerBottom {
2024-06-19 08:48:48 +08:00
height: calc(100vh - 201px);
2024-06-17 13:40:30 +08:00
margin-top: 8px;
.smallTitle {
font-size: 16px;
color: #000;
margin-bottom: 15px;
}
.smallTitle::before {
display: inline-block;
width: 4px;
height: 16px;
background: #0b58ff;
content: "";
margin-right: 8px;
vertical-align: -3px;
}
}
</style>