Преглед изворни кода

修改项目结算表单中的结算汇总

余思翰 пре 1 година
родитељ
комит
38433d5696

+ 2
- 1
oa-ui/src/views/flowable/form/components/choosePrice.vue Прегледај датотеку

@@ -151,11 +151,12 @@ export default {
151 151
     /* 获取单价 */
152 152
     getUnitPrice(work, workItem, subItem, scaleGrade, groundType) {
153 153
       getUnitPrice({ workItem, subItem, scaleGrade, groundType: groundType }).then(res => {
154
+        let content = work.workType + '/' + workItem
154 155
         if (res.length != 0) {
155 156
           work.priceId = res.data.id;
156 157
           this.setValue(work, 'price', res.data.price)
157 158
           this.setValue(work, 'unit', res.data.unit)
158
-          this.work.content = this.row.content
159
+          this.work.content = content
159 160
         }
160 161
       })
161 162
     },

+ 117
- 22
oa-ui/src/views/flowable/form/settleForm.vue Прегледај датотеку

@@ -2,7 +2,7 @@
2 2
  * @Author: ysh
3 3
  * @Date: 2024-04-30 09:03:14
4 4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-05-07 16:13:01
5
+ * @LastEditTime: 2024-05-08 17:54:13
6 6
 -->
7 7
 <template>
8 8
   <div class="app-container" v-loading="loading">
@@ -145,11 +145,11 @@
145 145
                   {{ work.price }}
146 146
                 </td>
147 147
                 <td>
148
-                  <el-input-number style="width: 100px" v-model="work.workload" clearable @blur="calculateSettle(work)"
149
-                    :controls="false"></el-input-number>
148
+                  <el-input-number :precision="2" style="width: 100px" v-model="work.workload" clearable
149
+                    @blur="calculateSettle(work)" :controls="false"></el-input-number>
150 150
                 </td>
151 151
                 <td>
152
-                  <el-input-number style="width: 100px" v-model="work.coefficient" clearable
152
+                  <el-input-number :precision="2" style="width: 100px" v-model="work.coefficient" clearable
153 153
                     @blur="calculateSettle(work)" :controls="false"></el-input-number>
154 154
                 </td>
155 155
                 <td>
@@ -184,6 +184,7 @@
184 184
             <div class="line"></div>
185 185
           </div>
186 186
           <el-form-item label-width="60px">
187
+            <h3>表1:扣除明细</h3>
187 188
             <table border="1">
188 189
               <tr>
189 190
                 <td style="width: 50px">序号</td>
@@ -201,8 +202,8 @@
201 202
                   </el-input>
202 203
                 </td>
203 204
                 <td>
204
-                  <el-input-number style="width: 200px" v-model="work.amount" clearable :controls="false"
205
-                    @blur="calculateActualSumSettle()"></el-input-number>
205
+                  <el-input-number :min="0" :precision="2" style="width: 200px" v-model="work.amount" clearable
206
+                    :controls="false" @blur="calculateActualSumSettle()"></el-input-number>
206 207
                   <!-- {{ work.amount }} -->
207 208
                 </td>
208 209
                 <td>
@@ -214,10 +215,42 @@
214 215
                     @click="deletWorkItem(index, settleSumList)">删除行</el-button>
215 216
                 </td>
216 217
               </tr>
218
+            </table>
219
+            <el-button icon="el-icon-plus" type="primary" plain size="mini" @click="addSumWorkList"></el-button>
220
+            <h3>表2:部门结算金额</h3>
221
+            <table border="1">
222
+              <tr>
223
+                <td style="width: 50px">序号</td>
224
+                <td style="width: 280px">部门名称</td>
225
+                <td style="width: 200px">结算金额(元)</td>
226
+                <td style="width: 280px">备注</td>
227
+                <td style="width: 100px">操作</td>
228
+              </tr>
229
+              <tr v-for="(dept, index) in deptSettleList" :key="index">
230
+                <td>
231
+                  {{ index + 1 }}
232
+                </td>
233
+                <td>
234
+                  <el-input v-model="dept.content" type="textarea" clearable :autosize="{ minRows: 2, maxRows: 10 }">
235
+                  </el-input>
236
+                </td>
237
+                <td>
238
+                  <el-input-number :precision="2" style="width: 200px" v-model="dept.amount" clearable
239
+                    :controls="false" @blur="calculateDeptAmount(index)"></el-input-number>
240
+                </td>
241
+                <td>
242
+                  <el-input v-model="dept.remark" type="textarea" clearable :autosize="{ minRows: 2, maxRows: 10 }">
243
+                  </el-input>
244
+                </td>
245
+                <td>
246
+                  <el-button type="text" size="mini" style="color: #f56c6c"
247
+                    @click="deletWorkItem(index, deptSettleList)">删除行</el-button>
248
+                </td>
249
+              </tr>
217 250
               <tr>
218 251
                 <td :colspan="2">实际结算总金额</td>
219 252
                 <td :colspan="3">
220
-                  <el-input-number style="width: 100%" v-model="actualSumSettle" clearable
253
+                  <el-input-number :precision="2" style="width: 100%" v-model="actualSumSettle" clearable
221 254
                     :controls="false"></el-input-number>
222 255
                 </td>
223 256
               </tr>
@@ -230,7 +263,7 @@
230 263
                 </td>
231 264
               </tr>
232 265
             </table>
233
-            <el-button icon="el-icon-plus" type="primary" plain size="mini" @click="addSumWorkList"></el-button>
266
+            <el-button icon="el-icon-plus" type="primary" plain size="mini" @click="addDeptSettleList"></el-button>
234 267
           </el-form-item>
235 268
 
236 269
           <!-- 结算审核情况 -->
@@ -414,6 +447,9 @@ export default {
414 447
       type: Boolean,
415 448
       default: false
416 449
     }
450
+  },
451
+  watch: {
452
+    
417 453
   },
