330 lines
12 KiB
Vue
330 lines
12 KiB
Vue
<template>
|
|
<div>
|
|
<el-col style="width: auto">
|
|
<el-card>
|
|
<el-select v-model="toolNumValue" filterable clearable size="small" style="margin-top:10px;width: 180px" placeholder="机床号" @change="typeChange1()">
|
|
<el-option
|
|
v-for="item in toolNum"
|
|
: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="NumValue" clearable filterable size="small" style="margin-bottom:10px;width: 120px" placeholder="组号">
|
|
<el-option
|
|
v-for="item in Num"
|
|
:key="item.value"
|
|
:label="item.label"
|
|
:value="item.value"/>
|
|
</el-select>
|
|
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:180px"/>
|
|
<el-button size="small" icon="el-icon-search" type="primary" plain @click="pageSize1=50; pageCurrent1=1;searchTable()">查询</el-button>
|
|
<el-table v-loading="loading1" :data="tableData1" :row-class-name="tableData1ClassName2" size="mini" highlight-current-row height="550px" border element-loading-text="拼命加载中" @row-click="searchTable2">
|
|
<el-table-column label="零件图号" prop="零件图号" align="center" width="175px" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.零件图号 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="零件名称" prop="零件名称" align="center" width="130px" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.零件名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="材料" prop="材料" align="center" width="82px" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.材料 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="数量" align="center" width="60px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.投产数量 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="block">
|
|
<el-pagination
|
|
v-if="!loading1"
|
|
:current-page="pageCurrent1"
|
|
:page-size="pageSize1"
|
|
:total="total1"
|
|
:pager-count="5"
|
|
layout="total, prev, pager, next, jumper"
|
|
@size-change="handleSizeChange1"
|
|
@current-change="handleCurrentChange1"/>
|
|
</div>
|
|
</el-card>
|
|
</el-col>
|
|
<el-col style="width: auto">
|
|
<el-card>
|
|
<el-button size="small" type="success" plain style="margin: 10px" @click="saveRowPrice()">保存</el-button>
|
|
<el-table v-loading="loading2" :data="tableData2" :row-class-name="tableData1ClassName" height="580" border element-loading-text="拼命加载中" size="small">
|
|
<el-table-column label="序号" type="index" align="center" width="50"/>
|
|
<el-table-column label="加工状态" width="100" align="center">
|
|
<template slot-scope="scope">
|
|
<span v-if="parseInt(scope.row.工序状态)===3" type="success" size="small">未加工</span>
|
|
<span v-if="parseInt(scope.row.工序状态)===4&&parseInt(scope.row.工艺编号)!==29" size="small">已完成</span>
|
|
<span v-if="parseInt(scope.row.工艺编号)===29" size="small">备料</span>
|
|
<span v-if="parseInt(scope.row.工序状态)===5" size="small">停产</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="是否外协" width="80" align="center">
|
|
<template slot-scope="scope">
|
|
<el-checkbox :disabled="parseInt(scope.row.工序状态)!==3||parseInt(scope.row.工艺编号)===29" v-model="checkBox[scope.$index]" @change="edit(scope.$index, 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" width="100px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.计划日期 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="计划工时" align="center" width="80px">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.工序工时 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</el-col>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { machine, getToolNum, getNum, searchTable, searchTable2, edit, edit2, saveRowPrice } from '@/api/Outsourcing/PreorderAssociation'
|
|
export default {
|
|
data() {
|
|
return {
|
|
entryNameValue: '',
|
|
entryName: [], // 项目名称
|
|
toolNumValue: '',
|
|
toolNum: [], // 机床号
|
|
NumValue: '',
|
|
Num: [], // 分组
|
|
count: 0, // 计数器 (表二是否有外协工序)
|
|
InOut: 1, // 工序间是否外协变量 1自家 2外协
|
|
index: 0, // 当前点击行(改变颜色不刷新用)
|
|
index2: 0, // 当前点击行(改变颜色不刷新用)
|
|
num1: '',
|
|
checkBox: [],
|
|
loading1: false,
|
|
loading2: false,
|
|
check_partName: false,
|
|
partName: '', // 零件名称
|
|
tableData1: [], // 表格数据
|
|
tableData2: [],
|
|
total1: null, // 总条数
|
|
pageSize1: 50, // 每页显示条数
|
|
pageCurrent1: 1
|
|
}
|
|
},
|
|
created() {
|
|
this.typeChange()
|
|
this.searchTable()
|
|
},
|
|
methods: {
|
|
fetchData() {
|
|
this.entryNameValue = ''
|
|
this.entryName = []
|
|
machine().then(response => {
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
this.entryName.push({
|
|
label: response.data[i].项目名称,
|
|
value: response.data[i].项目流水号
|
|
})
|
|
}
|
|
})
|
|
},
|
|
typeChange() {
|
|
this.toolNumValue = ''
|
|
this.toolNum = []
|
|
this.NumValue = ''
|
|
this.Num = []
|
|
getToolNum().then(response => {
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
this.toolNum.push({
|
|
label: response.data[i].机床图号,
|
|
value: response.data[i].机床流水号,
|
|
value2: response.data[i].项目名称
|
|
})
|
|
}
|
|
})
|
|
},
|
|
typeChange1() {
|
|
this.NumValue = ''
|
|
this.Num = []
|
|
getNum(this.toolNumValue).then(response => {
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
this.Num.push({
|
|
label: response.data[i].组号,
|
|
value: response.data[i].组件流水号
|
|
})
|
|
}
|
|
})
|
|
},
|
|
searchTable() {
|
|
this.loading1 = true
|
|
this.tableData1 = []
|
|
this.tableData2 = []
|
|
if (this.entryNameValue !== null && this.entryNameValue !== '') {
|
|
this.check_entryNameValue = 1
|
|
} else {
|
|
this.check_entryNameValue = 0
|
|
}
|
|
if (this.toolNumValue !== null && this.toolNumValue !== '') {
|
|
this.check_toolNumValue = 1
|
|
} else {
|
|
this.check_toolNumValue = 0
|
|
}
|
|
if (this.NumValue !== null && this.NumValue !== '') {
|
|
this.check_NumValue = 1
|
|
} else {
|
|
this.check_NumValue = 0
|
|
}
|
|
if (this.partName !== null && this.partName !== '') {
|
|
this.check_partName = 1
|
|
} else {
|
|
this.check_partName = 0
|
|
}
|
|
searchTable(this.check_entryNameValue, this.entryNameValue, this.check_toolNumValue, this.toolNumValue, this.check_NumValue, this.NumValue, this.check_partName, this.partName, this.pageCurrent1, this.pageSize1).then(response => {
|
|
this.tableData1 = response.data.rows
|
|
this.total1 = response.data.total
|
|
}).then(() => {
|
|
this.loading1 = false
|
|
})
|
|
},
|
|
searchTable2(row) {
|
|
this.loading2 = true
|
|
this.checkBox = []
|
|
this.tableData2 = []
|
|
this.index2 = row.index
|
|
searchTable2(row.工艺计划流水号).then(response => {
|
|
this.num1 = row.工艺计划流水号
|
|
if (response.data.length === 0) {
|
|
this.loading0 = false
|
|
} else {
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
if (response.data[i].工序间是否外协 === 1) {
|
|
this.checkBox.push(false)
|
|
} else {
|
|
this.checkBox.push(true)
|
|
}
|
|
}
|
|
for (let i = 0; i < response.data.length; i++) {
|
|
response.data[i].机加工开始时间 = response.data[i].机加工开始时间.split(' ')[0]
|
|
response.data[i].机加工结束时间 = response.data[i].机加工结束时间.split(' ')[0]
|
|
response.data[i].计划日期 = response.data[i].计划日期.split(' ')[0]
|
|
}
|
|
this.tableData2 = response.data
|
|
}
|
|
}).then(() => {
|
|
this.loading2 = false
|
|
})
|
|
},
|
|
tableData1ClassName({ row, rowIndex }) {
|
|
row.index = rowIndex
|
|
if (row.工序间是否外协 === 2) {
|
|
return 'XJWXwx'
|
|
}
|
|
if (parseInt(row.工序状态) !== 3 || parseInt(row.工艺编号) === 29) {
|
|
return 'XJWXywc'
|
|
}
|
|
},
|
|
tableData1ClassName2({ row, rowIndex }) {
|
|
row.index = rowIndex
|
|
if (row.状态 === 1 || row.状态 === '1') {
|
|
return 'XJWXwx'
|
|
}
|
|
},
|
|
// 修改外协状态
|
|
edit(index, row) {
|
|
this.count = 0
|
|
this.index = row.index
|
|
for (let i = 0; i < this.tableData2.length; i++) {
|
|
if (this.checkBox[i] === false) {
|
|
this.count = this.count + 1
|
|
}
|
|
}
|
|
if (this.count === this.tableData2.length) {
|
|
this.tableData1[this.index2].状态 = 0
|
|
edit2(row.工序流水号, row.工艺计划流水号, 0)
|
|
}
|
|
if (this.checkBox[index] === true) {
|
|
this.InOut = 2
|
|
this.tableData2[this.index].工序间是否外协 = 2
|
|
this.tableData1[this.index2].状态 = 1
|
|
edit(row.工序流水号, this.InOut).then(response => {
|
|
edit2(row.工序流水号, row.工艺计划流水号, 1)
|
|
})
|
|
} else {
|
|
this.InOut = 1
|
|
this.tableData2[this.index].工序间是否外协 = 1
|
|
edit(row.工序流水号, this.InOut)
|
|
}
|
|
},
|
|
// 保存行价格
|
|
saveRowPrice() {
|
|
this.count = 0
|
|
for (let i = 0; i < this.tableData2.length; i++) {
|
|
if (this.checkBox[i] === false) {
|
|
this.count = this.count + 1
|
|
}
|
|
}
|
|
if (this.tableData2.length === 0) {
|
|
this.$message.error('请选择零件')
|
|
} else {
|
|
if (this.count !== this.tableData2.length) {
|
|
this.a = 0
|
|
for (let i = 0; i < this.tableData2.length; i++) {
|
|
saveRowPrice(this.tableData2[i].工序流水号, 0, this.tableData2[i].工艺计划流水号, 0).then(response => {
|
|
this.a += parseInt(response.data[0].result)
|
|
if (this.a === this.tableData2.length) {
|
|
this.$message.success('保存成功')
|
|
this.searchTable()
|
|
}
|
|
})
|
|
}
|
|
} else {
|
|
this.$message.error('请选择需要外协工序')
|
|
}
|
|
}
|
|
},
|
|
handleSizeChange1(val) {
|
|
this.pageCurrent1 = 1
|
|
this.pageSize1 = val
|
|
this.searchTable()
|
|
},
|
|
handleCurrentChange1(val) {
|
|
this.pageCurrent1 = val
|
|
this.searchTable()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.el-card{
|
|
margin:0px;
|
|
}
|
|
.xujianwaix {
|
|
/*border: 1px solid red;*/
|
|
background: red;
|
|
}
|
|
.el-checkbox, .el-checkbox-button__inner {
|
|
color: blue;
|
|
}
|
|
</style>
|
|
<style>
|
|
.XJWXwx{
|
|
background: #9bd7fc !important;
|
|
}
|
|
.XJWXywc{
|
|
background: rgb(103,194,58) !important;
|
|
}
|
|
</style>
|