123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <template>
- <div>
- <!-- 年度开工率 -->
- <Echart
- :options="options"
- id="centerLeft1ALLChart"
- height="250px"
- width="450px"
- ref="column-board"
- ></Echart>
- </div>
- </template>
- <script>
- import Echart from '@/common/echart'
- //import { formatDate } from '../../../../utils/index.js'
- export default {
- data () {
- return {
- timing :null,
- options:{
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- legend: {
- textStyle: {
- fontSize: 18
- },
- itemWidth: 29,
- itemHeight: 19
- },
- grid: {
- left: '0%',
- right: '0%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- axisLabel: {
- show: false,
- fontSize: 16,
- fontWeight: "bold"
- }
- }
- ],
- yAxis: [
- {
- type: 'value',
- axisLabel: {
- fontSize: 16
- }
- },
- ],
- series: [
- {
- name: '计划数',
- type: 'bar',
- barWidth: 70,
- emphasis: {
- focus: 'series'
- },
- data:[],
- label: {
- show: true,
- position: 'top',
- fontSize:14,
- fontWeight: "bold"
- },
- },
- {
- name: '投入数',
- type: 'bar',
- barWidth: 70,
- emphasis: {
- focus: 'series'
- },
- data:[],
- label: {
- show: true,
- position: 'top',
- color:'#fff'
- },
- },
- {
- name: '产出数',
- type: 'bar',
- stack: 'Ad',
- barWidth: 70,
- data:[],
- emphasis: {
- focus: 'series'
- },
- label: {
- show: true,
- position: 'top',
- color:'#fff'
- }
- },
- {
- name: '不良数',
- type: 'bar',
- barWidth: 70,
- data:[],
- label: {
- show: true,
- position: 'top',
- color:'#fff'
- },
- emphasis: {
- focus: 'series'
- }
- }
- ]
- },
- };
- },
- components: {
- Echart, //子组件
- },
- props: {
- cdata: {
- type: Object,
- default: () => ({})
- },
- },
- mounted() {
- this.getdata();
- this.refreshdata();
- },
- beforeDestroy () {
- clearInterval(this.timing)
- },
- methods: {
- refreshdata() {
- this.timing = setInterval(() => {
- this.getdata(); //获取-数据
- }, 30000);
- },
- async getdata() {
- //20220211 -+formatDate(new Date()
- var caller = 'MAKEQTY';
- if (sessionStorage.getItem('li_code') == '所有'){
- caller = 'SMT!MAKEQTY!ALL';
- }
- await this.$http.get("kanban/datalist.action?caller="+caller+"&_noc=1&page=1&pageSize=100",{
- params: {
- condition: "1=1",
- }
- }).then((result)=>{
- let dataList = JSON.parse(result.data.data);
- let series0 = new Array();
- let series1 = new Array();
- let series2 = new Array();
- let series3 = new Array();
- let xAxis0 = new Array();
- for (let index = 0; index < dataList.length; index++) {
- const element = dataList[index];
- xAxis0.push(element.inqty);
- series0.push(element.planqty);
- //投入
- series1.push(element.inqty);
- //产出
- series2.push(element.outqty);
- //不良
- series3.push(element.ngqty);
- }
- this.options.xAxis[0].data = xAxis0;
- this.options.series[0].data = series0;
- this.options.series[1].data = series1;
- this.options.series[2].data = series2;
- this.options.series[3].data = series3;
- },(result)=>{
- console.error(result)
- }
- );
- }
- }
- }
- </script>
|