This commit is contained in:
bryan sun
2019-11-09 17:54:00 +08:00
parent 1f12f9532d
commit 105cce9a94
10 changed files with 377 additions and 306 deletions

View File

@@ -2,22 +2,32 @@
<div class="app-container receiveCheck">
<el-card>
<div slot="header">
<span>项目名称:</span>
<el-select v-model="projectValue" style="width:200px" placeholder="请选择" size="small" clearable filterable @change="projectChange">
<el-select v-model="machine" filterable clearable size="small" style="margin:0px 10px 0px 10px;width: 180px;" placeholder="机床号" @change="machineChange">
<el-option
v-for="item in project"
v-for="item in machines"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>机床图号:</span>
<el-select v-model="machineValue" style="width:190px" placeholder="请选择" size="small" clearable filterable @change="machineChange">
<el-option
v-for="item in machine"
:key="item.value"
:label="item.label"
:value="item.value"/>
:value="item.value">
<div style="float: left">{{ item.label }}</div>
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
</el-option>
</el-select>
<!-- <span>项目名称:</span>-->
<!-- <el-select v-model="projectValue" style="width:200px" placeholder="请选择" size="small" clearable filterable @change="projectChange">-->
<!-- <el-option-->
<!-- v-for="item in project"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<!-- <span>机床图号:</span>-->
<!-- <el-select v-model="machineValue" style="width:190px" placeholder="请选择" size="small" clearable filterable @change="machineChange">-->
<!-- <el-option-->
<!-- v-for="item in machine"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"/>-->
<!-- </el-select>-->
<span>组号:</span>
<el-select v-model="groupValue" style="width:140px" placeholder="请选择" size="small" clearable filterable>
<el-option
@@ -63,7 +73,7 @@
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column align="center" label="物料型号">
<el-table-column align="center" label="物料型号" min-width="150" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
@@ -85,7 +95,7 @@
</el-table-column>
<el-table-column align="center" label="领用时间" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.出库时间 }}
{{ scope.row.出库时间.substr(0,10) }}
</template>
</el-table-column>
</el-table>
@@ -94,14 +104,15 @@
</template>
<script>
import { initProject, searchMachine, searchGroup, searchReceiveCheck } from '@/api/PurchasingCenter/ReceiveCheck'
import { initProject, searchGroup, searchReceiveCheck, getMachines } from '@/api/PurchasingCenter/ReceiveCheck'
import Cookie from 'js-cookie'
export default {
data() {
return {
projectValue: '', // 项目名称
project: [],
machineValue: '',
machine: [],
machine: '',
machines: [],
groupValue: '',
group: [],
tableData1: [],
@@ -113,29 +124,69 @@ export default {
},
created() {
this.fetchData()
this.getMachine()
},
methods: {
getMachine() {
if (Cookie.get('machineValue') !== undefined) {
this.machine = ''
this.machines = []
getMachines().then(response => {
console.log(response, 343434)
for (let i = 0; i < response.data.length; i++) {
this.machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
if (Cookie.get('group') !== undefined) {
this.machine = parseInt(Cookie.get('machineValue'))
this.Group = parseInt(Cookie.get('group'))
// this.getTableData()
Cookie.remove('machineValue')
Cookie.remove('group')
} else {
// this.getTableData()
Cookie.remove('machineValue')
Cookie.remove('group')
}
})
} else {
this.Machine = ''
this.Machines = []
getMachines().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machines.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号,
value2: response.data[i].项目名称
})
}
})
}
},
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
projectChange() {
this.machine = []
this.machineValue = ''
this.group = []
this.groupValue = ''
searchMachine(this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machine.push({
value: response.data[i].机床流水号,
label: response.data[i].机床图号
})
}
})
},
// projectChange() {
// this.machines = []
// this.machine = ''
// this.group = []
// this.groupValue = ''
// searchMachine(this.projectValue).then(response => {
// for (let i = 0; i < response.data.length; i++) {
// this.machines.push({
// value: response.data[i].机床流水号,
// label: response.data[i].机床图号
// })
// }
// })
// },
machineChange() {
this.group = []
this.groupValue = ''
searchGroup(this.machineValue).then(response => {
searchGroup(this.machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.group.push({
value: response.data[i].组件流水号,
@@ -171,18 +222,18 @@ export default {
return sums
},
searchProject() { // 查询
if (!this.projectValue) {
this.$message.error('请选择项目')
} else {
let check2, check3
this.machineValue ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
searchReceiveCheck(1, this.projectValue, check2, this.machineValue, check3, this.groupValue).then(response => {
this.tableData1 = response.data
})
}
// if (!this.projectValue) {
// this.$message.error('请选择项目')
// } else {
let check2, check3
this.machine ? check2 = 1 : check2 = 0
this.groupValue ? check3 = 1 : check3 = 0
searchReceiveCheck(0, this.projectValue, check2, this.machine, check3, this.groupValue).then(response => {
this.tableData1 = response.data
})
}
}
// }
}
</script>