From e5e3e1a5bc8aa300c580126703bb6067221dee96 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期四, 15 六月 2023 10:09:08 +0800
Subject: [PATCH] 主要修改了个税计算

---
 src/views/project/travelexpenseslist/index.vue |  207 +++++++++++++++++++++++++++++++++++----------------
 1 files changed, 140 insertions(+), 67 deletions(-)

diff --git a/src/views/project/travelexpenseslist/index.vue b/src/views/project/travelexpenseslist/index.vue
index f9ced41..f153007 100644
--- a/src/views/project/travelexpenseslist/index.vue
+++ b/src/views/project/travelexpenseslist/index.vue
@@ -135,6 +135,7 @@
           <el-col :span="5">
             <el-form-item label="鎵�灞炵粍鍒�" prop="deptmentname">
               <el-input v-model="form.deptmentname" placeholder="鎵�灞炵粍鍒�" />
+              <!--<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="璇烽�夋嫨褰掑睘閮ㄩ棬" />-->
             </el-form-item>
           </el-col>
           <el-col :span="5">
@@ -323,7 +324,7 @@
                     if (scope.row.endtime) { return time.getTime() > new Date(scope.row.endtime.replace(/-/g, '/')) }
                   }
                 }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date"
-                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="寮�濮嬫棩鏈�" @blur="getallowance(scope.row)">
+                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="寮�濮嬫棩鏈�" @blur="getdays(scope.row)">
                 </el-date-picker>
               </template>
             </el-table-column>
@@ -334,7 +335,7 @@
                     if (scope.row.starttime) { return time.getTime() < new Date(scope.row.starttime.replace(/-/g, '/')) }
                   }
                 }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date"
-                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="缁撴潫鏃ユ湡" @blur="getallowance(scope.row)">
+                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="缁撴潫鏃ユ湡" @blur="getdays(scope.row)">
                 </el-date-picker>
               </template>
             </el-table-column>
@@ -343,21 +344,20 @@
                 <el-input v-model="scope.row.departure" placeholder="鍑哄彂鍦�" />
               </template>
             </el-table-column>
-            <el-table-column label="鍒拌揪鍦�" prop="destination2" align="center" width="140">
+            <el-table-column label="鍒拌揪鍦�" prop="destination" align="center" width="140">
               <template slot-scope="scope">
                 <!--  <el-input v-model="scope.row.destination" placeholder="鍒拌揪鍦�" @blur="getallowance(scope.row)" /> -->
-
                 <el-select filterable allow-create v-model="scope.row.destination" value-key="value" placeholder="鍒拌揪鍦�"
-                  @change="getallowance2(scope.row, scope.row.destination)">
+                  @change="getallowance(scope.row)">
                   <el-option v-for="dict in dict.type.sys_area_name" :key="dict.value" :label="dict.label"
-                    :value="dict.value"></el-option>
+                    :value="dict.label"></el-option>
 
                 </el-select>
               </template>
             </el-table-column>
             <el-table-column prop="days" label="澶╂暟" width="65" align="center">
               <template slot-scope="scope">
-                <el-input v-model="scope.row.days" @blur="getStandard(scope.row)" placeholder="澶╂暟" />
+                <el-input v-model="scope.row.days" @blur="getallowance(scope.row)" placeholder="澶╂暟" />
               </template>
             </el-table-column>
             <el-table-column prop="traffictype" label="鍑哄彂浜ら�氬伐鍏�" align="center" width="100">
@@ -379,7 +379,7 @@
             <el-table-column prop="trafficexpense" label="浜ら�氳垂" align="center" width="80">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.trafficexpense" placeholder="浜ら�氳垂" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -389,7 +389,7 @@
               <template slot-scope="scope">
                 <el-input v-model="scope.row.cityfee" placeholder="甯傚唴浜ら�氳垂" @blur="
                   (val) => {
-                    sumTotalFee();
+                    sumRowFee(scope.row);
                   }
                 ">{{ Number(scope.row.cityfee).toFixed(2) }}
                 </el-input>
