456 lines
16 KiB
Vue
456 lines
16 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<el-row>
|
|
<el-col style="width: 45%">
|
|
<el-card>
|
|
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 300px;" height="200px" size="mini" highlight-current-row @row-click="searchTable01">
|
|
<el-table-column label="供应商" align="center" width="170" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.供应商名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="请款时间" align="center" width="90">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.请款时间.split(' ')[0] }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="请款人" align="center" width="90">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.姓名 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="请款金额(元)" align="center" width="110" prop="请款金额">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.请款金额 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="审核" align="center" width="135">
|
|
<template slot-scope="scope">
|
|
<el-button type="text" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
|
|
<el-button type="text" style="color:black" size="mini" icon="el-icon-close" @click="noApproval(scope.row)">不通过</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</el-col>
|
|
<el-col style="width: 55%">
|
|
<el-card>
|
|
<el-table :data="gridData1" :summary-method="getSummaries2" style="width: 100%;max-height: 300px;" height="200px" border highlight-current-row size="mini" show-summary @row-click="searchContactDetail">
|
|
<el-table-column width="104" align="center" label="合同编号" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="合同总额(元)" prop="合同总金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.合同总金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="到货金额(元)" prop="到货金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.到货金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="已付金额(元)" prop="已付金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.已付金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="请款金额(元)" prop="请款金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.请款金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="到票金额(元)" prop="到票金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.到票金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column width="105" align="center" label="尚欠金额(元)" prop="尚欠金额">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.尚欠金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-card>
|
|
<el-table :data="contractDetail2" :summary-method="getSummaries" border height="500px" size="mini" stripe show-summary>
|
|
<el-table-column label="物料名称" align="center" min-width="120" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.物料名称 ? scope.row.物料名称 : scope.row.零件名称 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="物料规格" align="center" min-width="150" show-overflow-tooltip>
|
|
<template slot-scope="scope">
|
|
{{ scope.row.物料规格 ? scope.row.物料规格 : scope.row.规格 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="物料型号" align="center" width="150">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.物料型号 ? scope.row.物料型号 : scope.row.零件图号 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="物料型号" align="center" width="150">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.外购件机床 || scope.row.基本件机床 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="采购数量" align="center" width="80">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.数量 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="到货数量" align="center" width="80">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="到货金额" align="center" width="80">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.到货金额).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="合计(元)" align="center" min-width="100" prop="合计">
|
|
<template slot-scope="scope">
|
|
{{ (parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0)).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="单价(元)" align="center" min-width="100" prop="单价">
|
|
<template slot-scope="scope">
|
|
{{ parseFloat(scope.row.单价||0).toFixed(2) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="交货期要求" align="center" min-width="100" prop="交货期要求">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.合同类型 === 1 ? scope.row.交货期.split(' ')[0] === '1900-01-01' ? '-' : scope.row.交货期.split(' ')[0] : scope.row.交货期要求 }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="备注" align="center" min-width="150" prop="备注">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.备注 }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-card>
|
|
</el-row>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { initApproval, execApproval, initApprovalOffline, searchRequsetFundDetail1, searchRequsetFundDetail2, execApprovalOffline, searchContactDetail, searchMateriel } from '@/api/PurchasingCenter/FundApproval'
|
|
import { mapGetters } from 'vuex'
|
|
|
|
export default {
|
|
name: '', // 管理审核
|
|
data() {
|
|
return {
|
|
contractDetail1: '',
|
|
contractDetail2: [],
|
|
tableData1: [],
|
|
pageSize1: 10000,
|
|
pageCurrent1: 1,
|
|
total1: 0,
|
|
tableData2: [],
|
|
pageSize2: 10,
|
|
pageCurrent2: 1,
|
|
total2: 0,
|
|
gridData1: [],
|
|
gridData2: []
|
|
}
|
|
},
|
|
computed: {
|
|
...mapGetters([
|
|
'sidebar',
|
|
'avatar',
|
|
'name',
|
|
'id' // 人员编号
|
|
])
|
|
},
|
|
created() {
|
|
this.fetchData()
|
|
},
|
|
methods: {
|
|
searchContactDetail(row) {
|
|
var check
|
|
row.采购合同流水号 ? check = 1 : check = 2
|
|
searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => {
|
|
this.contractDetail2 = response.data
|
|
})
|
|
},
|
|
searchOfflineContactDetail(row) { // 查询离线合同明细
|
|
searchMateriel(row.离线合同流水号).then(response => {
|
|
this.contractDetail2 = response.data
|
|
})
|
|
},
|
|
getSummaries(param) { // 合计
|
|
const { columns, data } = param
|
|
const sums = []
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '合计'
|
|
} else if (index === 4) {
|
|
const values = data.map(item => Number(parseFloat(item['数量'])))
|
|
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] + ' 件'
|
|
} else {
|
|
sums[index] = '0'
|
|
}
|
|
} else if (index === 5) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (!data[i].到货数量) {
|
|
data[i].到货数量 = 0
|
|
}
|
|
if (!data[i].已到货数量) {
|
|
data[i].已到货数量 = 0
|
|
}
|
|
}
|
|
const values = data.map(item => Number(parseInt(item['到货数量'])) + Number(parseInt(item['已到货数量'])))
|
|
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] + ' 件'
|
|
} else {
|
|
sums[index] = '0'
|
|
}
|
|
} else if (index === 6) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (!data[i].到货数量) {
|
|
data[i].到货数量 = 0
|
|
}
|
|
if (!data[i].已到货数量) {
|
|
data[i].已到货数量 = 0
|
|
}
|
|
}
|
|
const values = data.map(item => Number(parseInt(item['到货数量'])) * Number(parseInt(item['单价'])))
|
|
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] = Number(sums[index]).toFixed(2) + ' 元'
|
|
} else {
|
|
sums[index] = '0.00'
|
|
}
|
|
} else if (index === 7) {
|
|
for (let i = 0; i < data.length; i++) {
|
|
if (!data[i].到货数量) {
|
|
data[i].到货数量 = 0
|
|
}
|
|
if (!data[i].已到货数量) {
|
|
data[i].已到货数量 = 0
|
|
}
|
|
}
|
|
const values = data.map(item => Number(parseInt(item['数量'])) * Number(parseInt(item['单价'])))
|
|
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] = Number(sums[index]).toFixed(2) + ' 元'
|
|
} else {
|
|
sums[index] = '0.00'
|
|
}
|
|
}
|
|
})
|
|
return sums
|
|
},
|
|
getSummaries2(param) { // 合计
|
|
const { columns, data } = param
|
|
const sums = []
|
|
columns.forEach((column, index) => {
|
|
if (index === 0) {
|
|
sums[index] = '总价'
|
|
return
|
|
} else {
|
|
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) + ' 元'
|
|
} else {
|
|
sums[index] = 'N/A'
|
|
}
|
|
}
|
|
})
|
|
return sums
|
|
},
|
|
fetchData() {
|
|
this.searchTable1()
|
|
// this.searchTable2()
|
|
},
|
|
searchTable1() {
|
|
this.tableData1 = []
|
|
this.gridData1 = []
|
|
this.contractDetail2 = []
|
|
initApproval(this.pageCurrent1, this.pageSize1, 0).then(response => {
|
|
this.tableData1 = response.data.rows
|
|
this.total1 = response.data.total
|
|
})
|
|
},
|
|
handleSizeChange1(val) {
|
|
this.pageSize1 = val
|
|
this.pageCurrent1 = 1
|
|
this.searchTable1()
|
|
},
|
|
handleCurrentChange1(val) {
|
|
this.pageCurrent1 = val
|
|
this.searchTable1()
|
|
},
|
|
searchTable2() {
|
|
initApprovalOffline(this.pageCurrent2, this.pageSize2, 0).then(response => {
|
|
this.tableData2 = response.data.rows
|
|
this.total2 = response.data.total
|
|
})
|
|
},
|
|
handleSizeChange2(val) {
|
|
this.pageSize2 = val
|
|
this.pageCurrent2 = 1
|
|
this.searchTable2()
|
|
},
|
|
handleCurrentChange2(val) {
|
|
this.pageCurrent2 = val
|
|
this.searchTable2()
|
|
},
|
|
searchTable01(row) { // 查看详情(请款信息包含的合同)
|
|
this.gridData1 = []
|
|
this.contractDetail2 = []
|
|
searchRequsetFundDetail1(row.采购合同请款流水号).then(response => {
|
|
this.gridData1 = response.data
|
|
})
|
|
},
|
|
searchTable02(row) { // 查看详情(请款信息包含的合同)
|
|
searchRequsetFundDetail2(row.离线合同请款流水号).then(response => {
|
|
this.gridData2 = response.data
|
|
})
|
|
},
|
|
yesApproval(row) { // 通过审核
|
|
this.$confirm('确定审核通过?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
execApproval(row.采购合同请款流水号, 1, '通过', this.id, 0).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('执行成功')
|
|
this.searchTable1()
|
|
} else { this.$message.error('执行失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '取消操作'
|
|
})
|
|
})
|
|
},
|
|
noApproval(row) { // 不通过审核
|
|
this.$prompt('请输入不通过原因', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消'
|
|
}).then(({ value }) => {
|
|
execApproval(row.采购合同请款流水号, 2, value, this.id, 0).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('执行成功')
|
|
this.tableData2 = []
|
|
this.searchTable1()
|
|
} else { this.$message.error('执行失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '取消操作'
|
|
})
|
|
})
|
|
},
|
|
yesApprovalOffline(row) { // 通过审核
|
|
this.$confirm('确定审核通过?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 0).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('执行成功')
|
|
this.searchTable2()
|
|
} else { this.$message.error('执行失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '取消操作'
|
|
})
|
|
})
|
|
},
|
|
noApprovalOffline(row) { // 不通过审核
|
|
this.$prompt('请输入不通过原因', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消'
|
|
}).then(({ value }) => {
|
|
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 0).then(response => {
|
|
if (response.data[0].result === '1') {
|
|
this.$message.success('执行成功')
|
|
this.searchTable2()
|
|
} else { this.$message.error('执行失败') }
|
|
})
|
|
}).catch(() => {
|
|
this.$message({
|
|
type: 'info',
|
|
message: '取消操作'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.el-card{
|
|
margin-bottom: 0px;
|
|
}
|
|
.el-select{
|
|
width:200px
|
|
}
|
|
.el-input{
|
|
width:200px
|
|
}
|
|
span{
|
|
margin: 10px 0 10px 10px;
|
|
}
|
|
.searchForm .el-form-item{
|
|
margin-bottom: 5px;
|
|
}
|
|
.el-tag{
|
|
margin: 0
|
|
}
|
|
</style>
|