Files
JY1.0/src/views/Inventory/OfflinePartOut/index.vue
chenjianan 83570945c2 lixin
2019-01-29 15:29:57 +08:00

316 lines
11 KiB
Vue

<template>
<div class="app-container">
<el-card>
<span style="margin: 5px">离线合同编号</span>
<el-input v-model="offlineContract" clearable size="small" style="width:200px" />
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchPurchasePartinfo()">查询</el-button>
</el-card>
<el-card>
<el-table
v-loading="listLoading"
:data="tableDataBasic"
size="mini"
border
style="width: 100%;"
height="200"
@row-click = "searchoutRecord"
>
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column label="离线合同编号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="可出库数量" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.货位存量 }}
</template>
</el-table-column>
<el-table-column label="物料型号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="物料规格" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" min-width="120">
<template slot-scope="scope" align="center">
<el-button size="mini" type="primary" icon="el-icon-sort-up" style="margin: 0 0 0 0px" @click="parOut(scope.row)">出库</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<!--零件出库对话框-->
<el-dialog :visible.sync="dialogFormVisible" title="零件出库" center width="380px">
<el-form ref="form" :model="Project" :rules="rules" label-position="left">
<el-form-item label="项目" prop="TotalContractAmount" label-width="100px">
<el-select v-model="form.ProjectValue" filterable clearable size="small" placeholder="项目" style="width: 200px;margin-right:10px" @change="searchMachine()">
<el-option
v-for="item in Project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="机床" prop="TotalContractAmount" label-width="100px">
<el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床" style="width: 200px;margin-right:10px" @change="searchGroupList()">
<el-option
v-for="item in Machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="分组" prop="TotalContractAmount" label-width="100px">
<el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="分组" style="width: 200px;margin-right:10px">
<el-option
v-for="item in GroupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="出库数量" prop="ContractNumberValue" label-width="100px" size="small">
<el-input v-model="form.DirectNumber" size="small" placeholder="出库数量" style="width: 200px"/>
</el-form-item>
<el-form-item label="领用者" prop="TotalContractAmount" label-width="100px">
<el-select v-model="PeopleValue" filterable clearable size="small" placeholder="领用者" style="width: 200px;margin-right:10px" @change="searchGroupList()">
<el-option
v-for="item in People"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="TotalContractAmount" label-width="100px">
<el-input v-model="form.DirectNote" size="small" placeholder="请输入备注" style="width: 200px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff('form')">取消</el-button>
<el-button type="primary" @click="addDirectPartm()">确定</el-button>
</div>
</el-dialog>
<el-card>
<el-table
v-loading="listLoading1"
:data="tableDataOut"
size="mini"
border
style="width: 100%;"
height="350">
<el-table-column
label="序号"
align="center"
type="index"
width="50"/>
<el-table-column label="项目名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="组号" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.组号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="出库数量" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.出库数量 }}
</template>
</el-table-column>
<el-table-column label="出库时间" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.出库时间 }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.备注 }}
</template>
</el-table-column>
</el-table>
</el-card>
</div>
</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 // 离线合同编号
}
},
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('零件出库失败')
}
})
this.dialogFormVisible = false
}
}
}
}
</script>
<style scoped>
</style>