装箱单修改

This commit is contained in:
hedekun
2018-11-27 13:57:32 +08:00
parent 08683fbe0c
commit cc3424a2f2
7 changed files with 143 additions and 95 deletions

View File

@@ -260,7 +260,7 @@
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
type="primary"
icon="el-icon-edit"
@click="editFile(scope.row)">编辑</el-button>
<el-button
@@ -274,7 +274,7 @@
</el-card>
<el-dialog :title="receiptTitle" :visible.sync="receiptVisible" center style="min-height: 200px" width="800px">
<el-form ref="receiptForm" :rules="rules" :model="receiptForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="receiptForm" :rules="receiptRules" :model="receiptForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="12">
<el-form-item label="装箱单号" prop="装箱单号">
@@ -321,10 +321,10 @@
</el-dialog>
<el-dialog :visible.sync="machineVisible" :title="machineTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="machineForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="machineForm" :rules="machineRules" :model="machineForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col v-if="machineTitle==='添加主机'" :span="24">
<el-form-item label="机床号" prop="装箱单号">
<el-form-item label="机床号" prop="机床号">
<el-select v-model="machineValue" placeholder="请选择机床图号" filterable size="small">
<el-option
v-for="item in machine"
@@ -354,7 +354,7 @@
</el-dialog>
<el-dialog :visible.sync="fileVisible" :title="fileTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="fileForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="fileForm" :rules="filerules" :model="fileForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="24">
<el-form-item label="名称" prop="名称">
@@ -381,7 +381,7 @@
</el-dialog>
<el-dialog :visible.sync="spareVisible" :title="spareTitle" center style="min-height: 200px" width="400px">
<el-form ref="machineForm" :rules="rules" :model="spareForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-form ref="spareForm" :rules="spareRule" :model="spareForm" label-position="left" label-width="110px" class="demo-ruleForm">
<el-row>
<el-col :span="24">
<el-form-item label="名称" prop="名称">
@@ -439,13 +439,17 @@ export default {
spareVisible: false,
spareTitle: '',
spareForm: {
: '',
备件编: '',
名称: '',
规格: '',
单位: '',
备注: '',
数量: ''
},
spareRule: {
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
spareData: [],
receiptForm: {
装箱单号: '',
@@ -455,12 +459,21 @@ export default {
联系人: '',
联系方式: ''
},
receiptRules: {
装箱单号: [{ required: true, message: '请输入装箱单号', trigger: 'blur' }],
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
发货节点: [{ required: true, message: '请输入发货节点', trigger: 'blur' }]
},
machineForm: {
序号: '',
机床号: '',
备注: '',
数量: ''
},
machineRules: {
机床号: [{ required: true, message: '请选择机床号', trigger: 'change' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
},
rules: {
},
machineTableData: [],
@@ -469,10 +482,14 @@ export default {
fileVisible: false,
fileTitle: '',
fileForm: {
: '',
文件编: '',
名称: '',
数量: '',
备注: ''
},
filerules: {
名称: [{ required: true, message: '请输入名称', trigger: 'blur' }],
数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
}
}
},
@@ -495,6 +512,10 @@ export default {
}
},
projectValue(val) {
this.machineTableData = []
this.receiptData = []
this.spareData = []
this.fileData = []
if (val) {
this.getMachineSelect(val)
}
@@ -570,8 +591,11 @@ export default {
cancel() {
this.receiptVisible = false
this.machineVisible = false
this.fileVisible = false
this.spareVisible = false
},
async getMachineData() {
this.machineTableData = []
const response = await getMachineData(this.receiptNum)
const data = response.data
for (let i = 0; i < data.length; i++) {
@@ -598,11 +622,15 @@ export default {
})
},
async submitAddMachine() {
const response = await addMachineData(this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addMachineData, [this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum], 'machineForm', function() {
this.machineVisible = false
this.getMachineData()
}
})
// const response = await addMachineData(this.projectName, this.machineValue, this.machineForm.备注, this.machineForm.数量, this.receiptNum)
// if (response.data[0].result === '1') {
// this.machineVisible = false
// this.getMachineData()
// }
},
editMachine(row) {
this.editForm(row, 'machineForm', function() {
@@ -611,11 +639,15 @@ export default {
})
},
async submitEditMachine() {
const response = await updateMachineData(this.machineForm.序号, this.machineForm.数量, this.machineForm.备注)
if (response.data[0].result === '1') {
this.editTable(updateMachineData, [this.machineForm.序号, this.machineForm.数量, this.machineForm.备注], 'machineForm', function() {
this.machineVisible = false
this.getMachineData()
}
})
// const response = await updateMachineData(this.machineForm.序号, this.machineForm.数量, this.machineForm.备注)
// if (response.data[0].result === '1') {
// this.machineVisible = false
// this.getMachineData()
// }
},
deleteMachine(row) {
this.deleteRow(deleteMachineData, row.序号, function() {
@@ -625,20 +657,18 @@ export default {
async getFileData() {
const response = await getFileData(this.receiptNum)
this.fileData = response.data
console.log(this.fileData)
},
addFile() {
this.addForm('machineForm', function() {
this.addForm('fileForm', function() {
this.fileTitle = `添加文件`
this.fileVisible = true
})
},
async submitAddFile() {
const response = await addFileData(this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addFileData, [this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.receiptNum], 'fileForm', function() {
this.fileVisible = false
this.getFileData()
}
})
},
editFile(row) {
this.editForm(row, 'fileForm', function() {
@@ -647,14 +677,13 @@ export default {
})
},
async submitEditFile() {
const response = await editFileData(this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.fileForm.序号)
if (response.data[0].result === '1') {
this.editTable(editFileData, [this.fileForm.名称, this.fileForm.数量, this.fileForm.备注, this.fileForm.文件编号], 'fileForm', function() {
this.fileVisible = false
this.getFileData()
}
})
},
deleteFile(row) {
this.deleteRow(deleteFileData, row., function() {
this.deleteRow(deleteFileData, row.文件编, function() {
this.getFileData()
})
},
@@ -669,11 +698,15 @@ export default {
})
},
async submitAddSpare() {
const response = await addSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum)
if (response.data[0].result === '1') {
this.addTable(addSpareData, [this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum], 'spareForm', function() {
this.spareVisible = false
this.getSpareData()
}
})
// const response = await addSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.receiptNum)
// if (response.data[0].result === '1') {
// this.spareVisible = false
// this.getSpareData()
// }
},
editSpare(row) {
this.editForm(row, 'spareForm', function() {
@@ -682,14 +715,18 @@ export default {
})
},
async submitEditSpare() {
const response = await editSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.fileForm.序号)
if (response.data[0].result === '1') {
this.editTable(editSpareData, [this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.spareForm.备件编号], 'spareForm', function() {
this.spareVisible = false
this.getSpareData()
}
})
// const response = await editSpareData(this.spareForm.名称, this.spareForm.规格, this.spareForm.单位, this.spareForm.数量, this.spareForm.备注, this.spareForm.备件编号)
// if (response.data[0].result === '1') {
// this.spareVisible = false
// this.getSpareData()
// }
},
deleteSpare(row) {
this.deleteRow(deleteSpareData, row., function() {
this.deleteRow(deleteSpareData, row.备件编, function() {
this.getSpareData()
})
}