Bladeren bron

修改预算的新增接口

余思翰 1 jaar geleden
bovenliggende
commit
0a483849a6

+ 98
- 55
oa-ui/src/views/oa/budget/addBudget.vue Bestand weergeven

@@ -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
 };

+ 54
- 50
oa-ui/src/views/oa/budget/components/budgetTable.vue Bestand weergeven

@@ -5,19 +5,19 @@
5 5
       <tr>
6 6
         <td class="head">项目名称</td>
7 7
         <td colspan="3">{{ projectForm.projectName }}</td>
8
-        <td>项目编号</td>
8
+        <td class="head">项目编号</td>
9 9
         <td colspan="2">{{ projectForm.projectNumber }}</td>
10 10
       </tr>
11 11
       <tr>
12
-        <td :rowspan="userLen">人员</td>
13
-        <td>姓名</td>
14
-        <td>岗位工资</td>
15
-        <td>人员成本(天)</td>
16
-        <td>进出场单价</td>
17
-        <td>预算天数</td>
18
-        <td>金额</td>
19
-      </tr>
20
-      <tr v-for="user in budgetForm.chooseUser" :key="user.userId">
12
+        <td :rowspan="userLen" class="head">人员</td>
13
+        <td class="head">姓名</td>
14
+        <td class="head">岗位工资</td>
15
+        <td class="head">人员成本(天)</td>
16
+        <td class="head">进出场单价</td>
17
+        <td class="head">预算天数</td>
18
+        <td class="head">金额</td>
19
+      </tr>
20
+      <tr v-for="user in budgetForm.chooseUser" :key="'user' + user.userId">
21 21
         <td>{{ user.nickName }}</td>
22 22
         <td>{{ user.salary.salary }}</td>
23 23
         <td>{{ parseFloat(user.salary.salary / 31).toFixed(2) }}</td>
@@ -26,15 +26,15 @@
26 26
         <td>{{ user.staffCost }}</td>
27 27
       </tr>
28 28
       <tr>
29
-        <td :rowspan="carLen">车辆</td>
30
-        <td>车牌号</td>
31
-        <td>油耗</td>
32
-        <td>总里程</td>
33
-        <td>折旧成天(天)</td>
34
-        <td>预算天数</td>
35
-        <td>金额</td>
36
-      </tr>
37
-      <tr v-for="car in budgetForm.chooseCar" :key="car.carId">
29
+        <td :rowspan="carLen" class="head">车辆</td>
30
+        <td class="head">车牌号</td>
31
+        <td class="head">油耗</td>
32
+        <td class="head">总里程</td>
33
+        <td class="head">折旧成天(天)</td>
34
+        <td class="head">预算天数</td>
35
+        <td class="head">金额</td>
36
+      </tr>
37
+      <tr v-for="car in budgetForm.chooseCar" :key="'car' + car.carId">
38 38
         <td>{{ car.licensePlate }}</td>
39 39
         <td>{{ car.mileage }}</td>
40 40
         <td>{{ car.distance }}</td>
@@ -43,15 +43,15 @@
43 43
         <td>{{ car.expense }}</td>
44 44
       </tr>
45 45
       <tr>
46
-        <td :rowspan="deviceLen">设备</td>
47
-        <td>设备名称</td>
48
-        <td>规格型号</td>
49
-        <td>品牌</td>
50
-        <td>折旧成本(天)</td>
51
-        <td>预算天数</td>
52
-        <td>金额</td>
53
-      </tr>
54
-      <tr v-for="device in budgetForm.chooseDevice" :key="device.deviceId">
46
+        <td :rowspan="deviceLen" class="head">设备</td>
47
+        <td class="head">设备名称</td>
48
+        <td class="head">规格型号</td>
49
+        <td class="head">品牌</td>
50
+        <td class="head">折旧成本(天)</td>
51
+        <td class="head">预算天数</td>
52
+        <td class="head">金额</td>
53
+      </tr>
54
+      <tr v-for="device in budgetForm.chooseDevice" :key="'device' + device.deviceId">
55 55
         <td>{{ device.name }}</td>
56 56
         <td>{{ device.series }}</td>
57 57
         <td>{{ device.brand }}</td>
@@ -60,17 +60,17 @@
60 60
         <td>{{ device.depreciation }}</td>
61 61
       </tr>
62 62
       <tr>
63
-        <td colspan="6">固定成本小计</td>
63
+        <td colspan="6" class="head">固定成本小计</td>
64 64
         <td>{{ budgetForm.fixCost }}</td>
65 65
       </tr>
66 66
       <tr>
