test #47

Merged
gtz217 merged 273 commits from test into master 2023-10-17 08:53:54 +08:00
2 changed files with 86 additions and 11 deletions
Showing only changes of commit fbd78c6aa5 - Show all commits

View File

@ -6,29 +6,44 @@
-->
<template>
<div class="line-chart">line LineChart</div>
<div class="line-chart"></div>
</template>
<script>
import * as echarts from 'echarts';
export default {
name: 'LineChart',
components: {},
props: ['config'],
data() {
return {
chart: null,
};
chart: null,
};
},
computed: {},
methods: {},
mounted() {
this.init();
},
beforeDestroy() {
if (this.chart) {
this.chart.dispose();
}
},
methods: {
init() {
console.log('thsi el', this.$el);
if (!this.chart) this.chart = echarts.init(this.$el);
this.chart.setOption(this.config);
},
},
};
</script>
<style scoped lang="scss">
.line-chart {
margin: 24px;
padding: 12px;
padding: 0 12px;
background: #e1e1e1;
min-height: 200px;
min-height: 320px;
}
</style>

View File

@ -29,7 +29,7 @@
@close="dialogClose"
@cancel="dialogClose"
@confirm="dialogClose">
<LineChart :config="lineChartConfig" />
<LineChart v-if="dialogVisible" :config="lineChartConfig" />
</base-dialog>
</div>
</template>
@ -72,8 +72,8 @@ export default {
dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'timestamp',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
// valueFormat: 'timestamp',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
@ -150,7 +150,67 @@ export default {
align: 'center',
},
],
lineChartConfig: {
grid: {
top: 88,
left: 56,
right: 56,
bottom: 56,
},
legend: {
top: 0,
left: 0,
padding: 5,
icon: 'roundRect',
itemWidth: 12,
itemHeight: 12,
itemGap: 20,
textStyle: {
fontSize: 14,
lineHeight: 14
},
},
xAxis: {
type: 'category',
data: ['设备1', '设备2', '设备3', '设备4', '设备5'],
},
yAxis: {
type: 'value',
name: '合格率',
nameLocation: 'end',
nameTextStyle: {
fontSize: 14,
align: 'right'
},
nameGap: 26
},
series: [
{
name: '产线1',
data: [150, 230, 224, 218, 135],
type: 'line',
smooth: true,
},
{
name: '产线2',
data: [111, 224, 42, 11, 24],
type: 'line',
smooth: true,
},
{
name: '产线3',
data: [218, 112, 331, 44, 99],
type: 'line',
smooth: true,
},
{
name: '产线4',
data: [3, 221, 42, 553, 311],
type: 'line',
smooth: true,
},
],
},
//
queryParams: {
pageNo: 1,