This commit is contained in:
liushuai
2020-01-01 19:21:42 +08:00
parent d30942c89e
commit 15f2cbf774
6 changed files with 1005 additions and 9 deletions

View File

@@ -0,0 +1,560 @@
<template>
<div class="app-container">
<el-card>
<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: 185px;" placeholder="机床号" @change="getGroup">
<el-option
v-for="item in Machines"
:key="item.value"
:label="item.label"
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<el-select v-model="Group" size="small" clearable placeholder="组号" style="margin:0px 10px;width: 100px;" @change="getTableData">
<el-option
v-for="item in Groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-input v-model="number" placeholder="零件号" clearable size="small" style="width: 170px;margin:0px 10px;"/>
<el-button type="success" class="el-icon-search" size="small" style="margin: 0px 10px;" @click="pageCurrent = 1;pageSize = 100;getTableData()">查询</el-button>
<el-button type="primary" class="el-icon-plus" size="small" style="margin: 0px 10px;" @click="addTableData()">加序</el-button>
</el-card>
<el-row>
<el-col style="width: 550px">
<el-card>
<el-table
:data="tableData1"
:row-class-name="tableRowClassName"
loading="loading"
class="table"
style="max-height: 830px"
highlight-current-row
empty-text=" "
border
@current-change="getRow">
<el-table-column align="center" label="序号" width="70">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺名" show-overflow-tooltip width="70">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="质检" width="60">
<template slot-scope="scope">
{{ scope.row.序间质检 }}
</template>
</el-table-column>
<el-table-column align="center" label="不合格数" width="80">
<template slot-scope="scope">
{{ scope.row.不合格数量 === 0 ? '' : scope.row.不合格数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="操作者" show-overflow-tooltip width="70">
<template slot-scope="scope">
{{ scope.row.操作者 }}
</template>
</el-table-column>
<el-table-column align="center" label="排产日期" width="95">
<template slot-scope="scope">
{{ scope.row.排产日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="完成日期" width="95">
<template slot-scope="scope">
{{ scope.row.完成日期 === '1900-01-01' ? '' : scope.row.完成日期 }}
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col style="width: 810px">
<el-card>
<el-table
:data="tableData"
:row-class-name="tableRowClassName"
loading="loading"
class="table"
highlight-current-row
border
height="630"
@current-change="getCurrentRow">
<el-table-column type="index" align="center" label="序号" width="80">
<template slot-scope="scope">
<el-radio :label="scope.row.序号" v-model="radio"/>
</template>
</el-table-column>
<el-table-column align="center" label="跟单号" width="100">
<template slot-scope="scope">
{{ scope.row.跟单号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件图号" show-overflow-tooltip width="180">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称" show-overflow-tooltip width="80">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="加工数" width="70">
<template slot-scope="scope">
{{ scope.row.加工数 }}
</template>
</el-table-column>
<el-table-column align="center" label="计划数" width="70">
<template slot-scope="scope">
{{ scope.row.投产数量 }}
</template>
</el-table-column>
<el-table-column align="center" label="加工完成" width="100">
<template slot-scope="scope">
{{ scope.row.完成日期 }}
</template>
</el-table-column>
<el-table-column align="center" label="计划完成" width="100">
<template slot-scope="scope">
{{ scope.row.计划结束时间 }}
</template>
</el-table-column>
<el-table-column align="center" label="用户名称" show-overflow-tooltip width="110">
<template slot-scope="scope">
{{ scope.row.客户名称 }}
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[100, 200, 300, 400]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</el-col>
</el-row>
<el-dialog v-el-drag-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 v-el-drag-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>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible2" title="加序" center style="min-height: 300px" width="400px">
<el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="90px" class="demo-ruleForm">
<el-row width="200px">
<el-form-item label="序号" prop="工序顺序" >
<el-input v-model="form2.工序顺序" size="small" style="width: 160px;margin:0px 10px" placeholder="序号"/>
</el-form-item>
<el-form-item label="工序名称" prop="工艺编号" >
<el-select v-model="form2.工艺编号" filterable size="small" style="width:160px;margin:0px 10px" placeholder="工艺编号">
<el-option
v-for="item in ProcessNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="操作工" prop="操作工" >
<el-select v-model="form2.操作工" filterable size="small" style="width:160px;margin:0px 10px" placeholder="操作工">
<el-option
v-for="item in People"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOffProcess('form2')">取消</el-button>
<el-button type="primary" @click="submitProcess('form2')" >确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getMachines, getGroups, getTable, gettabledata1, getTree, fn, getTable8, submitEdit, initProcessNumber, addProcess } from '@/api/ManufacturingCenter/AddingOrder'
import Cookie from 'js-cookie'
export default {
data() {
return {
Machine: '', // 机床号
Machines: [],
Group: '', // 组号
Groups: [],
number: '', // 零件图号
process: '', // 工艺计划流水号
tableData: [], // 工序表
loading: '',
checkbox_Machine: '', // 机床
checkbox_Group: '', // 分组
checkbox_number: '',
pageCurrent: 1,
pageSize: 100,
total: 0,
ProcessNumber: [], // 工艺
tableData1: [], // 工序表
radio: '',
completeTime: '', // 完成时间
row1: [],
isShow: true,
processSerialNumber: '', // 工序流水号
startTime: '', // 开始时间
endTime: '',
dateOfProduction: '', // 排产时间
title: '',
People: [],
dialogFormVisible: false,
dialogFormVisible2: false,
form: {
人员: '',
人员编号: '',
完成时间: ''
},
form2: {
操作工: '',
工序顺序: '',
工艺编号: ''
},
rules: {
人员: [{ required: true, message: '请选择操作员', trigger: 'change' }],
人员编号: [{ required: true, message: '人员编号', trigger: 'change' }],
完成时间: [{ required: true, message: '请选择实际完成时间', trigger: 'change' }]
},
rules2: {
操作工: [{ 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: {
addTableData() {
this.dialogFormVisible2 = true
},
getMachine() {
if (Cookie.get('machineValue') !== undefined) {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
getMachines().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
if (Cookie.get('group') !== undefined) {
this.Machine = parseInt(Cookie.get('machineValue'))
this.getGroup()
this.getTableData()
this.Group = parseInt(Cookie.get('group'))
// this.getTableData()
Cookie.remove('machineValue')
Cookie.remove('group')
} else {
// this.getTableData()
Cookie.remove('machineValue')
Cookie.remove('group')
}
})
} else {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
getMachines().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
this.getTableData()
}
}, // 获取组号
getGroup() {
this.Group = ''
this.Groups = []
getGroups(this.Machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
this.Group = response.data[0].组件流水号
})
this.getTableData()
}, // 按条件查询
getTableData() {
this.tableData = []
this.Loading = true
if (this.Machine === '') {
this.checkbox_Machine = 0
} else {
this.checkbox_Machine = 1
}
if (this.Group === '') {
this.checkbox_Group = 0
} else {
this.checkbox_Group = 1
}
if (this.number === '') {
this.checkbox_number = 0
} else {
this.checkbox_number = 1
}
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++) {
this.tableData.push({
工艺计划流水号: response.data.rows[i].工艺计划流水号,
序号: response.data.rows[i].序号,
跟单号: response.data.rows[i].跟单号,
零件图号: response.data.rows[i].零件图号,
零件名称: response.data.rows[i].零件名称,
加工数: response.data.rows[i].完成数量, // MES里采集 现在没有
投产数量: 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].客户名称 // 客户名
})
}
}
this.total = response.data.total
this.loading = false
})
}, // 获取工序表
getCurrentRow(row) {
this.completeTime = ''
this.dateOfProduction = ''
this.processSerialNumber = ''
this.radio = true
this.tableData1 = []
this.process = row.工艺计划流水号
this.row2 = row
gettabledata1(row.工艺计划流水号).then(response => {
if (response.data.length !== 0) {
for (let i = 0; i < response.data.length; i++) {
this.tableData1.push({
工序顺序: response.data[i].工序顺序,
工艺名称: response.data[i].工艺名称,
序间质检: response.data[i].质检结果,
排产日期: response.data[i].排产时间 ? response.data[i].排产时间.split(' ')[0] : '',
完成日期: response.data[i].工序完成日期 ? response.data[i].工序完成日期.split(' ')[0] : '',
操作者: response.data[i].操作者,
不合格数量: response.data[i].不合格数量,
质检数量: response.data[i].数量,
工序流水号: response.data[i].工序流水号
})
}
}
})
console.log(this.tableData1, 123)
}, // 补加完成日期
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
for (let i = 0; i < response.data.length; i++) {
this.People.push({
value: response.data[i].人员编号,
label: response.data[i].姓名
})
}
})
initProcessNumber().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.ProcessNumber.push({
value: response.data[i].工艺编号,
label: response.data[i].工艺名称
})
}
})
},
handleCurrentChange2(row) { // 获取当前行人员信息
this.ssks = row.节点名称
this.Number1 = row.人员编号
this.Name = row.姓名
},
getName() { // 提交人员
this.dialogFormVisible1 = false
this.form.人员 = this.Name
this.form.人员编号 = this.Number1
},
submitProcess() {
addProcess(this.process, this.form2.工序顺序, this.form2.工艺编号, this.form2.操作工).then(response => {
if (response.data[0].result === '1') {
this.$message.success('加序成功')
this.dialogFormVisible2 = false
} else {
this.$message.error('加序失败')
}
})
},
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()
},
callOffProcess(formName) {
this.dialogFormVisible2 = false
this.$refs[formName].resetFields()
},
handleSizeChange(val) {
this.pageSize = val
this.getTableData()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.getTableData()
}
}
}
</script>
<style>
.CompleteColor{
background: #9bd7fc !important;
}
</style>