11
WXL
2024-08-14 0ac2d43fce4d74f6eea5a51a2e16af4e6a536c7c
src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -195,7 +195,7 @@
          </el-col>
        </el-row>
                -->
        <!--
        <!--
        <el-row type="flex" :gutter="10" align="right" class="mb8">
          <el-col :span="6">
            <el-button
@@ -541,7 +541,7 @@
              width="120"
            >
              <template slot-scope="scope">
                <el-input
                <el-input
                  v-model="scope.row.foodexpenses"
                  placeholder="伙食费报销"
                  @blur="
@@ -909,6 +909,15 @@
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="算税状态" prop="infoid">
              <el-radio-group v-model="form.istax" align="left">
                <el-radio :label="-1">审核中</el-radio>
                <el-radio :label="0">允许算税</el-radio>
                <el-radio :label="1">已算税</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row
@@ -957,7 +966,7 @@
      :visible.sync="pdfVisible"
      width="60%"
    >
      <div>
      <div style="margin-bottom: 10px;">
        <el-table :data="tableDatatop" style="width: 100%">
          <el-table-column prop="orderno" label="序号"> </el-table-column>
          <el-table-column prop="personname" label="费用人员">
@@ -986,6 +995,13 @@
          </el-table-column>
        </el-table>
      </div>
      <el-alert
        title="新上传文件需在提交保存后才可进行案例关联,否则视为放弃"
        type="error"
        show-icon
        close-text="知道了"
      >
      </el-alert>
      <el-tabs
        style="margin-top: 20px;"
        v-model="activeName"
@@ -1054,7 +1070,7 @@
                  >
                    <template slot-scope="scope">
                      <el-button
                        type="primary"
                        type="danger"
                        size="mini"
                        @click.native.prevent.stop="deletedowfile(scope.row)"
                        >删除</el-button
@@ -1636,7 +1652,7 @@
      this.tableDatatop = [];
      this.fileListto = [];
      this.invoicefileListto = [];
      this.pdfimg = [];
      this.pdfimg = "";
      this.invoicepdfimg = [];
      this.pdfimgsrcList = [];
      this.invoicepdfimgsrcList = [];
