Files
JY1.0/src/views/WorkshopProcurement/FundApproval3/index.vue
2020-04-02 13:39:53 +08:00

571 lines
22 KiB
Vue

<template>
<div class="app-container">
<el-card>
<el-table v-loading="" :data="tableData" border stripe style="width: 100%" height="600px" size="mini">
<el-table-column label="类别" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.类别 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="right" min-width="100" prop="请款金额">
<template slot-scope="scope">
{{ Number(scope.row.请款金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.请款时间 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table v-show="scope.row.类别==='采购'" :data="gridData1" :summary-method="getSummaries" stripe size="mini" show-summary>
<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="合同总额" prop="请款金额">
<template slot-scope="scope">
{{ Number(scope.row.请款金额).toFixed(2) }}
</template>
</el-table-column>
</el-table>
<el-table v-show="scope.row.类别==='离线'" :data="gridData" stripe size="mini" show-summary>
<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="合同总额" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
</el-table>
<el-table v-show="scope.row.类别==='备料'" :data="gridData1" stripe size="mini" show-summary>
<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="150" align="center" label="供应商名称">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="开票金额" prop="开票金额">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="text" size="mini" icon="el-icon-search" style="margin-right: 10px" @click="searchTable01(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="text" size="mini" icon="el-icon-check" @click="yesApproval(scope.row)">通过</el-button>
<el-button type="text" size="mini" icon="el-icon-close" @click="noApproval(scope.row)">未过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
:total="total"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
<el-card v-if="false">
<el-table v-loading="" :data="tableData2" border stripe style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.请款时间 }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="100" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="付款" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData" stripe size="mini" show-summary>
<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="合同总额" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" size="mini" icon="el-icon-search" style="margin-right: 10px" @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesApprovalOffline(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noApprovalOffline(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<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>
<el-card v-if="false">
<el-table v-loading="" :data="tableData3" border stripe style="width: 100%;max-height: 300px;" height="300px" size="mini">
<el-table-column label="供应商" align="center" min-width="170">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.请款时间 }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额(元)" align="center" min-width="100" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
</template>
</el-table-column>
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData1" stripe size="mini" show-summary>
<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="150" align="center" label="供应商名称">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="开票金额" prop="开票金额">
<template slot-scope="scope">
{{ scope.row.开票金额 }}
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" size="mini" icon="el-icon-search" style="margin-right: 10px" @click="searchTable03(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" icon="el-icon-check" @click="yesMaterials(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" @click="noMaterials(scope.row)">不通过</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent3"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize3"
:total="total3"
style="display:inline-block;width:50%"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange3"
@current-change="handleCurrentChange3"/>
</div>
</el-card>
</div>
</template>
<script>
import { execApproval, initApproval1, initApprovalOffline, searchRequsetFundDetail, execApprovalOffline, searchRequsetFundDetail1, initApprovalMaterials, execMaterials, searchRequsetFundDetail3 } from '@/api/WorkshopProcurement/FundApproval'
import { mapGetters } from 'vuex'
export default {
name: '', // 财务审核
data() {
return {
tableData: [],
pageSize: 10,
pageCurrent: 1,
total: 0,
tableData2: [],
pageSize2: 10,
pageCurrent2: 1,
total2: 0,
gridData: [],
tableData3: [],
pageSize3: 10,
pageCurrent3: 1,
total3: 0,
gridData1: []
}
},
computed: {
...mapGetters([
'sidebar',
'avatar',
'name',
'id' // 人员编号
])
},
created() {
this.searchTable()
},
methods: {
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
} else if (index === 2) {
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.searchTable()
this.searchTable2()
this.searchTable3()
},
searchTable() {
this.tableData = []
initApproval1(this.pageCurrent, this.pageSize, 2).then(response => {
if (response.data.rows.length !== 0) {
for (let i = 0; i < response.data.rows.length; i++) {
response.data.rows[i].含税总金额 = parseInt(response.data.rows[i].含税总金额 * 100) / 100
response.data.rows[i].欠款金额 = parseInt(response.data.rows[i].欠款金额 * 100) / 100
this.tableData.push({
采购合同请款流水号: response.data.rows[i].采购合同请款流水号,
供应商名称: response.data.rows[i].供应商名称,
请款金额: response.data.rows[i].请款金额,
姓名: response.data.rows[i].姓名,
请款时间: response.data.rows[i].请款时间,
类别: '采购'
})
}
}
initApprovalOffline(this.pageCurrent2, this.pageSize2, 2).then(response2 => {
if (response2.data.rows.length !== 0) {
for (let i = 0; i < response2.data.rows.length; i++) {
this.tableData.push({
离线合同请款流水号: response2.data.rows[i].离线合同请款流水号,
供应商名称: response2.data.rows[i].供应商名称,
请款金额: response2.data.rows[i].请款金额,
姓名: response2.data.rows[i].姓名,
请款时间: response2.data.rows[i].请款时间,
类别: '离线'
})
}
}
initApprovalMaterials(this.pageCurrent3, this.pageSize3, 2).then(response3 => {
if (response3.data.rows.length !== 0) {
for (let i = 0; i < response3.data.rows.length; i++) {
this.tableData.push({
采购计划请款流水号: response3.data.rows[i].采购计划请款流水号,
供应商名称: response3.data.rows[i].供应商名称,
请款金额: response3.data.rows[i].请款金额,
姓名: response3.data.rows[i].姓名,
请款时间: response3.data.rows[i].请款时间,
类别: '备料'
})
}
}
this.total = response.data.total + response2.data.total + response3.data.total
})
})
})
},
// 查看详情(请款信息包含的合同)
searchTable01(row) {
this.gridData1 = []
this.gridData = []
if (row.类别 === '采购') {
searchRequsetFundDetail3(row.采购合同请款流水号).then(response => {
this.gridData1 = response.data
})
} else if (row.类别 === '离线') {
searchRequsetFundDetail(row.离线合同请款流水号).then(response => {
this.gridData = response.data
})
} else if (row.类别 === '备料') {
searchRequsetFundDetail1(row.采购计划请款流水号).then(response => {
this.gridData1 = response.data
})
}
},
handleSizeChange(val) {
this.pageSize = val
this.pageCurrent = 1
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
},
searchTable2() {
initApprovalOffline(this.pageCurrent2, this.pageSize2, 2).then(response => {
console.log(response.data.rows)
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()
},
searchTable02(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail(row.离线合同请款流水号).then(response => {
this.gridData = response.data
})
},
searchTable3() {
initApprovalMaterials(this.pageCurrent3, this.pageSize3, 2).then(response => {
console.log(response.data.rows)
this.tableData3 = response.data.rows
this.total3 = response.data.total
})
},
handleSizeChange3(val) {
this.pageSize3 = val
this.pageCurrent3 = 1
this.searchTable3()
},
handleCurrentChange3(val) {
this.pageCurrent3 = val
this.searchTable3()
},
searchTable03(row) { // 查看详情(请款信息包含的合同)
searchRequsetFundDetail1(row.采购计划请款流水号).then(response => {
this.gridData1 = response.data
})
},
yesApproval(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (row.类别 === '采购') {
execApproval(row.采购合同请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
} else if (row.类别 === '离线') {
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
} else if (row.类别 === '备料') {
execMaterials(row.采购计划请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
}
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApproval(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
if (row.类别 === '采购') {
execApproval(row.采购合同请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
} else if (row.类别 === '离线') {
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
} else if (row.类别 === '备料') {
execMaterials(row.采购计划请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
}
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
yesApprovalOffline(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execApprovalOffline(row.离线合同请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noApprovalOffline(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execApprovalOffline(row.离线合同请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
yesMaterials(row) { // 通过审核
this.$confirm('确定审核通过?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
execMaterials(row.采购计划请款流水号, 1, '通过', this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} else { this.$message.error('执行失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '取消操作'
})
})
},
noMaterials(row) { // 不通过审核
this.$prompt('请输入不通过原因', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({ value }) => {
execMaterials(row.采购计划请款流水号, 2, value, this.id, 2).then(response => {
if (response.data[0].result === '1') {
this.$message.success('执行成功')
this.searchTable()
} 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>