oa 一般采购支付 最后一笔

master
lion 1 month ago
parent a31db2adb5
commit cb9a80e2b2

@ -130,9 +130,9 @@
</div> </div>
<div class="xy-table-item-content" style="margin-left:10px"> <div class="xy-table-item-content" style="margin-left:10px">
<el-switch v-model="fundlogFormMap[pay.id].isLast" /> <el-switch v-model="fundlogFormMap[pay.id].isLast" />
</div>
</div> </div>
</div> </div>
</div>
<vxe-table :ref="'table_' + pay.id" stripe style="margin-top: 6px" keep-source :column-config="{ resizable: true }" <vxe-table :ref="'table_' + pay.id" stripe style="margin-top: 6px" keep-source :column-config="{ resizable: true }"
:print-config="{}" :export-config="{}" :expand-config="{ :print-config="{}" :export-config="{}" :expand-config="{
accordion: true, accordion: true,
@ -457,23 +457,23 @@ import {getToken} from "@/utils/auth";
for (const gid of groupIds) { for (const gid of groupIds) {
const form = this.fundlogFormMap[gid] || {} const form = this.fundlogFormMap[gid] || {}
if (!form.applyMoney || Number(form.applyMoney) <= 0) { if (!form.applyMoney || Number(form.applyMoney) <= 0) {
this.$message({ this.$message({
message: `${idToTitle[gid] || gid}】请填写本次申请付款金额`, message: `${idToTitle[gid] || gid}】请填写本次申请付款金额`,
duration: 2000, duration: 2000,
type: 'warning' type: 'warning'
}) })
return return
} }
if (!form.type) { if (!form.type) {
this.$message({ this.$message({
message: `${idToTitle[gid] || gid}】请选择款项类型`, message: `${idToTitle[gid] || gid}】请选择款项类型`,
duration: 2000, duration: 2000,
type: 'warning' type: 'warning'
}) })
return return
}
} }
// }
//
const groupMap = records.reduce((acc, row) => { const groupMap = records.reduce((acc, row) => {
const gid = row.sourceFlowId const gid = row.sourceFlowId
if (!acc[gid]) acc[gid] = [] if (!acc[gid]) acc[gid] = []
@ -485,20 +485,38 @@ import {getToken} from "@/utils/auth";
const rows = groupMap[gid] const rows = groupMap[gid]
let count = 0 let count = 0
let totalCount = 0 let totalCount = 0
let allToRemain = true // ""
console.log(`当前分组gid: ${gid}`)
console.log(`this.list中所有sourceFlowId:`, this.list.map(r => r.sourceFlowId))
const allItemsInGroup = this.list.filter(r => r.sourceFlowId == gid)
console.log(`匹配到的明细数量: ${allItemsInGroup.length}`)
let allCompleted = true
//
rows.forEach(item => { rows.forEach(item => {
const payNum = Number(item.payNum) const payNum = Number(item.payNum)
const num = Number(item.num) const num = Number(item.num)
const hasPay = Number(item.hasPayNum) const hasPay = Number(item.hasPayNum)
const remain = num - hasPay
if (isNaN(payNum) || payNum === 0 || payNum > num) count++ if (isNaN(payNum) || payNum === 0 || payNum > num) count++
if (payNum + hasPay > num) totalCount++ if (payNum + hasPay > num) totalCount++
// })
if (!(payNum > 0 && Math.abs(payNum - remain) < 1e-6)) {
allToRemain = false // +
} allItemsInGroup.forEach(item => {
}) const hasPay = Number(item.hasPayNum)
if (count > 0) { const num = Number(item.num)
//
const selectedItem = rows.find(r => r.id === item.id)
const totalPay = hasPay + (selectedItem ? Number(selectedItem.payNum) : 0)
console.log(`分组${gid}明细${item.id}: hasPay=${hasPay}, payNum=${selectedItem ? selectedItem.payNum : 0}, totalPay=${totalPay}, num=${num}, 是否完成=${totalPay >= num}`)
if (totalPay < num) {
allCompleted = false
}
})
console.log(`分组${gid} allCompleted:`, allCompleted, `总明细数:${allItemsInGroup.length}`)
if (count > 0) {
this.$message({ this.$message({
message: `${idToTitle[gid] || gid}】报销数量不能为0或报销数量大于总数量`, message: `${idToTitle[gid] || gid}】报销数量不能为0或报销数量大于总数量`,
duration: 2000, duration: 2000,
@ -515,7 +533,7 @@ import {getToken} from "@/utils/auth";
return return
} }
// //
if (allToRemain && this.fundlogFormMap[gid] && !this.fundlogFormMap[gid].isLast) { if (allCompleted && this.fundlogFormMap[gid] && !this.fundlogFormMap[gid].isLast) {
groupsToAutoEnd.push(gid) groupsToAutoEnd.push(gid)
} }
} }
@ -577,11 +595,7 @@ import {getToken} from "@/utils/auth";
// ID // ID
const contractIdStr = Array.from(new Set(wuzicaigou_items.map(i => i.contract_id).filter(Boolean))).join(',') const contractIdStr = Array.from(new Set(wuzicaigou_items.map(i => i.contract_id).filter(Boolean))).join(',')
// const amtTotal = wuzicaigou_items.reduce((sum, i) => sum + (Number(i.group_apply_money || i.apply_money) || 0), 0)
const amtTotal = (this.payList || []).reduce((sum, p) => {
const form = this.fundlogFormMap[p.id] || {}
return sum + (Number(form.applyMoney) || 0)
}, 0)
// //
const sumMoney = (contracts || []).reduce((sum, c) => sum + (Number(c?.money) || 0), 0) const sumMoney = (contracts || []).reduce((sum, c) => sum + (Number(c?.money) || 0), 0)

@ -15,7 +15,7 @@
<template> <template>
<Steps :logs="config.logs" :current-node="node"></Steps> <Steps :logs="config.logs" :current-node="node"></Steps>
<div v-if="(/\/detail/.test($route.path) || ( /\/create/.test($route.path) && $route.query.flow_id)) && config && config.flow"> <div v-if="/\/detail/.test($route.path) && config && config.flow">
<div v-if="config.flow.hasOwnProperty('out_contracts') && config.flow.out_contracts && config.flow.out_contracts.length > 0" style="margin-bottom: 10px;color:#F56C6C;"> <div v-if="config.flow.hasOwnProperty('out_contracts') && config.flow.out_contracts && config.flow.out_contracts.length > 0" style="margin-bottom: 10px;color:#F56C6C;">
<!-- 单条数据 --> <!-- 单条数据 -->
<div v-if="config.flow.out_contracts.length === 1"> <div v-if="config.flow.out_contracts.length === 1">
@ -186,7 +186,7 @@
@click="isShowRollback = true" @click="isShowRollback = true"
>退回</el-button >退回</el-button
> >
<!-- <el-button <el-button
v-if="$route.query.flow_id" v-if="$route.query.flow_id"
icon="el-icon-caret-right" icon="el-icon-caret-right"
type="primary" type="primary"
@ -194,7 +194,7 @@
size="small" size="small"
@click="isShowForward = true" @click="isShowForward = true"
>部门内转办</el-button >部门内转办</el-button
> --> >
<el-button <el-button
v-if="$route.query.flow_id" v-if="$route.query.flow_id"
icon="el-icon-document-add" icon="el-icon-document-add"
@ -271,29 +271,6 @@
frameborder="0" frameborder="0"
/> />
</vxe-modal> </vxe-modal>
<!-- 更改时间 -->
<el-dialog
title="请选择时间"
:visible.sync="isShowTime"
:close-on-click-modal="false"
width="30%"
>
<!-- 日期时间选择器 -->
<el-date-picker
v-model="selectedDateTime"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
:clearable="false"
style="width: 100%"
></el-date-picker>
<div slot="footer" class="dialog-footer">
<el-button @click="isShowTime = false,timeId='',selectedDateTime=''">取消</el-button>
<el-button type="primary" @click="updateTime"></el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@ -330,10 +307,6 @@ export default {
}, },
data() { data() {
return { return {
timeId:'',
isShowTime:false,
selectedDateTime:'',
selectedDateType:'',
isShowModal:false, isShowModal:false,
contractUrl:'', contractUrl:'',
printKey: 0, printKey: 0,
@ -916,43 +889,24 @@ export default {
async cellDblclickEvent({ row, column }) { async cellDblclickEvent({ row, column }) {
// if(this.$store.state.user.username !== 'admin') return // if(this.$store.state.user.username !== 'admin') return
if(!this.$store.state.user.roles.includes("全局流程监管")) return
if(column.field === 'created_at' || column.field === 'updated_at') { if(column.field === 'created_at' || column.field === 'updated_at') {
this.timeId = row.id this.$prompt('请输入时间', '提示', {
this.selectedDateType = column.field confirmButtonText: '确定',
this.selectedDateTime = row[column.field] cancelButtonText: '取消',
this.isShowTime = true inputPattern: /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/,
// this.$prompt('', '', { inputErrorMessage: '时间格式不正确'
// confirmButtonText: '', }).then(({ value }) => {
// cancelButtonText: '', updateNodeTime({
// inputPattern: /^(?:19|20)[0-9][0-9]-(?:(?:0[1-9])|(?:1[0-2]))-(?:(?:[0-2][1-9])|(?:[1-3][0-1])) (?:(?:[0-2][0-3])|(?:[0-1][0-9])):[0-5][0-9]:[0-5][0-9]$/, id: row.id,
// inputErrorMessage: '' date: value,
// }).then(({ value }) => { date_type: column.field
// updateNodeTime({ }).then(_ => {
// id: row.id, this.$message.success('更新成功')
// date: value, this.getConfig()
// date_type: column.field })
// }).then(_ => { })
// this.$message.success('')
// this.getConfig()
// })
// })
} }
}, },
updateTime(){
updateNodeTime({
id: this.timeId,
date: this.selectedDateTime,
date_type:this.selectedDateType,
}).then((_) => {
this.$message.success("更新成功");
this.timeId = ''
this.selectedDateTime = ''
this.selectedDateType = ''
this.isShowTime = false
this.getConfig()
});
},
}, },
computed: { computed: {
device() { device() {

Loading…
Cancel
Save