yxh
2 天以前 a79d67f8a9a9fa02f9d25f987b9611af965c484f
src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -9,7 +9,7 @@
              <el-date-picker
                style="width: 100%"
                v-model="form.applyTime"
                type="date"
                type="date" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="申请日期"
                :disabled="true"
@@ -369,7 +369,7 @@
                  size="small"
                  style="width: 100%"
                  v-model="scope.row.starttime"
                  type="date"
                  type="date" format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder="开始日期"
                  @blur="getdays(scope.row)"
@@ -401,7 +401,7 @@
                  size="small"
                  style="width: 100%"
                  v-model="scope.row.endtime"
                  type="date"
                  type="date" format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  placeholder="结束日期"
                  @blur="getdays(scope.row)"
@@ -848,7 +848,7 @@
            <!--
            <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"
                <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date" format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="打款日期" :disabled="true">
                </el-date-picker>
              </template>
@@ -1306,6 +1306,7 @@
import { getToken } from "@/utils/auth";
import debounce from "lodash/debounce";
import { moneySum, moneyAdd, moneyRound } from "@/utils/money";
import { checkFileName, checkDetails } from "@/utils/fileNameCheck";
export default {
  components: {
    Treeselect,
@@ -1690,7 +1691,43 @@
    },
    //文件上传成功回调
    /**
     * 2026-10-15:上传时校验附件文件名(业务要求:不合格立即提示且不加入列表)。
     * 规则与后端 AttachmentNameValidator 同口径:必须含中文 / 去掉扩展名后主干 ≤20 字 /
     * 不含空格及 / \ : * ? " < > | # % 等特殊字符。
     */
    checkUploadFileName(file) {
      const raw = file && file.raw ? file.raw.name : file && file.name;
      const r = checkFileName(raw);
      if (!r.ok) {
        this.$modal.msgError(r.msg);
        return false;
      }
      return true;
    },
    /**
     * 2026-10-15:保存前校验整单明细附件文件名(含同一行内重名)。
     * 口径(业务确认):只校验"本次变更"的附件——老单据里已存在的不合规附件名不能把保存卡死
     * (否则老单据改一个金额都存不进去)。后端按 id 读旧记录放行历史附件;前端拿不到"哪些是历史"
     * 的权威信息,因此**仅新增单据**做保存前拦截,编辑老单据时新增的不合规附件由后端二次校验拦下。
     */
    checkDetailFileNames() {
      if (this.form && this.form.id) {
        return true;
      }
      const c = checkDetails(this.rbDetails);
      if (!c.ok) {
        this.$modal.msgError(c.msg);
        return false;
      }
      return true;
    },
    uploadSccess(response, file, fileList) {
      if (!this.checkUploadFileName(file)) {
        return;
      }
      this.rbDetails;
      const config = {
        headers: { Authorization: "Bearer " + this.ICDtoken }
@@ -1711,14 +1748,11 @@
                name: file.name,
                url: URL.createObjectURL(blob)
              });
              // console.log(file.response.url);
              // console.log(file);
              this.pdfimgsrcList.push(file.response.url);
              this.fileListto.push({
                name: file.response.fileName,
                url: file.response.url
              });
              // 2026-10-15:删除这里的第二次 push。原来一次上传会向 fileListto / pdfimgsrcList
              // 各写两条,且第二条的 name 取的是 file.response.fileName(存储路径);而 remove()
              // 会把整个 fileListto 回写到 rbDetails[atpresent].annexfilesList,导致明细附件里
              // 混入路径形态的 name,被附件文件名校验误拦(前端没有"路径形态跳过"豁免),
              // 同时票据列表会多出一行。
              console.log(URL.createObjectURL(blob), "ur转换");
            })
            .catch(error => {
@@ -2693,11 +2727,7 @@
          this.continueOrExit();
        } else {
          this.$modal.closeLoading();
          if (res.msg) {
            this.$modal.msgError("操作失误");
          } else {
            this.$modal.msgError(res.msg);
          }
          this.$modal.msgError(res.msg || "操作失败");
        }
      });
    },
@@ -2764,6 +2794,11 @@
    /** 提交保存按钮 */
    submitForm: debounce(function (data) {
      // 2026-10-15:保存前附件文件名规范校验(仅新增单据;老单据的历史附件由后端按"只校验本次变更"放行)
      if (!this.checkDetailFileNames()) {
        return;
      }
      this.$refs["form"].validate(valid => {
        if (valid) {
          //票据文件处理
@@ -2987,6 +3022,11 @@
    },
    // 接受提醒立刻保存
    Savenow() {
      // 2026-10-15:保存前附件文件名规范校验(仅新增单据;老单据的历史附件由后端按"只校验本次变更"放行)
      if (!this.checkDetailFileNames()) {
        return;
      }
      this.Savereminder = false;
      this.Reminderquantity = 0;
      this.totalquantity = 0;