|
|
|
|
@ -256,7 +256,7 @@
|
|
|
|
|
</xy-dialog>
|
|
|
|
|
|
|
|
|
|
<!-- 新增表 预算计划 -->
|
|
|
|
|
<xy-dialog :is-show.sync="isShowPlan" title="预算计划" :width="640">
|
|
|
|
|
<xy-dialog :is-show.sync="isShowPlan" title="预算计划" :width="640" @on-ok="planSelect">
|
|
|
|
|
<template v-slot:normalContent>
|
|
|
|
|
<Input v-model="planSearch" search enter-button="搜 索" placeholder="搜索预算计划.." @on-search="getBudgets"/>
|
|
|
|
|
|
|
|
|
|
@ -636,6 +636,7 @@ export default {
|
|
|
|
|
isBudget:true,
|
|
|
|
|
plan:[]
|
|
|
|
|
},
|
|
|
|
|
plan:[],
|
|
|
|
|
rules:{
|
|
|
|
|
name:[
|
|
|
|
|
{required:true,message:"必填"}
|
|
|
|
|
@ -672,15 +673,28 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
//预算计划金额输入
|
|
|
|
|
planInput(e,row){
|
|
|
|
|
if(e <= (Number(row.money) - Number(row.use_money_total))){
|
|
|
|
|
row.useMoney = e
|
|
|
|
|
}else{
|
|
|
|
|
if(!/^[0-9]+.?[0-9]*$/.test(e) && e){
|
|
|
|
|
Message({
|
|
|
|
|
type:'warning',
|
|
|
|
|
message:'使用金额大于剩余预算'
|
|
|
|
|
message:'金额格式错误'
|
|
|
|
|
})
|
|
|
|
|
row.useMoney = 0
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if(e <= (Number(row.money) - Number(row.use_money_total))){
|
|
|
|
|
row.useMoney = e
|
|
|
|
|
this.plan.forEach(item => {
|
|
|
|
|
if(item.value.plan_id == row.id){
|
|
|
|
|
item.value.use_money = e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
Message({
|
|
|
|
|
type:'warning',
|
|
|
|
|
message:'使用金额大于剩余预算'
|
|
|
|
|
})
|
|
|
|
|
row.useMoney = 0
|
|
|
|
|
},
|
|
|
|
|
//合计
|
|
|
|
|
summary(param){
|
|
|
|
|
@ -930,7 +944,7 @@ export default {
|
|
|
|
|
selectPlan(sel,row){
|
|
|
|
|
if(sel){
|
|
|
|
|
//console.log(sel,row)
|
|
|
|
|
this.form.plan = sel.map(item => {
|
|
|
|
|
this.plan = sel.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
label:item.name,
|
|
|
|
|
value:{
|
|
|
|
|
@ -941,14 +955,39 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}else{
|
|
|
|
|
this.form.plan = []
|
|
|
|
|
this.plan = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//确认计划选择
|
|
|
|
|
planSelect(){
|
|
|
|
|
if(this.plan.length === 0){
|
|
|
|
|
Message({
|
|
|
|
|
type:'warning',
|
|
|
|
|
message:'选择计划不能为空'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
for(let item of this.plan){
|
|
|
|
|
console.log(item)
|
|
|
|
|
if(!item.value.use_money){
|
|
|
|
|
Message({
|
|
|
|
|
type:'warning',
|
|
|
|
|
message:'金额不能为空'
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.form.plan = this.plan
|
|
|
|
|
this.isShowPlan = false
|
|
|
|
|
},
|
|
|
|
|
//默认选择计划
|
|
|
|
|
toggleSelection(plans) {
|
|
|
|
|
if (plans && plans.length > 0) {
|
|
|
|
|
if (plans) {
|
|
|
|
|
this.plans.filter(plan => {
|
|
|
|
|
return plans.includes(plan.id)
|
|
|
|
|
if(plans.includes(plan.id)){
|
|
|
|
|
plan.useMoney = this.form.plan[plans.indexOf(plan.id)].value.use_money
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}).map(row => {
|
|
|
|
|
this.$refs.planTable.toggleRowSelection(row)
|
|
|
|
|
})
|
|
|
|
|
|