This commit is contained in:
liushuai
2019-09-21 17:14:12 +08:00
parent 2639368017
commit d77493b15d
5 changed files with 368 additions and 14 deletions

View File

@@ -1,6 +1,25 @@
<template>
<div>
<el-card>
<span>机床号:</span>
<el-select v-model="Machine" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="机床号" @change="getGroup()">
<el-option
v-for="item in Machines"
:key="item.value"
:label="item.label"
: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="Group" size="small" clearable placeholder="组号" style="margin-top:10px;width: 180px;">
<el-option
v-for="item in Groups"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<span>零件图号:</span>
<el-input v-model="partName" placeholder="零件图号" size="small" clearable style="width:200px;margin: 3px 0"/>
<el-button size="small" icon="el-icon-search" type="success" style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
@@ -91,12 +110,16 @@
</div>
</template>
<script>
import { searchtable, searchtable2, searchtable3, change2, change3, edit } from '@/api/ManufacturingCenter/MaterialArrivalManagement'
<script>import { getMachines, getGroups, searchtable, searchtable2, searchtable3, change2, change3, edit } from '@/api/ManufacturingCenter/MaterialArrivalManagement'
import { mapGetters } from 'vuex'
import Cookie from 'js-cookie'
export default {
data() {
return {
Machine: '',
Machines: [],
Group: '',
Groups: [],
arrest2: [],
editTime: '',
bianliang1: [],
@@ -128,10 +151,21 @@ export default {
'userId'
])
},
created() {
this.searchTable()
this.searchTable2()
watch: {
// 如果路由有变化,会再次执行该方法
'$route': {
handler(route) {
const _this = this
if (route.name === 'MaterialArrivalManagement') {
_this.getMachine()
}
}
}
},
// created() {
// this.searchTable()
// this.searchTable2()
// },
methods: {
handleSelectionChange2(val) {
this.arrest2 = val
@@ -151,17 +185,67 @@ export default {
})
}
},
getMachine() {
if (Cookie.get('machineValue') !== undefined) {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
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].项目名称
})
}
}).then(() => {
this.Machine = parseInt(Cookie.get('machineValue'))
this.getGroup()
this.Group = parseInt(Cookie.get('group'))
this.searchTable()
Cookie.remove('machineValue')
Cookie.remove('group')
this.searchTable2()
})
} else {
this.Machine = ''
this.Machines = []
this.Group = ''
this.Groups = []
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].项目名称
})
}
})
this.searchTable()
}
},
getGroup() {
this.Group = ''
this.Groups = []
getGroups(this.Machine).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.Groups.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.Data = []
if (this.partName !== '' && this.partName !== null) {
this.partNamecheck = true
} else {
this.partNamecheck = false
}
searchtable(this.partNamecheck, this.partName, 0, this.pageCurrent, this.pageSize).then(response => {
if (this.Machine) { this.Machinecheck = true } else { this.Machinecheck = false }
if (this.Group) { this.Groupcheck = true } else { this.Groupcheck = false }
if (this.partName) { this.partNamecheck = true } else { this.partNamecheck = false }
searchtable(this.Machinecheck, this.Machine, this.Groupcheck, this.Group, this.partNamecheck, this.partName, 0, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {