金工数据分析

This commit is contained in:
zhangdingyu
2019-12-12 17:05:05 +08:00
parent e8453afd31
commit dee8d4b275
3 changed files with 163 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
import request from '@/utils/request'
// 查询人员总工工时
export function search1(num1, num2, num3, num4, num5) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '车间生产管理工艺_工时统计_查询数据2',
param: '操作者_check=' + num1 + '&姓名=' + num2 + '&时间_check=' + num3 + '&开始时间=' + num4 + '&结束时间=' + num5
}
})
}

View File

@@ -0,0 +1,148 @@
<template>
<div class="app-container">
<el-row>
<el-card v-loading="loading1" style="height: 450px">
<span>工时分析</span>
<el-date-picker
v-model="startTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 170px;margin:0px 10px"
type="date"
placeholder="选择开始加工日期"/>
<span class="demonstration">~</span>
<el-date-picker
v-model="endTime"
value-format="yyyy-MM-dd"
size="small"
style="width: 170px;margin:0px 10px"
type="date"
placeholder="选择加工完成日期"/>
<el-button size="small" type="success" icon="el-icon-search" @click="search1()">查询</el-button>
<div v-if="chart1" id="myChart1" :style="{width: '100%', height: '400px', margin: 'auto'}"/>
</el-card>
</el-row>
<el-row>
<el-col :span="12">
<el-card v-loading="loading2" style="height: 450px">
<span>工人时间段统计</span>
<el-button size="small" type="success" icon="el-icon-search" @click="search2()">查询</el-button>
<div v-if="chart2" id="myChart2" :style="{width: '100%', height: '400px', margin: 'auto'}"/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { search1 } from '@/api/ManufacturingCenter/ManHourAnalysis'
import echarts from 'echarts'
export default {
data() {
return {
startTime: '',
endTime: '',
chart1: true,
res1: [],
loading1: false, // 图表1
chart2: true,
res2: [],
loading2: false // 2
}
},
methods: {
// 时间段工时
search1() {
this.chart1 = false
this.loading1 = true
var check
if (this.startTime && this.endTime) { check = 1 } else { check = 0 }
search1(0, 0, check, this.startTime, this.endTime).then(response => {
this.res1 = response.data
this.loading1 = false
this.chart1 = true
}).then(() => {
var myChart1 = echarts.init(document.getElementById('myChart1'))
myChart1.clear()
this.drawLine1(this.res1)
})
},
drawLine1(data) {
var dataX = []
var lineData1 = []
var lineData2 = []
for (let i = 0; i < data.length; i++) {
dataX.push(data[i].姓名)
lineData1.push(data[i].理论加工时间段)
lineData2.push(data[i].实际加工时间段)
}
var myChart1 = echarts.init(document.getElementById('myChart1'))
myChart1.clear()
myChart1.setOption({
legend: {
data: ['理论工时', '实际工时']
},
grid: {
left: '3%',
right: '8%',
bottom: '3%',
containLabel: true
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: {
type: 'category',
name: '姓名',
axisLabel: {
interval: 0,
rotate: 90,
margin: 10
},
data: dataX
},
yAxis: {
type: 'value',
name: 'min',
min: 0,
scale: 'true'
},
series: [
{
name: '理论工时',
type: 'bar',
color: '#67C23A',
label: {
normal: {
show: true,
position: 'inside'
}
},
data: lineData1
},
{
name: '实际工时',
type: 'bar',
color: 'rgb(213,58,53)',
label: {
normal: {
show: true,
position: 'top'
}
},
data: lineData2
}
]
})
}
}
}
</script>
<style>
</style>

View File

@@ -98,7 +98,7 @@
<!--</el-table-column>-->
<el-table-column label="应付金额" align="center" min-width="100px">
<template slot-scope="scope">
{{ parseFloat(scope.row.应付总额).toFixed(2) }}
{{ scope.row.实际付款时间 === '' ? parseFloat(scope.row.应付总额).toFixed(2) : '-' }}
</template>
</el-table-column>
<el-table-column label="扣款说明" align="center" min-width="120px">