@@ -399,7 +399,7 @@
             <el-table-column prop="hotelexpense" label="浣忓璐�" align="center" width="80">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.hotelexpense" placeholder="浣忓璐�" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -408,7 +408,7 @@
             <el-table-column prop="foodexpenses" label="椁愯垂鎶ラ攢" align="center" width="80">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.foodexpenses" placeholder="浼欓璐规姤閿�" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -416,7 +416,7 @@
             <el-table-column prop="foodallowance" label="浼欓琛ュ姪" align="center" width="80">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.foodallowance" placeholder="浼欓璐硅ˉ鍔�" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -424,7 +424,7 @@
             <el-table-column prop="otherexpense" label="鍏潅璐硅ˉ鍔�" align="center" width="80">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.otherexpense" placeholder="鏉傝垂" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -433,7 +433,7 @@
             <el-table-column prop="otherfeeamount" label="鍏朵粬璐圭敤" align="center" width="90">
               <template slot-scope="scope">
                 <el-input v-model="scope.row.otherfeeamount" placeholder="鍏朵粬璐圭敤" @blur="(val) => {
-                  sumTotalFee();
+                  sumRowFee(scope.row);
                 }
                   " />
               </template>
@@ -524,7 +524,7 @@
             </el-table-column><el-table-column prop="paiddate" slot="" label="鎵撴鏃ユ湡" fixed align="center" width="150">
               <template slot-scope="scope">
                 <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date"
-                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="鎵撴鏃ユ湡" :disabled="true" @blur="getallowance(scope.row)">
+                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="鎵撴鏃ユ湡" :disabled="true">
                 </el-date-picker>
               </template>
             </el-table-column>
@@ -580,8 +580,8 @@
                                                                                               -->
             <el-form-item label="鏂囦欢涓婁紶" align="left" prop="annexfiles">
               <!-- <file-upload ref="fileUpload" :fileType=fileType :limit="1" :on-success="handleUploadSuccess"></file-upload> -->
-              <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileList" multiple :limit="5"
-                :headers="headers" :on-success="(response, file, fileList) =>
+              <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileList" multiple
+                :limit="20" :headers="headers" :on-success="(response, file, fileList) =>
                   uploadSccess(response, file, fileList)
                   " :on-preview="downFile" :disabled='dialogType == "detail"' :on-error="handleUploadError"
                 :on-exceed="handleExceed" :on-remove="remove" accept="image/*,.pdf">
