11
WXL
2024-07-17 21fe2968337eb8eab97adc88750b71c4057e98f8
src/views/project/travelexpenseapply/index.vue
@@ -28,7 +28,7 @@
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="报销日期" prop="createTime">
          <el-form-item label="报销日期" prop="applyTime">
            <el-date-picker
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
@@ -66,6 +66,19 @@
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="捐献者" prop="name">
            <el-input
              v-model="queryParams.donorname"
              placeholder="请输入捐献者姓名"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="4">
@@ -125,10 +138,10 @@
        label="申请时间"
        width="150"
        align="center"
        prop="createTime"
        prop="applyTime"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
          <span>{{ parseTime(scope.row.applyTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
@@ -141,6 +154,19 @@
          <dict-tag
            :options="dict.type.sys_recordstatus"
            :value="scope.row.recordstatus"
          />
        </template>
      </el-table-column>
      <el-table-column
        label="申请材料状态"
        width="140"
        align="center"
        prop="checkstatus"
      >
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_stage_type"
            :value="scope.row.checkstatus"
          />
        </template>
      </el-table-column>
@@ -191,6 +217,7 @@
        label="操作"
        align="center"
        fixed="right"
        width="300"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
@@ -213,7 +240,7 @@
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            icon="el-icon-view"
            @click="handleDetail(scope.row)"
            >查看</el-button
          >
@@ -231,11 +258,26 @@
            v-if="scope.row.recordstatus == -1 || scope.row.recordstatus == 1"
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            >删除</el-button
            ><span class="button-delete"
              ><i class="el-icon-delete"></i>删除</span
            ></el-button
          >
          <!-- v-hasPermi="['project:funddetail:remove']" -->
        </template>
      </el-table-column>
      <el-table-column fixed="right" align="center" width="120" label="功能">
        <template slot-scope="scope">
          <el-button size="mini" v-if="scope.row.uploadStates == 1"
            >线下已报销</el-button
          >
          <el-button
            size="mini"
            type="success"
            v-else-if="scope.row.uploadStates == 0"
            @click="Dooffline('1', scope.row)"
            >线下报销</el-button
          >
        </template>
      </el-table-column>
    </el-table>
@@ -261,10 +303,10 @@
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row
          ><el-col :span="5">
            <el-form-item label="申请日期" prop="createTime">
            <el-form-item label="申请日期" prop="applyTime">
              <el-date-picker
                style="width: 100%"
                v-model="form.createTime"
                v-model="form.applyTime"
                type="date"
                value-format="yyyy-MM-dd HH:mm:ss"
                placeholder="申请日期"
@@ -1232,6 +1274,7 @@
import { getUser, getUserProfile } from "@/api/system/user";
import { treeselect } from "@/api/system/dept";
import { getSubsidy } from "@/api/project/travelcity";
import { addorupdateFund } from "@/api/project/fund";
import { listReportname, listUser } from "@/api/project/organization";
import { getToken } from "@/utils/auth";
export default {
@@ -1248,7 +1291,8 @@
    "sys_recordstatus",
    "sys_travelexpensebelong",
    "sys_traffictype",
    "sys_area_name"
    "sys_area_name",
    "sys_stage_type"
  ],
  data() {
    return {
@@ -1421,6 +1465,17 @@
    handleExceed() {
      this.$message.error(`上传文件数量不能超过 ${5} 个!`);
    },
    Dooffline(a, value) {
      value.uploadStates = 1;
      value.notes = "线下已报销";
      addorupdateFund(value).then(res => {
        if (res.code == 200) {
          this.$modal.msgSuccess("记录成功");
        } else {
          this.$modal.msgError(res.msg);
        }
      });
    },
    //文件上传成功回调
@@ -1713,21 +1768,27 @@
        var aEle = document.createElement("a");
        aEle.href =
          curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
        aEle.click();
        console.log(aEle.href);
        // 添加Authorization头部
        fetch(aEle.href, {
          headers: this.headers
        })
          .then(response => {
            // 将文件下载链接作为blob对象进行下载
            return response.blob();
          })
          .then(blob => {
            const url = window.URL.createObjectURL(new Blob([blob]));
            console.log(url);
            const link = document.createElement("a");
            link.href = url;
            const name = fileUrl["downloadName"];
            link.setAttribute("download", name); // 替换file.pdf为实际的文件名
            document.body.appendChild(link);
            link.click();
            link.parentNode.removeChild(link);
          });
      });
      // downloadconfirmationinfo(id).then((response) => {
      //   var fileUrl = response;
      //   //获取当前网址
      //   var urlBase = process.env.VUE_APP_BASE_API;
      //   var curWWWPath = window.document.location.href;
      //   var pos = curWWWPath.indexOf(window.document.location.pathname);
      //   // 创建a标签
      //   var aEle = document.createElement("a");
      //   aEle.href =
      //     curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"];
      //   aEle.click();
      // });
    },
    /** 查询报销申请列表 */
@@ -2129,6 +2190,7 @@
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      console.log(ids);
      this.$modal
        .confirm("是否确认删除该条记录?")
        .then(function() {
@@ -2545,19 +2607,26 @@
    //明显提示审批退回记录
    rowClassName({ row, column, rowIndex, columnIndex }) {
      //此判断为最后三行
      if (row.backflowlevel == 199) {
        return "addClassva";
      if (row.recordstatus == -1 && row.backflowlevel != null) {
        return "error-row";
      }
      return "";
    }
  }
};
</script>
<!-- <style scoped> -->
<!-- 不可加scoped,会独立样式element访问不到 -->
<style>
<style lang="scss" scoped>
.addClassva {
  /* background: #10aec2; */
  background: #93b5cf !important;
  background: #e8f4ff !important;
  /* color:whitesmoke; */
}
.button-delete {
  color: rgb(236, 69, 69);
}
::v-deep.el-table .error-row {
  background: #fcebeb;
}
</style>