yxh
2023-06-15 e5e3e1a5bc8aa300c580126703bb6067221dee96
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); }
          //解析出差地址
          /*
          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]);
            //解析出差地址
            /*
              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();
      });
    },
    //金额数字转换成大写