@@ -611,6 +611,8 @@
 </template>
 
 <script>
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import { listDonatebaseinfo } from "@/api/project/donatebaseinfo";
 import { listReimbursementpayee, addReimbursementpayee, updateReimbursementpayee } from "@/api/project/reimbursementpayee";
 import {
@@ -636,12 +638,14 @@
 import { getInfoBytheUserNo } from "@/api/project/externalperson";
 import { regionDataPlus, CodeToText } from "element-china-area-data";
 import Li_area_select from "@/components/Address";
-import { getUserProfile } from "@/api/system/user";
+import { getUser,getUserProfile } from "@/api/system/user";
+import { treeselect } from "@/api/system/dept";
 import { getSubsidy } from "@/api/project/travelcity";
 import { listReportname, listUser } from "@/api/project/organization";
 import { getToken } from "@/utils/auth";
 export default {
   components: {
+    Treeselect,
     Li_area_select,
   },
   name: "Funddetail",
@@ -668,7 +672,9 @@
       //鍏ㄩ儴浜哄憳
       personsList: [],
       //涓嬫媺鍙互閫夋嫨浜哄憳鍒楄〃  
-      personsSel: [],
+      personsSel: [],      
+      // 閮ㄩ棬鏍戦�夐」
+      deptOptions: undefined,
 
       costtypeobj: {
         value: 0,
@@ -713,7 +719,7 @@
         remark: null,
         departure: null,
         endtime: null,
-        destination2: null,
+        destination: null,
         uploadFlag: null,
         uploadTime: null,
         // orderByColumn: "createTime",
@@ -723,6 +729,11 @@
       queryParams2: {
         persontype: null,
         arriveAddr: null,
+      },
+      feesParams: {
+        beneficiaryNo: null,
+        starttime: null,
+        endtime: null,
       },
       //鏌ヨ浠樻
       queryParamsPayee: {
@@ -806,6 +817,8 @@
 
     //鑾峰彇鐧诲綍鑰呬俊鎭�
     this.getUsermsg();
+    //鑾峰彇閮ㄩ棬淇℃伅
+    //this.getTreeselect();
   },
 
   methods: {
@@ -837,6 +850,13 @@
       getUserProfile().then((response) => {
         this.defaultperson = response.data;
         this.standardlevel = response.data.standardlevel;
+      });
+    },
+
+    /** 鏌ヨ閮ㄩ棬涓嬫媺鏍戠粨鏋� */
+    getTreeselect() {
+      treeselect().then(response => {
+        this.deptOptions = response.data;
       });
     },
 
@@ -918,23 +938,25 @@
       }
     },
 
-    //璁$畻琛ュ姪
-    getallowance(row) {
-      if (
-        row.starttime != "" &&
-        row.starttime != null &&
-        row.endtime != "" &&
-        row.endtime != null
-      ) {
+    //璁$畻鏃ユ湡
+    getdays(row) {
+      if (row.starttime != "" && row.starttime != null && row.endtime != "" && row.endtime != null) {
         //璁$畻澶╂暟
         row.days = (Math.floor(Math.abs(Date.parse(row.starttime) - Date.parse(row.endtime)) / (1000 * 3600 * 24)) + 1).toString()
       } else {
-        row.days = '';
+        row.days = 0;
       };
 
+      //璁$畻琛ュ姪
+      this.getallowance(row);
+    },
+
+    //璁$畻琛ュ姪
+    getallowance(row) {
+      console.log("ro",row);
       //鍏潅璐硅ˉ鍔╋細鏉窞妗愬簮锛屽缓寰凤紝娣冲畨60锛屾澀宸炲叾浠栧湴鍖�0锛岄潪鏉窞鍦板尯80
-      if (row.destination2 != "") {
-        var tempStr = row.destination2;
+      if (row.destination != "") {
+        var tempStr = row.destination;
 
         //楠岃瘉鍩庡競
         if (tempStr == "鏉窞") {
@@ -951,12 +973,11 @@
       //浼欓璐硅ˉ鍔╋細鍩庡競锛堣タ钘忥紝鏂扮枂锛岄潚娴�.120锛夛紙鍏朵粬100锛�
       row.foodallowance = (parseInt(row.days) * 100).toString();
 
-      //璁$畻鍚堣
-      this.sumTotalFee();
+      //璁$畻鍚堣      
+      this.sumRowFee(row);
     },
 
     getallowance2(row, val2) {
-      // this.getallowance(row);
       this.arriveAddr = val2;
       this.queryParams2.arriveAddr;
       this.queryParams2.personType = row;
@@ -1001,7 +1022,7 @@
             row.hotelexpense = fee;
           })
           .finally(() => {
-            this.sumTotalFee(row);
+            this.sumTotalFee();
           });
       }
     },
@@ -1014,7 +1035,7 @@
         row.searchAddress.shi != "" &&
         row.searchAddress.qu != ""
       ) {
-        row.destination2 =
+        row.destination =
           row.searchAddress.sheng +
           row.searchAddress.shi +
           row.searchAddress.qu;
@@ -1250,17 +1271,19 @@
         getReimbursementdetaillist(ids).then((res) => {
           this.rbDetails = res.data;
           if (this.rbDetails.length == 0) { this.addDetailRow(0); }
-          //瑙f瀽鍑哄樊鍦板潃
-          /*
+
           for (let i = 0; i < this.rbDetails.length; i++) {
-            this.rbDetails[i].index = i;
-            this.rbDetails[i].searchAddress = {
-              sheng: this.rbDetails[i].travelprovincename,
-              shi: this.rbDetails[i].travelcityname,
-              qu: this.rbDetails[i].traveltownname,
-            };
+            this.sumRowFee(this.rbDetails[i]);
+            //瑙f瀽鍑哄樊鍦板潃
+            /*
+              this.rbDetails[i].index = i;
+              this.rbDetails[i].searchAddress = {
+                sheng: this.rbDetails[i].travelprovincename,
+                shi: this.rbDetails[i].travelcityname,
+                qu: this.rbDetails[i].traveltownname,
+              }; */
           }
-          */
+
           //瀹炴椂鍚堣閲戦
           //this.sumTotalFee();
         });
@@ -1300,9 +1323,11 @@
         listFundflow(listFundflowparams).then((res) => {
           this.fundflowList = res.rows;
         });
+
         //鎶ラ攢鏄庣粏
         getReimbursementdetaillist(ids).then((res) => {
           this.rbDetails = res.data;
+          /*
           for (let i = 0; i < this.rbDetails.length; i++) {
             this.rbDetails[i].index = i;
             this.rbDetails[i].searchAddress = {
@@ -1311,10 +1336,13 @@
               qu: this.rbDetails[i].traveltownname,
             };
           }
-          //this.sumTotalFee();
+          */
         });
 
-        //璐︽埛        
+        if (this.rbDetails.length > 0) this.sumTotalFee();
+
+
+        //浠樻淇℃伅        
         this.queryParamsPayee.rbid = ids;
         listReimbursementpayee(this.queryParamsPayee).then((res) => {
           this.rbPayees = res.rows;
@@ -1509,7 +1537,7 @@
         starttime: null,
         departure: null,
         endtime: null,
-        destination2: null,
+        destination: null,
         days: null,
         trafficexpense: 0,
         traffictype: null,
@@ -1610,11 +1638,11 @@
               this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
               rows.splice(index, 1);
               this.recountOrderNo2();
-              // this.sumTotalFee();
+              this.sumTotalFee();
             });
           } else {
             rows.splice(index, 1);
-            //this.sumTotalFee();
+            this.sumTotalFee();
             this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
             this.recountOrderNo2();
           }
@@ -1672,9 +1700,66 @@
         });
     },
 
