This commit is contained in:
chenjianan
2019-06-21 14:43:51 +08:00
parent c36ebf051f
commit 84b3e6ca9a
2 changed files with 152 additions and 37 deletions

View File

@@ -21,8 +21,19 @@ export function searchTable2(...params) {
data: {
type: '1',
name: '车间生产管理_外协到货单明细_查询数据',
param: `外协到货单流水号=${params[2]}`,
Pagination: params[0] + '&' + params[1]
param: `外协到货单流水号=${params[0]}`
}
})
}
// 查询外协到货单明细
export function searchTableDetail(...params) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '质检管理_外协质检数据_查询数据',
param: `检测类型=${params[0]}&外协到货单明细流水号=${params[1]}`
}
})
}

View File

@@ -33,9 +33,9 @@
@size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/>
</div>
<el-table v-loading="" :data="tableData2" show-summary stripe border style="width: 100%;max-height: 600px;" height="600px" size="mini">
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries" show-summary border style="width: 100%" size="mini">
<el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="零件名称" align="center" min-width="100">
<el-table-column label="零件名称" align="center" min-width="120">
<template slot-scope="scope">
{{ scope.row.零件名称 }}
</template>
@@ -45,17 +45,17 @@
{{ scope.row.零件图号 }}
</template>
</el-table-column>
<el-table-column label="零件数量" align="center" min-width="120">
<el-table-column label="零件数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.批次数量 }}
</template>
</el-table-column>
<el-table-column label="检验数量" align="center" min-width="100">
<el-table-column label="检验数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.检验数量 || 0 }}
</template>
</el-table-column>
<el-table-column label="不合格数量" align="center" min-width="100">
<el-table-column label="不合格数量" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.不合格数量 || 0 }}
</template>
@@ -65,39 +65,88 @@
{{ scope.row.检验时间 || '—' }}
</template>
</el-table-column>
<el-table-column label="形位" align="center" min-width="100">
<el-table-column label="形位" align="center" width="100">
<template slot-scope="scope">
{{ scope.row.形位 }}
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column label="尺寸" align="center" min-width="100">
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.尺寸 }}
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column label="外观" align="center" min-width="100">
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.外观 }}
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(1, scope.row.外协到货单明细流水号)">形位</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column label="尺寸" align="center" width="100">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(2, scope.row.外协到货单明细流水号)">尺寸</el-button>
</el-popover>
</template>
</el-table-column>
<el-table-column label="外观" align="center" width="100">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="类别">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="数值">
<template slot-scope="scope">
{{ scope.row.数值 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="零件数量">
<template slot-scope="scope">
{{ scope.row.零件数量 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" plain size="mini" icon="el-icon-search" @click="searchTableDetail(3, scope.row.外协到货单明细流水号)">外观</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin: 10px 0;">
<el-pagination
:current-page="pageCurrent2"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize2"
:total="total2"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange2"
@current-change="handleCurrentChange2"/>
</div>
</el-card>
</div>
</template>
<script>
import { searchTable1, searchTable2 } from '@/api/Outsourcing/OutsourcingQCSearch'
import { searchTable1, searchTable2, searchTableDetail } from '@/api/Outsourcing/OutsourcingQCSearch'
export default {
name: 'OutsourcingQCSearch',
data() {
@@ -109,13 +158,72 @@ export default {
tableData2: [],
pageCurrent2: 1,
pageSize2: 10,
total2: 0
total2: 0,
gridData: []
}
},
mounted() {
this.searchTable1()
},
methods: {
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 3) {
const values = data.map(item => Number(item['批次数量']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 4) {
const values = data.map(item => Number(item['检验数量']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 5) {
const values = data.map(item => Number(item['不合格数量']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return Number((prev + curr).toFixed(2))
} else {
return Number((prev).toFixed(2))
}
}, 0)
sums[index] += ''
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
sums[index] = '检验比例:' + ((sums[4] / sums[3]) * 100).toFixed(2) + '%'
}
})
return sums
},
// 查询到货单列表
searchTable1() {
searchTable1(this.pageCurrent1, this.pageSize1).then(response => {
@@ -135,19 +243,15 @@ export default {
},
searchTable2(row) {
console.log(row, 2)
searchTable2(this.pageCurrent2, this.pageSize2, row.外协到货单流水号).then(response => {
this.tableData2 = response.data.rows
this.total2 = response.data.total
searchTable2(row.外协到货单流水号).then(response => {
this.tableData2 = response.data
})
},
handleSizeChange2(val) {
this.pageSize2 = val
this.pageCurrent2 = 1
this.searchTable2()
},
handleCurrentChange2(val) {
this.pageCurrent2 = val
this.searchTable2()
searchTableDetail(type, num) {
searchTableDetail(type, num).then(response => {
this.gridData = response.data
})
console.log(type)
}
}
}