Files
JY1.0/src/views/WorkshopProcurement/OutsourcingProcessPlanning/index.vue
2018-12-21 08:41:19 +08:00

1240 lines
40 KiB
Vue

<template>
<div class="app-container">
<el-card>
<el-radio-group
v-model="radio"
size="small"
style="margin: 10px;"
@change="clearDetail">
<el-radio v-model="radio" :label="0">未编制</el-radio>
<el-radio v-model="radio" :label="1">已编制</el-radio>
</el-radio-group>
<span>工艺员:</span>
<el-select
v-model="CraftmenValue"
placeholder="工艺员"
size="small"
style="width:100px">
<el-option
v-for="item in Craftmen"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>项目名称:</span>
<el-select
v-model="projectNameValue"
placeholder="项目名称"
size="small"
style="width:100px"
clearable
@change="searchMachine()">
<el-option
v-for="item in projectName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床编号:</span>
<el-select
v-model="machineValue"
placeholder="机床编号"
size="small"
style="width:100px"
clearable
@change="searchGroup()">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>组号:</span>
<el-select
v-model="groupNumberValue"
placeholder="组号"
size="small"
style="width:100px"
clearable
@change="changeGroup()">
<el-option
v-for="item in groupNumber"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>图号/名称:</span>
<el-input
v-model="partNum"
clearable
style="width:120px"
placeholder="请双击选择"
size="small"
@change="clear()"
@dblclick.native="searchParts"/>
<el-button type="success" icon="el-icon-search" style="margin: 10px;" size="small" @click="searchDetail">查询
</el-button>
<el-button v-show="isShow2" type="danger" icon="el-icon-edit" size="small" @click="returnEdit">工艺调整
</el-button>
<div>
<span>种类:</span>
<el-input v-model="typeValue" placeholder="种类" size="small" readonly style="width:100px"/>
<span>名称/型号:</span>
<el-input v-model="partName" placeholder="名称" size="small" readonly style="width:115px"/>
<span>材质:</span>
<el-input v-model="materialName" placeholder="材质" size="small" style="width:120px" readonly/>
<el-checkbox v-model="checked" :disabled="isShow2" size="small" style="margin:10px">是否核准</el-checkbox>
<span>规格:</span>
<el-input v-model="spec" style="width:100px" size="small" placeholder="规格" readonly/>
<span>投产总数量:</span>
<el-input v-model="batchNum" placeholder="总数量" readonly size="small" style="width:80px;margin-top:10px;"/>
</div>
</el-card>
<el-card>
<el-row>
<span>输入数值:</span>
<el-input v-model="numVal" size="small" style="width:100px" placeholder="输入数值"/>
<span>选择参数:</span>
<el-select v-model="selParaValue" size="small" style="width:100px" placeholder="选择参数">
<el-option
v-for="item in selPara"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>公差:</span>
<el-input v-model="tolerance" size="small" style="width:150px" placeholder="公差"/>
<el-button style="margin:10px" type="primary" size="small" @click="calTol()">计算公差</el-button>
<el-button-group style="margin: 10px">
<el-button :disabled="disabled" type="warning" size="small" icon="el-icon-tickets" @click="WYbtn">完艺
</el-button>
<el-button :disabled="disabled" type="danger" size="small" icon="el-icon-delete" @click="deleteTable">删除
</el-button>
<el-button :disabled="disabled" type="primary" size="small" icon="el-icon-cjn-09" @click="saveApprove">保存
</el-button>
</el-button-group>
</el-row>
<el-table
v-loading="loading0"
:data="tableData"
border
style="width: 100%;max-height: 550px;"
size="mini"
height="550px">
<el-table-column prop="num" label="序号" width="50" align="center" type="index"/>
<el-table-column prop="name" label="工艺名称" width="230" align="center">
<template slot-scope="scope">
<el-input
v-model="scope.row.工艺名称"
:disabled="disabled"
size="mini"
readonly
style="width:200px"
@dblclick.native="tableSearch(scope.$index)"/>
</template>
</el-table-column>
<el-table-column prop="hard" label="难度等级" width="110" align="center">
<template slot-scope="scope">
<el-select
v-model="scope.row.工艺难度等级"
:disabled="disabled"
size="mini"
@change="hardEdit(scope.row)">
<el-option v-for="item in hard" :key="item.value" :label="item.label" :value="item.value">
<span style="color: #8492a6; font-size: 13px">{{ item.value }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="request" label="工艺要求" align="center" min-width="350">
<template slot-scope="scope">
<el-input
v-model="scope.row.工艺要求"
:rows="1"
:disabled="disabled"
size="mini"
type="textarea"
@change="requestEdit(scope.row)"/>
</template>
</el-table-column>
<el-table-column label="操作" width="300" align="center" fixed="right">
<template slot-scope="scope">
<div>
<el-button
:disabled="disabled"
size="mini"
icon="el-icon-arrow-up"
type="primary"
@click="upOne(scope.row)"/>
<el-button
:disabled="disabled"
size="mini"
icon="el-icon-arrow-down"
type="primary"
@click="downOne(scope.row)"/>
<el-button
:disabled="disabled"
size="mini"
icon="el-icon-circle-plus-outline"
type="primary"
@click="insertOne(scope.row)"/>
<el-button
:disabled="disabled"
size="mini"
icon="el-icon-delete"
type="danger"
@click="deleteOne(scope.row)"/>
</div>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog :visible.sync="dialogFormVisible2" title="工艺名称、工艺要求选择" center width="400px">
<el-form ref="form2" :model="form2" label-position="left" label-width="125px" class="demo-ruleForm">
<el-form-item label="工艺名称分类">
<el-select v-model="processNameClassValue" placeholder="分类" size="small" @change="cChange()">
<el-option
v-for="item in processNameClass"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="工艺名称">
<el-select v-model="processNameValue" placeholder="名称" size="small" @change="nChange()">
<el-option
v-for="item in processName"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="工艺要求">
<el-select v-model="processRequestValue" placeholder="要求" size="small">
<el-option
v-for="item in processRequest"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="mini" type="primary" @click="confirmSelect()">确定选择</el-button>
</el-form-item>
</el-form>
</el-dialog>
<el-dialog :visible.sync="dialogFormVisible1" title="已完工艺选择" center width="800px">
<el-form ref="form1" :model="form1" label-position="left" label-width="140px" class="demo-ruleForm">
<el-row>
<el-col :span="10">
<el-form-item label="项目名称">
<el-select
v-model="projectNameValue1"
placeholder="项目名称"
size="small"
style="width:150px"
@change="searchMachine1()">
<el-option
v-for="item in projectName1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="机床名称">
<el-select
v-model="machineValue1"
placeholder="机床编号"
size="small"
style="width:150px"
@change="searchGroup1()">
<el-option
v-for="item in Machine1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button size="small" type="success" icon="el-icon-search" @click="searchDetail1()">查询</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="组号">
<el-select
v-model="groupNumberValue1"
placeholder="组号"
size="small"
style="width:150px"
@change="changeGroup1()">
<el-option
v-for="item in groupNumber1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="图号/名称">
<el-input
v-model="partNum1"
clearable
style="width:150px"
placeholder="请双击选择"
size="small"
@dblclick.native="searchParts1"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button size="small" @click="processCopy1()">工艺拷贝</el-button>
</el-col>
</el-row>
<el-table
:data="tableData4"
style="width: 97%;max-height: 250px;margin-top: 15px"
size="mini"
border
height="250px">
<el-table-column align="center" label="工艺序号" width="80">
<template slot-scope="scope">
{{ scope.row.工序顺序 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺名称" width="120">
<template slot-scope="scope">
{{ scope.row.工艺名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="工艺要求">
<template slot-scope="scope">
{{ scope.row.工艺要求 }}
</template>
</el-table-column>
<el-table-column align="center" label="单件定额工时" width="110">
<template slot-scope="scope">
{{ scope.row.单件定额工时 }}
</template>
</el-table-column>
<el-table-column align="center" label="准结定额工时" width="110">
<template slot-scope="scope">
{{ scope.row.准结定额工时 }}
</template>
</el-table-column>
</el-table>
</el-form>
</el-dialog>
<el-dialog
:visible.sync="dialogFormVisible4"
title="图号"
center
style="min-height: 300px">
<el-table
:data="tableData8"
size="mini"
style="width: 97%;max-height: 300px"
height="300"
highlight-current-row
border
@row-click="selectParts">
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="1"
:page-sizes="[10, 20]"
:page-size="10"
:pager-count="5"
:total="total"
small
layout="sizes, prev, pager, next"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogFormVisible5"
title="图号"
center
style="min-height: 300px">
<el-table
:data="tableData9"
size="mini"
style="width: 97%;max-height: 300px"
height="300"
highlight-current-row
border
@row-click="selectParts1">
<el-table-column align="center" label="零件图号">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="1"
:page-sizes="[10, 20]"
:page-size="10"
:pager-count="5"
:total="total"
small
layout="total, sizes, prev, pager, next"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogFormVisible6"
title="图号"
center
style="min-height: 300px">
<el-table
:data="tableData10"
size="mini"
style="width: 97%;max-height: 300px"
height="300"
highlight-current-row
border
@row-click="selectParts2">
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料规格">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page1="1"
:page-sizes="[10, 20]"
:page-size1="10"
:pager-count1="5"
:total="total1"
small
layout="sizes, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit1()">确认</el-button>
</div>
</el-dialog>
<el-dialog
:visible.sync="dialogFormVisible7"
title="图号"
center
style="min-height: 300px">
<el-table
:data="tableData11"
size="mini"
style="width: 97%;max-height: 300px"
height="300"
highlight-current-row
border
@row-click="selectParts3">
<el-table-column align="center" label="零件图号">
<template slot-scope="scope">
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="零件名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="材料">
<template slot-scope="scope">
{{ scope.row.材料 }}
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page1="1"
:page-sizes="[10, 20]"
:page-size1="10"
:pager-count1="5"
:total="total1"
small
layout="total, sizes, prev, pager, next"
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit1()">确认</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import '@/icon/iconfont.css'
import {
initCraftmen,
getProject,
getMachine,
getGroup,
getPartnames1,
getProcedure,
initTolerance,
gongyiCopy,
hardEdit,
requestEdit,
processNameClick,
processNameSelect,
processRequestSelect,
searchTolerance,
insertOne,
deleteOne,
upOne,
downOne,
saveApprove,
selectRequest,
deleteTable,
returnEdit
} from '@/api/WorkshopProcurement/OutsourcingProcessPlanning'
import elInput from 'element-ui/packages/input'
export default {
components: {
elInput
},
data() {
return {
projectNameValue: '',
projectName: [],
machineValue: '',
Machine: [],
groupNumberValue: '',
groupNumber: [],
groupNum: '',
groupType: '',
projectNameValue1: '',
projectName1: [],
machineValue1: '',
Machine1: [],
groupNumberValue1: '',
groupNumber1: [],
groupNum1: '',
groupType1: '',
tableData8: [],
tableData9: [],
tableData10: [],
tableData11: [],
ProcessFlowNumber: '',
ProcessFlowNumber1: '',
partsTypeValue: '',
partsType: [],
total: 0,
pageCurrent: 1,
pageSize: 10,
total1: 0,
pageCurrent1: 1,
pageSize1: 10,
input: '', // 材质对话框查询1
tableMaterial: [],
dialogMaterial: false,
loading0: false,
radio: 0, // 第一组
partNum: '', // 零件号
partNum1: '', // 零件号
typeValue: '', // 种类
CraftmenValue: '', // 工艺员值
Craftmen: [], // 工艺员
partName: '', // 零件名称
partNumValue: '',
batchNum: '', // 投产总数量
materialName: '', // 材质名称
remark: '', // 备注
remark1: '', // 完艺零件名称
dialogFormVisible1: false, // 完艺对话框可见性
dialogFormVisible2: false, // 主界面查询工艺名称要求对话框可见性
dialogFormVisible4: false, // 图号外购件和标准件
dialogFormVisible5: false, // 图号基本件
dialogFormVisible6: false, // 图号外购件和标准件(完艺)
dialogFormVisible7: false, // 图号基本件(完艺)
form1: null, // 完艺表单
form2: null,
numVal: '', // 输入数值
selPara: [], // 选择参数数组
selParaValue: '', // 选择参数值
tolerance: '', // 公差
tableData: [], // 主表
tableData4: [], // 完艺表格
processSelect: [], // 工艺分类流水号
processNameClass: [], // 工艺名称分类
processNameClassValue: '',
processName: [], // 工艺名称
processNameValue: '',
processRequest: [], // 工艺要求
processRequestValue: '',
processN1: '', // 工艺编号
str: '', // 拼接字符串用的
value: '', // 第一个select的
checked: false, // 是否核准
checked1: false, // 修改
spec: '', // 规格
isShow2: false, // 修改的可见性
hard: [{ value: 'A' }, { value: 'B' }, { value: 'C' }],
disabled: false
}
},
created() {
this.fetchData()
this.initPerson()
},
methods: {
fetchData() {
initCraftmen().then(response => { // 初始化工艺员
for (let i = 0; i < response.data.length; i++) {
this.Craftmen.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
getProject(0).then(response => { // 初始化项目
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
initTolerance().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.selPara.push({
value: response.data[i].参数
})
}
})
},
clear() {
this.typeValue = ''
this.partName = ''
this.partNum = ''
this.materialName = ''
this.spec = ''
this.batchNum = ''
},
clearDetail() {
if (this.radio === 1) {
this.isShow2 = true
} else {
this.isShow2 = false
}
this.checked = false
this.projectNameValue = ''
this.projectName = []
getProject(this.radio).then(response => { // 初始化项目
for (let i = 0; i < response.data.length; i++) {
this.projectName.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
this.machineValue = ''
this.Machine = []
this.groupNumberValue = ''
this.groupNumber = []
this.partNum = ''
this.typeValue = ''
this.partName = ''
this.materialName = ''
this.spec = ''
this.batchNum = ''
this.tableData = []
},
returnEdit() { // 工艺修改
if (this.partNum === '' || this.partNum === null) {
this.$message.error('请选择零件')
} else {
this.$confirm('此操作会将该零件打回至未编制状态, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
returnEdit(this.ProcessFlowNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('打回成功')
this.ProcessFlowNumber = ''
this.partNum = ''
this.tableData = []
} else {
this.$message.error('打回失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
},
searchMachine() {
this.clear()
this.machineValue = ''
this.Machine = []
this.groupNumberValue = ''
this.groupNumber = []
getMachine(this.radio, this.projectNameValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
searchGroup() {
this.clear()
this.groupNumberValue = ''
this.groupNumber = []
getGroup(this.radio, this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
changeGroup() {
this.clear()
for (let i = 0; i < this.groupNumber.length; i++) {
if (this.groupNumber[i].value === this.groupNumberValue) {
this.groupNum = this.groupNumber[i].label
}
}
if (this.groupNum.indexOf('MX') !== -1) {
this.groupType = 0
} else {
this.groupType = 1
}
},
searchParts() { // 根据条件查零件号
if (this.groupNumberValue !== '') {
if (this.radio === 0) { // 未编制
this.disabled = false
this.isShow2 = false
this.checked1 = true
} else { // 已编制
this.isShow = true
this.isShow2 = true
this.disabled = true
this.checked1 = false
}
this.pageCurrent = 1
this.pageSize = 10
getPartnames1(this.radio, this.groupNumberValue, this.groupType, this.pageCurrent, this.pageSize).then(response => {
if (this.groupType === 0) {
this.dialogFormVisible5 = true
this.tableData9 = response.data.rows
console.log(response.data)
this.total = response.data.total
} else {
this.dialogFormVisible4 = true
this.tableData8 = response.data.rows
this.total = response.data.total
}
})
} else {
this.$message.warning('请先选择组号')
}
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
getPartnames1(this.radio, this.groupNumberValue, this.groupType, this.pageCurrent, this.pageSize).then(response => {
if (this.groupType === 0) {
this.dialogFormVisible5 = true
this.tableData9 = response.data.rows
this.total = response.data.total
} else {
this.dialogFormVisible4 = true
this.tableData8 = response.data.rows
this.total = response.data.total
}
})
},
handleCurrentChange(val) {
this.pageCurrent = val
getPartnames1(this.radio, this.groupNumberValue, this.groupType, this.pageCurrent, this.pageSize).then(response => {
if (this.groupType === 0) {
this.dialogFormVisible5 = true
this.tableData9 = response.data.rows
this.total = response.data.total
} else {
this.dialogFormVisible4 = true
this.tableData8 = response.data.rows
this.total = response.data.total
}
})
},
searchMachine1() {
this.machineValue1 = ''
this.Machine1 = []
this.groupNumberValue1 = ''
this.groupNumber1 = []
getMachine(1, this.projectNameValue1).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine1.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
searchGroup1() {
this.groupNumberValue1 = ''
this.groupNumber1 = []
getGroup(1, this.machineValue1).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNumber1.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
changeGroup1() {
for (let i = 0; i < this.groupNumber1.length; i++) {
if (this.groupNumber1[i].value === this.groupNumberValue1) {
this.groupNum1 = this.groupNumber1[i].label
}
}
if (this.groupNum1.indexOf('MX') !== -1) {
this.groupType1 = 0
} else {
this.groupType1 = 1
}
},
searchParts1() { // 根据条件查零件号
if (this.groupNumberValue1 !== '') {
this.pageCurrent1 = 1
this.pageSize1 = 10
getPartnames1(1, this.groupNumberValue1, this.groupType1, this.pageCurrent1, this.pageSize1).then(response => {
if (this.groupType1 === 0) {
this.dialogFormVisible7 = true
this.tableData11 = response.data.rows
console.log(response.data)
this.total1 = response.data.total
} else {
this.dialogFormVisible6 = true
this.tableData10 = response.data.rows
this.total1 = response.data.total
}
})
} else {
this.$message.warning('请先选择组号')
}
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
getPartnames1(1, this.groupNumberValue1, this.groupType1, this.pageCurrent1, this.pageSize1).then(response => {
if (this.groupType1 === 0) {
this.dialogFormVisible7 = true
this.tableData11 = response.data.rows
console.log(response.data)
this.total1 = response.data.total
} else {
this.dialogFormVisible6 = true
this.tableData10 = response.data.rows
this.total1 = response.data.total
}
})
},
handleCurrentChange1(val) {
this.pageCurrent1 = val
getPartnames1(1, this.groupNumberValue1, this.groupType1, this.pageCurrent1, this.pageSize1).then(response => {
if (this.groupType1 === 0) {
this.dialogFormVisible7 = true
this.tableData11 = response.data.rows
console.log(response.data)
this.total1 = response.data.total
} else {
this.dialogFormVisible6 = true
this.tableData10 = response.data.rows
this.total1 = response.data.total
}
})
},
selectParts(row) {
this.ProcessFlowNumber = row.工艺流水号
if (row.零件类型 === '1') {
this.typeValue = '标准件'
} else if (row.零件类型 === '2') {
this.typeValue = '外购件'
}
this.partName = row.物料型号
this.spec = row.物料规格
this.batchNum = row.批次数量
this.partNum = row.物料名称
},
selectParts1(row) {
this.ProcessFlowNumber = row.工艺流水号
if (row.零件类型 === '3') {
this.typeValue = '基本件'
}
this.partName = row.物料名称
this.materialName = row.材料
this.batchNum = row.批次数量
this.partNum = row.零件图号
},
selectParts2(row) {
this.ProcessFlowNumber1 = row.工艺流水号
this.partNum1 = row.物料名称
},
selectParts3(row) {
this.ProcessFlowNumber1 = row.工艺流水号
this.partNum1 = row.零件图号
},
submit() {
this.dialogFormVisible4 = false
this.dialogFormVisible5 = false
},
submit1() {
this.dialogFormVisible6 = false
this.dialogFormVisible7 = false
},
searchDetail() { // 查主表的信息
if (this.partNum === '' || this.partNum === null) {
this.$message.error('请选择零件作为查询对象')
} else {
this.loading0 = true
getProcedure(this.ProcessFlowNumber).then(response => {
this.tableData = []
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工艺编号 === null) {
response.data[i].工艺编号 = 0
}
if (response.data[i].工艺要求 === null) {
response.data[i].工艺要求 = ''
}
}
this.tableData = response.data
}).then(() => {
this.loading0 = false
})
}
},
searchDetail1() { // 查主表的信息
if (this.partNum1 === '' || this.partNum1 === null) {
this.$message.error('请选择零件作为查询对象')
} else {
getProcedure(this.ProcessFlowNumber1).then(response => {
this.tableData4 = []
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].工艺编号 === null) {
response.data[i].工艺编号 = 0
}
if (response.data[i].工艺要求 === null) {
response.data[i].工艺要求 = ''
}
}
this.tableData4 = response.data
})
}
},
WYbtn() { // 完艺按钮
this.tableData4 = []
this.dialogFormVisible1 = true
this.projectNameValue1 = ''
this.projectName1 = []
this.machineValue1 = ''
this.Machine1 = []
this.groupNumberValue1 = ''
this.groupNumber1 = []
this.partNum1 = ''
getProject(1).then(response => { // 初始化项目
for (let i = 0; i < response.data.length; i++) {
this.projectName1.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
processCopy1() { // 完艺工艺拷贝
this.dialogFormVisible1 = false
if (this.partNum === '') {
this.$message.error('请在主界面选择一个零件作为被拷贝对象')
} else {
gongyiCopy(this.ProcessFlowNumber1, this.ProcessFlowNumber).then(() => { // 工艺计划流水号_完成工艺, 工艺计划流水号_被拷工艺
this.searchDetail()
})
}
},
hardEdit(row) { // 修改难度等级
hardEdit(row.外购件工序流水号, row.工艺难度等级).then(response => {
})
},
requestEdit(row) { // 修改工艺要求
requestEdit(row.外购件工序流水号, row.工艺要求).then(response => {
})
},
tableSearch(index) { // 主界面工艺名称分类、工艺名称及工艺要求后续查询
if (this.checked1 === false) {
this.dialogFormVisible2 = false
} else {
this.dialogFormVisible2 = true
if (index !== this.index) {
this.str = '' // 清字符串
}
this.index = index
this.processNameClassValue = ''
this.processNameValue = ''
this.processRequestValue = ''
this.processNameClass = []
this.processName = []
this.processRequest = []
processNameClick().then(response => { // 初始化工艺名称的
for (let i = 0; i < response.data.length; i++) {
this.processNameClass.push({ // 工艺名称分类
value: response.data[i].工艺分类名称
})
this.processSelect.push({ // 工艺分类流水号
value: response.data[i].工艺分类流水号
})
}
})
}
},
cChange() { // 工艺名称分类改变
this.processNameValue = ''
this.processName = []
this.processRequestValue = ''
this.processRequest = []
for (let i = 0; i < this.processNameClass.length; i++) {
if (this.processNameClassValue === this.processNameClass[i].value) {
processNameSelect(this.processSelect[i].value).then(response => { // 查询工艺名称
for (let j = 0; j < response.data.length; j++) {
this.processName.push({
value: response.data[j].工艺名称,
num: response.data[j].工艺编号
})
}
})
}
}
},
nChange() { // 工艺名称改变
this.processRequestValue = ''
this.processRequest = []
for (let i = 0; i < this.processName.length; i++) {
if (this.processNameValue === this.processName[i].value) {
this.processN1 = this.processName[i].num // 工艺编号
processRequestSelect(this.processName[i].num).then(response => { // 查询工艺要求
for (let j = 0; j < response.data.length; j++) {
this.processRequest.push({
value: response.data[j].工艺要求
})
}
})
}
}
},
confirmSelect() { // 确定选择主表的工艺名称及要求
this.tableData[this.index].工艺编号 = this.processN1
this.tableData[this.index].工艺名称 = this.processNameValue
this.str = this.str + ' ' + this.processRequestValue
this.tableData[this.index].工艺要求 = this.str
this.dialogFormVisible2 = false
selectRequest(this.tableData[this.index].外购件工序流水号, this.tableData[this.index].工艺流水号, this.tableData[this.index].工艺编号, this.tableData[this.index].工序顺序, this.tableData[this.index].工艺要求).then(response => {
})
},
calTol() { // 计算公差
this.tolerance = ''
for (let i = 0; i < this.selPara.length; i++) {
if (this.selParaValue === this.selPara[i].value) {
break
}
}
searchTolerance(this.numVal, this.selParaValue).then(response => {
if (response.data.length !== 0) { // 防止超出范围报错
this.tolerance = response.data[0].公差
} else {
this.$message.error('输入的数值不对!')
}
})
},
saveApprove() { // 核准保存
if (this.checked === true) {
saveApprove(this.ProcessFlowNumber, this.CraftmenValue).then(response => {
if (response.data.length === 1) {
this.checked = false
this.partNum = ''
this.typeValue = ''
this.partName = ''
this.batchNum = ''
this.materialName = ''
this.spec = ''
this.tableData = []
this.$message.success('保存成功')
} else {
this.$message.error('保存失败')
}
})
} else {
this.$message.error('请核准后保存')
}
},
insertOne(row) { // 插入行
if (this.partNum === '') {
this.$message.error('请先选择一个零件')
} else {
insertOne(this.ProcessFlowNumber, row.外购件工序流水号).then(response => {
this.searchDetail()
})
}
},
deleteOne(row) { // 删除行
if (this.partNum === '') {
this.$message.error('请先选择一个零件')
} else {
this.$confirm('此操作将永久删除该行工艺, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOne(this.ProcessFlowNumber, row.外购件工序流水号).then(() => {
this.$message.success('删除成功')
this.searchDetail()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
},
upOne(row) { // 上移
if (this.partNum === '') {
this.$message.error('请先选择一个零件')
} else {
upOne(this.ProcessFlowNumber, row.外购件工序流水号).then(response => {
this.searchDetail()
})
}
},
downOne(row) { // 下移
if (this.partNum === '') {
this.$message.error('请先选择一个零件')
} else {
downOne(this.ProcessFlowNumber, row.外购件工序流水号).then(response => {
this.searchDetail()
})
}
},
deleteTable() { // 删除
if (this.partNum === '') {
this.$message.error('请选择一个零件')
} else {
this.$confirm('此操作将永久删除该零件的工艺, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (let i = 0; i < 20; i++) {
hardEdit(this.tableData[i].外购件工序流水号, '').then(response => {
})
}
deleteTable(this.ProcessFlowNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('删除成功')
this.searchDetail()
} else {
this.$message.error('删除失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
}
</script>
<style scoped>
.doing-row4 {
background: #f0f9eb;
}
.el-card {
margin-bottom: 15px;
}
.el-date-editor {
width: 150px
}
span {
margin: 10px 0 10px 10px;
}
</style>
<style>
.el-table .change {
background: oldlace;
}
</style>