11
heimawl
2023-08-10 be47dc22ea72ba989f75419181284dca0021d018
src/views/project/travelexpenseslist/Modifydetails/index.vue
@@ -212,7 +212,13 @@
          <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=""
@@ -607,13 +613,13 @@
              label="操作"
              align="center"
              width="120"
              v-if="dialogType == 'edit'"
            >
              <template slot-scope="scope">
                <el-button
                  type="text"
                  size="mini"
                  @click="addDetailRow(scope.$index)"
                  v-if="dialogType == 'edit'"
                  >新增</el-button
                >
                <el-button
@@ -622,18 +628,17 @@
                  "
                  type="text"
                  size="small"
                  v-if="dialogType == 'edit'"
                  >删除</el-button
                >
                  删除
                </el-button>
                <el-button
                  @click.native.prevent="
                    Filepopup(scope.$index, rbDetails, scope.row)
                  "
                  type="text"
                  size="small"
                  >票据</el-button
                >
                  文件
                </el-button>
              </template>
            </el-table-column>
          </el-table>
@@ -642,7 +647,13 @@
          <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=""
@@ -782,33 +793,19 @@
              label="请款说明"
              align="center"
              fixed
              width="280"
            >
              <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 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 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
              label="操作"
              align="center"
@@ -836,7 +833,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="审核人"
@@ -869,6 +866,26 @@
            />
          </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
@@ -877,7 +894,13 @@
          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>
@@ -928,11 +951,6 @@
        <div v-else class="pdfimgmins">{{ hintitle }}</div>
      </div>
    </el-dialog>
    <!-- <div class="container">
      <pdf :src="iframeurl"></pdf>
    </div> -->
    <!-- <embed :src="iframeurl" type="application/pdf" width="1000" height="800" /> -->
  </div>
</template>
@@ -954,6 +972,7 @@
  updateReimbursement,
  exportReimbursement,
  getdownload,
  checkfund,
  fundSubmit
} from "@/api/project/reimbursement";
import {
@@ -1006,7 +1025,9 @@
      //下拉可以选择人员列表
      personsSel: [],
      // 部门树选项
      deptOptions: undefined,
      //票据文件
      pdftitle: "",
      pdfimg: "",
      pdfVisible: false,
@@ -1014,6 +1035,7 @@
        value: 0,
        label: ""
      },
      hintitle: "选中左侧已上传文件预览查看",
      atpresent: "",
      iframeurl: "",
@@ -1106,19 +1128,34 @@
      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;
@@ -1136,10 +1173,24 @@
      }
    });
    //获取登录者信息
    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: {
@@ -1148,8 +1199,6 @@
    remove(file, fileList) {
      const rbDetails = [...this.rbDetails];
      this.fileListto.splice(this.fileListto.indexOf(file), 1);
      console.log(file);
      console.log(this.fileListto);
      rbDetails[this.atpresent].annexfilesList = this.fileListto;
    },
@@ -1159,29 +1208,22 @@
    //文件上传成功回调
    uploadSccess(response, file, fileList) {
      console.log(response);
      console.log(file);
      console.log(fileList);
      this.rbDetails;
      //获取附件信息位置
      //获取票据信息位置
      if (response.code == 200) {
        this.form.filename = file.raw.name;
        console.log(this.fileList);
        this.$modal.msgSuccess(response.msg);
        this.fileListto.push({ name: file.name, url: response.url });
        console.log(this.fileListto);
        this.rbDetails[this.atpresent].annexfilesList = this.fileListto;
      } else {
        this.$modal.msgError(response.msg);
        console.log(response.msg);
      }
    },
    // 点击文件
    // 点击票据
    Filepopup(index, rows, row) {
      console.log(index, rows, row);
      this.atpresent = index;
      console.log(this.atpresent);
      this.pdfVisible = true;
      if (this.rbDetails[index].annexfilesList) {
        this.fileListto = this.rbDetails[index].annexfilesList;
@@ -1213,14 +1255,6 @@
        this.$modal.msgWarning("当前文件暂不支持预览");
        this.previewpdf = false;
      }
    },
    //获取登录用户信息
    getUsermsg() {
      getUserProfile().then(response => {
        this.defaultperson = response.data;
        this.standardlevel = response.data.standardlevel;
      });
    },
    /** 查询部门下拉树结构 */
@@ -1333,30 +1367,35 @@
    //计算补助
    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) {
@@ -1501,10 +1540,12 @@
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      window.close();
    },
    // 表单重置
    reset() {
      this.fileListto = [];
@@ -1556,6 +1597,7 @@
      this.rbPayees = [];
      this.resetForm("form");
    },
    //
    handup(e) {
      console.log("上报", e);
@@ -1573,7 +1615,7 @@
      // this.queryParams.paprovincecode= this.$refs["residenceSelect" ].getSheng();
      // this.queryParams.patowncode= this.$refs["residenceSelect" ].getQu();
      this.queryParams.pageNum = 1;
      this.getList();
      // this.getList();
    },
    /** 重置按钮操作 */
