|
|
|
|
@ -5,8 +5,9 @@
|
|
|
|
|
:is-show.sync="isShow"
|
|
|
|
|
type="normal"
|
|
|
|
|
title="出差审批"
|
|
|
|
|
@on-ok="confirm"
|
|
|
|
|
>
|
|
|
|
|
<xy-table :table-item="table" :list="records">
|
|
|
|
|
<xy-table :table-item="table" :list="records" show-summary :summary-method="summary">
|
|
|
|
|
<template #btns> </template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
</xy-dialog>
|
|
|
|
|
@ -14,6 +15,10 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {getBudget} from "@/api/budget/budget";
|
|
|
|
|
import {addFundLog} from "@/api/paymentRegistration/fundLog";
|
|
|
|
|
import {save} from "@/api/away";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -21,7 +26,14 @@ export default {
|
|
|
|
|
table: [
|
|
|
|
|
{
|
|
|
|
|
prop: 'plan',
|
|
|
|
|
label: '资金来源'
|
|
|
|
|
label: '资金来源',
|
|
|
|
|
width: 140,
|
|
|
|
|
align: 'left',
|
|
|
|
|
formatter: (row) => {
|
|
|
|
|
return row.plan_link?.reduce((pre, cur) => {
|
|
|
|
|
return pre + (this.plans?.find(i => i.id === cur.plan_id)?.name ?? '') + ';'
|
|
|
|
|
}, '')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'title',
|
|
|
|
|
@ -39,6 +51,11 @@ export default {
|
|
|
|
|
label: '结束日期',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'admin.name',
|
|
|
|
|
label: '经办人',
|
|
|
|
|
width: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
prop: 'flow_title',
|
|
|
|
|
label: '编号',
|
|
|
|
|
@ -51,7 +68,8 @@ export default {
|
|
|
|
|
formatter: (row) => row.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_data?.totalAmt
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
records: []
|
|
|
|
|
records: [],
|
|
|
|
|
plans: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
@ -63,10 +81,49 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
setRecords(records = []) {
|
|
|
|
|
this.records = records
|
|
|
|
|
console.log(this.records)
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
summary(param) {
|
|
|
|
|
const { columns, data } = param;
|
|
|
|
|
return columns.map((column, index) => {
|
|
|
|
|
if(index === 0) {
|
|
|
|
|
return '合计'
|
|
|
|
|
} else {
|
|
|
|
|
return column.property === 'totalAmt' ? (
|
|
|
|
|
data.reduce((pre, cur) => pre + (isNaN(Number(cur.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_data?.totalAmt)) ? 0 : Number(cur.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_data?.totalAmt)), 0)
|
|
|
|
|
) : ''
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
async getBudgets() {
|
|
|
|
|
let res = await getBudget({
|
|
|
|
|
is_tree: 1
|
|
|
|
|
})
|
|
|
|
|
this.plans = res.list
|
|
|
|
|
},
|
|
|
|
|
async confirm() {
|
|
|
|
|
const res = await Promise.allSettled(this.records.map(record => addFundLog({
|
|
|
|
|
fund_type: 2,
|
|
|
|
|
away_id: record.id,
|
|
|
|
|
apply_money: record.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_data?.totalAmt,
|
|
|
|
|
remark: record.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_title,
|
|
|
|
|
contract_plan_act_links: record.plan_link?.map(plan => ({
|
|
|
|
|
plan_id: this.plans.find(i => i.id === plan.plan_id)?.children[0].id,
|
|
|
|
|
use_money: record.away_flow_links?.find(i => i.tag === "chuchaibaoxiao")?.flow_data?.totalAmt
|
|
|
|
|
})),
|
|
|
|
|
})))
|
|
|
|
|
await Promise.allSettled(res.map((i, index) => i.status === 'fulfilled' ? save({
|
|
|
|
|
financial_status: 2,
|
|
|
|
|
id: this.records[index].id
|
|
|
|
|
}) : ''))
|
|
|
|
|
this.$message.success('操作成功')
|
|
|
|
|
this.hidden()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {},
|
|
|
|
|
created() {
|
|
|
|
|
this.getBudgets()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|