yxh
yxh
2023-07-31 681bd876235ddb2a73fc218c64d0cf174b38d666
src/views/project/travelexpenseslist/Modifydetails/index.vue
@@ -166,7 +166,7 @@
          <el-col :span="20">报销明细录入:</el-col>
        </el-row>
        <el-row>
          <el-table :data="rbDetails" border highlight-current-row show-summary>
          <el-table :data="rbDetails" border highlight-current-row :summary-method="getSummaries" show-summary>
            <el-table-column prop="orderno" slot="" label="序号" align="center" fixed width="65">
              <template slot-scope="scope">
                <el-input v-model="scope.row.orderno" placeholder="序号" />
@@ -274,8 +274,8 @@
            <el-table-column prop="trafficexpense" label="交通费" align="center" width="80">
              <template slot-scope="scope">
                <el-input v-model="scope.row.trafficexpense" placeholder="交通费" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
@@ -294,8 +294,8 @@
            <el-table-column prop="hotelexpense" label="住宿费" align="center" width="80">
              <template slot-scope="scope">
                <el-input v-model="scope.row.hotelexpense" placeholder="住宿费" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
@@ -303,24 +303,24 @@
            <el-table-column prop="foodexpenses" label="餐费报销" align="center" width="80">
              <template slot-scope="scope">
                <el-input v-model="scope.row.foodexpenses" placeholder="伙食费报销" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
            <el-table-column prop="foodallowance" label="伙食补助" align="center" width="80">
              <template slot-scope="scope">
                <el-input v-model="scope.row.foodallowance" placeholder="伙食费补助" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
            <el-table-column prop="otherexpense" label="公杂费补助" align="center" width="80">
              <template slot-scope="scope">
                <el-input v-model="scope.row.otherexpense" placeholder="杂费" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
@@ -328,8 +328,8 @@
            <el-table-column prop="otherfeeamount" label="其他费用" align="center" width="90">
              <template slot-scope="scope">
                <el-input v-model="scope.row.otherfeeamount" placeholder="其他费用" @blur="val => {
                    sumRowFee(scope.row);
                  }
                  sumRowFee(scope.row);
                }
                  " />
              </template>
            </el-table-column>
@@ -344,19 +344,14 @@
                <el-input v-model="scope.row.total" placeholder="合计" />
              </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center" width="120" v-if="dialogType == 'edit'">
            <el-table-column fixed="right" label="操作" align="center" width="120">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="addDetailRow(scope.$index)">新增</el-button>
                <el-button @click.native.prevent="
                  deleteDetailRow(scope.$index, rbDetails, scope.row)
                  " type="text" size="small">
                  删除
                </el-button>
                <el-button @click.native.prevent="
                  Filepopup(scope.$index, rbDetails, scope.row)
                  " type="text" size="small">
                  附件
                </el-button>
                <el-button type="text" size="mini" @click="addDetailRow(scope.$index)"
                  v-if="dialogType == 'edit'">新增</el-button>
                <el-button @click.native.prevent="deleteDetailRow(scope.$index, rbDetails, scope.row)" type="text"
                  size="small" v-if="dialogType == 'edit'">删除</el-button>
                <el-button @click.native.prevent="Filepopup(scope.$index, rbDetails, scope.row)" type="text"
                  size="small">票据</el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -365,7 +360,7 @@
          <el-col :span="20">报销请款明细:</el-col>
        </el-row>
        <el-row style="margin-top: 30px">
          <el-table :data="rbPayees" border highlight-current-row show-summary>
          <el-table :data="rbPayees" border highlight-current-row :summary-method="getSummaries" show-summary>
            <el-table-column prop="orderno" slot="" label="序号" align="center" fixed width="65">
              <template slot-scope="scope">
                <el-input v-model="scope.row.orderno" placeholder="序号" />
@@ -418,17 +413,19 @@
                <el-input v-model="scope.row.amount" placeholder="打款金额" />
              </template>
            </el-table-column>
            <el-table-column prop="remark" slot="" label="请款说明" align="center" fixed width="280">
            <el-table-column prop="remark" slot="" label="请款说明" align="center" fixed>
              <template slot-scope="scope">
                <el-input v-model="scope.row.remark" placeholder="说明" />
              </template> </el-table-column><el-table-column prop="paiddate" slot="" label="打款日期" fixed align="center"
              width="150">
              </template>
            </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">
                </el-date-picker>
              </template>
            </el-table-column>
            </el-table-column>-->
            <el-table-column label="操作" align="center" width="100" v-if="dialogType == 'edit'">
              <template slot-scope="scope">
                <el-button type="text" size="mini" @click="addPayeeRow(scope.$index)">新增</el-button>
