完成日期补录正在加工零件

This commit is contained in:
bryan sun
2019-10-30 18:39:43 +08:00
parent 95794ba703
commit 59ed8e2d4d
9 changed files with 504 additions and 51 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="app-container">
<el-card>
<!-- <el-button :disabled="isShow" type="info" size="small" style="margin: 0px 10px;" @click="EditData">补录完成日期</el-button>-->
<el-button :disabled="isShow" type="info" size="small" style="margin: 0px 180px;float: right" @click="EditData">补录完成日期</el-button>
<el-select v-model="Machine" filterable clearable size="small" style="margin:0px 10px 0px 10px;width: 180px;" placeholder="机床号" @change="getGroup">
<el-option
v-for="item in Machines"
@@ -33,7 +33,8 @@
style="max-height: 830px"
highlight-current-row
empty-text=" "
border>
border
@current-change="getRow">
<el-table-column type="index" label="序号" width="50"/>
<el-table-column align="center" label="工艺名" width="90">
<template slot-scope="scope">
@@ -79,7 +80,7 @@
border
height="800"
@current-change="getCurrentRow">
<el-table-column type="index" label="序号" width="65">
<el-table-column type="index" label="序号" width="80">
<template slot-scope="scope">
<el-radio :label="scope.row.序号" v-model="radio"/>
</template>
@@ -133,11 +134,78 @@
</el-card>
</el-col>
</el-row>
<el-dialog :title="title" :visible.sync="dialogFormVisible" center style="min-height: 300px" width="400px">
<el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row width="200px">
<el-form-item label="操作员" prop="人员" >
<el-input v-model="form.人员" placeholder="操作员" readonly size="small" style="width: 80%" @focus="dialogTableVisible" />
</el-form-item>
<el-form-item label="人员编号" prop="人员编号" >
<el-input v-model="form.人员编号" placeholder="人员编号" disabled size="small" style="width: 80%" />
</el-form-item>
<el-form-item label="完成日期" prop="完成时间">
<el-date-picker
v-model="form.完成时间"
style="width: 80%"
size="small"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="submit('form')" >确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible1" title="人员信息" center width="750px">
<div style="height: 500px">
<div style="float: left;margin-top: 10px;margin-left: 20px;overflow-y: scroll;height: 400px">
<el-tree
:data="data2"
node-key="id"
style="width: 150px;float: left"
height="400"
accordion
default-expand-all="true"
highlight-current="true"
@node-click="handleNodeClick"/>
</div>
<el-table :data="List1" highlight-current-row height="400" style="width: 400px;float: left;margin-left: 30px" @row-click="handleCurrentChange2">
<el-table-column label="人员编号" align="center" >
<template slot-scope="scope">
{{ scope.row.人员编号 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" >
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="性别" align="center">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column label="工作岗位" align="center">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
</div>
<el-button style="margin-left: 260px" @click="dialogFormVisible1 = false">取消</el-button>
<el-button type="primary" style="margin-top: 20px" @click="getName">确认</el-button>
</el-dialog>
</div>
</template>
<script>
import { getMachines, getGroups, getTable, gettabledata1 } from '@/api/ManufacturingCenter/ProcessingStatusNew'
import { getMachines, getGroups, getTable, gettabledata1, getTree, fn, getTable8, submitEdit } from '@/api/ManufacturingCenter/ProcessingStatusNew'
import Cookie from 'js-cookie'
export default {
@@ -163,11 +231,32 @@ export default {
isShow: true,
processSerialNumber: '', // 工序流水号
startTime: '', // 开始时间
endTime: ''
endTime: '',
dateOfProduction: '', // 排产时间
title: '',
dialogFormVisible: false,
form: {
人员: '',
人员编号: '',
完成时间: ''
},
rules: {
人员: [{ required: true, message: '请选择操作员', trigger: 'change' }],
人员编号: [{ required: true, message: '人员编号', trigger: 'change' }],
完成时间: [{ required: true, message: '请选择实际完成时间', trigger: 'change' }]
},
dialogFormVisible1: false,
data2: [],
List1: [],
ssks: '',
Number1: '', // 人员编号
row2: [],
khbmbh: ''
}
},
created() {
this.getMachine()
this.getTable9()
},
methods: {
getMachine() {
@@ -250,12 +339,6 @@ export default {
getTable(this.checkbox_Machine, this.Machine, this.checkbox_Group, this.Group, this.checkbox_number, this.number, this.startTime, this.endTime, this.pageCurrent, this.pageSize).then(response => {
if (response.data.rows.length !== 0) {
for (let i = 0; i < response.data.rows.length; i++) {
// while (response.data.rows[i].机加工实际完成时间.indexOf('-') >= 0) {
// response.data.rows[i].机加工实际完成时间 = (response.data.rows[i].机加工实际完成时间.replace('-', '/'))
// }
// while (response.data.rows[i].机加工结束时间.indexOf('-') >= 0) {
// response.data.rows[i].机加工结束时间 = (response.data.rows[i].机加工结束时间.replace('-', '/'))
// }
this.tableData.push({
工艺计划流水号: response.data.rows[i].工艺计划流水号,
序号: response.data.rows[i].序号,
@@ -263,10 +346,8 @@ export default {
零件名称: response.data.rows[i].零件名称,
加工数: response.data.rows[i].完成数量, // MES里采集 现在没有
投产数量: response.data.rows[i].批次数量,
// 完成日期: response.data.rows[i].完成日期,
完成日期: response.data.rows[i].机加工实际完成时间 ? response.data.rows[i].机加工实际完成时间.split(' ')[0] : '', // 排产时间
计划结束时间: response.data.rows[i].机加工结束时间 ? response.data.rows[i].机加工结束时间.split(' ')[0] : '',
// 计划结束时间: response.data.rows[i].计划结束时间,
客户名称: response.data.rows[i].客户名称 // 客户名
})
}
@@ -276,58 +357,98 @@ export default {
})
}, // 获取工序表
getCurrentRow(row) {
// this.radio = row.序号
this.completeTime = ''
this.dateOfProduction = ''
this.processSerialNumber = ''
this.radio = true
this.tableData1 = []
this.row2 = row
gettabledata1(row.工艺计划流水号).then(response => {
console.log(response, 909090)
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
// while (response.data[i].计划日期.indexOf('-') >= 0) {
// response.data[i].计划日期 = (response.data[i].计划日期.replace('-', '/'))
// }
// while (response.data[i].工序完成日期.indexOf('-') >= 0) {
// response.data[i].工序完成日期 = (response.data[i].工序完成日期.replace('-', '/'))
// }
this.tableData1.push({
工艺名称: response.data[i].工艺名称,
序间质检: response.data[i].质检结果,
排产日期: response.data[i].排产时间 ? response.data[i].排产时间.split(' ')[0] : '',
// 排产日期: response.data[i].计划日期,
完成日期: response.data[i].工序完成日期 ? response.data[i].工序完成日期.split(' ')[0] : '',
操作者: response.data[i].操作者,
不合格数量: response.data[i].不合格数量,
质检数量: response.data[i].数量
质检数量: response.data[i].数量,
工序流水号: response.data[i].工序流水号
})
}
}
})
}, // 补加完成日期
// EditData() {
// editdata(this.processSerialNumber).then(response => {
// if (response.data.result === '1') {
// this.$message.success('编辑成功')
// } else {
// this.$message.error('编辑失败')
// }
// })
// },
// getRow(row) {
// console.log(this.completeTime)
// this.completeTime = row.完成日期
// this.processSerialNumber = row.工序流水号
// if (this.completeTime === null) {
// this.isShow = false
// } else {
// this.isShow = true
// }
// },
EditData() {
this.dialogFormVisible = true
this.form.人员 = ''
this.form.人员编号 = ''
this.form.完成时间 = ''
},
getRow(row) {
this.completeTime = row.完成日期
this.dateOfProduction = row.排产日期
this.processSerialNumber = row.工序流水号
if (this.completeTime === '' && this.dateOfProduction !== '') {
this.isShow = false
} else {
this.isShow = true
}
},
dialogTableVisible() {
this.dialogFormVisible1 = true
this.fetchData3()
},
fetchData3() {
getTree().then(response => { // 获取人员信息树
const data = response.data
this.data2 = fn(data, 0)
})
},
handleNodeClick(data) { // 树节点点击
this.ssks = data.label
getTable8(data.id).then(response => {
this.List1 = response.data
})
},
getTable9() {
this.khbmbh = 12
getTable8(this.khbmbh).then(response => {
this.List1 = response.data
})
},
handleCurrentChange2(row) { // 获取当前行人员信息
this.ssks = row.节点名称
this.Number1 = row.人员编号
this.Name = row.姓名
},
getName() { // 提交人员
this.dialogFormVisible1 = false
this.form.人员 = this.Name
this.form.人员编号 = this.Number1
},
submit() {
submitEdit(this.Number1, this.form.完成时间, this.processSerialNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('补录成功')
} else {
this.$message.error('补录失败')
}
})
this.dialogFormVisible = false
this.getCurrentRow(this.row2)
},
// 完成日期变色
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex
if (row.完成日期 !== '') {
return 'CompleteColor'
}
}, // 重置表单
callOff(formName) {
this.dialogFormVisible = false
this.$refs[formName].resetFields()
},
handleSizeChange(val) {
this.pageSize = val