2023.10.30提测能源&班组

This commit is contained in:
2023-10-30 10:26:54 +08:00
parent 392c1ea09b
commit 00fba0a83b
16 changed files with 821 additions and 165 deletions

View File

@@ -0,0 +1,162 @@
<template>
<div>
<el-drawer title="查看详情" :visible.sync="visible" size="70%" :wrapperClosable='false' @closed="closeDrawer">
<div class="box">
<base-table
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH"
/>
</div>
</el-drawer>
</div>
</template>
<script>
import { getByScheduling } from '@/api/monitoring/groupTeamView'
import { getSchedulingMonitoringRecord } from '@/api/monitoring/teamProduction'
export default {
name: 'TeamProductionDetail',
data() {
return {
visible: false,
tableProps: [
{
prop: 'lineName',
label: '产线',
minWidth: 120
},
{
prop: 'startTime',
label: '上班时间',
minWidth: 150
},
{
prop: 'endTime',
label: '下班时间',
minWidth: 150
},
{
prop: 'workOrderList',
label: '生产工单'
}
],
tableData: [],
tableH: this.tableHeight(200)
}
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(200)
})
},
methods: {
init(params) {
this.visible = true
// console.log(params)
getByScheduling({id:params.id}).then(res => {
let dataList1 = []
let dataList2 = []
if (res.data.nameData && res.data.nameData.length > 0) {
dataList1 = res.data
// 下一个接口的参数&&表头
let timeArr = []
res.data.nameData.map(item => {
let tablePropsObj = {
prop: '',
label: '',
children: [
{
prop: '',
label: '上片数据'
},
{
prop: '',
label: '下片数据'
},
{
prop: '',
label: '良品面积'
},
{
prop: '',
label: '报废数据'
},
{
prop: '',
label: '报废比例'
}
]
}
timeArr.push(this.parseTime(item.name))
tablePropsObj.prop = item.name
tablePropsObj.label = this.parseTime(item.name)
tablePropsObj.children[0].prop = item.name+'sumInput'
tablePropsObj.children[1].prop = item.name+'sumOutput'
tablePropsObj.children[2].prop = item.name+'goodArea'
tablePropsObj.children[3].prop = item.name+'dynamicValue'
tablePropsObj.children[4].prop = item.name+'dynamicRatio'
this.tableProps.push(tablePropsObj)
})
getSchedulingMonitoringRecord({
checkTime: timeArr
}).then(result => {
dataList2 = result.data
// console.log(dataList1)
// console.log(dataList2)
for (let i = 0; i < dataList1.data.length; i++) {
let obj = {}
obj.lineName = dataList1.data[i].lineName
obj.startTime = this.parseTime(params.startTime)
obj.endTime = this.parseTime(params.endTime)
obj.workOrderList = dataList1.data[i].workOrderList
let subData1 = dataList1.data[i].data
for (let ii = 0; ii < subData1.length; ii++) {
obj[subData1[ii].dynamicName+'sumInput'] = subData1[ii].dynamicValue.sumInput
obj[subData1[ii].dynamicName+'sumOutput'] = subData1[ii].dynamicValue.sumOutput
obj[subData1[ii].dynamicName+'goodArea'] = subData1[ii].dynamicValue.goodArea
}
for (let j = 0; j < dataList2.data.length; j++) {
let subData2 = dataList2.data[j].data
for (let jj = 0; jj < subData2.length; jj++) {
obj[subData2[jj].dynamicName+'dynamicValue'] = subData2[jj].dynamicValue
obj[subData2[jj].dynamicName+'dynamicRatio'] = obj[subData2[jj].dynamicName+'dynamicValue'] / obj[subData2[jj].dynamicName+'sumOutput']
}
}
this.tableData.push(obj)
}
})
}
})
},
closeDrawer() {
this.tableData = []
this.tableProps = [
{
prop: 'lineName',
label: '产线',
minWidth: 120
},
{
prop: 'startTime',
label: '上班时间',
minWidth: 150
},
{
prop: 'endTime',
label: '下班时间',
minWidth: 150
},
{
prop: 'workOrderList',
label: '生产工单'
}
]
}
}
}
</script>
<style lang="scss" scoped>
.box {
padding: 0 32px;
}
</style>

View File

@@ -0,0 +1,157 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick"
/>
<!-- 列表 -->
<base-table
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-props="tableProps"
:table-data="list"
:max-height="tableH"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="160"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<!-- 查看生产情况 -->
<team-production-detail v-if='paramVisible' ref='schedulingMonitoringDetail'/>
</div>
</template>
<script>
import { groupTeamSchedulingPage } from '@/api/monitoring/teamProduction'
import { parseTime } from '@/utils/ruoyi'
import TeamProductionDetail from './components/teamProductionDetail'
const tableProps = [
{
prop: 'createTime',
label: '排班创建时间',
filter: parseTime
},
{
prop: 'startDay',
label: '上班日期'
},
{
prop: 'startTime',
label: '上班时间',
filter: parseTime
},
{
prop: 'endTime',
label: '下班时间',
filter: parseTime
},
{
prop: 'classesName',
label: '班次名称'
},
{
prop: 'teamName',
label: '班组名称'
}
]
const tableBtn = [
{
type: 'viewDetail',
btnName: '查看生产情况'
}
]
export default {
name: 'GroupTeamScheduling',
data() {
return {
formConfig: [
{
type: 'select',
label: '班次信息',
selectOptions: [],
param: 'classesId'
},
{
type: 'input',
label: '班组信息',
placeholder: '班组信息',
param: 'teamName'
},
{
type: 'datePicker',
label: '上班日期',
dateType: 'date',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: "timestamp",
param: 'startDay',
defaultSelect: '',
width: 200
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary'
}
],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 20,
classesId: '',
teamName: '',
startDay: ''
},
tableProps,
tableBtn,
list: [],
tableH: this.tableHeight(220),
total: 0,
paramVisible: false
}
},
components: { TeamProductionDetail },
mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(220)
})
this.getList()
},
methods: {
buttonClick(val) {
this.queryParams.pageNo = 1;
this.queryParams.cnName = val.cnName
this.getList()
},
getList() {
groupTeamSchedulingPage().then(res => {
console.log(res)
this.list = res.data.list || []
this.total = res.data.total || 0
})
},
getGroupClass() {
},
handleClick(val) {
console.log(val)
this.paramVisible = true
this.$nextTick(() => {
this.$refs.schedulingMonitoringDetail.init(val.data)
})
}
}
}
</script>