67
-        <td :rowspan="workLen">预计结算金额</td>
68
-        <td>工作内容</td>
69
-        <td>比例尺</td>
70
-        <td>总工作量</td>
71
-        <td>单价</td>
72
-        <td>系数</td>
73
-        <td>金额</td>
67
+        <td :rowspan="workLen" class="head">预计结算金额</td>
68
+        <td class="head">工作内容</td>
69
+        <td class="head">比例尺</td>
70
+        <td class="head">总工作量</td>
71
+        <td class="head">单价</td>
72
+        <td class="head">系数</td>
73
+        <td class="head">金额</td>
74 74
       </tr>
75 75
       <tr v-for="(work, index) in budgetForm.workList" :key="'work' + index">
76 76
         <td>{{ work.content }}</td>
@@ -81,35 +81,35 @@
81 81
         <td>{{ work.total }}</td>
82 82
       </tr>
83 83
       <tr>
84
-        <td colspan="5">外协费用</td>
84
+        <td colspan="5" class="head">外协费用</td>
85 85
         <td>{{ budgetForm.outExpense }}</td>
86 86
       </tr>
87 87
       <tr>
88
-        <td colspan="5">商务费用</td>
88
+        <td colspan="5" class="head">商务费用</td>
89 89
         <td>{{ budgetForm.businessExpense }}</td>
90 90
       </tr>
91 91
       <tr>
92
-        <td colspan="5">车船租赁</td>
92
+        <td colspan="5" class="head">车船租赁</td>
93 93
         <td>{{ budgetForm.rentExpense }}</td>
94 94
       </tr>
95 95
       <tr>
96
-        <td colspan="5">其他费用</td>
96
+        <td colspan="5" class="head">其他费用</td>
97 97
         <td>{{ budgetForm.otherExpense }}</td>
98 98
       </tr>
99 99
       <tr>
100
-        <td colspan="6">直接成本小计</td>
100
+        <td colspan="6" class="head">直接成本小计</td>
101 101
         <td>{{ budgetForm.directExpense }}</td>
102 102
       </tr>
103 103
       <tr>
104
-        <td colspan="6">总成本=(固定成本+直接成本)*120%</td>
105
-        <td>{{ totalCost }}</td>
104
+        <td colspan="6" class="head">总成本=(固定成本+直接成本)*120%</td>
105
+        <td>{{ totalBudget }}</td>
106 106
       </tr>
107
-      <tr>
108
-        <td>编制人</td>
109
-        <td colspan="2"></td>
110
-        <td>审核人</td>
107
+      <!-- <tr>
108
+        <td class="head">编制人</td>
109
+        <td colspan="2">{{  }}</td>
110
+        <td class="head">审核人</td>
111 111
         <td colspan="3"></td>
112
-      </tr>
112
+      </tr> -->
113 113
     </table>
114 114
   </div>
115 115
 </template>
@@ -132,7 +132,7 @@ export default {
132 132
       carLen: 1,
133 133
       deviceLen: 1,
134 134
       workLen: 1,
135
-      totalCost: 0
135
+      totalBudget: 0
136 136
     }
137 137
   },
