| | |
| | | <template> |
| | | <div>工作统计图</div> |
| | | <div class="work-main" style="overflow: scroll;width:100%;height:100vh"> |
| | | <div class="work-head"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="24"> |
| | | <el-card> |
| | | <el-form :inline="true" :model="formInline" class="demo-form-inline"> |
| | | <el-form-item> |
| | | <p><span>*</span>检测日期:</p> |
| | | <el-date-picker |
| | | v-model="dateTime" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <p><span>*</span>检验类型:</p> |
| | | <el-select v-model="formInline.region" placeholder="采购入库"> |
| | | <el-option label="区域一" value="shanghai"></el-option> |
| | | <el-option label="区域二" value="beijing"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item class="buttons"> |
| | | <el-button>清空</el-button> |
| | | <el-button type="primary" @click="onSubmit">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="work-center" > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-card> |
| | | <p>负责人统计</p> |
| | | <div id="leaderStati" style="width:100%;height:400px;"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-card> |
| | | <p>实验员统计</p> |
| | | <div id="testerStati" style="width:100%;height:400px;"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-card> |
| | | <p>负责人及时率</p> |
| | | <div id="leaderTimly" style="width:100%;height:400px;"></div> |
| | | </el-card> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-card> |
| | | <p>实验员及时率</p> |
| | | <div id="testerTimly" style="width:100%;height:400px;"></div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="work-foot"></div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | formInline: { |
| | | user: '', |
| | | region: '' |
| | | }, |
| | | dateTime: '', |
| | | } |
| | | }, |
| | | mounted(){ |
| | | this.initLeaderStatiChart('leaderStati'); |
| | | this.initLeaderTimlyChart(); |
| | | this.initLeaderStatiChart('testerStati'); |
| | | this.initTesterTimlyChart(); |
| | | }, |
| | | methods: { |
| | | onSubmit() { |
| | | console.log('submit!'); |
| | | }, |
| | | initLeaderStatiChart(id){ |
| | | var chartDom = document.getElementById(id); |
| | | var myChart = echarts.init(chartDom); |
| | | var option; |
| | | |
| | | let xAxisData = []; |
| | | let data1 = []; |
| | | let data2 = []; |
| | | let data3 = []; |
| | | let data4 = []; |
| | | for (let i = 0; i < 10; i++) { |
| | | xAxisData.push('Class' + i); |
| | | data1.push(+(Math.random() * 2).toFixed(2)); |
| | | data2.push(+(Math.random() * 5).toFixed(2)); |
| | | data3.push(+(Math.random() + 0.3).toFixed(2)); |
| | | data4.push(+Math.random().toFixed(2)); |
| | | } |
| | | var emphasisStyle = { |
| | | itemStyle: { |
| | | shadowBlur: 10, |
| | | shadowColor: 'rgba(0,0,0,0.3)' |
| | | } |
| | | }; |
| | | option = { |
| | | legend: { |
| | | data: ['bar', 'bar2'], |
| | | left: 'center' |
| | | }, |
| | | tooltip: {}, |
| | | xAxis: { |
| | | data: xAxisData, |
| | | name: '姓名', |
| | | axisLine: { onZero: true }, |
| | | splitLine: { show: false }, |
| | | splitArea: { show: false } |
| | | }, |
| | | yAxis: {}, |
| | | grid: { |
| | | bottom: 100 |
| | | }, |
| | | series: [ |
| | | { |
| | | name: 'bar', |
| | | type: 'bar', |
| | | stack: 'one', |
| | | emphasis: emphasisStyle, |
| | | data: data1 |
| | | }, |
| | | { |
| | | name: 'bar2', |
| | | type: 'bar', |
| | | stack: 'one', |
| | | emphasis: emphasisStyle, |
| | | data: data2 |
| | | } |
| | | ] |
| | | }; |
| | | myChart.on('brushSelected', function (params) { |
| | | var brushed = []; |
| | | var brushComponent = params.batch[0]; |
| | | for (var sIdx = 0; sIdx < brushComponent.selected.length; sIdx++) { |
| | | var rawIndices = brushComponent.selected[sIdx].dataIndex; |
| | | brushed.push('[Series ' + sIdx + '] ' + rawIndices.join(', ')); |
| | | } |
| | | myChart.setOption({ |
| | | title: { |
| | | backgroundColor: '#333', |
| | | text: 'SELECTED DATA INDICES: \n' + brushed.join('\n'), |
| | | bottom: 0, |
| | | right: '10%', |
| | | width: 100, |
| | | textStyle: { |
| | | fontSize: 12, |
| | | color: '#fff' |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | option && myChart.setOption(option); |
| | | }, |
| | | initTesterStatiChart(){ |
| | | |
| | | }, |
| | | initLeaderTimlyChart(){ |
| | | |
| | | }, |
| | | initTesterTimlyChart(){ |
| | | |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | |
| | | .work-main{ |
| | | width:100%; |
| | | margin:0; |
| | | padding: 0; |
| | | .work-head{ |
| | | width:94%; |
| | | height:100; |
| | | margin: 5px 10px; |
| | | position: fixed; |
| | | z-index: 10; |
| | | .demo-form-inline{ |
| | | margin: 0px 10px; |
| | | p{ |
| | | margin: 0; |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | span{ |
| | | font-size: 16px; |
| | | font-weight: bold; |
| | | color: red; |
| | | } |
| | | } |
| | | .buttons{ |
| | | margin: 40px 0px 0px 900px; |
| | | } |
| | | } |
| | | } |
| | | .work-center{ |
| | | margin: 0px 0px 5px 10px; |
| | | padding: 18vh 0px 5px 0px; |
| | | .el-card{ |
| | | margin: 5px 0px; |
| | | height:500px; |
| | | } |
| | | } |
| | | } |
| | | </style> |