领用加机床分组

This commit is contained in:
chenjianan
2019-03-25 09:22:03 +08:00
parent 094844015f
commit 6bc14761a4
2 changed files with 123 additions and 19 deletions

View File

@@ -11,15 +11,39 @@ export function initProject() {
}
})
}
// 机床查询
export function searchMachine(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: 'PDM_机床名称_查询数据',
param: '项目流水号_check=1&项目流水号=' + num
}
})
}
// 分组查询
export function searchGroup(num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: 'PDM_组件名称_查询数据',
param: '机床流水号=' + num
}
})
}
// 初始化项目金额统计表
export function searchReceiveCheck(check, num) {
export function searchReceiveCheck(check1, num1, check2, num2, check3, num3) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_领用核算_查询数据',
param: `项目流水号_check=${check}&项目流水号=${num}`
param: `项目流水号_check=${check1}&项目流水号=${num1}&机床流水号_check=${check2}&机床流水号=${num2}&组件流水号_check=${check3}&组件流水号=${num3}`
}
})
}

View File

@@ -2,21 +2,38 @@
<div class="app-container">
<el-card>
<span>项目名称:</span>
<el-select v-model="projectValue" style="width:200px" placeholder="请选择" size="small" clearable filterable>
<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:200px" 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:200px" placeholder="请选择" size="small" clearable filterable>
<el-option
v-for="item in group"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="searchProject()">查询</el-button>
</el-card>
<el-card style="margin-top: 15px">
<el-table
:data="tableData1"
:summary-method="getSummaries"
style="width: 100%"
height="440"
height="650"
size="mini"
show-summary
stripe
@@ -27,6 +44,16 @@
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column align="center" label="机床图号" width="100px">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column align="center" label="组号" width="80px">
<template slot-scope="scope">
{{ scope.row.组号 || '—' }}
</template>
</el-table-column>
<el-table-column align="center" label="物料名称">
<template slot-scope="scope">
{{ scope.row.物料名称 }}
@@ -44,7 +71,7 @@
</el-table-column>
<el-table-column align="center" label="小计(元)" prop="小计">
<template slot-scope="scope">
{{ scope.row.小计 }}
{{ scope.row.小计.toFixed(2) }}
</template>
</el-table-column>
<el-table-column align="center" label="单价">
@@ -68,27 +95,21 @@
</template>
<script>
import { initProject, searchReceiveCheck } from '@/api/PurchasingCenter/ReceiveCheck'
import { initProject, searchMachine, searchGroup, searchReceiveCheck } from '@/api/PurchasingCenter/ReceiveCheck'
export default {
data() {
return {
projectValue: '', // 项目名称
project: [],
machineValue: '',
machine: [],
groupValue: '',
group: [],
tableData1: [],
check1: '',
pageCurrent: 1,
pageSize: 10,
total: 0,
form: {
项目名称: '',
物料名称: '',
物料规格: '',
物料型号: '',
数量: '',
单价: '',
小计: ''
}
total: 0
}
},
created() {
@@ -98,11 +119,62 @@ export default {
fetchData() {
this.getSelect(initProject, ['项目名称', '项目流水号'], 'project')
},
projectChange() {
this.machine = []
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].机床图号
})
}
})
},
machineChange() {
this.group = []
searchGroup(this.machineValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.group.push({
value: response.data[i].组件流水号,
label: response.data[i].组号
})
}
})
},
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
return
}
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index].toFixed(2)
sums[index] += ' 元'
} else {
sums[index] = ''
}
})
return sums
},
searchProject() { // 查询
if (!this.projectValue) {
this.$message.error('请选择项目')
} else {
searchReceiveCheck(1, this.projectValue).then(response => {
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
})
}
@@ -112,5 +184,13 @@ export default {
</script>
<style scoped>
.el-select{
width:200px
}
.el-input{
width:200px
}
span{
margin: 10px 0 10px 10px;
}
</style>