Ver código fonte

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

余思翰 1 ano atrás
pai
commit
38433d5696

+ 2
- 1
oa-ui/src/views/flowable/form/components/choosePrice.vue Ver arquivo

151
     /* 获取单价 */
151
     /* 获取单价 */
152
     getUnitPrice(work, workItem, subItem, scaleGrade, groundType) {
152
     getUnitPrice(work, workItem, subItem, scaleGrade, groundType) {
153
       getUnitPrice({ workItem, subItem, scaleGrade, groundType: groundType }).then(res => {
153
       getUnitPrice({ workItem, subItem, scaleGrade, groundType: groundType }).then(res => {
154
+        let content = work.workType + '/' + workItem
154
         if (res.length != 0) {
155
         if (res.length != 0) {
155
           work.priceId = res.data.id;
156
           work.priceId = res.data.id;
156
           this.setValue(work, 'price', res.data.price)
157
           this.setValue(work, 'price', res.data.price)
157
           this.setValue(work, 'unit', res.data.unit)
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 Ver arquivo

2
  * @Author: ysh
2
  * @Author: ysh
3
  * @Date: 2024-04-30 09:03:14
3
  * @Date: 2024-04-30 09:03:14
4
  * @LastEditors: Please set LastEditors
4
  * @LastEditors: Please set LastEditors
5
- * @LastEditTime: 2024-05-07 16:13:01
5
+ * @LastEditTime: 2024-05-08 17:54:13
6
 -->
6
 -->
7
 <template>
7
 <template>
8
   <div class="app-container" v-loading="loading">
8
   <div class="app-container" v-loading="loading">
145
                   {{ work.price }}
145
                   {{ work.price }}
146
                 </td>
146
                 </td>
147
                 <td>
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
                 </td>
150
                 </td>
151
                 <td>
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
                     @blur="calculateSettle(work)" :controls="false"></el-input-number>
153
                     @blur="calculateSettle(work)" :controls="false"></el-input-number>
154
                 </td>
154
                 </td>
155
                 <td>
155
                 <td>
184
             <div class="line"></div>
184
             <div class="line"></div>
185
           </div>
185
           </div>
186
           <el-form-item label-width="60px">
186
           <el-form-item label-width="60px">
187
+            <h3>表1:扣除明细</h3>
187
             <table border="1">
188
             <table border="1">
188
               <tr>
189
               <tr>
189
                 <td style="width: 50px">序号</td>
190
                 <td style="width: 50px">序号</td>
201
                   </el-input>
202
                   </el-input>
202
                 </td>
203
                 </td>
203
                 <td>
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
                   <!-- {{ work.amount }} -->
207
                   <!-- {{ work.amount }} -->
207
                 </td>
208
                 </td>
208
                 <td>
209
                 <td>
214
                     @click="deletWorkItem(index, settleSumList)">删除行</el-button>
215
                     @click="deletWorkItem(index, settleSumList)">删除行</el-button>
215
                 </td>
216
                 </td>
216
               </tr>
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
               <tr>
250
               <tr>
218
                 <td :colspan="2">实际结算总金额</td>
251
                 <td :colspan="2">实际结算总金额</td>
219
                 <td :colspan="3">
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
                     :controls="false"></el-input-number>
254
                     :controls="false"></el-input-number>
222
                 </td>
255
                 </td>
223
               </tr>
256
               </tr>
230
                 </td>
263
                 </td>
231
               </tr>
264
               </tr>
232
             </table>
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
           </el-form-item>
267
           </el-form-item>
235
 
268
 
236
           <!-- 结算审核情况 -->
269
           <!-- 结算审核情况 -->
414
       type: Boolean,
447
       type: Boolean,
415
       default: false
448
       default: false
416
     }
449
     }
450
+  },
451
+  watch: {
452
+    
417
   },
453
   },
418
   data() {
454
   data() {
419
     return {
455
     return {
449
         content: "结算费用合计",
485
         content: "结算费用合计",
450
         amount: 0,
486
         amount: 0,
451
         remark: "",
487
         remark: "",
488
+        tableNumber: '2'
452
       },
489
       },
453
       settleSumList: [
490
       settleSumList: [
454
         {
491
         {
455
           content: "",
492
           content: "",
456
           amount: 0,
493
           amount: 0,
457
           remark: "",
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
       oldSettleSumList: [],
506
       oldSettleSumList: [],
461
       actualSumSettle: "",
507
       actualSumSettle: "",
462
       clickWork: {},
508
       clickWork: {},
488
           this.listSettleSummaryFn();
534
           this.listSettleSummaryFn();
489
           getUser(this.form.reporter).then(res => {
535
           getUser(this.form.reporter).then(res => {
490
             if (res.data) {
536
             if (res.data) {
491
-              console.log(res.data);
492
               this.form.reporterName = res.data.nickName;
537
               this.form.reporterName = res.data.nickName;
493
               this.deptId = res.data.deptId
538
               this.deptId = res.data.deptId
494
             }
539
             }
592
       this.$refs["settleForm"].validate(vaild => {
637
       this.$refs["settleForm"].validate(vaild => {
593
         if (vaild) {
638
         if (vaild) {
594
           this.preserve();
639
           this.preserve();
595
-          debugger
596
           if (this.taskName == '结算发起') {
640
           if (this.taskName == '结算发起') {
597
             this.getNextFlowNodeFn(17);
641
             this.getNextFlowNodeFn(17);
598
           } else if (this.taskName == '综合事务部处理') {
642
           } else if (this.taskName == '综合事务部处理') {
712
         content: "",
756
         content: "",
713
         amount: 0,
757
         amount: 0,
714
         remark: "",
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
     deletWorkItem(index, arr) {
770
     deletWorkItem(index, arr) {
727
       let sum = work.workload * work.coefficient * work.price;
780
       let sum = work.workload * work.coefficient * work.price;
728
       work.settle = Number(sum).toFixed(2);
781
       work.settle = Number(sum).toFixed(2);
729
       this.calculateSumSettle();
782
       this.calculateSumSettle();
783
+      this.calculateActualSumSettle();
730
     },
784
     },
731
     calculateSumSettle() {
785
     calculateSumSettle() {
732
       let sum = 0;
786
       let sum = 0;
734
       for (let a of arr) {
788
       for (let a of arr) {
735
         sum = sum + Number(a.settle);
789
         sum = sum + Number(a.settle);
736
       }
790
       }
737
-      this.settleSumTr.amount = sum;
791
+      this.settleSumTr.amount = sum.toFixed(2);
738
     },
792
     },
739
     calculateActualSumSettle() {
793
     calculateActualSumSettle() {
740
       let sum = 0;
794
       let sum = 0;
742
       for (let a of arr) {
796
       for (let a of arr) {
743
         sum = sum + Number(a.amount);
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
     handleChoosePrice(work, index) {
814
     handleChoosePrice(work, index) {
748
       this.clickWork = work;
815
       this.clickWork = work;
756
       this.setValue(this.settleWorkList[index], "groundType", val.groundType);
823
       this.setValue(this.settleWorkList[index], "groundType", val.groundType);
757
       this.setValue(this.settleWorkList[index], "price", val.price);
824
       this.setValue(this.settleWorkList[index], "price", val.price);
758
       this.setValue(this.settleWorkList[index], "priceId", val.priceId);
825
       this.setValue(this.settleWorkList[index], "priceId", val.priceId);
826
+      this.setValue(this.settleWorkList[index], "content", val.content);
759
       this.calculateSettle(this.settleWorkList[index]);
827
       this.calculateSettle(this.settleWorkList[index]);
760
       this.drawer = false;
828
       this.drawer = false;
761
     },
829
     },
767
     addSettleFn() {
835
     addSettleFn() {
768
       let settleId = this.taskForm.formId;
836
       let settleId = this.taskForm.formId;
769
       this.form.settleId = settleId;
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
     addSettleWorkFn(settleId) {
853
     addSettleWorkFn(settleId) {
776
       for (let work of this.settleWorkList) {
854
       for (let work of this.settleWorkList) {
786
       for (let item of this.settleSumList) {
864
       for (let item of this.settleSumList) {
787
         item.settleId = settleId;
865
         item.settleId = settleId;
788
         setTimeout(() => {
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
     },
899
     },
812
     listSettleSummaryFn() {
900
     listSettleSummaryFn() {
813
       listSettleSummary({ settleId: this.taskForm.formId }).then(res => {
901
       listSettleSummary({ settleId: this.taskForm.formId }).then(res => {
814
-        this.settleSumList = res.rows;
815
         this.oldSettleSumList = res.rows;
902
         this.oldSettleSumList = res.rows;
816
-        for (let s of this.settleSumList) {
903
+        for (let s of res.rows) {
817
           if (s.content == "结算费用合计") {
904
           if (s.content == "结算费用合计") {
818
             this.settleSumTr = s;
905
             this.settleSumTr = s;
819
             break;
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
         this.calculateActualSumSettle();
915
         this.calculateActualSumSettle();
826
       });
916
       });
875
   /*设置背景颜色*/
965
   /*设置背景颜色*/
876
   /* background-color: #bfa; */
966
   /* background-color: #bfa; */
877
 }
967
 }
968
+
969
+h3 {
970
+  font-family: '黑体';
971
+  font-weight: bold;
972
+}
878
 </style>
973
 </style>

Carregando…
Cancelar
Salvar