sinake
昨天 c91591e1acb14ce6002cf760255488da092c67b3
src/views/project/unitCost/organfee/index.vue
@@ -8,10 +8,10 @@
      v-show="showSearch"
      label-width="90px"
    >
      <el-form-item label="接收医院" prop="hospitalno">
      <el-form-item label="付款医院" prop="hospitalno">
        <el-select
          v-model="queryParams.hospitalno"
          placeholder="请选择接收医院"
          placeholder="请选择付款医院"
          clearable
          filterable
          size="small"
@@ -34,7 +34,7 @@
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="报告日期">
      <el-form-item label="捐献日期">
        <el-date-picker
          v-model="donatetimeRange"
          type="daterange"
@@ -62,6 +62,17 @@
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          >导出</el-button
        >
      </el-col>
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
@@ -72,7 +83,7 @@
      <el-table-column type="index" label="序号" width="55" align="center" />
      <el-table-column
        prop="donatetime"
        label="报告日期"
        label="捐献日期"
        width="120"
        align="center"
      >
@@ -80,6 +91,12 @@
          <span>{{ parseTime(scope.row.donatetime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
       <el-table-column
        prop="hospitalname"
        label="付款医院"
        width="200"
        align="center"
      />
      <el-table-column
        prop="donorname"
        label="捐献者"
@@ -93,17 +110,20 @@
        align="center"
      />
      <el-table-column
        prop="payOrganName"
        label="付款器官名称"
        width="140"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column
        prop="caseno"
        label="器官分配编号"
        align="center"
        show-overflow-tooltip
      />
      <el-table-column prop="name" label="受体姓氏" width="120" align="center" />
      <el-table-column label="移植日期" width="120" align="center">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.receiveTime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column label="器官状态" width="120" align="center">
        <template slot-scope="scope">
          <span>{{ selectOrganState(scope.row.organState) }}</span>
@@ -115,12 +135,28 @@
        width="120"
        align="center"
      />
      <el-table-column label="付款状态" width="100" align="center">
        <template slot-scope="scope">
          <span>{{ payStatus(scope.row) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="amount"
        label="实收金额"
        width="120"
        align="center"
      />
      <el-table-column label="未付金额" width="160" align="center">
        <template slot-scope="scope">
          <span>{{ formatReceivableDiff(scope.row) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="收款日期" width="120" align="center">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.organtime, "{y}-{m}-{d}") }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="organchargedesc"
        label="备注"
@@ -169,7 +205,14 @@
      append-to-body
      :close-on-click-modal="false"
    >
      <el-form ref="editForm" :model="editForm" label-width="90px">
      <el-form ref="editForm" :model="editForm" label-width="110px">
        <el-form-item label="付款器官名称" prop="payOrganName">
          <el-input
            v-model="editForm.payOrganName"
            maxlength="100"
            placeholder="请输入付款器官名称"
          />
        </el-form-item>
        <el-form-item label="器官状态" prop="organState">
          <el-select
            v-model="editForm.organState"
@@ -208,7 +251,8 @@
<script>
import {
  listDonorchargeorgan,
  updateDonorchargeorgan
  updateDonorchargeorgan,
  exportOrganfee
} from "@/api/project/donorcharge";
import { listOrganization } from "@/api/project/organization";
@@ -218,6 +262,8 @@
    return {
      // 遮罩层
      loading: false,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
@@ -231,18 +277,19 @@
      // 器官状态(对应 service_donorchargeorgan.organ_state)
      organStateList: [
        { value: "1", label: "移植" },
        { value: "2", label: "失功" },
        { value: "2", label: "弃用" },
        { value: "3", label: "库存" },
        { value: "4", label: "已移植" },
        { value: "5", label: "弃用" },
        { value: "6", label: "直系免除" },
        { value: "7", label: "不良事件" }
        { value: "4", label: "失功" },
        { value: "5", label: "直系免除" },
        { value: "6", label: "不良事件" },
        { value: "7", label: "科研" }
      ],
      // 修改弹窗
      editOpen: false,
      editLoading: false,
      editForm: {
        id: null,
        payOrganName: null,
        organState: null,
        organchargedesc: null
      },
@@ -278,6 +325,53 @@
          this.loading = false;
        });
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$modal
        .confirm("是否确认导出器官费用数据?")
        .then(() => {
          this.exportLoading = true;
          return exportOrganfee(queryParams);
        })
        .then(response => {
          this.$download.name(response.msg);
        })
        .catch(() => {})
        .finally(() => {
          this.exportLoading = false;
        });
    },
    /** 应收金额-实收金额的差额(保留两位小数),应收金额为空时返回 null */
    receivableDiff(row) {
      if (
        row.organcharge === null ||
        row.organcharge === undefined ||
        row.organcharge === ""
      ) {
        return null;
      }
      const receivable = Number(row.organcharge);
      if (isNaN(receivable)) {
        return null;
      }
      const received = Number(row.amount);
      const diff = receivable - (isNaN(received) ? 0 : received);
      return Math.round(diff * 100) / 100;
    },
    /** 差额展示文本,固定两位小数 */
    formatReceivableDiff(row) {
      const diff = this.receivableDiff(row);
      return diff === null ? "" : diff.toFixed(2);
    },
    /** 差额为 0 为已付,其它为未付 */
    payStatus(row) {
      const diff = this.receivableDiff(row);
      if (diff === null) {
        return "";
      }
      return diff === 0 ? "已付" : "未付";
    },
    /** 是否未收费:organ_charge_state 为 0 或为空 */
    isUncharged(row) {
      const state = row.organChargeState;
@@ -301,10 +395,11 @@
        })
        .catch(() => {});
    },
    /** 打开修改弹窗(器官状态、备注) */
    /** 打开修改弹窗(付款器官名称、器官状态、备注) */
    handleEdit(row) {
      this.editForm = {
        id: row.id,
        payOrganName: row.payOrganName || "",
        organState:
          row.organState === null || row.organState === undefined
            ? null