金工工时统计
This commit is contained in:
@@ -12,3 +12,24 @@ export function search1(num1, num2, num3, num4, num5) {
|
||||
}
|
||||
})
|
||||
}
|
||||
export function search2(num1, num2, num3, num4, num5) {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '1',
|
||||
name: '车间生产管理工艺_金工工时统计_查询数据',
|
||||
param: '操作者_check=' + num1 + '&姓名=' + num2 + '&时间_check=' + num3 + '&开始时间=' + num4 + '&结束时间=' + num5
|
||||
}
|
||||
})
|
||||
}
|
||||
export function searchPerson() {
|
||||
return request({
|
||||
url: '',
|
||||
method: 'post',
|
||||
data: {
|
||||
type: '3',
|
||||
name: `select distinct 姓名 from 车间生产管理工艺_工时查询_实际工时_视图 where 加工完成时间 is not null and 是否启用 = 1`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
<el-col :span="12">
|
||||
<el-card v-loading="loading2" style="height: 450px">
|
||||
<span>工人时间段统计</span>
|
||||
<el-select v-model="nameValue" filterable size="small" placeholder="工位号" style="width: 110px">
|
||||
<el-option
|
||||
v-for="item in name"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<el-date-picker v-model="startTime2" :clearable="false" size="small" type="year" value-format="yyyy" format="yyyy" style="width: 150px" placeholder="选择年"/>
|
||||
<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>
|
||||
@@ -35,7 +43,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { search1 } from '@/api/ManufacturingCenter/ManHourAnalysis'
|
||||
import { search1, search2, searchPerson } from '@/api/ManufacturingCenter/ManHourAnalysis'
|
||||
import echarts from 'echarts'
|
||||
|
||||
export default {
|
||||
@@ -46,12 +54,31 @@ export default {
|
||||
chart1: true,
|
||||
res1: [],
|
||||
loading1: false, // 图表1
|
||||
nameValue: '',
|
||||
name: [],
|
||||
startTime2: '',
|
||||
chart2: true,
|
||||
res2: [],
|
||||
loading2: false // 2
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
fetchData() {
|
||||
this.name = []
|
||||
searchPerson().then(response => {
|
||||
for (let i = 0; i < response.data.length; i++) {
|
||||
this.name.push({
|
||||
label: response.data[i].姓名,
|
||||
value: response.data[i].姓名
|
||||
})
|
||||
}
|
||||
}).then(() => {
|
||||
this.nameValue = this.name[0].value
|
||||
})
|
||||
},
|
||||
// 时间段工时
|
||||
search1() {
|
||||
this.chart1 = false
|
||||
@@ -138,6 +165,96 @@ export default {
|
||||
}
|
||||
]
|
||||
})
|
||||
},
|
||||
search2() {
|
||||
this.chart2 = false
|
||||
this.loading2 = true
|
||||
var check, startTime, endtime
|
||||
if (this.startTime2) { check = 1 } else { check = 0 }
|
||||
if (check === 1) {
|
||||
startTime = this.startTime2 + '-01-01'
|
||||
endtime = this.startTime2 + '-12-31'
|
||||
}
|
||||
search2(1, this.nameValue, check, startTime, endtime).then(response => {
|
||||
this.res2 = response.data
|
||||
this.loading2 = false
|
||||
this.chart2 = true
|
||||
}).then(() => {
|
||||
var myChart2 = echarts.init(document.getElementById('myChart2'))
|
||||
myChart2.clear()
|
||||
this.drawLine2(this.res2)
|
||||
})
|
||||
},
|
||||
drawLine2(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 myChart2 = echarts.init(document.getElementById('myChart2'))
|
||||
myChart2.clear()
|
||||
myChart2.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: 0,
|
||||
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
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user