Files
JY1.0/src/views/ManufacturingCenter/ProcessPlanning/index.vue
zhangdingyu 7cdb10d153 1205
2018-12-05 10:40:07 +08:00

1239 lines
43 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container">
<el-card>
<el-radio-group
v-model="radio"
size="small"
style="margin: 10px;"
@change="CraftmenValue = '';checked = false;
partNumValue = '';typeValue = '';partName = '';
material = '';materialName = '';spec = '';batchNum = '';
searchParts()">
<el-radio v-model="radio" :label="1">未编制</el-radio>
<el-radio v-model="radio" :label="2">已编制</el-radio>
</el-radio-group>
<span>工艺员:</span>
<el-select
v-model="CraftmenValue"
placeholder="工艺员"
size="small"
style="width:100px"
@change="clearDetail();searchParts()">
<el-option
v-for="item in Craftmen"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件号:</span>
<el-select
v-model="partNumValue"
filterable
clearable
placeholder="零件号"
size="small"
@clear="clearDetail"
@change="searchParts">
<el-option
v-for="item in partNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<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>
<el-button v-show="!isShow2" plain size="small" style="margin: 10px;float:right" @click="switchEdit()">切换编辑模式
</el-button>
<div v-show="isShow">
<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:215px" readonly>
<el-button slot="prepend" icon="el-icon-search" @click="dialogMaterial=true"/>
<el-button slot="append" icon="el-icon-cjn-09" @click="saveMaterial"/>
</el-input>
<el-checkbox v-model="checked" :disabled="isShow2" size="small" style="margin:10px">是否核准</el-checkbox>
<span>规格:</span>
<el-input v-model="spec" :readonly="isShow2" style="width:100px" size="small" placeholder="规格"/>
<span>投产总数量:</span>
<el-input v-model="batchNum" 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 v-if="isShow1" style="margin: 10px">
<el-button v-if="isShow1" type="info" size="small" icon="el-icon-tickets" @click="copyAndSave">复制并保存
</el-button>
<el-button v-if="isShow1" type="info" size="small" icon="el-icon-document" @click="pasteTable">粘贴</el-button>
<el-button :disabled="disabled" type="warning" size="small" icon="el-icon-tickets" @click="DYbtn">典艺
</el-button>
<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"
@dblclick.native="tableSearch(scope.$index)"
@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="dialogMaterial" title="材质选择" center width="400px">
<el-input v-model="input" placeholder="材质" size="small" style="width:200px"/>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin: 0 0 10px 10px"
@click="total=0;pageCurrent=1;pageSize=10;searchMaterial()">查询
</el-button>
<el-table
:data="tableMaterial"
size="mini"
highlight-current-row
border
@row-click="selectMaterial">
<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" size="small" @click="selectMaterial2()">提交</el-button>
</div>
</el-dialog>
<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="dialogFormVisible" title="典型工艺选择" center width="800px">
<el-form ref="form" :model="form" label-position="left" label-width="125px" class="demo-ruleForm">
<el-row>
<el-col :span="10">
<el-form-item label="典型工艺零件分类">
<el-select
v-model="typicalClassValue"
placeholder="分类"
size="small"
style="width:150px"
@change="classChange()">
<el-option
v-for="item in typicalClass"
: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
id="name"
v-model="partNameValue1"
placeholder="零件名称"
size="small"
style="width:150px"
@change="nameChange()">
<el-option
v-for="item in partName1"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button type="success" size="small" icon="el-icon-search" @click="searchProcess()">查询</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="典型工艺号">
<el-select
id="num"
v-model="processNumValue"
placeholder="工艺号"
style="width:150px"
size="small"
@change="numChange()">
<el-option
v-for="item in partName1"
:key="item.value"
:label="item.num"
:value="item.value"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="备注">
<el-input v-model="remark" size="small" readonly style="width: 150px;"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button size="small" @click="processCopy()">工艺拷贝</el-button>
</el-col>
</el-row>
<el-table
:data="tableData2"
style="width: 97%;max-height: 300px;margin-top:15px"
height="300px"
border
size="mini">
<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="180">
<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="80">
<template slot-scope="scope">
{{ scope.row.工艺难度等级 }}
</template>
</el-table-column>
</el-table>
</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-input v-model="CraftmanValue" clearable size="small" readonly style="width: 150px;">
<el-button slot="append" icon="el-icon-search" @click="dialogFormVisible3=true"/>
</el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="零件号">
<el-input v-model="PN" size="small" placeholder="输入零件号" style="width: 150px" @change="inputChange"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="工艺定制开始日期">
<el-date-picker
v-model="date01"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择开始日期"/>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="工艺定制结束日期">
<el-date-picker
v-model="date02"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
size="small"
placeholder="选择结束日期"/>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button size="small" type="success" icon="el-icon-search" @click="searchProcess1()">查询</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="零件图号">
<el-select
v-model="tuhaoValue"
placeholder="零件图号"
size="small"
style="width:150px"
@change="numChange1()">
<el-option
v-for="item in tuhao"
: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="remark1" size="small" readonly style="width: 150px;"/>
</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="dialogFormVisible3"
title="工艺定额人员"
center
style="min-height: 300px">
<el-table
:data="tableData3"
size="mini"
style="width: 97%;max-height: 300px"
height="300"
highlight-current-row
border
@row-click="selectPerson">
<el-table-column align="center" label="考勤编号" width="150">
<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="150">
<template slot-scope="scope">
{{ scope.row.性别 }}
</template>
</el-table-column>
<el-table-column align="center" label="工作岗位" width="150">
<template slot-scope="scope">
{{ scope.row.岗位名称 }}
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="tijiao()">提交</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import '@/icon/iconfont.css'
import {
initCraftmen,
getPartnames1,
getPartnames2,
detailInfo,
mainTable,
getMaterial,
searchMaterial,
typicalProcess,
initTolerance,
FcK,
searchProcess,
searchWYgongyi,
gongyiCopy,
initPerson,
gongyiYQ,
hardEdit,
requestEdit,
processNameClick,
processNameSelect,
processRequestSelect,
searchTolerance,
insertOne,
deleteOne,
upOne,
downOne,
saveMaterial,
saveApprove,
selectRequest,
pasteTable,
deleteTable,
returnEdit,
searchRecord
} from '@/api/ManufacturingCenter/ProcessPlanning'
import elInput from 'element-ui/packages/input'
export default {
components: {
elInput
},
data() {
return {
total: 0,
pageCurrent: 1,
pageSize: 10,
input: '', // 材质对话框查询1
tableMaterial: [],
dialogMaterial: false,
loading0: false,
radio: 1, // 第一组
partNumValue: '', // 零件号值
partNum: [], // 零件号
typeValue: '', // 种类
CraftmenValue: '', // 工艺员值
Craftmen: [], // 工艺员
CraftmanValue: '', // 完艺表单工艺员值
CraftmanValue2: '', // 完艺表单工艺员值中间变量
Craftman: [], // 完艺表单工艺员
partName: '', // 零件名称
batchNum: '', // 投产总数量
material: '', // 材质流水号
materialName: '', // 材质名称
materialClass: [], // 材质类
typicalClassValue: '', // 典型工艺零件分类值
typicalClass: [], // 典型工艺零件分类
partNameValue1: '', // 典型工艺零件名称值
partName1: [], // 典型工艺零件名称
partNameValue1check: false, // 典型工艺零件名称check
processNumValue: '', // 典型工艺号值
processNum: [], // 典型工艺号
processNumValuecheck: false, // 典型工艺号check
remark: '', // 备注
remark1: '', // 完艺零件名称
dialogFormVisible: false, // 典艺对话框可见性
dialogFormVisible1: false, // 完艺对话框可见性
dialogFormVisible2: false, // 主界面查询工艺名称要求对话框可见性
dialogFormVisible3: false, // 完艺对话框中选择工艺员可见性
form: null, // 典艺表单
form1: null, // 完艺表单
form2: null, // 主界面查询表单
serialNum1: [], // 典型工艺名称分类流水号
serialNumValue1: '1', // 典型工艺名称分类流水号值,初值1否则置空时无参数
serialNumValue1check: false, // 典型工艺名称分类流水号check
serialNum2: [], // 典型工艺流水号
serialNumValue2: '1', // 典型工艺流水号值初值1否则置空时无参数
numVal: '', // 输入数值
selPara: [], // 选择参数数组
selParaValue: '', // 选择参数值
tolerance: '', // 公差
tableData: [], // 主表
tableData2: [], // 典艺内的表格
tableData3: [], // 工艺定额人员
tableData4: [], // 完艺表格
processSelect: [], // 工艺分类流水号
processNameClass: [], // 工艺名称分类
processNameClassValue: '',
processName: [], // 工艺名称
processNameValue: '',
processRequest: [], // 工艺要求
processRequestValue: '',
processN1: '', // 工艺编号
str: '', // 拼接字符串用的
value: '', // 第一个select的
checked: false, // 是否核准
checked1: false, // 修改
spec: '', // 规格
isShow: true, // '编辑模式'可见性
isShow1: true, // “复制并保存”“粘贴”按钮的可见性
isShow2: false, // 修改的可见性
date01: '', // 完艺开始时间
date02: '', // 完艺结束时间
PN: '', // 零件号
num: '', // 工艺计划流水号
perNum: '',
perNum2: '',
tuhao: [],
tuhaoValue: '',
check1: 0,
check2: 0,
check3: 0,
check4: 0,
hard: [{ value: 'A' }, { value: 'B' }, { value: 'C' }],
disabled: false,
result: 0,
oldNum: '',
newNum: '',
tableRecord: [],
materialName2: '',
material2: ''
}
},
created() {
this.fetchData()
this.initPerson()
this.getList()
},
methods: {
clearDetail() {
this.checked = false
this.partNumValue = ''
this.typeValue = ''
this.partName = ''
this.material = ''
this.materialName = ''
this.spec = ''
this.batchNum = ''
},
returnEdit() { // 在制零件工艺修改
if (this.partNumValue === '' || this.partNumValue === null) {
this.$message.error('请选择零件')
} else {
this.$confirm('此操作会将该零件打回至未编制状态, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
returnEdit(this.partNumValue).then(response => {
if (response.data[0].result === '1') {
this.$message.success('打回成功')
this.partNumValue = ''
this.tableData = []
} else {
this.$message.error('打回失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
}
},
handleCurrentChange(val) { // 材质分页
this.pageCurrent = val
if (this.input === '' || this.input === null) {
this.getList()
} else {
this.searchMaterial()
}
},
handleSizeChange(val) { // 材质分页
this.pageCurrent = 1
this.pageSize = val
if (this.input === '' || this.input === null) {
this.getList()
} else {
this.searchMaterial()
}
},
selectMaterial(row) { // 选择材质
this.materialName2 = ''
this.material2 = ''
this.materialName2 = row.材料
this.material2 = row.材料流水号
},
selectMaterial2() {
this.materialName = ''
this.material = ''
this.materialName = this.materialName2
this.material = this.material2
this.dialogMaterial = false
},
fetchData() {
this.materialClass = []
getMaterial().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.materialClass.push({
label: response.data[i].材料,
value: response.data[i].材料流水号
})
}
})
initCraftmen().then(response => { // 初始化工艺员
for (let i = 0; i < response.data.length; i++) {
this.Craftmen.push({
label: response.data[i].姓名,
value: response.data[i].人员编号
})
}
})
typicalProcess().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.typicalClass.push({
value: response.data[i].典型工艺名称分类
})
this.serialNum1.push({
value: response.data[i].典型工艺名称分类流水号
})
}
})
initTolerance().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.selPara.push({
value: response.data[i].参数
})
}
})
},
initPerson() { // 初始化工艺员
initPerson().then(response => {
this.tableData3 = response.data
})
},
getList() { // 往材质对话框中放
this.tableMaterial = []
getMaterial(this.pageCurrent, this.pageSize).then(response => {
this.total = response.data.total
this.tableMaterial = response.data.rows
})
},
searchMaterial() { // 材质查询
searchMaterial(this.pageCurrent, this.pageSize, this.input).then(response => {
this.total = response.data.total
this.tableMaterial = response.data.rows
})
},
searchParts() { // 根据条件查零件号
this.tableData = []
this.partNum = []
if (this.radio === 1) { // 未编制
this.disabled = false
this.isShow1 = true
this.isShow2 = false
this.checked1 = true
getPartnames1(this.CraftmenValue, this.partNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
} else { // 已编制
this.isShow = true
this.isShow1 = false
this.isShow2 = true
this.disabled = true
this.checked1 = false
getPartnames2(this.CraftmenValue, this.partNumValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.partNum.push({
label: response.data[i].零件图号,
value: response.data[i].工艺计划流水号
})
}
})
}
},
switchEdit() { // 切换编辑模式
if (this.radio === 1) {
this.isShow = !this.isShow
} else {
this.isShow = true
}
},
searchDetail() { // 查主表和上面显示的信息
if (this.partNumValue === '' || this.partNumValue === null) {
this.$message.error('请选择零件作为查询对象')
} else {
this.loading0 = true
detailInfo(this.partNumValue).then(response => {
if (response.data.length !== 0) {
this.typeValue = response.data[0].零件类型名称
this.partName = response.data[0].零件名称
this.batchNum = response.data[0].批次数量
this.material = response.data[0].材料流水号
this.materialName = response.data[0].材料
this.spec = response.data[0].原材料规格
}
})
this.tableRecord = []
searchRecord(this.partNumValue).then(response => {
this.tableRecord = response.data
})
mainTable(this.partNumValue).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
this.newNum = this.partNumValue
}).then(() => {
this.loading0 = false
})
}
},
DYbtn() { // 典艺按钮
this.dialogFormVisible = true
this.processNumValue = ''
this.partNameValue1 = ''
this.typicalClassValue = ''
this.remark = ''
this.serialNumValue1 = '1' // 有默认值
this.serialNumValue2 = '1' // 有默认值
this.tableData2 = null
},
WYbtn() { // 完艺按钮
this.tableData4 = []
this.dialogFormVisible1 = true
},
selectPerson(row) { // 选择工艺员
this.CraftmanValue2 = row.姓名
this.perNum2 = row.人员编号
},
tijiao() { // 提交完艺表单中工艺定额人员的选择
this.dialogFormVisible3 = false
this.CraftmanValue = this.CraftmanValue2
this.perNum = this.perNum2
this.remark1 = ''
this.tuhaoValue = ''
},
inputChange() { // 零件号改变
this.remark1 = ''
this.tuhaoValue = ''
},
classChange() { // 当分类改变时,获取零件名称和典型工艺流水号
this.partNameValue1 = ''
this.processNumValue = ''
for (let i = 0; i < this.typicalClass.length; i++) {
if (this.typicalClassValue === this.typicalClass[i].value) {
this.serialNumValue1 = this.serialNum1[i].value
FcK(this.serialNumValue1).then(response => {
this.partName1 = []
this.processNum = []
this.remark = response.data[0].备注
for (let j = 0; j < response.data.length; j++) {
this.partName1.push({
label: response.data[j].典型工艺名称,
num: response.data[j].典型工艺号,
value: response.data[j].典型工艺流水号
})
}
})
}
}
},
nameChange() { // 当零件名称改变时,典型工艺号改变
for (let i = 0; i < this.partName1.length; i++) {
if (this.partNameValue1 === this.partName1[i].value) {
this.processNumValue = this.partName1[i].num
this.serialNumValue2 = this.partNameValue1
}
}
},
numChange() { // 当典型工艺号改变时,零件名称改变
for (let i = 0; i < this.partName1.length; i++) {
if (this.processNumValue === this.partName1[i].value) {
this.partNameValue1 = this.partName1[i].value
this.serialNumValue2 = this.partNameValue1
}
}
},
searchProcess() { // 典艺工艺查询
if (this.typicalClassValue === '') {
this.serialNumValue1check = false
} else {
this.serialNumValue1check = true
}
if (this.partNameValue1 === '') {
this.partNameValue1check = false
} else {
this.partNameValue1check = true
}
if (this.processNumValue === '') {
this.processNumValuecheck = false
} else {
this.processNumValuecheck = true
}
this.tableData2 = []
searchProcess(this.serialNumValue1check, this.serialNumValue1, this.partNameValue1check, this.serialNumValue2, this.processNumValuecheck, this.serialNumValue2).then(response => {
this.tableData2 = response.data
})
},
processCopy() { // 典艺工艺拷贝
if (this.partNumValue === '') {
this.$message.error('请在主界面选择一个零件作为被拷贝对象')
this.dialogFormVisible = false
} else if (this.partNameValue1 === '') {
this.$message.error('请选择零件名称')
} else {
for (let i = 0; i < this.tableData2.length; i++) {
this.tableData[i].工艺名称 = this.tableData2[i].工艺名称
this.tableData[i].工艺难度等级 = this.tableData2[i].工艺难度等级
this.tableData[i].工艺要求 = this.tableData2[i].工艺要求
selectRequest(this.tableData[i].工序流水号, this.tableData[i].工艺计划流水号, this.tableData2[i].工艺编号, this.tableData2[i].工艺序号, this.tableData2[i].工艺要求).then(response => {
})
hardEdit(this.tableData[i].工序流水号, this.tableData2[i].工艺难度等级).then(response => {
})
this.dialogFormVisible = false
}
}
},
searchProcess1() { // 完艺工艺查询
this.tuhao = []
if (this.PN === '') { // 零件号
this.check1 = 0
} else {
this.check1 = 1
}
if (this.perNum === '') { // 工艺员编号
this.check2 = 0
} else {
this.check2 = 1
}
if (this.remark1 === '') { // 零件名称
this.check4 = 0
} else {
this.check4 = 1
}
if (this.date01 === '' || this.date02 === '' || this.date01 === null || this.date02 === null) { // 日期
this.check3 = 0
} else {
this.check3 = 1
}
searchWYgongyi(this.check1, this.PN, this.check2, this.perNum, this.check3, this.date01, this.date02, this.check4, this.remark1).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.tuhao.push({
value: response.data[i].零件图号,
name: response.data[i].零件名称,
num: response.data[i].工艺计划流水号
})
}
})
},
processCopy1() { // 完艺工艺拷贝
this.dialogFormVisible1 = false
if (this.partNumValue === '') {
this.$message.error('请在主界面选择一个零件作为被拷贝对象')
} else {
gongyiCopy(this.num, this.partNumValue).then(() => { // 工艺计划流水号_完成工艺, 工艺计划流水号_被拷工艺
this.searchDetail()
})
}
},
numChange1() { // 当完成工艺号改变时,零件名称改变,并获取工艺要求
this.remark1 = ''
this.tableData4 = null
for (let i = 0; i < this.tuhao.length; i++) {
if (this.tuhaoValue === this.tuhao[i].value) {
this.remark1 = this.tuhao[i].name
this.num = this.tuhao[i].num
}
}
gongyiYQ(this.num).then(response => {
this.tableData4 = response.data
})
},
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('输入的数值不对!')
}
})
},
copyAndSave() { // 复制并保存
if (this.tableData.length !== 0) {
this.oldNum = this.tableData[0].工艺计划流水号
this.saveApprove()
} else {
this.$message.error('当前没有可以被复制的工艺')
}
},
saveApprove() { // 核准保存
if (this.checked === true) {
for (let i = 0; i < 30; i++) {
saveApprove(this.tableData[i].工艺计划流水号, this.tableData[i].工艺编号, this.tableData[i].工艺要求, this.spec, this.tableData[i].工序顺序, this.tableData[i].工序间是否外协, this.tableData[i].工序流水号, this.material, '', '', this.CraftmenValue, this.tableData[i].工艺难度等级)
}
this.checked = false
this.partNumValue = ''
this.typeValue = ''
this.partName = ''
this.batchNum = ''
this.material = ''
this.materialName = ''
this.spec = ''
this.newNum = ''
this.$message.success('保存成功')
this.searchParts()
} else {
this.$message.error('请核准后保存')
}
},
insertOne(row) { // 插入行
if (this.partNumValue === '') {
this.$message.error('请先选择一个零件')
} else {
insertOne(this.partNumValue, row.工序流水号).then(response => {
this.searchDetail()
})
}
},
deleteOne(row) { // 删除行
if (this.partNumValue === '') {
this.$message.error('请先选择一个零件')
} else {
this.$confirm('此操作将永久删除该行工艺, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteOne(this.partNumValue, row.工序流水号).then(() => {
this.$message.success('删除成功')
this.searchDetail()
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
},
upOne(row) { // 上移
if (this.partNumValue === '') {
this.$message.error('请先选择一个零件')
} else {
upOne(this.partNumValue, row.工序流水号).then(response => {
this.searchDetail()
})
}
},
downOne(row) { // 下移
if (this.partNumValue === '') {
this.$message.error('请先选择一个零件')
} else {
downOne(this.partNumValue, row.工序流水号).then(response => {
this.searchDetail()
})
}
},
saveMaterial() { // 保存材质
if (this.partNumValue === '' || this.material === '') {
this.$message.error('请选择一个零件')
} else {
saveMaterial(this.partNumValue, this.material).then(response => {
if (response.data[0].result === '1') {
this.$message.success('保存成功')
} else {
this.$message.error('保存失败')
}
})
}
},
pasteTable() { // 粘贴
if (this.partNumValue === '' || this.partNumValue === null) {
this.$message.error('请选择零件作为被粘贴对象')
} else {
pasteTable(this.oldNum, this.newNum).then(response => {
if (response.data[0].result === '1') {
this.$message.success('粘贴成功')
this.searchDetail()
} else {
this.$message.error('粘贴失败')
}
})
}
},
deleteTable() { // 删除
if (this.newNum === '') {
this.$message.error('请选择一个零件')
} else {
this.$confirm('此操作将永久删除该零件的工艺, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
for (let i = 0; i < 30; i++) {
hardEdit(this.tableData[i].工序流水号, '').then(response => {
})
}
deleteTable(this.newNum).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>