WXL
2026-03-19 5aa165156994b1b8a601063fa0a1107d1893ea57
src/views/business/allocation/index.vue
@@ -8,19 +8,28 @@
        :inline="true"
        label-width="100px"
      >
        <el-form-item label="住院号" prop="hospitalNo">
        <el-form-item label="住院号" prop="inpatientno">
          <el-input
            v-model="queryParams.hospitalNo"
            v-model="queryParams.inpatientno"
            placeholder="请输入住院号"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="捐献者姓名" prop="donorName">
        <el-form-item label="捐献者姓名" prop="name">
          <el-input
            v-model="queryParams.donorName"
            v-model="queryParams.name"
            placeholder="请输入捐献者姓名"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="案例编号" prop="caseNo">
          <el-input
            v-model="queryParams.caseNo"
            placeholder="请输入案例编号"
            clearable
            style="width: 200px"
            @keyup.enter.native="handleQuery"
@@ -33,9 +42,25 @@
            clearable
            style="width: 200px"
          >
            <el-option label="已分配" value="allocated" />
            <el-option label="待分配" value="pending" />
            <el-option label="全部" value="" />
            <el-option
              v-for="dict in dict.type.allocation_Status"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item label="分配时间范围" prop="allocationTimeRange">
          <el-date-picker
            v-model="queryParams.allocationTimeRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
            style="width: 240px"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="handleQuery"
@@ -60,13 +85,13 @@
            @click="handleUpdate"
            >修改</el-button
          >
          <el-button
          <!-- <el-button
            type="danger"
            icon="el-icon-delete"
            :disabled="multiple"
            :disabled="single"
            @click="handleDelete"
            >删除</el-button
          >
          > -->
        </el-col>
        <el-col :span="8" style="text-align: right">
          <el-tooltip content="刷新" placement="top">
@@ -85,31 +110,57 @@
      >
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column
          label="住院号"
          label="案例编号"
          align="center"
          prop="hospitalNo"
          prop="caseNo"
          width="120"
        />
        <el-table-column
          label="捐献者姓名"
          label="捐献者编号"
          align="center"
          prop="donorName"
          prop="donorno"
          width="120"
        />
        <el-table-column label="性别" align="center" prop="gender" width="80">
        <el-table-column label="姓名" align="center" prop="name" width="100" />
        <el-table-column
          label="住院号"
          align="center"
          prop="inpatientno"
          width="120"
        />
        <el-table-column label="性别" align="center" prop="sex" width="80">
          <template slot-scope="scope">
            <dict-tag
              :options="dict.type.sys_user_sex"
              :value="parseInt(scope.row.gender)"
              :value="scope.row.sex"
            />
          </template>
        </el-table-column>
        <el-table-column label="年龄" align="center" prop="age" width="80" />
        <el-table-column
          label="血型"
          align="center"
          prop="bloodtype"
          width="80"
        />
        <el-table-column
          label="证件号码"
          align="center"
          prop="idcardno"
          width="180"
        />
        <el-table-column
          label="疾病诊断"
          align="center"
          prop="diagnosis"
          prop="diagnosisname"
          min-width="180"
          show-overflow-tooltip
        />
        <el-table-column
          label="医疗机构"
          align="center"
          prop="treatmenthospitalname"
          min-width="150"
          show-overflow-tooltip
        />
        <el-table-column
@@ -119,9 +170,10 @@
          width="100"
        >
          <template slot-scope="scope">
            <el-tag :type="scope.row.allocationStatus === 'allocated' ? 'success' : 'warning'">
              {{ scope.row.allocationStatus === 'allocated' ? '已分配' : '待分配' }}
            </el-tag>
            <dict-tag
              :options="dict.type.allocation_Status"
              :value="scope.row.allocationStatus"
            />
          </template>
        </el-table-column>
        <el-table-column
@@ -141,7 +193,7 @@
        <el-table-column
          label="登记人"
          align="center"
          prop="registrant"
          prop="registrationName"
          width="100"
        />
        <el-table-column
@@ -162,6 +214,7 @@
          label="操作"
          align="center"
          width="210"
          fixed="right"
          class-name="small-padding fixed-width"
        >
          <template slot-scope="scope">
@@ -185,6 +238,7 @@
              icon="el-icon-delete"
              style="color: #F56C6C"
              @click="handleDelete(scope.row)"
              :disabled="scope.row.allocationStatus === '2'"
              >删除</el-button
            >
          </template>
@@ -204,19 +258,21 @@
</template>
<script>
import { listOrganAllocation, delOrganAllocation } from "./organAllocation";
import { allocationList } from "@/api/businessApi";
import Pagination from "@/components/Pagination";
export default {
  name: "OrganAllocationList",
  components: { Pagination },
  dicts: ["sys_user_sex"],
  dicts: ["sys_user_sex", "allocation_Status"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 选中的行数据
      selectedRows: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
@@ -229,9 +285,11 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        hospitalNo: undefined,
        donorName: undefined,
        allocationStatus: undefined
        inpatientno: undefined,
        name: undefined,
        caseNo: undefined,
        allocationStatus: undefined,
        allocationTimeRange: []
      }
    };
  },
@@ -242,13 +300,33 @@
    // 查询器官分配列表
    getList() {
      this.loading = true;
      listOrganAllocation(this.queryParams)
      // 处理查询参数
      const params = {
        ...this.queryParams
      };
      // 移除分页参数以外的额外参数
      delete params.allocationTimeRange;
      // 如果有时间范围参数
      if (
        this.queryParams.allocationTimeRange &&
        this.queryParams.allocationTimeRange.length === 2
      ) {
        params.allocationTimeStart =
          this.queryParams.allocationTimeRange[0] + " 00:00:00";
        params.allocationTimeEnd =
          this.queryParams.allocationTimeRange[1] + " 23:59:59";
      }
      allocationList(params)
        .then(response => {
          if (response.code === 200) {
            this.organAllocationList = response.data.rows;
            this.total = response.data.total;
            this.organAllocationList = response.data || [];
            this.total = response.total || 0;
          } else {
            this.$message.error("获取数据失败");
            this.$message.error(response.msg || "获取数据失败");
          }
          this.loading = false;
        })
@@ -270,7 +348,8 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id);
      this.ids = selection.map(item => item.infoid);
      this.selectedRows = selection;
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
@@ -278,7 +357,7 @@
    handleView(row) {
      this.$router.push({
        path: "/case/allocationInfo",
        query: { id: row.id }
        query: { id: row.id, infoid: row.infoid }
      });
    },
    // 新增按钮操作
@@ -287,27 +366,34 @@
    },
    // 修改按钮操作
    handleUpdate(row) {
      const id = row.id || this.ids[0];
      this.$router.push({
        path: "/case/allocationInfo",
        query: { id: id }
        query: { id: row.id, infoid: row.infoid }
      });
    },
    // 删除按钮操作
    handleDelete(row) {
      const ids = row.id ? [row.id] : this.ids;
      const selectedRow =
        row || (this.selectedRows.length === 1 ? this.selectedRows[0] : null);
      if (!selectedRow) {
        this.$message.warning("请选择一条记录");
        return;
      }
      this.$confirm("是否确认删除选中的数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return delOrganAllocation(ids);
          // return allocationdelete([selectedRow.infoid]);
        })
        .then(response => {
          if (response.code === 200) {
            this.$message.success("删除成功");
            this.getList();
          } else {
            this.$message.error(response.msg || "删除失败");
          }
        })
        .catch(() => {});