yxh
yxh
2023-08-02 648ddd53f3f0cc84d5fba81944b976d51e0c1372
src/views/project/fund/overheadcosts/index.vue
@@ -536,7 +536,7 @@
  data() {
    //这里存放数据
    return {
      currentApplyType: "3",
      currentApplyType: "4",
      // 遮罩层
      loading: true,
      // 导出遮罩层
@@ -801,6 +801,248 @@
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: 0, businesstype: 4, operationtype: "add" }
      });
      this.istrue += 2;
      this.reset();
      this.queryParams.params = {};
      this.form.username = this.defaultperson.nickName;
      this.form.userno = this.defaultperson.userName;
      this.form.deptmentname = this.defaultperson.dept.deptName;
      this.form.deptmentno = this.defaultperson.dept.deptId;
      this.form.managername = this.defaultperson.dept.leader;
      // this.form.createTime = nowdate;
      //this.open = true;
      //this.initFundApplyForm();
      this.fundDetails = [];
      this.addRow();
      this.dialogOpen = true;
      this.title = "添加费用申请";
      this.dialogType = "edit";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: row.id, businesstype: 4, operationtype: "edit" }
      });
      this.isopen = 0;
      this.reset();
      this.queryParams.params = {};
      this.dialogType = "edit";
      this.dialogOpen = true;
      this.title = "修改费用申请";
      const id = row.id || this.ids;
      getFund(id).then((response) => {
        this.form = response.data;
        this.form.name = this.curCase.name;
        //附件处理
        this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
        getownFundDetail(id).then(async (res) => {
          this.fundDetails = res.data;
          for (let m = 0; m < this.fundDetails.length; m++) {
            this.fundDetails[m].itemArr = [];
            this.getItemArr(m, this.fundDetails[m]);
          }
        });
      });
    },
    /** 查看按钮操作 */
    handleDetail(row) {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: row.id, businesstype: 4, operationtype: "detail" }
      });
      this.isopen = 0;
      this.reset();
      this.queryParams.params = {};
      this.form.donorno = this.curCase.donorno;
      this.form.infoid = this.curCase.id;
      this.dialogOpen = true;
      this.title = "查看费用申请";
      this.dialogType = "detail";
      const id = row.id || this.ids;
      getFund(id).then((response) => {
        this.form = response.data;
        this.form.name = this.curCase.name;
        let listFundflowparams = {
          fundid: row.id,
          fundtype: 2,
        };
        //附件处理
        this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
        listFundflow(listFundflowparams).then((res) => {
          this.fundflowList = res.rows;
        });
        getownFundDetail(id).then((res) => {
          this.fundDetails = res.data;
          for (let m = 0; m < this.fundDetails.length; m++) {
            this.fundDetails[m].itemArr = [];
            this.getItemArr(m, this.fundDetails[m]);
            this.fundDetails[m].fundblock = [];
            this.fundDetails[m].fundblock.push({
              expense: this.fundDetails[m].expense,
              expensedescribe: this.fundDetails[m].servicesscopename,
              remark: this.fundDetails[m].servicesscope,
              servicesscope: this.fundDetails[m].servicesscope,
            });
          }
        });
      });
    },
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm("是否确认删除该记录?")
        .then(function () {
          return delFund(ids);
        })
        .then(() => {
          getownFundDetail(ids).then((res) => {
            let listdetails = res.data;
            for (let i = 0; i < listdetails.length; i++) {
              delFunddetail(listdetails[i].id);
            }
          });
          // this.getList();
          this.getfundList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          let formData = this.form;
          for (let k = 0; k < this.fundDetails.length; k++) {
            let tempDetail = this.fundDetails[k];
            if (tempDetail.itemid == null) {
              this.$modal.msgWarning("请选择服务项目");
              return;
            }
            //判断单位 unitSel
            // try {
            //   //获取服务项目明细
            //   let unitIndex = this.bankaccountlist.findIndex(
            //     (item) => tempDetail.unitno == item.reportNo
            //   );
            //   if (unitIndex > -1) {
            //     tempDetail.unitname = this.bankaccountlist[unitIndex].reportName;
            //   } else {
            //     tempDetail.unitname = tempDetail.unitno;
            //   }
            // } catch {
            //   tempDetail.unitname = tempDetail.unitno;
            // }
          }
          try {
            this.form.unitname = this.$refs.orgSelecter.getOptionByValue(
              this.form.unitno
            ).organizationname;
          } catch {
            this.form.treatmenthospitalname = this.form.treatmenthospitalno;
          }
          this.loading = true;
          //附件处理
          let list = this.fileList;
          if (list.length > 0) {
            this.form.annexbankcard = list.map(item => item.url).join(",");
          }
          this.form.donorname = this.curCase.name;
          this.form.pretaxcost = parseFloat(this.form.amountrequested).toFixed(
            2
          );
          if (this.form.id != null) {
            updateFund(this.form).then((response) => {
              this.getfundList();
              this.dialogOpen = false;
              this.getList();
              this.selectDonotor(this.curCase);
              this.$modal.msgSuccess("修改成功");
              this.loading = false;
              for (let m = 0; m < this.fundDetails.length; m++) {
                let tempData = this.fundDetails[m];
                let tempItemArr = tempData.itemArr;
                tempData.fundid = formData.id;
                //获取服务项目明细
                let itemIndex = tempItemArr.findIndex(
                  (item) => tempData.itemid == item.id
                );
                if (itemIndex > -1) {
                  tempData.itemname = tempItemArr[itemIndex].itemName;
                  tempData.itemid = tempItemArr[itemIndex].id;
                }
                if (tempData.id > 0) {
                  updateFunddetail(tempData).then((response2) => { });
                } else {
                  addFunddetail(tempData).then((response2) => { });
                }
              }
            });
          } else {
            //保存费用申请
            for (let m = 0; m < this.fundDetails.length; m++) {
              let tempData = this.fundDetails[m];
              let tempUtemArr = tempData.itemArr;
              //获取服务项目明细
              let itemIndex = tempUtemArr.findIndex(
                (item) => tempData.itemid == item.id
              );
              if (itemIndex > -1) {
                tempData.itemname = tempUtemArr[itemIndex].itemName;
                tempData.itemid = tempUtemArr[itemIndex].id;
              }
              //获取applytypename
              let applytypeIndex = this.fundtypeArr.findIndex(
                (item) => tempData.applytype == item.value
              );
              if (applytypeIndex > -1) {
                tempData.applytypename = this.fundtypeArr[applytypeIndex].label;
              }
              this.fundDetails[m] = tempData;
            }
            this.form.serviceFunddetails = this.fundDetails;
            addorupdateFund(this.form).then((response) => {
              if (response.code === 200) {
                this.$modal.msgSuccess("新增成功");
                this.loading = false;
              } else {
                this.$modal.msgError("新增失败:" + response.msg);
                this.loading = false;
              }
            });
            //关闭窗口
            this.loading = false;
            this.dialogOpen = false;
            this.getList();
          }
        }
      });
    },
    /** 查询捐献人道慰问金列表 */
    getList() {
      this.loading = true;
@@ -827,31 +1069,7 @@
      });
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: 0, pos: 2,routerparam:this.defaultperson }
      });
      this.istrue += 2;
      this.reset();
      this.queryParams.params = {};
      this.form.username = this.defaultperson.nickName;
      this.form.userno = this.defaultperson.userName;
      this.form.deptmentname = this.defaultperson.dept.deptName;
      this.form.deptmentno = this.defaultperson.dept.deptId;
      this.form.managername = this.defaultperson.dept.leader;
      // this.form.createTime = nowdate;
      //this.open = true;
      //this.initFundApplyForm();
      this.fundDetails = [];
      this.addRow();
      this.dialogOpen = true;
      this.title = "添加费用申请";
      this.dialogType = "edit";
    },
    getfundList() {
@@ -988,124 +1206,6 @@
      // });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          let formData = this.form;
          for (let k = 0; k < this.fundDetails.length; k++) {
            let tempDetail = this.fundDetails[k];
            if (tempDetail.itemid == null) {
              this.$modal.msgWarning("请选择服务项目");
              return;
            }
            //判断单位 unitSel
            // try {
            //   //获取服务项目明细
            //   let unitIndex = this.bankaccountlist.findIndex(
            //     (item) => tempDetail.unitno == item.reportNo
            //   );
            //   if (unitIndex > -1) {
            //     tempDetail.unitname = this.bankaccountlist[unitIndex].reportName;
            //   } else {
            //     tempDetail.unitname = tempDetail.unitno;
            //   }
            // } catch {
            //   tempDetail.unitname = tempDetail.unitno;
            // }
          }
          try {
            this.form.unitname = this.$refs.orgSelecter.getOptionByValue(
              this.form.unitno
            ).organizationname;
          } catch {
            this.form.treatmenthospitalname = this.form.treatmenthospitalno;
          }
          this.loading = true;
          //附件处理
          let list = this.fileList;
          if (list.length > 0) {
            this.form.annexbankcard = list.map(item => item.url).join(",");
          }
          this.form.donorname = this.curCase.name;
          this.form.pretaxcost = parseFloat(this.form.amountrequested).toFixed(
            2
          );
          if (this.form.id != null) {
            updateFund(this.form).then((response) => {
              this.getfundList();
              this.dialogOpen = false;
              this.getList();
              this.selectDonotor(this.curCase);
              this.$modal.msgSuccess("修改成功");
              this.loading = false;
              for (let m = 0; m < this.fundDetails.length; m++) {
                let tempData = this.fundDetails[m];
                let tempItemArr = tempData.itemArr;
                tempData.fundid = formData.id;
                //获取服务项目明细
                let itemIndex = tempItemArr.findIndex(
                  (item) => tempData.itemid == item.id
                );
                if (itemIndex > -1) {
                  tempData.itemname = tempItemArr[itemIndex].itemName;
                  tempData.itemid = tempItemArr[itemIndex].id;
                }
                if (tempData.id > 0) {
                  updateFunddetail(tempData).then((response2) => { });
                } else {
                  addFunddetail(tempData).then((response2) => { });
                }
              }
            });
          } else {
            //保存费用申请
            for (let m = 0; m < this.fundDetails.length; m++) {
              let tempData = this.fundDetails[m];
              let tempUtemArr = tempData.itemArr;
              //获取服务项目明细
              let itemIndex = tempUtemArr.findIndex(
                (item) => tempData.itemid == item.id
              );
              if (itemIndex > -1) {
                tempData.itemname = tempUtemArr[itemIndex].itemName;
                tempData.itemid = tempUtemArr[itemIndex].id;
              }
              //获取applytypename
              let applytypeIndex = this.fundtypeArr.findIndex(
                (item) => tempData.applytype == item.value
              );
              if (applytypeIndex > -1) {
                tempData.applytypename = this.fundtypeArr[applytypeIndex].label;
              }
              this.fundDetails[m] = tempData;
            }
            this.form.serviceFunddetails = this.fundDetails;
            addorupdateFund(this.form).then((response) => {
              if (response.code === 200) {
                this.$modal.msgSuccess("新增成功");
                this.loading = false;
              } else {
                this.$modal.msgError("新增失败:" + response.msg);
                this.loading = false;
              }
            });
            //关闭窗口
            this.loading = false;
            this.dialogOpen = false;
            this.getList();
          }
        }
      });
    },
    getBankAccount() {
      //获取银行账号列表,类型是机构
@@ -1121,105 +1221,6 @@
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: row.id, pos: 2 }
      });
      this.isopen = 0;
      this.reset();
      this.queryParams.params = {};
      this.dialogType = "edit";
      this.dialogOpen = true;
      this.title = "修改费用申请";
      const id = row.id || this.ids;
      getFund(id).then((response) => {
        this.form = response.data;
        this.form.name = this.curCase.name;
        //附件处理
        this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
        getownFundDetail(id).then(async (res) => {
          this.fundDetails = res.data;
          for (let m = 0; m < this.fundDetails.length; m++) {
            this.fundDetails[m].itemArr = [];
            this.getItemArr(m, this.fundDetails[m]);
          }
        });
      });
    },
    /** 查看按钮操作 */
    handleDetail(row) {
      this.$router.push({
        path: "/finance/funddetail/",
        query: { id: row.id, pos: 2 }
      });
      this.isopen = 0;
      this.reset();
      this.queryParams.params = {};
      this.form.donorno = this.curCase.donorno;
      this.form.infoid = this.curCase.id;
      this.dialogOpen = true;
      this.title = "查看费用申请";
      this.dialogType = "detail";
      const id = row.id || this.ids;
      getFund(id).then((response) => {
        this.form = response.data;
        this.form.name = this.curCase.name;
        let listFundflowparams = {
          fundid: row.id,
          fundtype: 2,
        };
        //附件处理
        this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
        listFundflow(listFundflowparams).then((res) => {
          this.fundflowList = res.rows;
        });
        getownFundDetail(id).then((res) => {
          this.fundDetails = res.data;
          for (let m = 0; m < this.fundDetails.length; m++) {
            this.fundDetails[m].itemArr = [];
            this.getItemArr(m, this.fundDetails[m]);
            this.fundDetails[m].fundblock = [];
            this.fundDetails[m].fundblock.push({
              expense: this.fundDetails[m].expense,
              expensedescribe: this.fundDetails[m].servicesscopename,
              remark: this.fundDetails[m].servicesscope,
              servicesscope: this.fundDetails[m].servicesscope,
            });
          }
        });
      });
    },
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal
        .confirm("是否确认删除该记录?")
        .then(function () {
          return delFund(ids);
        })
        .then(() => {
          getownFundDetail(ids).then((res) => {
            let listdetails = res.data;
            for (let i = 0; i < listdetails.length; i++) {
              delFunddetail(listdetails[i].id);
            }
          });
          // this.getList();
          this.getfundList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    },
    deleteRows(row, index, rows) {
      this.$confirm("是否确认删除?", "提示", {