@@ -442,7 +439,7 @@
          </el-table>
        </el-row>
        <el-row v-if="dialogType == 'detail'">
        <el-row v-if="dialogType == 'detail' || dialogType == 'check'">
          <el-table :data="fundflowList" border>
            <el-table-column label="审核人" align="center" width="120" prop="checkusername" />
            <el-table-column label="审核日期" align="center" width="160" prop="createTime" />
@@ -453,10 +450,28 @@
            <el-table-column label="审核备注" align="center" prop="flowcontent" />
          </el-table>
        </el-row>
        <el-row style="margin-top: 25px; margin-bottom: 5px" v-if="dialogType == 'check'">
          <el-col :span="7">
            <el-form-item label="审核结果" align="left">
              <el-radio-group v-model="checkObj.flowlevelone" align="left">
                <el-radio label="1">通过</el-radio>
                <el-radio label="2">不通过</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="dialogType == 'check'">
          <el-col :span="17">
            <el-form-item label="审核备注" align="left">
              <el-input v-model="checkObj.flowconclusion" placeholder="备注" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm" v-if="dialogType == 'edit'">保 存</el-button>
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="checksubmit" v-if="dialogType == 'check'">提 交</el-button>
        <!--<el-button @click="cancel">退 出</el-button>-->
      </div>
    </div>
@@ -466,7 +481,7 @@
          <div>
            <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto" multiple
              :limit="20" :headers="headers" :on-success="(response, file, fileList) =>
                  uploadSccess(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">
              <el-button :disabled="dialogType == 'detail'" size="small" type="primary">上传</el-button>
@@ -514,6 +529,7 @@
  updateReimbursement,
  exportReimbursement,
  getdownload,
  checkfund,
  fundSubmit
} from "@/api/project/reimbursement";
import {
@@ -566,7 +582,9 @@
      //下拉可以选择人员列表
      personsSel: [],
      // 部门树选项
      deptOptions: undefined,
      //票据文件
      pdftitle: "",
      pdfimg: "",
      pdfVisible: false,
@@ -574,6 +592,7 @@
        value: 0,
        label: ""
      },
      hintitle: "选中左侧已上传文件预览查看",
      atpresent: "",
      iframeurl: "",
@@ -666,19 +685,36 @@
      headers: {
        Authorization: "Bearer " + getToken()
      }
      },
      //审批信息
      checkObj: {
        flowlevelone: null,
        flowconclusion: null,
        fundid: null,
      },
      //保存按钮控制
      idisabled: false,
    };
  },
  created() {
    //获取记录列表
    this.getList();
    this.gainee();
    // this.getList();
    //获取报销中的人员信息
    this.getPersonList();
  },
  mounted() {
    //获取登录者信息
    getUserProfile().then(response => {
      this.defaultperson = response.data;
      this.standardlevel = response.data.standardlevel;
      console.log("this.defaultperson", this.defaultperson);
    });
    //获取捐献者姓名
    listDonatebaseinfo().then(res => {
      let list = res.rows;
@@ -696,10 +732,27 @@
      }
    });
    //获取登录者信息
    this.getUsermsg();
    //获取部门信息
    //this.getTreeselect();
  },
  mounted() {
    //选择业务类型:1、新增;2、修改;3、查看
    let ids = this.$route.query.id;
    let pos = this.$route.query.pos;
    this.defaultperson = this.$route.query.routerparam;
    if (pos == 1) {
      this.handleAdd(ids);
    } else if (pos == 2) {
      this.handleUpdate(ids);
    }
    else if (pos == 3) {
      this.handleDetail(ids);
    }
    else if (pos == 4) {
      this.handleCheck(ids);
    }
  },
  methods: {
@@ -724,7 +777,7 @@
      console.log(fileList);
      this.rbDetails;
      //获取附件信息位置
      //获取票据信息位置
      if (response.code == 200) {
        this.form.filename = file.raw.name;
        console.log(this.fileList);
@@ -737,7 +790,7 @@
        this.$modal.msgError(response.msg);
      }
    },
    // 点击文件
    // 点击票据
    Filepopup(index, rows, row) {
      console.log(index, rows, row);
      this.atpresent = index;
@@ -773,14 +826,6 @@
        this.$modal.msgWarning("当前文件暂不支持预览");
        this.previewpdf = false;
      }
    },
    //获取登录用户信息
    getUsermsg() {
      getUserProfile().then(response => {
        this.defaultperson = response.data;
        this.standardlevel = response.data.standardlevel;
      });
    },
    /** 查询部门下拉树结构 */
