This commit is contained in:
chenjianan
2019-01-29 15:29:57 +08:00
parent fe445114a2
commit 83570945c2

View File

@@ -157,157 +157,157 @@
</template>
<script>
import { initProject, searchmachine, searchTeam, searchPart, searchPeople, outlinePartOut, outRecord } from '@/api/Inventory/OfflinePartOut'
import { mapGetters } from 'vuex'
export default {
data() {
return {
Project: [],
ProjectValue_check: 1,
MachineValue: ' ',
Machine: [],
MachineValue_check: 1,
GroupNumValue: ' ',
GroupNumValue_check: 1,
GroupNum: [],
tableDataBasic: [],
People: [],
PeopleValue: '',
dialogFormVisible: false,
form: {
ProjectValue: '',
DirectNumber: '',
DirectNote: ''
},
rules: { // 表单验证规则
ProjectValue: [{ required: true, message: '请选择项目', trigger: 'blur' }],
DirectNumber: [{ required: true, message: '请输入直达件数量', trigger: 'blur' }],
DirectNote: [{ required: true, message: '请输入直达件备注', trigger: 'change' }]
},
contractNumber: '',
locateNumber: '',
materialNumber: '',
PeopleNumber: '',
tableDataOut: [],
listLoading: '',
listLoading1: '',
partnumber: '',
offlineContract: null // 离线合同编号
import { initProject, searchmachine, searchTeam, searchPart, searchPeople, outlinePartOut, outRecord } from '@/api/Inventory/OfflinePartOut'
import { mapGetters } from 'vuex'
export default {
data() {
return {
Project: [],
ProjectValue_check: 1,
MachineValue: ' ',
Machine: [],
MachineValue_check: 1,
GroupNumValue: ' ',
GroupNumValue_check: 1,
GroupNum: [],
tableDataBasic: [],
People: [],
PeopleValue: '',
dialogFormVisible: false,
form: {
ProjectValue: '',
DirectNumber: '',
DirectNote: ''
},
rules: { // 表单验证规则
ProjectValue: [{ required: true, message: '请选择项目', trigger: 'blur' }],
DirectNumber: [{ required: true, message: '请输入直达件数量', trigger: 'blur' }],
DirectNote: [{ required: true, message: '请输入直达件备注', trigger: 'change' }]
},
contractNumber: '',
locateNumber: '',
materialNumber: '',
PeopleNumber: '',
tableDataOut: [],
listLoading: '',
listLoading1: '',
partnumber: '',
offlineContract: null // 离线合同编号
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.searchPurchasePartinfo()
this.fetchData()
this.searchPeopleData()
this.getpeopleid()
},
methods: {
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'Project') // 项目名称
},
// 获取人员编号
getpeopleid() {
this.PeopleNumber = this.id
},
searchMachine() { // 查询机床
if (this.ProjectValue === '') {
this.ProjectValue_check = 0
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
created() {
this.searchPurchasePartinfo()
this.fetchData()
this.searchPeopleData()
this.getpeopleid()
},
methods: {
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'Project') // 项目名称
},
// 获取人员编号
getpeopleid() {
this.PeopleNumber = this.id
},
searchMachine() { // 查询机床
if (this.ProjectValue === '') {
this.ProjectValue_check = 0
}
searchmachine(this.ProjectValue_check, this.form.ProjectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
searchGroupList() { // 查询组号
searchTeam(this.MachineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组件名称,
value: response.data[i].组件流水号
})
}
})
},
// 离线件查询
searchPurchasePartinfo() {
this.listLoading = true
this.tableDataBasic = []
searchPart(this.offlineContract).then(response => {
this.tableDataBasic = response.data
this.listLoading = false
})
},
// 离线记录查询
searchoutRecord(row) {
this.contractNumber = row.离线合同明细流水号
this.listLoading1 = true
outRecord(this.contractNumber).then(response => {
this.tableDataOut = response.data
this.listLoading1 = false
})
},
// 打开表单
parOut(row) {
this.form = []
this.MachineValue = ''
this.GroupNumValue = ''
this.dialogFormVisible = true
this.contractNumber = row.离线合同明细流水号
this.locateNumber = row.货位流水号
this.materialNumber = row.物料流水号
this.partnumber = row.货位存量
this.searchoutRecord()
},
// 重置表单
callOff() {
this.form.DirectNumber = ''
this.form.DirectNumberx = ''
this.form.DirectNote = ''
this.dialogFormVisible = false
},
searchPeopleData() { // 查询人员
searchPeople(this.token).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.People.push({
label: response.data[i].姓名,
value: response.data[i].考勤编号
})
}
})
},
// 离线外购件出库
addDirectPartm() {
if (this.partnumber < this.form.DirectNumber) {
this.$message.error('请正确输入数量')
} else {
outlinePartOut(this.contractNumber, this.PeopleValue, this.form.DirectNumber, this.locateNumber, this.form.DirectNote, this.form.ProjectValue, this.MachineValue, this.GroupNumValue, this.materialNumber, this.PeopleNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('零件出库成功')
this.dialogFormVisible = false
this.searchPurchasePartinfo()
outRecord(this.contractNumber).then(response => {
this.tableDataOut = response.data
this.listLoading1 = false
})
} else {
this.$message.error('零件出库失败')
}
searchmachine(this.ProjectValue_check, this.form.ProjectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Machine.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
this.dialogFormVisible = false
}
})
},
searchGroupList() { // 查询组号
searchTeam(this.MachineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.GroupNum.push({
label: response.data[i].组件名称,
value: response.data[i].组件流水号
})
}
})
},
// 离线件查询
searchPurchasePartinfo() {
this.listLoading = true
this.tableDataBasic = []
searchPart(this.offlineContract).then(response => {
this.tableDataBasic = response.data
this.listLoading = false
})
},
// 离线记录查询
searchoutRecord(row) {
this.contractNumber = row.离线合同明细流水号
this.listLoading1 = true
outRecord(this.contractNumber).then(response => {
this.tableDataOut = response.data
this.listLoading1 = false
})
},
// 打开表单
parOut(row) {
this.form = []
this.MachineValue = ''
this.GroupNumValue = ''
this.dialogFormVisible = true
this.contractNumber = row.离线合同明细流水号
this.locateNumber = row.货位流水号
this.materialNumber = row.物料流水号
this.partnumber = row.货位存量
this.searchoutRecord()
},
// 重置表单
callOff() {
this.form.DirectNumber = ''
this.form.DirectNumberx = ''
this.form.DirectNote = ''
this.dialogFormVisible = false
},
searchPeopleData() { // 查询人员
searchPeople(this.token).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.People.push({
label: response.data[i].姓名,
value: response.data[i].考勤编号
})
}
})
},
// 离线外购件出库
addDirectPartm() {
if (this.partnumber < this.form.DirectNumber) {
this.$message.error('请正确输入数量')
} else {
outlinePartOut(this.contractNumber, this.PeopleValue, this.form.DirectNumber, this.locateNumber, this.form.DirectNote, this.form.ProjectValue, this.MachineValue, this.GroupNumValue, this.materialNumber, this.PeopleNumber).then(response => {
if (response.data[0].result === '1') {
this.$message.success('零件出库成功')
this.dialogFormVisible = false
this.searchPurchasePartinfo()
outRecord(this.contractNumber).then(response => {
this.tableDataOut = response.data
this.listLoading1 = false
})
} else {
this.$message.error('零件出库失败')
}
})
this.dialogFormVisible = false
}
}
}
}
</script>
<style scoped>