+    //璁$畻涓�琛屽悎璁�
+    //璁$畻褰撳墠琛屾姤閿�鍐呭璐圭敤鍚堣
+    sumRowFee(row) {
+      let totalFee = 0;
+      if (!isNaN(parseFloat(row.trafficexpense))) {
+        totalFee += parseFloat(row.trafficexpense);
+      }
+      if (!isNaN(parseFloat(row.cityfee))) {
+        totalFee += parseFloat(row.cityfee);
+      }
+      if (!isNaN(parseFloat(row.hotelexpense))) {
+        totalFee += parseFloat(row.hotelexpense);
+      }
+      if (!isNaN(parseFloat(row.otherexpense))) {
+        totalFee += parseFloat(row.otherexpense);
+      }
+      if (!isNaN(parseFloat(row.foodexpenses))) {
+        totalFee += parseFloat(row.foodexpenses);
+      }
+      if (!isNaN(parseFloat(row.foodallowance))) {
+        totalFee += parseFloat(row.foodallowance);
+      }
+      if (!isNaN(parseFloat(row.otherfeeamount))) {
+        totalFee += parseFloat(row.otherfeeamount);
+      }
+      row.total = totalFee;
+
+      /*
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].cityfee);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance);
+      }
+      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) {
+        totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount);
+      }
+      this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2);
+      this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]);
+      */
+      //閲嶆柊璁$畻鏁翠釜鎶ラ攢鍗曠殑鍚堣
+      this.sumTotalFee();
+    },
+
     //璁$畻璐圭敤鍚堣
     sumTotalFee() {
       let allSum = 0;
+
       //鎹愮尞鑰呭灞炶垂鐢�
       if (!isNaN(parseFloat(this.form.donoramount))) {
         allSum += parseFloat(this.form.donoramount);
@@ -1683,10 +1768,11 @@
       //鎶ラ攢鏄庣粏璐圭敤
       try {
         for (let i = 0; i < this.rbDetails.length; i++) {
+          /*
           let totalFee = 0;
           //璁$畻褰撳墠鎶ラ攢鍐呭璐圭敤鍚堣
-          if (!isNaN(parseFloat(this.rbDetails[i].trafficexpense))) {
-            totalFee += parseFloat(this.rbDetails[i].trafficexpense);
+          if (!isNaN(parseFloat(this.rbDetails[i].total))) {
+            totalFee += parseFloat(this.rbDetails[i].total);
           }
           if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) {
             totalFee += parseFloat(this.rbDetails[i].cityfee);
@@ -1708,6 +1794,8 @@
           }
           this.rbDetails[i].total = parseFloat(totalFee).toFixed(2);
           this.$set(this.rbDetails, i, this.rbDetails[i]);
+          */
+
           if (!isNaN(parseFloat(this.rbDetails[i].total))) {
             allSum += parseFloat(this.rbDetails[i].total);
           }
@@ -1716,21 +1804,6 @@
         this.form.amountrequested = allSum.toFixed(2);
         this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested);
       } catch { }
-    },
-
-    getDetailArr(rbid) {
-      getReimbursementdetaillist(rbid).then((res) => {
-        this.rbDetails = res.data;
-        for (let i = 0; i < this.rbDetails.length; i++) {
-          this.rbDetails[i].index = i;
-          this.rbDetails[i].searchAddress = {
-            sheng: this.rbDetails[i].travelprovincename,
-            shi: this.rbDetails[i].travelcityname,
-            qu: this.rbDetails[i].traveltownname,
-          };
-        }
-        this.sumTotalFee();
-      });
     },
 
     //閲戦鏁板瓧杞崲鎴愬ぇ鍐�

--
Gitblit v1.9.3