@@ -1645,26 +1661,31 @@
      this.pdfVisible = true;
      if (this.rbDetails[index].annexfilesList) {
        this.rbDetails[index].annexfilesList.forEach((value, indexson) => {
          const pdfimg = this.Networkheader + "/prod-api" + value.url;
          fetch(pdfimg, config)
            .then(response => response.blob())
            .then(blob => {
              // 将获取的数据流转换为URL
              this.fileListto.push({
                name: value.name,
                url: URL.createObjectURL(blob)
        const fetchPromises = this.rbDetails[index].annexfilesList.map(
          (value, indexson) => {
            const pdfimg = this.Networkheader + "/prod-api" + value.url;
            return fetch(pdfimg, config)
              .then(response => response.blob())
              .then(blob => {
                return {
                  name: value.name,
                  url: URL.createObjectURL(blob)
                };
              })
              .catch(error => {
                console.error("Error loading image", error);
                return null;
              });
              if (this.fileListto.length == 1) {
                this.pdfimg = URL.createObjectURL(blob);
              }
              this.pdfimgsrcList.push(URL.createObjectURL(blob));
            })
            .catch(error => {
              console.error("Error loading image", error);
              return;
            });
          }
        );
        Promise.all(fetchPromises).then(fileListto => {
          this.fileListto = fileListto.filter(item => item !== null);
          this.pdfimg = this.fileListto[0].url;
          console.log(this.pdfimg, "pdfimg");
          this.pdfimgsrcList = this.fileListto.map(item => item.url);
        });
        this.previewpdf = true;
      } else {
        this.fileListto = [];
@@ -1673,26 +1694,35 @@
      }
      //发票
      if (this.rbDetails[index].invoicefilesList) {
        this.rbDetails[index].invoicefilesList.forEach((value, indexson) => {
          const pdfimg = this.Networkheader + "/prod-api" + value.url;
          fetch(pdfimg, config)
            .then(response => response.blob())
            .then(blob => {
              // 将获取的数据流转换为URL
              this.invoicefileListto.push({
                name: value.name,
                url: URL.createObjectURL(blob)
        const fetchPromises = this.rbDetails[index].invoicefilesList.map(
          (value, indexson) => {
            const pdfimg = this.Networkheader + "/prod-api" + value.url;
            return fetch(pdfimg, config)
              .then(response => response.blob())
              .then(blob => {
                return {
                  name: value.name,
                  url: URL.createObjectURL(blob)
                };
              })
              .catch(error => {
                console.error("Error loading image", error);
                return null;
              });
              if (this.invoicefileListto.length == 1) {
                this.invoicepdfimg = URL.createObjectURL(blob);
              }
              this.invoicepdfimgsrcList.push(URL.createObjectURL(blob));
            })
            .catch(error => {
              console.error("Error loading image", error);
              return;
            });
          }
        );
        Promise.all(fetchPromises).then(invoicefileListto => {
          this.invoicefileListto = invoicefileListto.filter(
            item => item !== null
          );
          this.invoicepdfimg = this.invoicefileListto[0].url;
          console.log(this.invoicepdfimg, "invoicepdfimg");
          this.invoicepdfimgsrcList = this.invoicefileListto.map(
            item => item.url
          );
        });
        this.previewpdf = true;
      } else {
        this.invoicefileListto = [];
@@ -1700,11 +1730,13 @@
        this.pdftitle = "";
      }
      if (this.activeName == 1) {
      if (this.activeName == "common") {
        this.pdftitle = "共" + this.pdfimgsrcList.length + "项";
      } else {
        this.pdftitle = "共" + this.invoicepdfimgsrcList.length + "项";
      }
      console.log(this.fileListto, "this.fileListto");
      console.log(this.rbDetails[index].annexfilesList, "annexfilesList");
    },
    // 点击已上传文件
@@ -1796,10 +1828,36 @@
        const index = this.getIndexInArray(this.fileListto, row);
        const item = this.fileListto.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
        this.fileListto.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
        const indexann = this.rbDetails[
          this.atpresent
        ].annexfilesList.findIndex(item => item.name == row.name);
        const itemann = this.rbDetails[this.atpresent].annexfilesList.splice(
          indexann,
          1
        )[0]; // 移除指定索引处的元素,并保存到item变量中
        this.rbDetails[this.atpresent].annexfilesList.splice(
          indexann - 1,
          0,
          itemann
        ); // 将itemann插入到索引位置的前一位
      } else {
        const index = this.getIndexInArray(this.invoicefileListto, row);
        const item = this.invoicefileListto.splice(index, 1)[0]; // 移除指定索引处的元素,并保存到item变量中
        this.invoicefileListto.splice(index - 1, 0, item); // 将item插入到索引位置的前一位
        const indexinvo = this.rbDetails[
          this.atpresent
        ].invoicefilesList.findIndex(item => item.name == row.name);
        const iteminvo = this.rbDetails[this.atpresent].invoicefilesList.splice(
          indexinvo,
          1
        )[0]; // 移除指定索引处的元素,并保存到item变量中
        this.rbDetails[this.atpresent].invoicefilesList.splice(
          indexinvo - 1,
          0,
          iteminvo
        ); // 将iteminvo插入到索引位置的前一位
      }
    },
@@ -2353,6 +2411,8 @@
      getReimbursement(id).then(response => {
        this.form = response.data;
        console.log(this.form.checkstatus, "checkstatus");
        this.form.checkstatus = this.form.checkstatus.toString();
        //票据
        this.fileListto = this.form.annexfiles
@@ -2434,11 +2494,20 @@
      this.$modal.loading("正在提交审核,请稍候!");
      checkfund(checkfundobj).then(res => {
        this.$modal.closeLoading();
        this.$modal.msgSuccess("提交审核成功!");
        // 关闭窗口
        this.$store.dispatch("tagsView/delView", this.$route);
        this.$router.go(-1);
        if (res.code == 200) {
          this.$modal.closeLoading();
          this.$modal.msgSuccess("提交审核成功!");
          // 关闭窗口
          this.$store.dispatch("tagsView/delView", this.$route);
          this.$router.go(-1);
        } else {
          this.$modal.closeLoading();
          if (res.msg) {
            this.$modal.msgError("操作失误");
          } else {
            this.$modal.msgError(res.msg);
          }
        }
      });
    },
@@ -2464,6 +2533,47 @@
          const rbDetails = [...this.rbDetails];
          const rbPayees = [...this.rbPayees];
          //保存前校验数据
          for (let k = 0; k < rbDetails.length; k++) {
            let tempDetail = rbDetails[k];
            console.log(tempDetail, "tem");
            if (!tempDetail.persontype) {
              this.$modal.msgWarning(
                "明细表中,第" +
                  (k + 1).toString() +
                  "行的人员类别未选择,请先选择人员类别后再提交保存!"
              );
              return;
            }
            if (!tempDetail.personname) {
              this.$modal.msgWarning(
                "明细表中,第" +
                  (k + 1).toString() +
                  "行的费用人员未选择,请选择费用人员后再提交保存!"
              );
              return;
            }
            if (!tempDetail.starttime) {
              this.$modal.msgWarning(
                "明细表中,第" +
                  (k + 1).toString() +
                  "行的开始日期未选择,请选择开始日期后再提交保存!"
              );
              return;
            }
            if (!tempDetail.endtime) {
              this.$modal.msgWarning(
                "明细表中,第" +
                  (k + 1).toString() +
                  "行的结束日期姓名为选择,请选择结束日期后再提交保存!"
              );
              return;
            }
          }
          if (this.form.id != null) {
            console.log(this.form);
            updateReimbursement(this.form);