418 454
   data() {
419 455
     return {
@@ -449,14 +485,24 @@ export default {
449 485
         content: "结算费用合计",
450 486
         amount: 0,
451 487
         remark: "",
488
+        tableNumber: '2'
452 489
       },
453 490
       settleSumList: [
454 491
         {
455 492
           content: "",
456 493
           amount: 0,
457 494
           remark: "",
495
+          tableNumber: '0'
458 496
         },
459 497
       ],
498
+      deptSettleList: [
499
+        {
500
+          content: "",
501
+          amount: 0,
502
+          remark: "",
503
+          tableNumber: '1'
504
+        }
505
+      ],
460 506
       oldSettleSumList: [],
461 507
       actualSumSettle: "",
462 508
       clickWork: {},
@@ -488,7 +534,6 @@ export default {
488 534
           this.listSettleSummaryFn();
489 535
           getUser(this.form.reporter).then(res => {
490 536
             if (res.data) {
491
-              console.log(res.data);
492 537
               this.form.reporterName = res.data.nickName;
493 538
               this.deptId = res.data.deptId
494 539
             }
@@ -592,7 +637,6 @@ export default {
592 637
       this.$refs["settleForm"].validate(vaild => {
593 638
         if (vaild) {
594 639
           this.preserve();
595
-          debugger
596 640
           if (this.taskName == '结算发起') {
597 641
             this.getNextFlowNodeFn(17);
598 642
           } else if (this.taskName == '综合事务部处理') {
@@ -712,6 +756,15 @@ export default {
712 756
         content: "",
713 757
         amount: 0,
714 758
         remark: "",
759
+        tableNumber: '0'
760
+      });
761
+    },
762
+    addDeptSettleList() {
763
+      this.deptSettleList.push({
764
+        content: "",
765
+        amount: 0,
766
+        remark: "",
767
+        tableNumber: '1'
715 768
       });
716 769
     },
717 770
     deletWorkItem(index, arr) {
@@ -727,6 +780,7 @@ export default {
727 780
       let sum = work.workload * work.coefficient * work.price;
728 781
       work.settle = Number(sum).toFixed(2);
729 782
       this.calculateSumSettle();
783
+      this.calculateActualSumSettle();
730 784
     },
731 785
     calculateSumSettle() {
732 786
       let sum = 0;
@@ -734,7 +788,7 @@ export default {
734 788
       for (let a of arr) {
735 789
         sum = sum + Number(a.settle);
736 790
       }
737
-      this.settleSumTr.amount = sum;
791
+      this.settleSumTr.amount = sum.toFixed(2);
738 792
     },
739 793
     calculateActualSumSettle() {
740 794
       let sum = 0;
@@ -742,7 +796,20 @@ export default {
742 796
       for (let a of arr) {
743 797
         sum = sum + Number(a.amount);
744 798
       }
745
-      this.actualSumSettle = sum;
799
+      this.actualSumSettle = Number(this.settleSumTr.amount) - sum;
800
+    },
801
+    calculateDeptAmount(index){
802
+      debugger
803
+      let num = 0
804
+      let len = this.deptSettleList.length
805
+      if (len > 1){
806
+        if(index == len - 1){
807
+          for(let i = 0; i< index ;i ++){
808
+            num = num + this.deptSettleList[i].amount
809
+          }
810
+          this.deptSettleList[index].amount = this.actualSumSettle - num
811
+        }
812
+      }
746 813
     },
747 814
     handleChoosePrice(work, index) {
748 815
       this.clickWork = work;
@@ -756,6 +823,7 @@ export default {
756 823
       this.setValue(this.settleWorkList[index], "groundType", val.groundType);
757 824
       this.setValue(this.settleWorkList[index], "price", val.price);
758 825
       this.setValue(this.settleWorkList[index], "priceId", val.priceId);
826
+      this.setValue(this.settleWorkList[index], "content", val.content);
759 827
       this.calculateSettle(this.settleWorkList[index]);
760 828
       this.drawer = false;
761 829
     },
@@ -767,10 +835,20 @@ export default {
767 835
     addSettleFn() {
768 836
       let settleId = this.taskForm.formId;
769 837
       this.form.settleId = settleId;
770
-      addSettle(this.form).then(res => {
771
-        this.addSettleWorkFn(settleId);
772
-        this.addSettleSummaryFn(settleId);
773
-      });
838
+      getSettle(this.taskForm.formId).then(res=>{
839
+        if(res.data){
840
+          updateSettle(this.form);
841
+          this.addSettleWorkFn(settleId);
842
+          this.addSettleSummaryFn(settleId);
843
+        }else{
844
+          addSettle(this.form).then(res => {
845
+          this.addSettleWorkFn(settleId);
846
+          this.addSettleSummaryFn(settleId);
847
+        });
848
+        }
849
+        
850
+      })
851
+      
774 852
     },
775 853
     addSettleWorkFn(settleId) {
776 854
       for (let work of this.settleWorkList) {
@@ -786,8 +864,18 @@ export default {
786 864
       for (let item of this.settleSumList) {
787 865
         item.settleId = settleId;
788 866
         setTimeout(() => {
789
-          addSettleSummary(item);
790
-        }, 500)
867
+          addSettleSummary(item).then(res=>{
868
+            console.log(item);
869
+          });
870
+        }, 1000)
871
+      }
872
+      for (let item of this.deptSettleList) {
873
+        item.settleId = settleId;
874
+        setTimeout(() => {
875
+          addSettleSummary(item).then(res=>{
876
+            console.log(item);
877
+          });
878
+        }, 1000)
791 879
       }
792 880
     },
793 881
     // 获取数据
@@ -811,16 +899,18 @@ export default {
811 899
     },
812 900
     listSettleSummaryFn() {
813 901
       listSettleSummary({ settleId: this.taskForm.formId }).then(res => {
814
-        this.settleSumList = res.rows;
815 902
         this.oldSettleSumList = res.rows;
816
-        for (let s of this.settleSumList) {
903
+        for (let s of res.rows) {
817 904
           if (s.content == "结算费用合计") {
818 905
             this.settleSumTr = s;
819 906
             break;
820 907
           }
821 908
         }
822
-        this.settleSumList = this.settleSumList.filter(
823
-          item => item.content !== "结算费用合计"
909
+        this.settleSumList = res.rows.filter(
910
+          item => item.tableNumber == "0"
911
+        );
912
+        this.deptSettleList = res.rows.filter(
913
+          item => item.tableNumber == "1"
824 914
         );
825 915
         this.calculateActualSumSettle();
826 916
       });
@@ -875,4 +965,9 @@ table {
875 965
   /*设置背景颜色*/
876 966
   /* background-color: #bfa; */
877 967
 }
968
+
969
+h3 {
970
+  font-family: '黑体';
971
+  font-weight: bold;
972
+}
878 973
 </style>

Loading…
Откажи
Сачувај