@@ -889,34 +934,36 @@
      //计算补助
      this.getallowance(row);
    },
    //计算补助
    getallowance(row) {
      console.log("ro", row);
      //公杂费补助:杭州桐庐,建德,淳安60,杭州其他地区0,非杭州地区80
      if (row.destination != "") {
        var tempStr = row.destination;
      if (row.persontype == "专职人员" || row.persontype == "协调员" || row.persontype == "管理人员") {
        //公杂费补助:杭州桐庐,建德,淳安60,杭州其他地区0,非杭州地区80
        if (row.destination != "") {
          var tempStr = row.destination;
        //验证城市
        if (tempStr == "杭州") {
          row.otherexpense = "";
        } else if (
          tempStr == "杭州-桐庐" ||
          tempStr == "杭州-建德" ||
          tempStr == "杭州-淳安"
        ) {
          row.otherexpense = (parseInt(row.days) * 60).toString();
        } else {
          row.otherexpense = (parseInt(row.days) * 80).toString();
          //验证城市
          if (tempStr == "杭州") {
            row.otherexpense = "";
          } else if (
            tempStr == "杭州-桐庐" ||
            tempStr == "杭州-建德" ||
            tempStr == "杭州-淳安"
          ) {
            row.otherexpense = (parseInt(row.days) * 60).toString();
          } else {
            row.otherexpense = (parseInt(row.days) * 80).toString();
          }
        }
        //伙食费补助:城市(西藏,新疆,青海.120)(其他100)
        row.foodallowance = (parseInt(row.days) * 100).toString();
        //计算合计
        this.sumRowFee(row);
      }
      //伙食费补助:城市(西藏,新疆,青海.120)(其他100)
      row.foodallowance = (parseInt(row.days) * 100).toString();
      //计算合计
      this.sumRowFee(row);
    },
    getStandard(row) {
@@ -1061,10 +1108,12 @@
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      window.close();
    },
    // 表单重置
    reset() {
      this.fileListto = [];
@@ -1116,6 +1165,7 @@
      this.rbPayees = [];
      this.resetForm("form");
    },
    //
    handup(e) {
      console.log("上报", e);
@@ -1133,7 +1183,7 @@
      // this.queryParams.paprovincecode= this.$refs["residenceSelect" ].getSheng();
      // this.queryParams.patowncode= this.$refs["residenceSelect" ].getQu();
      this.queryParams.pageNum = 1;
      this.getList();
      // this.getList();
    },
    /** 重置按钮操作 */
@@ -1151,11 +1201,12 @@
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "新增报销申请";
      // this.open = true;
      this.title = "新增差旅申请单";
      this.dialogType = "edit";
      this.fundflowList = [];
      console.log(this.title, this.defaultperson);
      this.form.userno = this.defaultperson.userName;
      this.form.username = this.defaultperson.nickName;
@@ -1166,23 +1217,14 @@
      this.addDetailRow(0);
      this.addPayeeRow(0);
    },
    gainee() {
      let ids = this.$route.query.id;
      let pos = this.$route.query.pos;
      console.log(ids, pos);
      if (pos == 2) {
        this.handleDetail(ids);
      } else if (pos == 1) {
        this.handleUpdate(ids);
      }
    },
    /** 修改按钮操作 */
    handleUpdate(ids) {
      this.$router.push({
        path: "/finance/travelexpenseslist/Modifydetails/",
        query: { id: ids }
      });
      // this.$router.push({
      //   path: "/finance/travelexpenseslist/Modifydetails/",
      //   query: { id: ids }
      // });
      this.dialogType = "edit";
      this.reset();
      // this.open = true;
@@ -1203,11 +1245,12 @@
        //获取报销明细信息
        getReimbursementdetaillist(ids).then(res => {
          this.rbDetails = res.data;
          console.log(this.rbDetails);
          if (this.rbDetails.length == 0) {
            this.addDetailRow(0);
          }
          //实时合计金额
          //this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
            //解析出差地址
@@ -1219,9 +1262,6 @@
                qu: this.rbDetails[i].traveltownname,
              }; */
          }
          //实时合计金额
          //this.sumTotalFee();
        });
        //获取报销打款信息
