WXL
昨天 f409f83de7f803178715f128f275d77741c3072d
src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -30,7 +30,6 @@
              >
                <el-option
                  v-for="item in personsList"
                  :key="item.reportNo"
                  :label="item.reportName"
                  :value="item.reportName"
                >
@@ -65,7 +64,6 @@
              >
                <el-option
                  v-for="dict in dict.type.sys_travelexpensebelong"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
@@ -81,6 +79,7 @@
              <el-select
                v-model="form.infoid"
                @change="selectbaseinfo"
                @clear="clearDonatorInfo"
                clearable
                filterable
                placeholder="请选择捐献者"
@@ -94,6 +93,14 @@
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <div style="margin-left: 10px;">
              <dict-tag
                :options="dict.type.sys_DonationStatus"
                :value="form.invoicecount"
              />
            </div>
          </el-col>
        </el-row>
        <el-row style="margin-top: 10px">
@@ -145,7 +152,7 @@
            <el-form-item label="出差人" prop="travelers">
              <el-select v-model="form.travelers" clearable filterable allow-create ref="getReportname"
                default-first-option placeholder="请选择" @change="getAccountinfo()">
                <el-option v-for="item in travelers" :key="item.reportNo" :label="item.reportName"
                <el-option v-for="item in travelers"  :label="item.reportName"
                  :value="item.reportName">
                </el-option>
              </el-select>
@@ -329,8 +336,8 @@
                  @focus1="getPersons(scope.row)"
                >
                  <el-option
                    v-for="item in personsSel"
                    :key="item.reportNo"
                    v-for="(item, index) in personsSel"
                    :key="`${item.reportNo}_${index}`"
                    :label="item.reportName"
                    :value="item.reportName"
                  >
@@ -779,8 +786,8 @@
                  @change="getAccountinfo2(scope.row, scope.row.persontype)"
                >
                  <el-option
                    v-for="item in personsSel"
                    :key="item.reportNo"
                    v-for="(item, index) in personsSel"
                    :key="`${item.reportNo}_${index}`"
                    :label="item.reportName"
                    :value="item.reportName"
                  >
@@ -1312,7 +1319,8 @@
    "sys_recordstatus",
    "sys_travelexpensebelong",
    "sys_traffictype",
    "sys_area_name"
    "sys_area_name",
    "sys_DonationStatus"
  ],
  data() {
    return {
@@ -1905,13 +1913,27 @@
        const index = this.getIndexInArray(this.fileListto, row);
        this.fileListto.splice(index, 1);
        console.log(this.rbDetails[this.atpresent].annexfilesList);
        indexvalue = this.rbDetails[this.atpresent].annexfilesList.find(
          (item, index) => {
            return item.name == row.name;
          }
        );
        console.log(indexvalue, "删除索引");
        this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
        // indexvalue = this.rbDetails[this.atpresent].annexfilesList.find(
        //   (item, index) => {
        //     return item.name == row.name;
        //   }
        // );
        // console.log(indexvalue, "删除索引");
        // this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
        const targetIndex = this.rbDetails[
          this.atpresent
        ].annexfilesList.findIndex(item => {
          return item.name === row.name; // 建议使用严格相等 ===
        });
        console.log(targetIndex, "删除索引"); // 现在打印的是索引号,例如 0, 1, 2...
        if (targetIndex > -1) {
          // 确保找到了元素
          this.rbDetails[this.atpresent].annexfilesList.splice(targetIndex, 1);
          console.log("删除成功");
        } else {
          console.log("未找到对应项目,无法删除");
        }
      } else {
        const indexlist = this.getIndexInArray(
          this.invoicepdfimgsrcList,
@@ -1921,13 +1943,23 @@
        const index = this.getIndexInArray(this.invoicefileListto, row);
        this.invoicefileListto.splice(index, 1);
        console.log(this.rbDetails[this.atpresent].invoicefilesList);
        indexvalue = this.rbDetails[this.atpresent].invoicefilesList.find(
          (item, index) => {
            return item.name == row.name;
          }
        );
        console.log(indexvalue, "删除索引");
        this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
        const targetIndex = this.rbDetails[
          this.atpresent
        ].invoicefilesList.findIndex(item => {
          return item.name === row.name; // 建议使用严格相等 ===
        });
        console.log(targetIndex, "删除索引"); // 现在打印的是索引号,例如 0, 1, 2...
        if (targetIndex > -1) {
          // 确保找到了元素
          this.rbDetails[this.atpresent].invoicefilesList.splice(
            targetIndex,
            1
          );
          console.log("删除成功");
        } else {
          console.log("未找到对应项目,无法删除");
        }
      }
    },
    // 点击上移
@@ -2219,10 +2251,22 @@
        if (item.id == this.form.infoid) {
          this.form.donorno = item.donorno;
          this.form.donorname = item.name;
          // 新增:将捐献者的 recordstate 赋值到 invoicecount
          if (item.recordstate !== undefined && item.recordstate !== null) {
            this.form.invoicecount = item.recordstate.toString();
          } else {
            this.form.invoicecount = ""; // 如果 recordstate 为空,清空字段
          }
        }
      });
    },
    // 添加清除方法
    clearDonatorInfo() {
      this.form.donorno = "";
      this.form.donorname = "";
      this.form.invoicecount = ""; // 清空 invoicecount
    },
    onpick(e) {
      // console.log(e,this.value1)
    },
@@ -2629,8 +2673,12 @@
            0
          );
          //校验请款金额合计是否等于报销单金额
          if (this.form.amountrequested != addnumber) {
          // 保留2位小数后进行比较
          const requestedAmount = Number(this.form.amountrequested);
          const calculatedAmount = Number(addnumber);
          // 使用toFixed保留2位小数
          if (requestedAmount.toFixed(2) !== calculatedAmount.toFixed(2)) {
            this.$message({
              message:
                "报销请款表中合计金额不等于报销单的报销金额,请更正后再保存!",