|
@@ -2,7 +2,7 @@
|
2
|
2
|
* @Author: ysh
|
3
|
3
|
* @Date: 2024-03-25 15:05:59
|
4
|
4
|
* @LastEditors: Please set LastEditors
|
5
|
|
- * @LastEditTime: 2024-03-29 16:51:06
|
|
5
|
+ * @LastEditTime: 2024-04-03 11:23:25
|
6
|
6
|
-->
|
7
|
7
|
<template>
|
8
|
8
|
<div>
|
|
@@ -124,30 +124,23 @@
|
124
|
124
|
<td style="width:100px">进出场单价</td>
|
125
|
125
|
<td style="width:100px">预算天数</td>
|
126
|
126
|
<td style="width: 100px">总额</td>
|
127
|
|
- <td></td>
|
128
|
127
|
</tr>
|
129
|
128
|
<tr v-for="user in chooseUser" :key="user.userId">
|
130
|
129
|
<td>{{ user.nickName }}</td>
|
131
|
130
|
<td>{{ user.salary.salary }}</td>
|
132
|
131
|
<td>{{ parseFloat(user.salary.salary / 31).toFixed(2) }}</td>
|
133
|
132
|
<td>
|
134
|
|
- <el-input v-model="user.inOutPrice" placeholder="请输入进出场单价" @change="calculateUserTotal(user)"></el-input>
|
|
133
|
+ <el-input v-model="user.inOutPrice" placeholder="请输入进出场单价"
|
|
134
|
+ @change="calculateUserTotal(user)"></el-input>
|
135
|
135
|
</td>
|
136
|
136
|
<td>
|
137
|
|
- <el-input v-model="user.days" placeholder="请输入天数" @change="calculateUserTotal(user)"
|
138
|
|
- ></el-input>
|
|
137
|
+ <el-input v-model="user.days" placeholder="请输入天数" @change="calculateUserTotal(user)"></el-input>
|
139
|
138
|
</td>
|
140
|
139
|
<td class="staffCost">{{ user.staffCost }}</td>
|
141
|
|
- <td>
|
142
|
|
- <!-- <el-button type="text" @click="calculateUserTotal(user)">计算</el-button> -->
|
143
|
|
- </td>
|
144
|
140
|
</tr>
|
145
|
141
|
<tr>
|
146
|
142
|
<td colspan="5">合计</td>
|
147
|
143
|
<td>{{ budgetForm.staffCost }}</td>
|
148
|
|
- <td>
|
149
|
|
- <el-button type="text" @click="calculateTotal('staffCost')">计算</el-button>
|
150
|
|
- </td>
|
151
|
144
|
</tr>
|
152
|
145
|
</table>
|
153
|
146
|
</el-form-item>
|
|
@@ -170,7 +163,6 @@
|
170
|
163
|
<td style="width:110px">折旧成本(天)</td>
|
171
|
164
|
<td style="width:110px">预算天数</td>
|
172
|
165
|
<td style="width: 100px">总额</td>
|
173
|
|
- <td></td>
|
174
|
166
|
</tr>
|
175
|
167
|
<tr v-for="car in chooseCar" :key="car.carId">
|
176
|
168
|
<td>{{ car.licensePlate }}</td>
|
|
@@ -187,16 +179,10 @@
|
187
|
179
|
<el-input v-model="car.days" placeholder="请输入天数" @change="calculateCarTotal(car)"></el-input>
|
188
|
180
|
</td>
|
189
|
181
|
<td class="carCost">{{ car.expense }}</td>
|
190
|
|
- <td>
|
191
|
|
- <!-- <el-button type="text" @click="calculateCarTotal(car)">计算</el-button> -->
|
192
|
|
- </td>
|
193
|
182
|
</tr>
|
194
|
183
|
<tr>
|
195
|
184
|
<td colspan="5">合计</td>
|
196
|
185
|
<td>{{ budgetForm.carCost }}</td>
|
197
|
|
- <td>
|
198
|
|
- <el-button type="text" @click="calculateTotal('carCost')">计算</el-button>
|
199
|
|
- </td>
|
200
|
186
|
</tr>
|
201
|
187
|
</table>
|
202
|
188
|
</el-form-item>
|
|
@@ -219,7 +205,6 @@
|
219
|
205
|
<td>折旧成本(天)</td>
|
220
|
206
|
<td style="width:100px">预算天数</td>
|
221
|
207
|
<td style="width: 100px">总额</td>
|
222
|
|
- <td></td>
|
223
|
208
|
</tr>
|
224
|
209
|
<tr v-for="device in chooseDevice" :key="device.deviceId">
|
225
|
210
|
<td>{{ device.name }}</td>
|
|
@@ -232,22 +217,15 @@
|
232
|
217
|
<el-input v-model="device.days" placeholder="请输入天数" @change="calculateDeviceTotal(device)"></el-input>
|
233
|
218
|
</td>
|
234
|
219
|
<td class="deviceCost">{{ device.depreciation }}</td>
|
235
|
|
- <td>
|
236
|
|
- <!-- <el-button type="text" @click="calculateDeviceTotal(device)">计算</el-button> -->
|
237
|
|
- </td>
|
238
|
220
|
</tr>
|
239
|
221
|
<tr>
|
240
|
222
|
<td colspan="5">合计</td>
|
241
|
223
|
<td>{{ budgetForm.deviceCost }}</td>
|
242
|
|
- <td>
|
243
|
|
- <el-button type="text" @click="calculateTotal('deviceCost')">计算</el-button>
|
244
|
|
- </td>
|
245
|
224
|
</tr>
|
246
|
225
|
</table>
|
247
|
226
|
</el-form-item>
|
248
|
227
|
<el-form-item label="固定成本小计:">
|
249
|
|
- <el-tag type="danger" style="margin-right:20px;font-size:14px;">{{ budgetForm.fixCost }}</el-tag>
|
250
|
|
- <el-button @click="getFixCost" type="success">计算</el-button>
|
|
228
|
+ <el-tag type="danger" style="margin-right:20px;font-size:14px;">¥ {{ budgetForm.fixCost }}</el-tag>
|
251
|
229
|
</el-form-item>
|
252
|
230
|
</el-form>
|
253
|
231
|
|
|
@@ -267,20 +245,23 @@
|
267
|
245
|
<el-form>
|
268
|
246
|
<choose-money :workList="workList" @getSettle="getSettle"></choose-money>
|
269
|
247
|
<el-form-item label="外协费用:">
|
270
|
|
- <el-input-number v-model="budgetForm.outExpense" style="width:400px;"></el-input-number>
|
|
248
|
+ <el-input v-model="budgetForm.outExpense" style="width:400px;"
|
|
249
|
+ @change="getDirectExpense(budgetForm)"></el-input>
|
271
|
250
|
</el-form-item>
|
272
|
251
|
<el-form-item label="商务费用:">
|
273
|
|
- <el-input-number v-model="budgetForm.businessExpense" style="width:400px;"></el-input-number>
|
|
252
|
+ <el-input v-model="budgetForm.businessExpense" style="width:400px;"
|
|
253
|
+ @change="getDirectExpense(budgetForm)"></el-input>
|
274
|
254
|
</el-form-item>
|
275
|
255
|
<el-form-item label="车船租赁:">
|
276
|
|
- <el-input-number v-model="budgetForm.rentExpense" style="width:400px;"></el-input-number>
|
|
256
|
+ <el-input v-model="budgetForm.rentExpense" style="width:400px;"
|
|
257
|
+ @change="getDirectExpense(budgetForm)"></el-input>
|
277
|
258
|
</el-form-item>
|
278
|
259
|
<el-form-item label="其他费用:">
|
279
|
|
- <el-input-number v-model="budgetForm.otherExpense" style="width:400px;"></el-input-number>
|
|
260
|
+ <el-input v-model="budgetForm.otherExpense" style="width:400px;"
|
|
261
|
+ @change="getDirectExpense(budgetForm)"></el-input>
|
280
|
262
|
</el-form-item>
|
281
|
263
|
<el-form-item label="直接成本小计:">
|
282
|
|
- {{ budgetForm.directExpense }}
|
283
|
|
- <el-button type="success" style="margin-left:30px;" @click="getDirectExpense(budgetForm)">计算</el-button>
|
|
264
|
+ <el-tag type="danger" style="margin-right:20px;font-size:14px;"> ¥{{ budgetForm.directExpense }} </el-tag>
|
284
|
265
|
</el-form-item>
|
285
|
266
|
|
286
|
267
|
</el-form>
|
|
@@ -302,13 +283,19 @@
|
302
|
283
|
<el-breadcrumb-item>直接成本小计</el-breadcrumb-item>
|
303
|
284
|
<el-breadcrumb-item>¥ {{ budgetForm.directExpense }}</el-breadcrumb-item>
|
304
|
285
|
</el-breadcrumb>
|
305
|
|
- <budget-table :budgetForm="budgetForm" :projectForm="projectForm" ></budget-table>
|
|
286
|
+ <budget-table :budgetForm="budgetForm" :projectForm="projectForm" @getTotal="getTotalBudget"></budget-table>
|
|
287
|
+ </div>
|
|
288
|
+ <div class="finish" v-if="activeStep == 4">
|
|
289
|
+ <el-result icon="success" title="成功提示" subTitle="预算表生成完成">
|
|
290
|
+ <template slot="extra">
|
|
291
|
+ </template>
|
|
292
|
+ </el-result>
|
306
|
293
|
</div>
|
307
|
294
|
<el-divider></el-divider>
|
308
|
295
|
<div class="btn">
|
309
|
296
|
<el-button @click="activeStep -= 1" :disabled="activeStep == 0">上一步</el-button>
|
310
|
297
|
<el-button @click="confirmStep" type="primary" v-if="activeStep < 4">下一步</el-button>
|
311
|
|
- <el-button @click="activeStep += 1" type="primary" v-if="activeStep == 4">生成预算表</el-button>
|
|
298
|
+ <el-button @click="goBack" type="primary" v-if="activeStep == 4">完成</el-button>
|
312
|
299
|
</div>
|
313
|
300
|
</div>
|
314
|
301
|
|
|
@@ -338,7 +325,7 @@
|
338
|
325
|
</el-table-column>
|
339
|
326
|
<el-table-column label="项目编号" align="center" key="projectNumber" prop="projectNumber" />
|
340
|
327
|
<el-table-column label="项目名称" align="center" key="projectName" prop="projectName" width="200px" />
|
341
|
|
- <el-table-column label="项目负责人" align="center" key="projectLeaderName" prop="projectLeaderName" />
|
|
328
|
+ <el-table-column label="项目负责人" align="center" key="projectLeader" prop="projectLeaderUser.nickName" />
|
342
|
329
|
<el-table-column align="center">
|
343
|
330
|
<template slot-scope="scope">
|
344
|
331
|
<el-button size="mini" type="text" @click="chooseProject(scope.row)">选择</el-button>
|
|
@@ -374,6 +361,7 @@ import chooseCar from "./components/chooseCar.vue";
|
374
|
361
|
import chooseDevice from "./components/chooseDevice.vue";
|
375
|
362
|
import chooseMoney from "./components/chooseMoney.vue";
|
376
|
363
|
import budgetTable from './components/budgetTable.vue';
|
|
364
|
+import { addBudget } from '@/api/oa/budget/budget.js';
|
377
|
365
|
export default {
|
378
|
366
|
components: {
|
379
|
367
|
choosePeople, chooseCar, chooseDevice, chooseMoney, budgetTable
|
|
@@ -381,8 +369,27 @@ export default {
|
381
|
369
|
data() {
|
382
|
370
|
return {
|
383
|
371
|
activeStep: 0,
|
384
|
|
- form: {},
|
|
372
|
+ form:{
|
|
373
|
+ projectId: null,
|
|
374
|
+ staffCost: 0,
|
|
375
|
+ carCost: 0,
|
|
376
|
+ deviceCost: 0,
|
|
377
|
+ fixCost: 0,
|
|
378
|
+ outExpense: 0,
|
|
379
|
+ businessExpense: 0,
|
|
380
|
+ rentExpense: 0,
|
|
381
|
+ otherExpense: 0,
|
|
382
|
+ directExpense: 0,
|
|
383
|
+ totalBudget: 0,
|
|
384
|
+ settleExpense:0,
|
|
385
|
+ compiler: '',
|
|
386
|
+ auditor: ''
|
|
387
|
+ },
|
385
|
388
|
budgetForm: {
|
|
389
|
+ projectId: null,
|
|
390
|
+ staffCost: 0,
|
|
391
|
+ carCost: 0,
|
|
392
|
+ deviceCost: 0,
|
386
|
393
|
fixCost: 0,
|
387
|
394
|
outExpense: 0,
|
388
|
395
|
businessExpense: 0,
|
|
@@ -390,6 +397,7 @@ export default {
|
390
|
397
|
otherExpense: 0,
|
391
|
398
|
directExpense: 0,
|
392
|
399
|
totalBudget: 0,
|
|
400
|
+ settleExpense:0,
|
393
|
401
|
compiler: '',
|
394
|
402
|
auditor: ''
|
395
|
403
|
}, // 预算表
|
|
@@ -459,7 +467,6 @@ export default {
|
459
|
467
|
this.openProject = false;
|
460
|
468
|
},
|
461
|
469
|
confirmStep() {
|
462
|
|
- debugger
|
463
|
470
|
if (this.activeStep == 0) {
|
464
|
471
|
if (this.projectForm.projectNumber == undefined) {
|
465
|
472
|
this.activeStep = 0;
|
|
@@ -467,11 +474,28 @@ export default {
|
467
|
474
|
} else {
|
468
|
475
|
this.activeStep += 1;
|
469
|
476
|
}
|
470
|
|
- }else if(this.activeStep == 2){
|
|
477
|
+ } else if (this.activeStep == 2) {
|
471
|
478
|
this.budgetForm.chooseUser = this.chooseUser;
|
472
|
479
|
this.budgetForm.chooseCar = this.chooseCar;
|
473
|
480
|
this.budgetForm.chooseDevice = this.chooseDevice;
|
|
481
|
+ this.budgetForm.projectId = this.projectForm.projectId;
|
474
|
482
|
this.activeStep += 1;
|
|
483
|
+ this.calculateThatCost();
|
|
484
|
+ } else if (this.activeStep == 3) {
|
|
485
|
+ console.log(this.budgetForm);
|
|
486
|
+ this.form.projectId = this.budgetForm.projectId
|
|
487
|
+ this.form.staffCost = this.budgetForm.staffCost
|
|
488
|
+ this.form.carCost = this.budgetForm.carCost
|
|
489
|
+ this.form.deviceCost = this.budgetForm.deviceCost
|
|
490
|
+ this.form.fixCost = this.budgetForm.fixCost
|
|
491
|
+ this.form.outExpense = this.budgetForm.outExpense
|
|
492
|
+ this.form.businessExpense = this.budgetForm.businessExpense
|
|
493
|
+ this.form.rentExpense = this.budgetForm.rentExpense
|
|
494
|
+ this.form.otherExpense = this.budgetForm.otherExpense
|
|
495
|
+ this.form.directExpense = this.budgetForm.directExpense
|
|
496
|
+ this.form.totalBudget = this.budgetForm.totalBudget
|
|
497
|
+ this.form.settleExpense = this.budgetForm.settleExpense
|
|
498
|
+ this.addBudgetForm(this.form)
|
475
|
499
|
}
|
476
|
500
|
else {
|
477
|
501
|
this.activeStep += 1;
|
|
@@ -495,21 +519,18 @@ export default {
|
495
|
519
|
});
|
496
|
520
|
},
|
497
|
521
|
getSettle(val) {
|
498
|
|
- console.log(val);
|
499
|
|
- console.log(this.budgetForm);
|
500
|
522
|
this.budgetForm.settleExpense = val.settle;
|
501
|
523
|
this.budgetForm.workList = val.workList;
|
|
524
|
+ this.getDirectExpense(this.budgetForm)
|
502
|
525
|
},
|
503
|
526
|
// 计算单个人员的成本
|
504
|
527
|
calculateUserTotal(user) {
|
505
|
|
- if (user.inOutPrice == undefined) {
|
506
|
|
- this.$message.error("请输入进出场单价");
|
507
|
|
- return;
|
508
|
|
- }
|
509
|
528
|
let total =
|
510
|
529
|
(parseFloat(user.salary.salary / 31).toFixed(2) + Number(user.inOutPrice)) *
|
511
|
530
|
Number(user.days);
|
512
|
531
|
this.$set(user, "staffCost", total.toFixed(2));
|
|
532
|
+ this.getCost("staffCost", "staffCost", this.chooseUser);
|
|
533
|
+ this.getFixCost()
|
513
|
534
|
},
|
514
|
535
|
calculateCarTotal(car) {
|
515
|
536
|
let total1 = Number(car.mileage) * Number(car.distance)
|
|
@@ -517,21 +538,21 @@ export default {
|
517
|
538
|
let sum = (total1 + total2).toFixed(2);
|
518
|
539
|
this.$set(car, 'depreciation', total2);
|
519
|
540
|
this.$set(car, 'expense', sum);
|
|
541
|
+ this.getCost("expense", "carCost", this.chooseCar);
|
|
542
|
+ this.getFixCost()
|
520
|
543
|
},
|
521
|
544
|
calculateDeviceTotal(device) {
|
522
|
545
|
let total = Number(device.dayCost) * Number(device.days)
|
523
|
546
|
this.$set(device, 'depreciation', total);
|
|
547
|
+ this.getCost("depreciation", "deviceCost", this.chooseDevice);
|
|
548
|
+ this.getFixCost()
|
524
|
549
|
},
|
525
|
|
- // 合计
|
526
|
|
- calculateTotal(val) {
|
527
|
|
- const elements = document.querySelectorAll("." + val);
|
|
550
|
+ getCost(name1, name2, list) {
|
528
|
551
|
let sum = 0;
|
529
|
|
- if (elements.length > 0) {
|
530
|
|
- for (let e of elements) {
|
531
|
|
- sum = sum + Number(e.innerHTML);
|
532
|
|
- }
|
533
|
|
- this.$set(this.budgetForm, val, sum.toFixed(2));
|
|
552
|
+ for (let user of list) {
|
|
553
|
+ sum = sum + Number(user[name1])
|
534
|
554
|
}
|
|
555
|
+ this.budgetForm[name2] = sum.toFixed(2)
|
535
|
556
|
},
|
536
|
557
|
getFixCost() {
|
537
|
558
|
let total = Number(this.budgetForm.staffCost) + Number(this.budgetForm.carCost) + Number(this.budgetForm.deviceCost)
|
|
@@ -539,9 +560,31 @@ export default {
|
539
|
560
|
},
|
540
|
561
|
// 获取直接成本
|
541
|
562
|
getDirectExpense(form) {
|
542
|
|
- console.log(this.budgetForm);
|
543
|
|
- let sum = Number(form.settleExpense) + form.outExpense + form.rentExpense + form.businessExpense + form.otherExpense
|
|
563
|
+ let sum = Number(form.settleExpense) + Number(form.outExpense) + Number(form.rentExpense) + Number(form.businessExpense) + Number(form.otherExpense)
|
544
|
564
|
this.budgetForm.directExpense = sum.toFixed(2)
|
|
565
|
+ },
|
|
566
|
+ getTotalBudget(val) {
|
|
567
|
+ this.budgetForm.totalBudget = val
|
|
568
|
+ },
|
|
569
|
+ addBudgetForm(form) {
|
|
570
|
+ addBudget(form)
|
|
571
|
+ },
|
|
572
|
+ calculateThatCost() {
|
|
573
|
+ let staffCost = 0;
|
|
574
|
+ let carCost = 0;
|
|
575
|
+ let deviceCost = 0;
|
|
576
|
+ for (let user of this.chooseUser) {
|
|
577
|
+ staffCost = staffCost + Number(user.staffCost)
|
|
578
|
+ }
|
|
579
|
+ for (let car of this.chooseCar) {
|
|
580
|
+ carCost = carCost + Number(car.expense)
|
|
581
|
+ }
|
|
582
|
+ for (let device of this.chooseDevice) {
|
|
583
|
+ deviceCost = deviceCost + Number(device.depreciation)
|
|
584
|
+ }
|
|
585
|
+ this.budgetForm.staffCost = staffCost;
|
|
586
|
+ this.budgetForm.carCost = carCost;
|
|
587
|
+ this.budgetForm.deviceCost = deviceCost;
|
545
|
588
|
}
|
546
|
589
|
},
|
547
|
590
|
};
|