@@ -1591,11 +1633,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;
@@ -1606,23 +1649,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;
@@ -1648,6 +1682,8 @@
            this.addDetailRow(0);
          }
          //实时合计金额
          //this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
            //解析出差地址
@@ -1659,9 +1695,6 @@
                qu: this.rbDetails[i].traveltownname,
              }; */
          }
          //实时合计金额
          //this.sumTotalFee();
        });
        //获取报销打款信息
@@ -1686,7 +1719,7 @@
      getReimbursement(id).then(response => {
        this.form = response.data;
        //附件
        //票据
        this.fileListto = this.form.annexfiles
          ? this.form.annexfiles
              .split(",")
@@ -1695,7 +1728,6 @@
        //审核状态
        this.form.recordstatus = response.data.recordstatus + "";
        let ids = response.data.id;
        let listFundflowparams = {
          fundid: ids,
@@ -1718,9 +1750,12 @@
            };
          }
          */
          //合计费用
          // if (this.rbDetails.length > 0) this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
          }
        });
        if (this.rbDetails.length > 0) this.sumTotalFee();
        //付款信息
        this.queryParamsPayee.rbid = ids;
@@ -1733,10 +1768,100 @@
      });
    },
    /** 审核按钮操作 */
    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(",")
              .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;
          console.log(this.rbDetails);
          /*
          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);
          }
        });
      });
    },
    //提交审核意见
    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) {
@@ -1793,7 +1918,7 @@
          }
          */
          //附件文件处理
          //票据文件处理
          let list = this.fileListto;
          console.log(list);
@@ -1815,8 +1940,6 @@
          const rbDetails = [...this.rbDetails];
          const rbPayees = [...this.rbPayees];
          console.log(rbDetails);
          console.log(rbPayees);
          if (this.form.id != null) {
            console.log(this.form);
            updateReimbursement(this.form);
@@ -1845,7 +1968,10 @@
            this.$modal.msgSuccess("修改报销单保存成功!");
            this.open = false;
            this.getList();
            // 关闭窗口
            this.$router.go(-1);
            // this.getList();
            // })
            // .catch(err => {
            //   this.$modal.msgError("修改报销单保存失败!");
@@ -1870,7 +1996,9 @@
                this.$modal.msgSuccess("新增报销单保存成功!");
                this.open = false;
                this.getList();
                // 关闭窗口
                this.$router.go(-1);
              })
              .catch(err => {
                this.$modal.msgError("新增报销单保存失败!");
@@ -2294,6 +2422,51 @@
        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;
    }
  }
};
@@ -2302,10 +2475,12 @@
<style lang="scss" scoped>
.Modifydetailscla {
  padding: 10px;
  .boxdiv {
    font-size: 18px;
    padding: 0 30px;
    padding-bottom: 60px;
    .top-text {
      text-align: center;
@@ -2314,19 +2489,23 @@
      margin: 20px 0;
      margin-bottom: 50px;
    }
    .dialog-footer {
      text-align: left;
      margin-top: 10px;
    }
  }
}
.upload-demo {
  text-align: center;
}
.pdfimg {
  display: flex; // text-align: center;
  width: 100%;
  height: 600px;
  .box-pdf {
    width: 200px;
    padding-top: 20px;
@@ -2334,25 +2513,37 @@
    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 {
    width: 200px;
    padding: 20px;
    font-size: 18px;
  }
  .pdftit:hover {
    background: #c0cef7;
  }
  .pdfimgmin {
    width: 60%;
    img {
      width: 100%;
    }
  }
  .pdfimgmins {
    font-size: 28px;
    width: 60%;
    text-align: center;
  }
}
::v-deep .el-input--medium .el-input__inner {
  height: 36px;
  line-height: 36px;
  text-align: center;
}
</style>