1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<template>
<div>
<a-row>
<a-col :span="24">
<div class="main-title">
<span>项目经费预算表 <strong>(金额单位:万元)</strong></span>
</div>
</a-col>
</a-row>
<a-row type="flex" class="row_center">
<a-col :span="4" class="bg-gray">
<div class="special-middle">
<div>预算科目</div>
</div>
</a-col>
<a-col :span="3" class="bg-gray">
<div class="special-middle">
<div>总预算数</div>
</div>
</a-col>
<a-col :span="3" class="bg-gray">
<div class="special-middle">
<div>省级财政资金</div>
</div>
</a-col>
<a-col :span="3" class="bg-gray">
<div class="special-middle">
<div>自筹资金</div>
</div>
</a-col>
<a-col :span="11" class="bg-gray">
<div class="special-middle">
<div>备注</div>
</div>
</a-col>
</a-row>
<a-row v-for="(item, index) in budget" :key="index" type="flex" class="row_center">
<a-col :span="4" style="text-align: left;">
<div class="special-middle">{{ item.budgetName }}</div>
</a-col>
<a-col :span="3">
<div class="special-middle">{{parseFloat(item.totalBudget).toFixed(2)}}</div>
</a-col>
<a-col :span="3">
<div class="special-middle">
<a-form-model-item v-if="!invisibleApplyFunds.includes(index)" :prop="'budget.' + index + '.applyFunds'" :rules="{required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.applyFunds" @change="outNumberChange(index)" :min="0" :step="0.01" style="width: 80%" />
</a-form-model-item>
<div v-else>{{parseFloat(item.applyFunds).toFixed(2)}}</div>
</div>
</a-col>
<a-col :span="3">
<div class="special-middle">
<a-form-model-item v-if="!invisibleSelfFunds.includes(index)" :prop="'budget.' + index + '.selfFunds'" :rules="{required: true, message: '*', trigger: 'blur',}">
<a-input-number v-model="item.selfFunds" @change="outNumberChange(index)" :min="0" :step="0.01" style="width: 80%" />
</a-form-model-item>
<div v-else>{{parseFloat(item.selfFunds).toFixed(2)}}</div>
</div>
</a-col>
<a-col :span="11">
<div class="special-middle">
<a-form-model-item :prop="'budget.' + index + '.calculationBasis'">
<a-input v-model="item.calculationBasis" :maxLength="100" style="width: 90%;" />
</a-form-model-item>
</div>
</a-col>
</a-row>
</div>
</template>
<script>
// 用法 <budget-edit :budget.sync="formData.budget" />
export default {
name: "BudgetEdit",
data () {
return {
invisibleTotalBudget: [],
invisibleApplyFunds: [0, 2, 3, 4, 5, 6, 7, 8, 9],
invisibleSelfFunds: [0, 1, 2, 7, 8, 9],
};
},
props: {
budget: {
type: Array,
default: () => {
return [];
},
},
},
created () { },
methods: {
// //资金来源计算
// calFundFrom() {
// this.budget[0].applyFunds = this.budget[1].applyFunds + this.budget[2].applyFunds
// this.budget[0].selfFunds = this.budget[1].selfFunds + this.budget[2].selfFunds
// this.calRowTotalAmount(0)
// },
// //资金支出计算
// calFundPayment() {
// this.budget[3].applyFunds = this.budget[4].applyFunds + this.budget[8].applyFunds
// this.budget[3].selfFunds = this.budget[4].selfFunds + this.budget[8].selfFunds
// this.calRowTotalAmount(3)
// },
// //直接费计算
// calDirectFee() {
// this.budget[4].applyFunds = this.budget[5].applyFunds + this.budget[6].applyFunds + this.budget[7].applyFunds
// this.budget[4].selfFunds = this.budget[5].selfFunds + this.budget[6].selfFunds + this.budget[7].selfFunds
// this.calRowTotalAmount(4)
// },
// calRowTotalAmount(index) {
// this.budget[index].totalBudget = this.budget[index].applyFunds + this.budget[index].selfFunds
// },
// outNumberChange (index) {
// this.calRowTotalAmount(index)
// this.calDirectFee()
// this.calFundPayment()
// this.calFundFrom()
// if (this.budget[0].totalBudget < this.budget[3].totalBudget)
// this.$message.info('资金支出总数不能大于资金来源总数!')
// },
//一、资金来源合计
calTotalFund () {
this.budget[0].totalBudget = this.budget[0].applyFunds + this.budget[0].selfFunds
this.$emit('save', [this.budget[0].totalBudget, this.budget[0].applyFunds, this.budget[0].selfFunds])
},
//(一)财政资金
calFundFrom () {
this.budget[0].applyFunds = this.budget[1].applyFunds
},
//(二)自筹资金
calSelfFee () {
this.budget[2].selfFunds = this.budget[3].selfFunds + this.budget[4].selfFunds + this.budget[5].selfFunds + this.budget[6].selfFunds
this.budget[0].selfFunds = this.budget[2].selfFunds
this.calRowTotalAmount(2)
},
//1.设备费
calEquipment () {
this.budget[9].applyFunds = this.budget[10].applyFunds + this.budget[11].applyFunds + this.budget[12].applyFunds + this.budget[13].applyFunds
this.budget[9].selfFunds = this.budget[10].selfFunds + this.budget[11].selfFunds + this.budget[12].selfFunds + this.budget[13].selfFunds
this.calRowTotalAmount(9)
},
//(一)直接费用
calDirectFee () {
this.calEquipment()
this.budget[8].applyFunds = this.budget[9].applyFunds + this.budget[14].applyFunds + this.budget[15].applyFunds + this.budget[16].applyFunds + this.budget[17].applyFunds + this.budget[18].applyFunds + this.budget[19].applyFunds + this.budget[20].applyFunds + this.budget[21].applyFunds
this.budget[8].selfFunds = this.budget[9].selfFunds + this.budget[14].selfFunds + this.budget[15].selfFunds + this.budget[16].selfFunds + this.budget[17].selfFunds + this.budget[18].selfFunds + this.budget[19].selfFunds + this.budget[20].selfFunds + this.budget[21].selfFunds
this.calRowTotalAmount(8)
},
//二、支出预算合计
calFundPayment () {
this.calDirectFee()
this.budget[7].applyFunds = this.budget[8].applyFunds + this.budget[22].applyFunds
this.budget[7].selfFunds = this.budget[8].selfFunds + this.budget[22].selfFunds
this.calRowTotalAmount(7)
},
calRowTotalAmount (index) {
this.budget[index].totalBudget = this.budget[index].applyFunds + this.budget[index].selfFunds
},
outNumberChange (index) {
this.calRowTotalAmount(index)
this.calFundFrom()
this.calSelfFee()
this.calTotalFund()
this.calFundPayment()
if (this.budget[0].totalBudget < this.budget[7].totalBudget)
this.$message.info('资金支出总数不能大于资金来源总数!')
}
},
};
</script>