97 lines
1.8 KiB
Vue
97 lines
1.8 KiB
Vue
|
<!--
|
||
|
* @Author: zwq
|
||
|
* @Date: 2023-08-22 15:01:54
|
||
|
* @LastEditors: zwq
|
||
|
* @LastEditTime: 2023-11-04 15:18:38
|
||
|
* @Description:
|
||
|
-->
|
||
|
<template>
|
||
|
<el-row :gutter="10" class="chart-container">
|
||
|
<el-col :span="14">
|
||
|
<div class="chart-card">
|
||
|
<barChart
|
||
|
ref="barChart"
|
||
|
height="500px"
|
||
|
title="库存总览"
|
||
|
v-if="overviewList.length"
|
||
|
:histogram="overviewList" />
|
||
|
<!-- 没有数据 -->
|
||
|
<div class="no-data-bg" v-else></div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
<el-col :span="10">
|
||
|
<div class="chart-card">
|
||
|
<pieChart
|
||
|
ref="pieChart"
|
||
|
height="600px"
|
||
|
v-if="rateList.length"
|
||
|
:pie-data="rateList" />
|
||
|
<!-- 没有数据 -->
|
||
|
<div class="no-data-bg" v-else></div>
|
||
|
</div>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import barChart from '../../chart/BarChart.vue';
|
||
|
import pieChart from '../../chart/PieChart.vue';
|
||
|
import {
|
||
|
getOverview,
|
||
|
getRate,
|
||
|
} from '@/api/warehouse/warehouseLocation';
|
||
|
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
urlOptions: {
|
||
|
allURL: getOverview,
|
||
|
rateURL: getRate
|
||
|
},
|
||
|
overviewList: [],
|
||
|
rateList: []
|
||
|
};
|
||
|
},
|
||
|
components: {
|
||
|
barChart,
|
||
|
pieChart
|
||
|
},
|
||
|
mounted() {
|
||
|
this.getDataList();
|
||
|
},
|
||
|
methods: {
|
||
|
// 获取数据列表
|
||
|
getDataList() {
|
||
|
const data = {
|
||
|
storageType : 1
|
||
|
}
|
||
|
this.urlOptions.allURL(data).then((response) => {
|
||
|
this.overviewList = response.data;
|
||
|
this.$nextTick(() => {
|
||
|
this.$refs.barChart.initChart();
|
||
|
});
|
||
|
});
|
||
|
this.urlOptions.rateURL(data).then((response) => {
|
||
|
this.rateList = response.data;
|
||
|
this.$nextTick(() => {
|
||
|
this.$refs.pieChart.initChart();
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
},
|
||
|
};
|
||
|
</script>
|
||
|
|
||
|
<style scoped>
|
||
|
.chart-container {
|
||
|
min-height: calc(100vh - 120px - 8px);
|
||
|
background-color: #f0f2f7;
|
||
|
}
|
||
|
.chart-card {
|
||
|
min-height: calc(100vh - 120px - 8px);
|
||
|
background-color: #fff;
|
||
|
padding: 16px;
|
||
|
border-radius: 8px;
|
||
|
}
|
||
|
</style>
|