This commit is contained in:
bryan sun
2019-11-13 18:09:58 +08:00
6 changed files with 297 additions and 334 deletions

View File

@@ -75,14 +75,14 @@ export function execApprovalOffline(num1, num2, reason, person, state) {
})
}
// 采购合同内容查询
export function searchContactDetail(num) {
export function searchContactDetail(check, num1, num2) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_采购合同内容_查询数据',
param: '采购合同流水号=' + num
name: '采购管理_采购合同内容_查询数据_合并后',
param: `check=${check}&采购合同流水号=${num1}&离线合同流水号=${num2}`
}
})
}

View File

@@ -12,14 +12,14 @@ export function searchTable0(check, date1, date2) {
})
}
// 采购合同内容查询
export function searchContract(num) {
export function searchContract(check, num1, num2) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_采购合同内容_查询数据',
param: '采购合同流水号=' + num
name: '采购管理_采购合同内容_查询数据_合并后',
param: `check=${check}&采购合同流水号=${num1}&离线合同流水号=${num2}`
}
})
}
@@ -48,14 +48,14 @@ export function searchSupplier() {
})
}
// 采购合同请款
export function submitRequestFund(contractGroup, sumGroup, supplier, money, person) {
export function submitRequestFund(contractGroup, offGroup, sumGroup, supplier, money, person) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '采购管理_采购合同_请款_增加数据',
param: `采购合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person}`
name: '采购管理_采购合同_请款_增加数据_合并后',
param: `采购合同流水号组=${contractGroup}&离线合同流水号组=${offGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person}`
}
})
}
@@ -84,14 +84,14 @@ export function cancelRequestFund(num) {
})
}
// 查询离线合同待请款信息
export function searchPurchaseContract(check, num) {
export function searchPurchaseContract(check1, check, num) {
return request({
url: '',
method: 'post',
data: {
type: '1',
name: '采购管理_采购合同_查询数据',
param: `供应商流水号_check=${check}&供应商流水号=${num}`
name: '采购管理_采购合同_查询数据_合并后',
param: `check=${check1}&供应商流水号_check=${check}&供应商流水号=${num}`
}
})
}

View File

@@ -30,7 +30,7 @@
<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.采购合同编号 }}
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
@@ -58,72 +58,11 @@
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<el-table v-loading="" :data="tableData2" border 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="gridData2" stripe size="mini" show-summary highlight-current-row @row-click="searchOfflineContactDetail">
<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>
<h3 style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/>
<h3 style="">离线合同</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<h3 style="">合同明细</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" stripe show-summary>
<el-table-column label="合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
{{ scope.row.合同类型 === 1 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
@@ -131,7 +70,7 @@
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="物料规格" align="center" min-width="100">
<el-table-column label="物料规格" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
@@ -141,31 +80,36 @@
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="80">
<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="80" prop="单价">
<el-table-column label="单价" align="center" min-width="100" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
{{ parseFloat(scope.row.单价||0).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0) }}
{{ (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">
{{ scope.row.交货期要求 }}
{{ 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="80" prop="备注">
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<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.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
</el-table>
</div>
</template>
@@ -205,8 +149,11 @@ export default {
},
methods: {
searchContactDetail(row) {
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
var check
row.采购合同流水号 ? check = 1 : check = 2
searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
// this.contractDetail1 = response.data[0].合同内容
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
@@ -220,7 +167,7 @@ export default {
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
} else if (index === 6) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
@@ -231,7 +178,7 @@ export default {
return prev
}
}, 0)
sums[index] += ' 元'
sums[index] = sums[index].toFixed(2) + ' 元'
} else {
sums[index] = 'N/A'
}
@@ -241,7 +188,7 @@ export default {
},
fetchData() {
this.searchTable1()
this.searchTable2()
// this.searchTable2()
},
searchTable1() {
initApproval(this.pageCurrent1, this.pageSize1, 0).then(response => {
@@ -310,6 +257,7 @@ export default {
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('执行失败') }
})

View File

@@ -26,11 +26,11 @@
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData1" stripe size="mini" highlight-current-row show-summary @row-click="searchContactDetail">
<el-table :data="gridData1" :summary-method="getSummaries2" stripe size="mini" highlight-current-row show-summary @row-click="searchContactDetail">
<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.采购合同编号 }}
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
@@ -58,111 +58,11 @@
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<el-table v-loading="" :data="tableData2" border 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="gridData2" stripe size="mini" highlight-current-row show-summary @row-click="searchOfflineContactDetail">
<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>
<h3 id="firstAnchor" style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="background-color:white;min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/><hr>
<h3 id="secondAnchor" style="">离线合同</h3>
<div id="offlineContract" style="background-color:white;min-height:500px;margin: 0 auto;width: 800px;border:1px solid black">
<table v-show="contractDetail2.length > 0" class="offlineContract" cellspacing="0px" align="center" border="1 solid black" width="100%">
<tr>
<th colspan="14"><h1>离线合同</h1></th>
</tr>
<tr>
<td colspan="3" rowspan="2" style="text-align:center;font-size: 30px;font-weight: bold">GAOJING</td>
<td width="80px">合同名称</td>
<td id="contractName" colspan="2" style="text-align: left;"/>
<td width="80px">供应商</td>
<td id="supplier" colspan="5" style="text-align: left;"/>
<td id="qrCode" colspan="2" rowspan="2"/>
</tr>
<tr>
<td width="80px">合同编号</td>
<td id="contractNum" colspan="2" style="text-align: left;"/>
<td width="80px">采购员</td>
<td id="buyer" colspan="5" style="text-align: left;"/>
</tr>
<tr id="tablehead">
<td width="50px">序号</td>
<td colspan="2">名称</td>
<td>规格</td>
<td colspan="2">型号</td>
<td>数量</td>
<td colspan="2">单价</td>
<td colspan="2">合计</td>
<td>交货期</td>
<td colspan="2">备注</td>
</tr>
<tr>
<td>总计</td>
<td id="remark" colspan="10"/>
<td id="total" colspan="2" style="text-align: left;"/>
<td/>
</tr>
</table>
</div>
<!--
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="150">
<h3 style="">合同明细</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" stripe show-summary>
<el-table-column label="合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
{{ scope.row.合同类型 === 1 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="150">
@@ -170,7 +70,7 @@
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column label="物料规格" align="center" min-width="100">
<el-table-column label="物料规格" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
@@ -180,33 +80,37 @@
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="80">
<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="80" prop="单价">
<el-table-column label="单价" align="center" min-width="100" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
{{ parseFloat(scope.row.单价||0).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0) }}
{{ (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">
{{ scope.row.交货期要求 }}
{{ 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="80" prop="备注">
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<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.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
</el-table>
-->
</div>
</template>
@@ -245,8 +149,33 @@ export default {
this.fetchData()
},
methods: {
getSummaries2(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
return
} else if (index === 2 || index === 3) {
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
},
showOffline(row) {
console.log(row, 222)
const children = document.getElementsByClassName('tableData')
const parent = document.getElementsByClassName('offlineContract')[0]
if (children.length !== 0) {
@@ -285,13 +214,13 @@ export default {
document.getElementById('remark').innerHTML = row.离线合同备注
},
searchContactDetail(row) {
document.documentElement.scrollTop = this.$el.querySelector('#firstAnchor').offsetTop
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
var check
row.采购合同流水号 ? check = 1 : check = 2
searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
document.documentElement.scrollTop = this.$el.querySelector('#secondAnchor').offsetTop
searchMateriel(row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
this.showOffline(row)
@@ -303,7 +232,7 @@ export default {
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
} else if (index === 6) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
@@ -314,7 +243,7 @@ export default {
return prev
}
}, 0)
sums[index] += ' 元'
sums[index] = sums[index].toFixed(2) + ' 元'
} else {
sums[index] = 'N/A'
}

View File

@@ -26,11 +26,11 @@
<el-table-column label="审核" align="center" width="320">
<template slot-scope="scope">
<el-popover placement="right" width="400" trigger="click">
<el-table :data="gridData1" class="subTableHeader" stripe size="mini" show-summary highlight-current-row @row-click="searchContactDetail">
<el-table :data="gridData1" :summary-method="getSummaries2" class="subTableHeader" stripe size="mini" show-summary highlight-current-row @row-click="searchContactDetail">
<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.采购合同编号 }}
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="合同总额" prop="请款金额">
@@ -58,113 +58,58 @@
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">离线合同</h3>
<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="320">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="请款时间" align="center" min-width="140">
<template slot-scope="scope">
{{ scope.row.请款时间.substr(0,10) }}
</template>
</el-table-column>
<el-table-column label="请款人" align="center" min-width="80">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="90" 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="gridData2" class="subTableHeader" stripe size="mini" show-summary highlight-current-row @row-click="searchOfflineContactDetail">
<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="80" 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" plain style="margin-right: 10px" @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button type="primary" size="mini" plain icon="el-icon-check" @click="yesApprovalOffline(scope.row)">通过</el-button>
<el-button type="danger" size="mini" icon="el-icon-close" plain @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>
<h3 style="margin-top: 0">采购合同</h3>
<div id="print" class="print" style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="contractDetail1"/>
<h3 style="">离线合同</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border stripe style="margin-top:10px;max-height: 500px;" height="500px" size="mini" show-summary>
<el-table-column label="离线合同编号" align="center" min-width="130">
<h3 style="">合同明细</h3>
<el-table v-loading="" :data="contractDetail2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" stripe show-summary>
<el-table-column label="合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.离线合同编号 }}
{{ scope.row.合同类型 === 1 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column label="物料名称" align="center" min-width="100 ">
<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="150">
<el-table-column label="物料规格" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="物料型号" align="center" min-width="120">
<el-table-column label="物料型号" align="center" min-width="200">
<template slot-scope="scope">
{{ scope.row.物料型号 }}
</template>
</el-table-column>
<el-table-column label="数量" align="center" min-width="80">
<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="80" prop="单价">
<el-table-column label="单价" align="center" min-width="100" prop="单价">
<template slot-scope="scope">
{{ scope.row.单价 }}
{{ parseFloat(scope.row.单价||0).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="合计" align="center" min-width="80" prop="合计">
<el-table-column label="合计" align="center" min-width="100" prop="合计">
<template slot-scope="scope">
{{ parseFloat(scope.row.单价||0) * parseInt(scope.row.数量||0) }}
{{ (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">
{{ scope.row.交货期要求 }}
{{ 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="80" prop="备注">
<el-table-column label="备注" align="center" min-width="150" prop="备注">
<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.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
</el-table>
</div>
</template>
@@ -203,9 +148,37 @@ export default {
this.fetchData()
},
methods: {
getSummaries2(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
return
} else if (index === 2 || index === 3) {
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
},
searchContactDetail(row) {
searchContactDetail(row.采购合同流水号).then(response => {
this.contractDetail1 = response.data[0].合同内容
var check
row.采购合同流水号 ? check = 1 : check = 2
searchContactDetail(check, row.采购合同流水号, row.离线合同流水号).then(response => {
this.contractDetail2 = response.data
})
},
searchOfflineContactDetail(row) { // 查询离线合同明细
@@ -219,7 +192,7 @@ export default {
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 7) {
} else if (index === 6) {
const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量'])))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
@@ -230,7 +203,7 @@ export default {
return prev
}
}, 0)
sums[index] += ' 元'
sums[index] = sums[index].toFixed(2) + ' 元'
} else {
sums[index] = 'N/A'
}

View File

@@ -11,12 +11,7 @@
:label="item.label"
:value="item.value"/>
</el-select>
<el-button
type="success"
size="small"
icon="el-icon-search"
style="margin-left: 10px"
@click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent1=1;pageSize1=10;total1=0;searchTable1()">查询</el-button>
<el-button type="primary" size="small" icon="el-icon-goods" style="" @click="requestFund">请款</el-button>
</div>
<h3>请款表</h3>
@@ -80,21 +75,21 @@
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-popover placement="right" width="500" trigger="click">
<el-table :data="gridData" highlight-current-row size="mini" show-summary @row-click="searchContract">
<el-table :data="gridData" :summary-method="getSummaries2" highlight-current-row size="mini" show-summary @row-click="searchContract">
<el-table-column width="50" align="center" type="index" label="序号"/>
<el-table-column min-width="150" align="center" label="采购合同编号">
<el-table-column min-width="150" align="center" label="合同编号">
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
{{ scope.row.采购合同编号 ? scope.row.采购合同编号 : scope.row.离线合同编号 }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="已付金额" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
{{ parseFloat(scope.row.已付金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column min-width="100" align="center" label="请款金额" prop="请款金额">
<template slot-scope="scope">
{{ scope.row.请款金额 }}
{{ parseFloat(scope.row.请款金额).toFixed(2) }}
</template>
</el-table-column>
</el-table>
@@ -116,65 +111,118 @@
@current-change="handleCurrentChange1"/>
</div>
</el-card>
<el-card>
<h3 style="margin-top: 0">合同明细</h3>
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries" border style="margin-top:10px;max-height: 500px;" height="500px" size="mini" stripe show-summary>
<el-table-column label="合同编号" align="center" min-width="150">
<template slot-scope="scope">
{{ scope.row.合同类型 === 1 ? scope.row.采购合同编号 : 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="200">
<template slot-scope="scope">
{{ scope.row.物料规格 }}
</template>
</el-table-column>
<el-table-column label="物料型号" align="center" min-width="200">
<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">
{{ parseFloat(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) * parseInt(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-column label="到货数量" align="center" min-width="100">
<template slot-scope="scope">
{{ scope.row.合同类型 === 1 ? scope.row.已到货数量 : scope.row.到货数量 }}
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogVisible2" title="采购合同请款" center style="min-height: 300px" width="1000px">
<span>供应商</span>
<el-select v-model="supplierValue" placeholder="供应商" filterable clearable size="small">
<el-select v-model="supplierValue" placeholder="供应商" filterable clearable size="small" @change="searchTable01()">
<el-option
v-for="item in supplier"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 10px 10px 10px" @click="searchTable01()">查询</el-button>
<el-table v-loading="" :data="tableData01" border style="max-height: 300px;" height="300px" size="mini" @row-click="searchContract" @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="50"/>
<el-table-column label="采购合同编号" align="center" min-width="100">
<!--<el-button type="success" size="small" icon="el-icon-search" style="margin: 0 10px 10px 10px" @click="searchTable01()">查询</el-button>-->
<el-table v-loading="" :data="tableData01" border style="max-height: 300px;" height="300px" size="mini" @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" type="selection" align="center" width="45"/>
<el-table-column label="采购合同编号" align="center" min-width="140" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.采购合同编号 }}
</template>
</el-table-column>
<el-table-column label="采购合同名称" align="center" min-width="120">
<el-table-column label="采购合同名称" align="center" min-width="100" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.采购合同名称 }}
</template>
</el-table-column>
<el-table-column label="供应商" align="center" min-width="180">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
</template>
</el-table-column>
<el-table-column label="采购员" align="center" width="80">
<el-table-column label="采购员" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="合同类型" align="center" width="70">
<template slot-scope="scope">
{{ scope.row.合同类型 === 1 ? '采购' : '离线' }}
</template>
</el-table-column>
<el-table-column label="合同总额" align="center" width="80" prop="合同总额">
<template slot-scope="scope">
{{ scope.row.合同总额 ? parseInt(scope.row.合同总额 * 100)/100 : '-' }}
{{ scope.row.合同总额 ? (parseInt(scope.row.合同总额 * 100)/100).toFixed(2) : '-' }}
</template>
</el-table-column>
<el-table-column label="已付金额" align="center" width="80" prop="已付金额">
<template slot-scope="scope">
{{ scope.row.已付金额 }}
{{ parseFloat(scope.row.已付金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="申请中金额" align="center" min-width="100" prop="申请中金额">
<template slot-scope="scope">
{{ scope.row.申请中金额 }}
{{ parseFloat(scope.row.申请中金额).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="120" prop="请款金额">
<el-table-column label="请款金额" align="center" min-width="180" prop="请款金额">
<template slot-scope="scope">
<el-input-number :max="scope.row.合同总额 - scope.row.已付金额 - scope.row.申请中金额" :disabled="(scope.row.合同总额 - scope.row.已付金额 - scope.row.申请中金额) === 0" :min="0" v-model="scope.row.请款金额" :precision="2" size="mini" controls-position="right" style="width: 100%;"/>
</template>
</el-table-column>
</el-table>
<span>合计<el-input v-model="SUM" readonly size="mini" style="width: 80px; margin: 10px 10px 0 10px"/></span>
<span>合计<el-input v-model="SUM" readonly size="mini" style="width: 150px; margin: 10px 10px 0 10px"/></span>
<el-button type="primary" size="small" style="float:right;margin: 10px" icon="el-icon-check" @click="submitRequestFund">确定请款</el-button>
</el-dialog>
<div style="min-height:500px;margin: 0px auto;width:800px;border:1px solid black" v-html="returns"/>
</div>
</template>
@@ -248,6 +296,7 @@ export default {
tableData01: [],
SUM: 0,
contractGroup: [],
offGroup: [],
gridData: []
}
},
@@ -287,10 +336,63 @@ export default {
})
},
searchContract(row) {
searchContract(row.采购合同流水号).then(response => {
this.returns = response.data[0].合同内容
var check
row.采购合同流水号 ? check = 1 : check = 2
searchContract(check, row.采购合同流水号, row.离线合同流水号).then(response => {
this.tableData2 = response.data
})
},
getSummaries(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
} else if (index === 6) {
const values = data.map(item => Number(parseFloat(item['单价']) * 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].toFixed(2) + ' 元'
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
getSummaries2(param) { // 合计
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
return
} else if (index === 2 || index === 3) {
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
},
handleSizeChange1(val) {
this.pageSize1 = val
this.pageCurrent1 = 1
@@ -310,7 +412,7 @@ export default {
})
this.totalSum = 0
this.totalPay = 0
searchPurchaseContract(check2, this.supplierValue).then(response => {
searchPurchaseContract(1, check2, this.supplierValue).then(response => {
response.data.map(data => {
this.totalSum += data.合同总额
this.totalPay += data.已付金额
@@ -327,9 +429,10 @@ export default {
searchTable01() { // 查询待请款
if (this.supplierValue) {
this.contractGroup = []
this.offGroup = []
let check
this.supplierValue ? check = 1 : check = 0
searchPurchaseContract(check, this.supplierValue).then(response => {
searchPurchaseContract(2, check, this.supplierValue).then(response => {
this.tableData01 = response.data
this.tableData01.map(v => {
this.$set(v, '请款金额', 0)
@@ -337,8 +440,6 @@ export default {
return v
})
})
} else {
this.$message.error('请选择供应商')
}
},
selectable(row, index) { // 控制某行是否可选
@@ -348,31 +449,43 @@ export default {
this.selectContents = val
this.SUM = 0
this.contractGroup = []
this.offGroup = []
this.sumGroup = []
for (let i = 0; i < val.length; i++) {
this.SUM += parseFloat(val[i].请款金额)
this.contractGroup.push(val[i].采购合同流水号)
this.offGroup.push(val[i].采购合同流水号)
this.sumGroup.push(val[i].请款金额)
}
this.SUM = parseFloat(this.SUM).toFixed(2)
},
submitRequestFund() { // 确认请款
if (this.supplierValue && this.contractGroup.length !== 0) {
this.SUM = 0
this.contractGroup = []
this.offGroup = []
this.sumGroup = []
for (let i = 0; i < this.tableData01.length; i++) {
for (let j = 0; j < this.selectContents.length; j++) {
if (this.selectContents[j].采购合同流水号 === this.tableData01[i].采购合同流水号) {
this.SUM += parseFloat(this.tableData01[i].请款金额)
this.contractGroup.push(this.tableData01[i].采购合同流水号)
this.sumGroup.push(this.tableData01[i].请款金额)
if (this.selectContents[j].采购合同流水号 === this.tableData01[i].采购合同流水号 && this.selectContents[j].合同类型 === this.tableData01[i].合同类型) {
if (this.selectContents[j].合同类型 === 1) {
this.SUM += parseFloat(this.tableData01[i].请款金额)
this.contractGroup.push(this.tableData01[i].采购合同流水号)
this.offGroup.push('a974548')
this.sumGroup.push(this.tableData01[i].请款金额)
} else {
this.SUM += parseFloat(this.tableData01[i].请款金额)
this.contractGroup.push('a974548')
this.offGroup.push(this.tableData01[i].采购合同流水号)
this.sumGroup.push(this.tableData01[i].请款金额)
}
}
}
}
if (this.SUM === 0) {
this.$message.error('请款金额不能为0')
} else {
submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => { // 采购合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person
submitRequestFund(this.contractGroup, this.offGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => {
if (response.data[0].result === '1') {
this.$message.success('请款成功')
this.searchTable1()