@@ -1246,7 +1286,68 @@
      getReimbursement(id).then(response => {
        this.form = response.data;
        //附件
        //票据
        this.fileListto = this.form.annexfiles
          ? this.form.annexfiles
            .split(",")
            .map(item => ({ url: item, name: item }))
          : [];
        //审核状态
        this.form.recordstatus = response.data.recordstatus + "";
        let ids = response.data.id;
        let listFundflowparams = {
          fundid: ids,
          fundtype: 1
        };
        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 = {
              sheng: this.rbDetails[i].travelprovincename,
              shi: this.rbDetails[i].travelcityname,
              qu: this.rbDetails[i].traveltownname,
            };
          }
          */
          //合计费用
          // if (this.rbDetails.length > 0) this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
          }
        });
        //付款信息
        this.queryParamsPayee.rbid = ids;
        listReimbursementpayee(this.queryParamsPayee).then(res => {
          this.rbPayees = res.rows;
          if (this.rbPayees.length == 0) {
            this.addPayeeRow(0);
          }
        });
      });
    },
    /** 审核按钮操作 */
    handleCheck(ids) {
      this.dialogType = "check";
      this.title = "报销申请详情";
      this.reset();
      this.open = true;
      const id = ids || this.ids;
      this.checkObj.fundid = id;
      getReimbursement(id).then(response => {
        this.form = response.data;
        //票据
        this.fileListto = this.form.annexfiles
          ? this.form.annexfiles
            .split(",")
@@ -1278,9 +1379,13 @@
            };
          }
          */
        });
        if (this.rbDetails.length > 0) this.sumTotalFee();
          //合计费用
          // if (this.rbDetails.length > 0) this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
          }
        });
        //付款信息
        this.queryParamsPayee.rbid = ids;
@@ -1293,10 +1398,36 @@
      });
    },
    //提交审核意见
    checksubmit() {
      let checkfundobj = {
        flowconclusion: this.checkObj.flowlevelone,
        flowcontent: this.checkObj.flowconclusion,
        fundid: this.checkObj.fundid,
      };
      if (
        checkfundobj.flowconclusion == null ||
        checkfundobj.flowconclusion == undefined ||
        checkfundobj.flowconclusion == ""
      ) {
        this.$modal.msgError("请选择审核结论后再提交审批结果!");
        return;
      }
      checkfund(checkfundobj).then((res) => {
        this.reset();
        this.open = false;
        this.getList();
        this.$modal.msgSuccess("提交审核成功!");
      });
    },
    /** 提交保存按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          // idisabled=true;
          /**
           let indexErrTime = this.rbDetails.findIndex((item) => {
             if (item.endtime && item.starttime) {
@@ -1353,7 +1484,7 @@
          }
          */
          //附件文件处理
          //票据文件处理
          let list = this.fileListto;
          console.log(list);
@@ -1405,7 +1536,10 @@
            this.$modal.msgSuccess("修改报销单保存成功!");
            this.open = false;
            this.getList();
                // 关闭窗口
                this.$router.go(-1);
            // this.getList();
            // })
            // .catch(err => {
            //   this.$modal.msgError("修改报销单保存失败!");
@@ -1430,12 +1564,17 @@
                this.$modal.msgSuccess("新增报销单保存成功!");
                this.open = false;
                this.getList();
                // this.getList();
                // 关闭窗口
                this.$router.go(-1);
              })
              .catch(err => {
                this.$modal.msgError("新增报销单保存失败!");
              });
          }
        }
      });
    },
@@ -1854,9 +1993,42 @@
        chineseStr += cnInteger;
      }
      return chineseStr;
    }
    },
    //表格合计
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      var columnnames = ["bankname", "bankcardno", "remark", "personname", "starttime", "endtime", "departure", "destination", "traffictype", "traffictype2", "departure"];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }
        //去除部分字段计算
        if (columnnames.indexOf(column.property) > -1) { return; }
        const values = data.map(item => Number(item[column.property]));
        if (!values.every(value => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index] += '';
        } else {
          sums[index] = '';
        }
      });
      return sums;
    },
  }
};
</script>
<style lang="scss" scoped>
@@ -1900,6 +2072,7 @@
    border: 1px solid #dcdfe6;
    -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
      0 0 6px 0 rgba(0, 0, 0, 0.04);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1); // <- Add this to fix.
  }
  .pdftit {
@@ -1925,5 +2098,13 @@
    width: 60%;
    text-align: center;
  }
}
::v-deep .el-input--medium .el-input__inner {
  height: 36px;
  line-height: 36px;
  text-align: center;
}
</style>