138 138
   created() {
@@ -141,6 +141,8 @@ export default {
141 141
     this.carLen = this.budgetForm.chooseCar.length + 1;
142 142
     this.deviceLen = this.budgetForm.chooseDevice.length + 1;
143 143
     this.workLen = this.budgetForm.workList.length + 5;
144
+    this.totalBudget = ((Number(this.budgetForm.directExpense) + Number(this.budgetForm.fixCost)) * 1.2).toFixed(2);
145
+    this.$emit('getTotal',this.totalBudget)
144 146
   },
145 147
   methods: {
146 148
 
@@ -166,6 +168,8 @@ export default {
166 168
 }
167 169
 
168 170
 .head {
169
-  background-color: var(--primary-color);
171
+  // background-color: var(--current-color);
172
+  // opacity: 0.5;
173
+  // color: #fff;
170 174
 }
171 175
 </style>

+ 37
- 31
oa-ui/src/views/oa/budget/components/chooseMoney.vue Bestand weergeven

@@ -66,14 +66,6 @@
66 66
               </el-option>
67 67
             </el-select>
68 68
           </td>
69
-          <!-- <td>
70
-              <el-select v-model="work.subItem" :style="{ width: '100%' }"
71
-                @change="getUnitPrice(work, work.workItem, work.subItem, work.scaleGrade, work.groundType)">
72
-                <el-option v-for="item in work.workSelect.subItemList" :key="item.value" :label="item.label"
73
-                  :value="item.value">
74
-                </el-option>
75
-              </el-select>
76
-            </td> -->
77 69
           <td>
78 70
             <el-select v-model="work.scaleGrade" :style="{ width: '100%' }"
79 71
               @change="getUnitPrice(work, work.workItem, work.subItem, work.scaleGrade, work.groundType)">
@@ -104,11 +96,15 @@
104 96
             {{ work.total }}
105 97
           </td>
106 98
         </tr>
99
+        <tr>
100
+          <td colspan="8">合计</td>
101
+          <td>{{ settle }}</td>
102
+        </tr>
107 103
       </table>
108 104
       <div style="color:red">tips:预结算表中的系数为:困难系统和调整系数相乘的值(1分制)。例如:困难系数1,调整系数0.8,最终系数为0.8</div>
109 105
     </el-form-item>
110 106
     <el-form-item label="预结算合计:">
111
-      {{ settle }}<el-button @click="getSettle()" type="success" style="margin-left:30px;">计算</el-button>
107
+      <el-tag type="danger" style="margin-right:20px;font-size:14px;">¥{{  settle }}</el-tag>
112 108
     </el-form-item>
113 109
   </div>
114 110
 </template>
@@ -151,6 +147,9 @@ export default {
151 147
       this.getWorkTypeList(work);
152 148
     }
153 149
   },
150
+  mounted(){
151
+    this.getSettleSum();
152
+  },
154 153
   methods: {
155 154
     /* 获取工作类别 */
156 155
     getWorkTypeList(work) {
@@ -195,22 +194,31 @@ export default {
195 194
     },
196 195
     /* 获取比例尺 */
197 196
     getScaleGradeList(work, workItem) {
198
-      getScaleGradeList({ workItem }).then(res => {
199
-        if (res) {
200
-          let scaleGradeList = this.setArray(res);
201
-          work.workSelect.scaleGradeLoading = false;
202
-          work.workSelect.scaleGradeList = scaleGradeList;
203
-          this.setValue(work, 'scaleGrade', scaleGradeList[0].label)
204
-          // work.scaleGrade = scaleGradeList[0].label;
205
-          if (work.scaleGrade == undefined) {
206
-            this.setValue(work, 'scaleGrade', '无');
207
-          }
208
-          if (work.groundType == undefined) {
209
-            this.setValue(work, 'groundType', '一般地类');
210
-          }
211
-          this.getUnitPrice(work, work.workItem, work.subItem, work.scaleGrade, work.groundType);
197
+      if (work.scale) {
198
+        this.setValue(work, 'scaleGrade', work.scale);
199
+        if (work.groundType == undefined) {
200
+          this.setValue(work, 'groundType', '一般地类');
212 201
         }
213
-      })
202
+        this.getUnitPrice(work, work.workItem, work.subItem, work.scaleGrade, work.groundType);
203
+      } else {
204
+        getScaleGradeList({ workItem }).then(res => {
205
+          if (res) {
206
+            let scaleGradeList = this.setArray(res);
207
+            work.workSelect.scaleGradeLoading = false;
208
+            work.workSelect.scaleGradeList = scaleGradeList;
209
+            this.setValue(work, 'scaleGrade', scaleGradeList[0].label)
210
+            // work.scaleGrade = scaleGradeList[0].label;
211
+            if (work.scaleGrade == undefined) {
212
+              this.setValue(work, 'scaleGrade', '无');
213
+            }
214
+            if (work.groundType == undefined) {
215
+              this.setValue(work, 'groundType', '一般地类');
216
+            }
217
+            this.getUnitPrice(work, work.workItem, work.subItem, work.scaleGrade, work.groundType);
218
+          }
219
+        })
220
+      }
221
+
214 222
     },
215 223
     /* 获取单价 */
216 224
     getUnitPrice(work, workItem, subItem, scaleGrade, groundType) {
@@ -229,20 +237,18 @@ export default {
229 237
     getTotal(work) {
230 238
       let total = this.calculateTotal(work.price, work.coefficient, work.workLoad, 1);
231 239
       this.setValue(work, 'total', total)
240
+      this.getSettleSum();
232 241
     },
233 242
     /* 计算总额 */
234 243
     calculateTotal(price, coefficient, workLoad, percent) {
235 244
       return ((parseFloat(price) * parseFloat(coefficient) * parseFloat(workLoad)) * percent).toFixed(2);
236 245
     },
237
-    getSettle() {
238
-      const elements = document.querySelectorAll(".workTotal");
246
+    getSettleSum() {
239 247
       let sum = 0;
240
-      if (elements.length > 0) {
241
-        for (let e of elements) {
242
-          sum = sum + Number(e.innerHTML);
243
-        }
244
-        this.settle = sum.toFixed(2)
248
+      for(let work of this.workList){
249
+        sum = sum + Number(work.total)
245 250
       }
251
+      this.settle = sum.toFixed(2);
246 252
       let obj = {}
247 253
       obj.workList = this.workList;
248 254
       obj.settle = this.settle;

Laden…
Annuleren
Opslaan