yxh
6 天以前 531d433ab95e1c5ca48637eca9dc157380f675c0
src/views/project/fund/applyDetail/index.vue
@@ -49,7 +49,7 @@
          </el-col>
          <el-col :span="5" v-if="ismanager == true">
            <el-form-item label="申请金额" prop="pretaxcost">
              <el-input v-model="form.pretaxcost" placeholder="税前金额合计" :disabled="true" />
              <el-input :value="formatMoneyValue(form.pretaxcost)" class="money-input" placeholder="税前金额合计" :disabled="true" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
@@ -124,7 +124,7 @@
        </el-row>
        <el-row>
          <el-table :data="rbDetails" v-loading="loading" max-height="800" border highlight-current-row>
            <el-table-column prop="orderno" align="center" label="序号" width="88">
            <el-table-column prop="orderno" align="center" label="序号" width="75">
              <template slot-scope="scope">
                <el-input v-model="scope.row.orderno" placeholder="序号" />
              </template>
@@ -155,7 +155,7 @@
                </el-select>
              </template>
            </el-table-column>
            <el-table-column prop="price" align="center" label="单价" width="120" v-if="businessType == 4">
            <el-table-column prop="price" align="right" header-align="right" label="单价" width="120" v-if="businessType == 4" class-name="money-column" :formatter="formatMoney">
              <template slot-scope="scope">
                <el-input v-model="scope.row.price" placeholder="单价" @blur="
                  val => {
@@ -173,23 +173,29 @@
                " />
              </template>
            </el-table-column>
            <el-table-column prop="amount" align="center" :label="amountlabel" width="120">
            <el-table-column prop="amount" align="right" header-align="right" class-name="money-column" :label="amountlabel" width="120" :formatter="formatMoney">
              <template slot-scope="scope">
                <el-input v-model="scope.row.amount" placeholder="金额" />
                <el-input v-model="scope.row.amount" class="money-input" placeholder="金额" @blur="normalizeMoney(scope.row, 'amount')" />
              </template>
            </el-table-column>
            <el-table-column prop="taxamount" align="center" label="劳务个税" width="120" v-if="
            <el-table-column prop="vatAmount" align="right" header-align="right" class-name="money-column" label="增值税" width="110" :formatter="formatMoney"
              v-if="businessType == '1'" />
            <el-table-column prop="cityTaxAmount" align="right" header-align="right" class-name="money-column" label="城建税" width="110" :formatter="formatMoney"
              v-if="businessType == '1'" />
            <el-table-column prop="laborPretaxAmount" align="right" header-align="right" class-name="money-column" label="劳务税前" width="120" :formatter="formatMoney"
              v-if="businessType == '1'" />
            <el-table-column prop="taxamount" align="right" header-align="right" class-name="money-column" label="劳务个税" width="120" v-if="
              ismanager == true &&
              (businessType == '1' || businessType == '2')
            ">
            " :formatter="formatMoney">
              <template slot-scope="scope">
                <el-input v-model="scope.row.taxamount" placeholder="劳务个税" />
                <el-input v-model="scope.row.taxamount" class="money-input" placeholder="劳务个税" @blur="normalizeMoney(scope.row, 'taxamount')" />
              </template>
            </el-table-column>
            <el-table-column prop="taxedamount" align="center" label="劳务税后" width="120"
              v-if="businessType == '1' || businessType == '2'">
            <el-table-column prop="taxedamount" align="right" header-align="right" class-name="money-column" label="劳务税后" width="120"
              v-if="businessType == '1' || businessType == '2'" :formatter="formatMoney">
              <template slot-scope="scope">
                <el-input v-model="scope.row.taxedamount" placeholder="劳务税后" />
                <el-input v-model="scope.row.taxedamount" class="money-input" placeholder="劳务税后" @blur="normalizeMoney(scope.row, 'taxedamount')" />
              </template>
            </el-table-column>
            <el-table-column prop="beneficiaryname" column-key="sdad" align="center" :label="beneficiarylabel"
@@ -283,7 +289,7 @@
              <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto"
                :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                  uploadSccess(response, file, fileList)
                  " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError"
                  " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck"
                :on-remove="remove" accept="image/*,.pdf">
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">
@@ -291,7 +297,14 @@
                  <em><el-button :disabled="operationType == 'detail'" size="small" type="primary">点击上传</el-button></em>
                </div>
              </el-upload>
              <el-table :data="fileListto" @row-click="downFile" style="width: 100%" height="400">
              <div
                v-if="operationType == 'detail'"
                class="upload-disabled-tip"
              >
                <i class="el-icon-warning-outline" />
                当前为查看模式,不能上传附件
              </div>
              <el-table ref="annexTable" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400">
                <el-table-column prop="name" :show-overflow-tooltip="true" label="名称">
                  <template slot-scope="scope">
                    <i style="color:#409EFF" class=" el-icon-s-order" />{{
@@ -536,13 +549,13 @@
      />
      <div style="margin-bottom: 10px;">
        <el-table :data="tableDatatop" style="width: 100%">
          <el-table-column v-if="businessType == 4" prop="price" align="center" label="单价">
          <el-table-column v-if="businessType == 4" prop="price" align="right" header-align="right" class-name="money-column" label="单价" :formatter="formatMoney">
          </el-table-column>
          <el-table-column prop="quantity" align="center" label="数量" v-if="businessType == 4">
          </el-table-column>
          <el-table-column prop="amount" align="center" :label="amountlabel">
          <el-table-column prop="amount" align="right" header-align="right" class-name="money-column" :label="amountlabel" :formatter="formatMoney">
          </el-table-column>
          <el-table-column prop="taxedamount" align="center" label="劳务税后" v-if="
          <el-table-column prop="taxedamount" align="right" header-align="right" class-name="money-column" label="劳务税后" :formatter="formatMoney" v-if="
            (this.ismanager == true) &
            (form.applytype == '1' || form.applytype == '2')
          ">
@@ -587,7 +600,7 @@
                <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto"
                  :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                    uploadSccess(response, file, fileList)
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError"
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck"
                  :on-remove="remove" accept="image/*,.pdf">
                  <i class="el-icon-upload"></i>
                  <div class="el-upload__text">
@@ -596,7 +609,14 @@
                        type="primary">点击上传</el-button></em>
                  </div>
                </el-upload>
                <el-table :data="fileListto" @row-click="downFile" style="width: 100%" height="400">
              <div
                v-if="operationType == 'detail'"
                class="upload-disabled-tip"
              >
                <i class="el-icon-warning-outline" />
                当前为查看模式,不能上传附件
              </div>
                <el-table ref="annexTable2" :data="fileListto" :row-class-name="annexRowClass" @row-click="downFile" style="width: 100%" height="400">
                  <el-table-column prop="name" :show-overflow-tooltip="true" label="名称">
                    <template slot-scope="scope">
                      <i style="color:#409EFF" class=" el-icon-s-order" />
@@ -628,7 +648,7 @@
                <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="invoicefileList"
                  :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                    uploadSccess(response, file, fileList)
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError"
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError" :before-upload="beforeUploadCheck"
                  :on-remove="remove" accept="image/*,.pdf">
                  <i class="el-icon-upload"></i>
                  <div class="el-upload__text">
@@ -637,7 +657,14 @@
                        type="primary">点击上传</el-button></em>
                  </div>
                </el-upload>
                <el-table :data="invoicefileListto" @row-click="downFile" style="width: 100%" height="400">
              <div
                v-if="operationType == 'detail'"
                class="upload-disabled-tip"
              >
                <i class="el-icon-warning-outline" />
                当前为查看模式,不能上传附件
              </div>
                <el-table ref="invoiceTable" :data="invoicefileListto" :row-class-name="invoiceRowClass" @row-click="downFile" style="width: 100%" height="400">
                  <el-table-column prop="name" :show-overflow-tooltip="true" label="名称">
                    <template slot-scope="scope">
                      <i style="color:#409EFF" class=" el-icon-s-order" />
@@ -1112,6 +1139,9 @@
      fileListto: [],
      invoicefileList: [],
      invoicefileListto: [],
      // 2026-11-10:新上传附件行高亮用(附件 / 发票)
      flashAnnexName: "",
      flashInvoiceName: "",
      invoicepdfimg: "",
      invoicepdfimgsrcList: [],
      invoDatatop: [],
@@ -2950,7 +2980,97 @@
    invoicehandleViewerClose() {
      this.invoiceviewerVisible = false;
    },
    handleUploadError() { },
    /**
     * 2026-11-10:上传前置校验(before-upload)
     * 原实现把文件名校验放在 on-success,文件**已经传到服务器**才判断,
     * 不合格就直接丢弃 → 服务器留垃圾文件、界面只闪一下提示,用户感觉"没反应"。
     * 这里前移到上传前,不合格直接不发请求。
     * @returns {boolean} false 阻止上传
     */
    beforeUploadCheck(file) {
      if (this.operationType === "detail") {
        this.$modal.msgError("当前为查看模式,不能上传附件");
        return false;
      }
      return this.checkUploadFileName(file);
    },
    /**
     * 2026-11-10:上传结果异常时的统一提示
     * 后端 /common/upload 出错时返回 HTTP 200 + code 500/401,el-upload 会走 on-success,
     * 必须在这里给出明确提示,否则用户看不到任何反馈。
     */
    notifyUploadFail(response) {
      const code = response && response.code;
      const msg = (response && response.msg) || "未知错误";
      if (code === 401 || code === 403) {
        this.$modal.msgError("登录已过期,请重新登录后再上传附件");
        return;
      }
      this.$modal.msgError("上传失败:" + msg);
    },
    /**
     * 2026-11-10:上传失败(HTTP 非 2xx / 断网 / 被网关拦截等)
     * 原实现是空函数 `handleUploadError() { }`,失败时完全没有提示。
     */
    handleUploadError(err, file, fileList) {
      const status = err && err.status;
      const fileName = (file && file.name) || "文件";
      if (status === 401 || status === 403) {
        this.$modal.msgError("登录已过期,请重新登录后再上传附件");
        return;
      }
      let msg = "上传失败";
      if (status) {
        msg += ":HTTP " + status + "(可能是文件过大或网络异常)";
      } else if (err && err.message) {
        msg += ":" + err.message;
      }
      this.$modal.msgError(msg + ",文件:" + fileName);
    },
    /** 新上传行高亮:附件表 */
    annexRowClass({ row }) {
      return row && row.name === this.flashAnnexName ? "row-flash" : "";
    },
    /** 新上传行高亮:发票表 */
    invoiceRowClass({ row }) {
      return row && row.name === this.flashInvoiceName ? "row-flash" : "";
    },
    /**
     * 2026-11-10:新上传附件定位 —— 高亮 + 滚动到表格底部
     * @param {string} refName 表格 ref
     * @param {string} name 文件名(用于 row-class-name 匹配)
     * @param {string} kind annex | invoice
     */
    flashTable(refName, name, kind) {
      if (kind === "annex") {
        this.flashAnnexName = name;
      } else {
        this.flashInvoiceName = name;
      }
      this.$nextTick(() => {
        const table = this.$refs[refName];
        const wrap =
          table && table.$el
            ? table.$el.querySelector(".el-table__body-wrapper")
            : null;
        if (wrap) {
          wrap.scrollTop = wrap.scrollHeight;
        }
      });
      setTimeout(() => {
        if (kind === "annex") {
          this.flashAnnexName = "";
        } else {
          this.flashInvoiceName = "";
        }
      }, 2000);
    },
    remove(file, fileList) {
      const rbDetails = [...this.rbDetails];
      if (this.activeName == "common") {
@@ -3036,8 +3156,12 @@
            url: response.fileName
          });
          this.pdftitle = "共" + this.pdfimgsrcList.length + "项";
          // 2026-11-10:新行高亮并滚动到可见位置,避免"看不出有反应"
          this.flashTable("annexTable", file.name, "annex");
          this.flashTable("annexTable2", file.name, "annex");
        } else {
          console.log(response.msg);
          // 2026-11-10:后端返回 HTTP 200 + 非 200 业务码时,原来只 console.log,界面无提示
          this.notifyUploadFail(response);
        }
      } else {
        if (response.code == 200) {
@@ -3067,6 +3191,11 @@
            url: response.fileName
          });
          this.pdftitle = "共" + this.invoicepdfimgsrcList.length + "项";
          // 2026-11-10:新行高亮并滚动到可见位置
          this.flashTable("invoiceTable", file.name, "invoice");
        } else {
          // 2026-11-10:原来该分支没有 else,失败时完全无提示
          this.notifyUploadFail(response);
        }
      }
    },
@@ -3628,6 +3757,19 @@
  text-align: center;
}
/* 2026-11-10:查看模式下上传区的说明 + 新上传行高亮 */
.upload-disabled-tip {
  margin-top: 6px;
  font-size: 13px;
  color: #e6a23c;
  text-align: center;
}
::v-deep .el-table .row-flash td {
  background-color: #e7f1f4 !important;
  transition: background-color 0.3s ease;
}
.pdfimg {
  display: flex; // text-align: center;
  width: 100%;