11
WXL
2024-08-14 0ac2d43fce4d74f6eea5a51a2e16af4e6a536c7c
src/views/project/unitCost/index.vue
@@ -1,206 +1,85 @@
<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="120px"
    >
      <el-form-item label="付款医院" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="医疗机构" prop="name">
        <el-input v-model="queryParams.name" placeholder="请输入医疗机构" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="收款年度" prop="donationcategory">
        <el-input
          v-model="queryParams.donationcategory"
          placeholder="请输入捐献类别"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
        <el-input v-model="queryParams.donationcategory" placeholder="请输入查询时间" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="收款状态" prop="chargeamount">
        <el-input
          v-model="queryParams.chargeamount"
          placeholder="请输入费用金额"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      <el-form-item label="收款金额" prop="chargeamount">
        <el-input v-model="queryParams.chargeamount" placeholder="请输入收款金额" clearable size="small"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:donorcharge:add']"
          >新增</el-button
        >
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['system:donorcharge:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:donorcharge:edit']"
          >修改</el-button
        >
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['system:donorcharge:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:donorcharge:remove']"
          >删除</el-button
        >
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['system:donorcharge:remove']">删除</el-button>
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table
      v-loading="loading"
      :data="donorchargeList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column
        label="申请时间"
        align="center"
        prop="createTime"
        width="180"
      >
    <el-table v-loading="loading" :data="donorchargeList" @selection-change="handleSelectionChange">
      <el-table-column label="申请时间" align="center" prop="createTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收款单号" align="center" prop="paymentno" />
      <el-table-column
        label="付款医院"
        width="180"
        align="center"
        prop="hospitalname"
      />
      <el-table-column label="申请单号" align="center" prop="paymentno" />
      <el-table-column label="医疗机构" width="180" align="center" prop="hospitalname" />
      <el-table-column label="状态" align="center" prop="paystatus">
      <el-table-column label="付款状态" align="center" prop="paystatus">
        <template slot-scope="scope">
          <dict-tag
            :options="dict.type.sys_gathering"
            :value="scope.row.paystatus"
          />
          <dict-tag :options="dict.type.Collection_status" :value="scope.row.paystatus" />
        </template>
      </el-table-column>
      <el-table-column
        label="应收金额"
        align="center"
        prop="receivableamount"
      />
      <el-table-column label="已收金额" align="center" prop="receivedamount" />
      <el-table-column
        label="收款日期"
        width="180"
        align="center"
        prop="receivedtime"
      />
      <el-table-column label="经办人" align="center" prop="updateBy" />
      <el-table-column label="应收金额" align="center" prop="receivableamount" />
      <el-table-column label="实收金额" align="center" prop="receivedamount" />
      <el-table-column label="收款日期" width="180" align="center" prop="receivedtime"><template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="经办人" align="center" prop="userName" />
      <el-table-column label="操作" width="280" align="center">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:donorcharge:edit']"
            >修改</el-button
          >
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleDetail(scope.row)"
            v-hasPermi="['system:donorcharge:edit']"
            >详情</el-button
          >
          <el-button
            size="mini"
            type="text"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:donorcharge:remove']"
            ><span class="button-delete"
              ><i class="el-icon-delete"></i>删除</span
            ></el-button
          >
          <el-button
            size="mini"
            type="primary"
            @click="download(scope.row)"
            icon="el-icon-download"
            circle
          ></el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['system:donorcharge:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleDetail(scope.row)"
            v-hasPermi="['system:donorcharge:edit']">详情</el-button>
          <el-button size="mini" type="text" @click="handleDelete(scope.row)"
            v-hasPermi="['system:donorcharge:remove']"><span class="button-delete"><i
                class="el-icon-delete"></i>删除</span></el-button>
          <el-button size="mini" type="primary" @click="download(scope.row.id)" icon="el-icon-download"
            circle></el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
    <el-dialog
      :visible.sync="showSelectionDialog"
      :close-on-click-modal="false"
      :title="'请选择捐献案例'"
      width="500px"
      style="text-align: center"
      v-loading="loading"
    >
      <el-form ref="selectionForm" :model="selectionForm">
    <el-dialog :visible.sync="showSelectionDialog" :close-on-click-modal="false" :title="'请选择收款单的医疗机构'" width="500px"
      style="text-align: center" v-loading="loading">
      <el-form ref="selectionForm" :model="selectionForm" label-width="100px">
        <el-row>
          <el-form-item
            align="left"
            label="医疗机构"
            prop="treatmenthospitalno"
          >
            <org-selecter
              ref="addOrgSelect"
              :org-type="'4'"
              v-model="selectionForm.donorid"
            />
          <el-form-item align="left" label="医疗机构:" prop="treatmenthospitalno">
            <org-selecter ref="addOrgSelect" :org-type="'4'" v-model="selectionForm.itemid" />
          </el-form-item>
        </el-row>
      </el-form>
@@ -227,10 +106,11 @@
import { listOrganization } from "@/api/project/organization";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
export default {
  name: "Donorcharge",
  dicts: ["sys_gathering"],
  dicts: ["Collection_status"],
  components: {
    OrgSelecter
  },
@@ -262,8 +142,8 @@
      donorinfolist: [],
      selectionForm: {
        index: null,
        donorid: null,
        donorname: null
        itemid: null,
        itemname: null
      },
      loadingdonorlist: false,
@@ -291,6 +171,9 @@
        pageSize: 10,
        donorchargeid: null
      },
      headers: {
        Authorization: "Bearer " + getToken()
      },
      // 表单参数
      form: {},
      // 表单校验
@@ -305,15 +188,15 @@
    //专家/医疗机构/费用报销机构选择
    confirmSelection() {
      var curdonorinfo = null;
      console.log(this.selectionForm.donorid, "donorid");
      console.log(this.selectionForm.itemid, "itemid");
      //从案例列表获取信息
      this.donorinfolist.map(item => {
        if (this.selectionForm.donorid == item.id) {
        if (this.selectionForm.itemid == item.id) {
          curdonorinfo = item;
        }
      });
      let searchData = {
        organizationid: this.selectionForm.donorid //传入的类型
        organizationid: this.selectionForm.itemid //传入的类型
      }; //搜索条件
      listOrganization(searchData).then(res => {
        if (res.code == 200) {
@@ -382,8 +265,8 @@
    /** 新增按钮操作 */
    handleAdd() {
      this.selectionForm.index = null;
      this.selectionForm.donorid = null;
      this.selectionForm.donorname = null;
      this.selectionForm.itemid = null;
      this.selectionForm.itemname = null;
      if (this.donorlist[0]) {
        this.showSelectionDialog = true;
@@ -402,8 +285,8 @@
            this.donorinfolist.forEach(item1 => {
              this.donorlist.push({
                donorid: item1.id,
                donorname: item1.name
                itemid: item1.id,
                itemname: item1.name
              });
            });
            console.log(this.donorinfolist, " this.donorinfolist");
@@ -431,8 +314,39 @@
      });
    },
    // 打印
    download(row) {
      dyDonorpayment(row.id).then(res => {});
    download(id) {
      // const id =this.row.id
      dyDonorpayment(id).then(res => {
        var fileUrl = res;
        //获取当前网址
        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"];
        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);
          });
      });
    },
    /** 删除按钮操作 */
@@ -440,14 +354,14 @@
      const ids = row.id || this.ids;
      this.$modal
        .confirm('是否确认删除捐献案例器官列编号为"' + ids + '"的数据项?')
        .then(function() {
        .then(function () {
          return delDonorpayment(ids);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => {});
        .catch(() => { });
    },
    /** 导出按钮操作 */
@@ -463,7 +377,7 @@
          this.$download.name(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
        .catch(() => { });
    }
  }
};