| | |
| | | "@vueuse/core": "10.11.0", |
| | | "axios": "0.28.1", |
| | | "clipboard": "2.0.11", |
| | | "echarts": "5.5.1", |
| | | "echarts": "^5.5.1", |
| | | "element-plus": "2.7.6", |
| | | "file-saver": "2.0.5", |
| | | "fuse.js": "6.6.2", |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢çç¼å表 |
| | | export function weldSeamEchartsList(query) { |
| | | return request({ |
| | | url: '/aps/weldSeam/weldSeamEchartsList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-row> |
| | | <!-- <el-col> |
| | | <div style="width: 100%; height: 60px; text-align: center; border-bottom: 2px solid #ccc"> |
| | | <h1>çç¼éæ±ç»è®¡å¾è¡¨</h1> |
| | | </div> |
| | | </el-col> --> |
| | | <el-col> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="90px"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»è®¡æ¥æ" style="width: 50%;"> |
| | | <el-date-picker |
| | | v-model="totalDay" |
| | | value-format="YYYY-MM" |
| | | type="monthrange" |
| | | range-separator="-" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="Search" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="Refresh" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </el-col> |
| | | <el-col> |
| | | <div ref="chartRef" v-show="showSearch" :style="{ width:width,height:height }"></div> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | import * as echarts from 'echarts'; |
| | | import { weldSeamEchartsList} from "@/api/mainPlan/weldSeamEcharts/weldSeamEcharts"; |
| | | const totalDay = ref([]); |
| | | const data = reactive({ |
| | | form: {}, |
| | | queryParams: { |
| | | produceYear: null, |
| | | produceMonth: null, |
| | | }, |
| | | rules: { |
| | | } |
| | | }); |
| | | const { queryParams } = toRefs(data); |
| | | const chartRef = ref(null); |
| | | const height = ref(document.documentElement.clientHeight - 180 + "px"); |
| | | const width = ref(document.documentElement.clientWidth - 240 + "px"); |
| | | |
| | | const showSearch = ref(false); |
| | | |
| | | /* const dataList = [ |
| | | ['product', 'åé-订å-管路', 'åé-订å-æ°æ', 'åé-颿µ-管路', 'åé-颿µ-æ°æ', 'åé-颿µ-管路1', 'åé-颿µ-æ°æ1', 'åé-颿µ-管路2', 'åé-颿µ-æ°æ2', 'åé-颿µ-管路3', 'åé-颿µ-æ°æ3', 'åé-颿µ-管路4', 'åé-颿µ-æ°æ4'], |
| | | ['4æ', '43.3', '85.8', '93.7', '93.7', '43.3', '85.8', '43.3', '85.8', '93.7', '93.7', '43.3', '85.8'], |
| | | ['5æ', '43.3', '85.8', '93.7', '93.7', '43.3', '85.8', '43.3', '85.8', '93.7', '93.7', '43.3', '85.8'], |
| | | ['6æ', 86.4, 65.2, 82.5, 93.7], |
| | | ['7æ', 72.4, 53.9, 39.1, 93.7], |
| | | ['8æ', 72.4, 53.9, 39.1, 93.7], |
| | | |
| | | ] */ |
| | | |
| | | // const series = [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }] |
| | | |
| | | |
| | | let myChart = null; |
| | | |
| | | const renderChart = (data,series) => { |
| | | // åå§å ECharts å®ä¾ |
| | | myChart = echarts.init(chartRef.value); |
| | | const option = { |
| | | legend: { |
| | | width: 1000, |
| | | top: 30, |
| | | left: 'center', |
| | | type: "scroll", |
| | | itemGap: 30,//å¾ä¾çä¸ä¸é´è· |
| | | // itemWidth: 10,//å¾ä¾å·¦ä¾§å¾åçé¿åº¦ |
| | | // padding: 5, |
| | | }, |
| | | tooltip: {}, |
| | | dataset: { |
| | | source: data |
| | | }, |
| | | xAxis: { type: 'category' }, |
| | | yAxis: { name: 'æ°é'}, |
| | | grid: { top:'15%',bottom:'5%'}, |
| | | series: series, |
| | | title: { |
| | | text: 'åç产åºå°ç®¡è·¯ä¸æ°æéæ±å¯¹æ¯å¾', |
| | | left: 'center', |
| | | }, |
| | | toolbox: { |
| | | show: true, |
| | | feature: { |
| | | saveAsImage: {}, |
| | | magicType: { |
| | | show: true, |
| | | type: ['line','bar','stack','tiled'], |
| | | }, |
| | | restore: {//è¿ååå§å¾è¡¨ |
| | | show: true |
| | | }, |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // 使ç¨é
置项æ¾ç¤ºå¾è¡¨ |
| | | myChart.setOption(option); |
| | | }; |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | function handleQuery() { |
| | | showSearch.value = true; |
| | | getList(); |
| | | } |
| | | |
| | | /** éç½®æé®æä½ */ |
| | | function resetQuery() { |
| | | totalDay.value = []; |
| | | // handleQuery(); |
| | | clearChart(); |
| | | showSearch.value = false; |
| | | } |
| | | |
| | | function getList() { |
| | | clearChart(); |
| | | queryParams.value.params = {}; |
| | | if (null != totalDay && '' != totalDay) { |
| | | queryParams.value.params["startDay"] = totalDay.value[0]; |
| | | queryParams.value.params["endDay"] = totalDay.value[1]; |
| | | } |
| | | weldSeamEchartsList(queryParams.value).then(response => { |
| | | let dataList = []; |
| | | let series = []; |
| | | dataList = response.data; |
| | | if(response.data.length === 1){ |
| | | showSearch.value = false; |
| | | }else{ |
| | | for(let i=0;i<response.data[0].length-1;i++){ |
| | | series.push({ type: 'bar' }); |
| | | } |
| | | renderChart(dataList,series); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | |
| | | /**æ¸
é¤chart */ |
| | | function clearChart() { |
| | | if (myChart) { |
| | | myChart.dispose(); |
| | | myChart = null; |
| | | } |
| | | } |
| | | </script> |