|
|
|
|
@ -155,7 +155,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
</xy-dialog>
|
|
|
|
|
|
|
|
|
|
<xy-table :list="list" :table-item="table" :row-key="'pid'" :treeProps="{ children: 'fund_logs', hasChildren: 'hasChildren' }">
|
|
|
|
|
<xy-table :list="list" :table-item="table" :row-key="'pid'" :tree-props="{ children: 'fund_logs', hasChildren: 'hasChildren' }">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="操作"
|
|
|
|
|
@ -170,7 +170,7 @@
|
|
|
|
|
confirm
|
|
|
|
|
:transfer="true"
|
|
|
|
|
title="确认要审核吗?"
|
|
|
|
|
@on-ok="updateCollect(scope.row)"
|
|
|
|
|
@on-ok="showAuditDialog(scope.row)"
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
size="small"
|
|
|
|
|
@ -190,6 +190,17 @@
|
|
|
|
|
>
|
|
|
|
|
</template> -->
|
|
|
|
|
</template>
|
|
|
|
|
<!-- <template slot-scope="scope">
|
|
|
|
|
<Button
|
|
|
|
|
size="small"
|
|
|
|
|
type="primary"
|
|
|
|
|
style="margin-left: 10px; margin-bottom: 4px"
|
|
|
|
|
@click="
|
|
|
|
|
($refs['examineRegistration'].isShow = true),
|
|
|
|
|
$refs['examineRegistration'].getRegistration(scope.row.id)
|
|
|
|
|
"
|
|
|
|
|
>审核确认123</Button>
|
|
|
|
|
</template> -->
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
@ -208,18 +219,105 @@
|
|
|
|
|
ref="examineRegistration"
|
|
|
|
|
@refresh="getCollects"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<!-- 审核确认弹窗 -->
|
|
|
|
|
<el-dialog
|
|
|
|
|
title="审核确认"
|
|
|
|
|
:visible.sync="auditDialogVisible"
|
|
|
|
|
width="80%"
|
|
|
|
|
:close-on-click-modal="false"
|
|
|
|
|
:close-on-press-escape="false"
|
|
|
|
|
>
|
|
|
|
|
<div v-if="currentAuditRow">
|
|
|
|
|
<!-- 基本信息表格 -->
|
|
|
|
|
<div style="margin-bottom: 20px;color:#000">
|
|
|
|
|
{{ currentAuditRow.contract_id ? (currentAuditRow.contract ? currentAuditRow.contract.name : '') : (currentAuditRow.away ? currentAuditRow.away.title : currentAuditRow.name) }}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 每个fund_logs及其plan_link的区块 -->
|
|
|
|
|
<div v-if="currentAuditRow.fund_logs && currentAuditRow.fund_logs.length > 0">
|
|
|
|
|
<div v-for="(fundLog, fundLogIndex) in currentAuditRow.fund_logs" :key="fundLog.id" style="margin-bottom: 30px;">
|
|
|
|
|
<h4 style="margin-bottom: 15px; color: #409EFF;">付款记录 #{{ fundLogIndex + 1 }}</h4>
|
|
|
|
|
<!-- fund_logs信息表格 -->
|
|
|
|
|
<el-table :data="[fundLog]" border style="margin-bottom: 15px;">
|
|
|
|
|
<el-table-column prop="contract.name" label="项目名称" min-width="200">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.contract_id ? (scope.row.contract ? scope.row.contract.name : '') : (scope.row.away ? scope.row.away.title : scope.row.name) }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="apply_money" label="付款申请金额(元)" width="150" align="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.apply_money ? Number(scope.row.apply_money).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') : '' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="act_money" label="实际支付金额(元)" width="150" align="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.act_money ? Number(scope.row.act_money).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') : '' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="type" label="款项类型" width="120" />
|
|
|
|
|
<el-table-column prop="admin.name" label="经办人" width="120" align="center" />
|
|
|
|
|
<el-table-column prop="department.name" label="业务科室" width="140" align="center" />
|
|
|
|
|
<el-table-column prop="remark" label="备注" min-width="200" />
|
|
|
|
|
<el-table-column prop="created_at" label="创建信息" width="160" />
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<!-- 对应的plan_link表格 -->
|
|
|
|
|
<div v-if="fundLog.plan_link && fundLog.plan_link.length > 0">
|
|
|
|
|
<h5 style="margin-bottom: 10px; color: #67C23A;">预算计划使用情况</h5>
|
|
|
|
|
<el-table :data="getPlanLinkData(fundLog)" border>
|
|
|
|
|
<el-table-column label="" width="55" align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-checkbox v-model="scope.row.selected" @change="handleSelectionChange(scope.row, fundLog.id)" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="year" label="年份" width="100" align="center" />
|
|
|
|
|
<el-table-column prop="name" label="名称" min-width="200" />
|
|
|
|
|
<el-table-column prop="content" label="内容" min-width="200" />
|
|
|
|
|
<el-table-column prop="money" label="计划金额" width="150" align="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ scope.row.money ? Number(scope.row.money).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') : '' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="使用金额" width="150" align="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input-number
|
|
|
|
|
v-model="scope.row.use_money"
|
|
|
|
|
:precision="2"
|
|
|
|
|
:min="0"
|
|
|
|
|
:max="999999999"
|
|
|
|
|
:disabled="!scope.row.selected"
|
|
|
|
|
controls-position="right"
|
|
|
|
|
size="small"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else style="text-align: center; color: #909399; padding: 20px;">
|
|
|
|
|
暂无预算计划关联
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="auditDialogVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="confirmAudit">确认审核</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
getFundLog,
|
|
|
|
|
delFundLog,
|
|
|
|
|
editorFundLog
|
|
|
|
|
} from '@/api/paymentRegistration/fundLog'
|
|
|
|
|
import { getCollect,addCollect} from '@/api/paymentRegistration/collect'
|
|
|
|
|
import { getCollect, addCollect } from '@/api/paymentRegistration/collect'
|
|
|
|
|
|
|
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
import { parseTime } from '@/utils'
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
import { getBudget } from '@/api/budget/budget'
|
|
|
|
|
@ -286,6 +384,9 @@ export default {
|
|
|
|
|
selectDate: '',
|
|
|
|
|
list: [],
|
|
|
|
|
total: 0,
|
|
|
|
|
auditDialogVisible: false,
|
|
|
|
|
currentAuditRow: null,
|
|
|
|
|
planLinkDataMap: {},
|
|
|
|
|
flowStatus: new Map([
|
|
|
|
|
[2, '待申请'],
|
|
|
|
|
[-1, '已退回'],
|
|
|
|
|
@ -303,14 +404,14 @@ export default {
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
table: [
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
label: '项目名称',
|
|
|
|
|
minWidth: 250,
|
|
|
|
|
prop: 'contract.name',
|
|
|
|
|
align: 'left',
|
|
|
|
|
// fixed: this.$store.getters.device === 'mobile' ? false : 'left',
|
|
|
|
|
customFn: row => {
|
|
|
|
|
return (<span>{ row.contract_id ? (row.contract ? row.contract.name : '') : (row.away?row.away.title:row.name) }</span>)
|
|
|
|
|
return (<span>{ row.contract_id ? (row.contract ? row.contract.name : '') : (row.away ? row.away.title : row.name) }</span>)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
@ -319,9 +420,9 @@ export default {
|
|
|
|
|
align: 'right',
|
|
|
|
|
width: 180,
|
|
|
|
|
formatter: (v1, v2, value) => {
|
|
|
|
|
return value?Number(value)
|
|
|
|
|
return value ? Number(value)
|
|
|
|
|
.toFixed(2)
|
|
|
|
|
.replace(/(\d)(?=(\d{3})+\.)/g, '$1,'):''
|
|
|
|
|
.replace(/(\d)(?=(\d{3})+\.)/g, '$1,') : ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
@ -330,18 +431,17 @@ export default {
|
|
|
|
|
align: 'right',
|
|
|
|
|
width: 180,
|
|
|
|
|
formatter: (v1, v2, value) => {
|
|
|
|
|
return value?Number(value)
|
|
|
|
|
return value ? Number(value)
|
|
|
|
|
.toFixed(2)
|
|
|
|
|
.replace(/(\d)(?=(\d{3})+\.)/g, '$1,'):''
|
|
|
|
|
.replace(/(\d)(?=(\d{3})+\.)/g, '$1,') : ''
|
|
|
|
|
}
|
|
|
|
|
},{
|
|
|
|
|
}, {
|
|
|
|
|
label: '已纳入资金执行率金额',
|
|
|
|
|
width: 300,
|
|
|
|
|
align: 'left',
|
|
|
|
|
customFn: (row) => {
|
|
|
|
|
{
|
|
|
|
|
if (row.plan_act_links && row.plan_act_links.length > 0) {
|
|
|
|
|
return row.plan_act_links.map((item) => {
|
|
|
|
|
if (row.plan_link && row.plan_link.length > 0) {
|
|
|
|
|
return row.plan_link.map((item) => {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
{' '}
|
|
|
|
|
@ -350,7 +450,6 @@ export default {
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -395,29 +494,28 @@ export default {
|
|
|
|
|
label: '财务确认状态',
|
|
|
|
|
width: 100,
|
|
|
|
|
customFn: row => {
|
|
|
|
|
if(row.fund_logs){
|
|
|
|
|
return (row.status === 0)
|
|
|
|
|
if (row.fund_logs) {
|
|
|
|
|
return (row.status === 0)
|
|
|
|
|
? (<span style='color:rgb(96, 109, 241)'>待审核</span>)
|
|
|
|
|
: (<span style='color: rgb(147, 201, 134)'>已审核</span>)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
// label: '次数',
|
|
|
|
|
// prop: 'pay_count',
|
|
|
|
|
// width: 95,
|
|
|
|
|
//customFn: row => {
|
|
|
|
|
// return (<span>{ row.contract_id ? row.pay_count : row.pay_count_away }</span>)
|
|
|
|
|
//}
|
|
|
|
|
//},
|
|
|
|
|
// {
|
|
|
|
|
// label: '次数',
|
|
|
|
|
// prop: 'pay_count',
|
|
|
|
|
// width: 95,
|
|
|
|
|
// customFn: row => {
|
|
|
|
|
// return (<span>{ row.contract_id ? row.pay_count : row.pay_count_away }</span>)
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
label: '最后一笔',
|
|
|
|
|
prop: 'is_end',
|
|
|
|
|
width: 125,
|
|
|
|
|
formatter: (cell, data, value) => {
|
|
|
|
|
return value===0?'否':(value === 1 ? '是' : '')
|
|
|
|
|
return value === 0 ? '否' : (value === 1 ? '是' : '')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
@ -577,11 +675,11 @@ export default {
|
|
|
|
|
const res = await getCollect({
|
|
|
|
|
page_size: this.pageSize,
|
|
|
|
|
page: this.pageIndex,
|
|
|
|
|
//keyword: this.keyword,
|
|
|
|
|
// keyword: this.keyword,
|
|
|
|
|
start_date: this.selectDate,
|
|
|
|
|
status: this.status,
|
|
|
|
|
act_plan_link_id: this.select.plan_id,
|
|
|
|
|
//show_type: 1,
|
|
|
|
|
// show_type: 1,
|
|
|
|
|
'flow_link[0][custom_model_id]': 75,
|
|
|
|
|
'flow_link[0][flow_status]': this.select.flow_status,
|
|
|
|
|
department_id: this.select.department_id
|
|
|
|
|
@ -589,25 +687,24 @@ export default {
|
|
|
|
|
this.addParentReference(res.list.data)
|
|
|
|
|
this.list = []
|
|
|
|
|
this.list = res.list.data
|
|
|
|
|
console.log("this.list",this.list)
|
|
|
|
|
console.log('this.list', this.list)
|
|
|
|
|
this.total = res.list.total
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addParentReference(data, parent = null) {
|
|
|
|
|
if (!Array.isArray(data)) return;
|
|
|
|
|
if (!Array.isArray(data)) return
|
|
|
|
|
|
|
|
|
|
data.forEach(node => {
|
|
|
|
|
node.parent = parent;
|
|
|
|
|
node.parent = parent
|
|
|
|
|
|
|
|
|
|
if (node.fund_logs && node.fund_logs.length > 0) {
|
|
|
|
|
node.pid = 'p' + node.id;
|
|
|
|
|
this.addParentReference(node.fund_logs, node);
|
|
|
|
|
}else{
|
|
|
|
|
node.pid = node.id;
|
|
|
|
|
|
|
|
|
|
node.pid = 'p' + node.id
|
|
|
|
|
this.addParentReference(node.fund_logs, node)
|
|
|
|
|
} else {
|
|
|
|
|
node.pid = node.id
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
deleteFundLog(row) {
|
|
|
|
|
delFundLog({
|
|
|
|
|
@ -620,6 +717,123 @@ export default {
|
|
|
|
|
this.getCollects()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getPlanLinkData(fundLog) {
|
|
|
|
|
// 从planLinkDataMap中获取数据,这样可以保留选中状态
|
|
|
|
|
if (this.planLinkDataMap[fundLog.id]) {
|
|
|
|
|
return this.planLinkDataMap[fundLog.id]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 如果没有缓存,则从fundLog中获取
|
|
|
|
|
if (!fundLog.plan_link || fundLog.plan_link.length === 0) {
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fundLog.plan_link.map(planItem => ({
|
|
|
|
|
year: planItem.plan?.year || '',
|
|
|
|
|
name: planItem.plan?.name || '',
|
|
|
|
|
content: planItem.plan?.content || '',
|
|
|
|
|
money: planItem.plan?.money || 0,
|
|
|
|
|
use_money: fundLog.act_money || 0, // 初始值为fund_logs的act_money
|
|
|
|
|
selected: true, // 默认选中
|
|
|
|
|
fund_log_id: fundLog.id,
|
|
|
|
|
plan_id: planItem.plan?.id || '',
|
|
|
|
|
plan_link_id: planItem.id
|
|
|
|
|
}))
|
|
|
|
|
},
|
|
|
|
|
handleSelectionChange(row, fundLogId) {
|
|
|
|
|
// 当复选框状态改变时的处理逻辑
|
|
|
|
|
console.log('Selection changed:', row, fundLogId)
|
|
|
|
|
},
|
|
|
|
|
showAuditDialog(row) {
|
|
|
|
|
this.currentAuditRow = row
|
|
|
|
|
this.planLinkDataMap = {}
|
|
|
|
|
|
|
|
|
|
// 处理fund_logs中的plan_link数据
|
|
|
|
|
if (row.fund_logs && row.fund_logs.length > 0) {
|
|
|
|
|
row.fund_logs.forEach(fundLog => {
|
|
|
|
|
if (fundLog.plan_link && fundLog.plan_link.length > 0) {
|
|
|
|
|
this.planLinkDataMap[fundLog.id] = fundLog.plan_link.map(planItem => ({
|
|
|
|
|
year: planItem.plan?.year || '',
|
|
|
|
|
name: planItem.plan?.name || '',
|
|
|
|
|
content: planItem.plan?.content || '',
|
|
|
|
|
money: planItem.plan?.money || 0,
|
|
|
|
|
use_money: fundLog.act_money || 0, // 初始值为fund_logs的act_money
|
|
|
|
|
selected: true, // 默认选中
|
|
|
|
|
fund_log_id: fundLog.id,
|
|
|
|
|
plan_id: planItem.plan?.id || '', // 保存plan的id
|
|
|
|
|
plan_link_id: planItem.id
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.auditDialogVisible = true
|
|
|
|
|
},
|
|
|
|
|
confirmAudit() {
|
|
|
|
|
// 检查每个fund_logs是否至少选择了一条预算计划
|
|
|
|
|
if (!this.currentAuditRow.fund_logs || this.currentAuditRow.fund_logs.length === 0) {
|
|
|
|
|
Message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: '没有付款记录'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取付款登记的项目名称
|
|
|
|
|
const projectName = this.currentAuditRow.contract_id
|
|
|
|
|
? (this.currentAuditRow.contract ? this.currentAuditRow.contract.name : '')
|
|
|
|
|
: (this.currentAuditRow.away ? this.currentAuditRow.away.title : this.currentAuditRow.name)
|
|
|
|
|
|
|
|
|
|
// 检查每个付款记录是否至少选择了一条预算计划,并构建contract_plan_act_links数组
|
|
|
|
|
const contract_plan_act_links = []
|
|
|
|
|
|
|
|
|
|
for (const fundLog of this.currentAuditRow.fund_logs) {
|
|
|
|
|
const planLinkData = this.planLinkDataMap[fundLog.id] || []
|
|
|
|
|
const selectedItems = planLinkData.filter(item => item.selected)
|
|
|
|
|
|
|
|
|
|
if (selectedItems.length === 0) {
|
|
|
|
|
// 提示的项目名称应该是付款登记的项目名称
|
|
|
|
|
Message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
message: `项目"${projectName}"未选择预算计划`
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 构建选中项的数据
|
|
|
|
|
selectedItems.forEach(item => {
|
|
|
|
|
contract_plan_act_links.push({
|
|
|
|
|
fund_log_id: fundLog.id,
|
|
|
|
|
contract_id: fundLog.contract_id,
|
|
|
|
|
plan_id: item.plan_id,
|
|
|
|
|
use_money: item.use_money
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 打印提交的数据
|
|
|
|
|
console.log('准备提交的数据:', {
|
|
|
|
|
id: this.currentAuditRow.id,
|
|
|
|
|
status: 1,
|
|
|
|
|
contract_plan_act_links
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 以下是原来的提交逻辑(暂时注释掉)
|
|
|
|
|
addCollect({
|
|
|
|
|
id: this.currentAuditRow.id,
|
|
|
|
|
status: 1,
|
|
|
|
|
contract_plan_act_links
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
Message({
|
|
|
|
|
type: 'success',
|
|
|
|
|
message: '操作成功'
|
|
|
|
|
})
|
|
|
|
|
this.auditDialogVisible = false
|
|
|
|
|
this.getCollects()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
updateCollect(row) {
|
|
|
|
|
console.log('123')
|
|
|
|
|
addCollect({
|
|
|
|
|
|