<template>
|
<div class="organ-allocation-list">
|
<!-- 查询条件 -->
|
<el-card class="search-card">
|
<el-form
|
:model="queryParams"
|
ref="queryForm"
|
:inline="true"
|
label-width="100px"
|
>
|
<el-form-item label="住院号" prop="inpatientno">
|
<el-input
|
v-model="queryParams.inpatientno"
|
placeholder="请输入住院号"
|
clearable
|
style="width: 200px"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="捐献者姓名" prop="name">
|
<el-input
|
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"
|
/>
|
</el-form-item>
|
<el-form-item label="分配状态" prop="allocationStatus">
|
<el-select
|
v-model="queryParams.allocationStatus"
|
placeholder="请选择分配状态"
|
clearable
|
style="width: 200px"
|
>
|
<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"
|
>搜索</el-button
|
>
|
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
|
<!-- 操作按钮 -->
|
<el-card class="tool-card">
|
<el-row :gutter="10">
|
<el-col :span="16">
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
>新建分配</el-button
|
>
|
<el-button
|
type="success"
|
icon="el-icon-edit"
|
:disabled="single"
|
@click="handleUpdate"
|
>修改</el-button
|
>
|
<!-- <el-button
|
type="danger"
|
icon="el-icon-delete"
|
:disabled="single"
|
@click="handleDelete"
|
>删除</el-button
|
> -->
|
</el-col>
|
<el-col :span="8" style="text-align: right">
|
<el-tooltip content="刷新" placement="top">
|
<el-button icon="el-icon-refresh" circle @click="getList" />
|
</el-tooltip>
|
</el-col>
|
</el-row>
|
</el-card>
|
|
<!-- 数据表格 -->
|
<el-card>
|
<el-table
|
v-loading="loading"
|
:data="organAllocationList"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column
|
label="案例编号"
|
align="center"
|
prop="caseNo"
|
width="120"
|
/>
|
<el-table-column
|
label="捐献者编号"
|
align="center"
|
prop="donorno"
|
width="120"
|
/>
|
<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="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="diagnosisname"
|
min-width="180"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
label="医疗机构"
|
align="center"
|
prop="treatmenthospitalname"
|
min-width="150"
|
show-overflow-tooltip
|
/>
|
<el-table-column
|
label="分配状态"
|
align="center"
|
prop="allocationStatus"
|
width="100"
|
>
|
<template slot-scope="scope">
|
<dict-tag
|
:options="dict.type.allocation_Status"
|
:value="scope.row.allocationStatus"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="分配时间"
|
align="center"
|
prop="allocationTime"
|
width="160"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.allocationTime
|
? parseTime(scope.row.allocationTime, "{y}-{m}-{d} {h}:{i}")
|
: "-"
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="登记人"
|
align="center"
|
prop="registrationName"
|
width="100"
|
/>
|
<el-table-column
|
label="登记时间"
|
align="center"
|
prop="registrationTime"
|
width="160"
|
>
|
<template slot-scope="scope">
|
<span>{{
|
scope.row.registrationTime
|
? parseTime(scope.row.registrationTime, "{y}-{m}-{d} {h}:{i}")
|
: "-"
|
}}</span>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="操作"
|
align="center"
|
width="210"
|
fixed="right"
|
class-name="small-padding fixed-width"
|
>
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-view"
|
@click="handleView(scope.row)"
|
>详情</el-button
|
>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleUpdate(scope.row)"
|
>修改</el-button
|
>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-delete"
|
style="color: #F56C6C"
|
@click="handleDelete(scope.row)"
|
:disabled="scope.row.allocationStatus === '2'"
|
>删除</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"
|
/>
|
</el-card>
|
</div>
|
</template>
|
|
<script>
|
import { allocationList } from "@/api/businessApi";
|
import Pagination from "@/components/Pagination";
|
|
export default {
|
name: "OrganAllocationList",
|
components: { Pagination },
|
dicts: ["sys_user_sex", "allocation_Status"],
|
data() {
|
return {
|
// 遮罩层
|
loading: true,
|
// 选中数组
|
ids: [],
|
// 选中的行数据
|
selectedRows: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 总条数
|
total: 0,
|
// 器官分配表格数据
|
organAllocationList: [],
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
inpatientno: undefined,
|
name: undefined,
|
caseNo: undefined,
|
allocationStatus: undefined,
|
allocationTimeRange: []
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
// 查询器官分配列表
|
getList() {
|
this.loading = true;
|
|
// 处理查询参数
|
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 || [];
|
this.total = response.total || 0;
|
} else {
|
this.$message.error(response.msg || "获取数据失败");
|
}
|
this.loading = false;
|
})
|
.catch(error => {
|
console.error("获取器官分配列表失败:", error);
|
this.loading = false;
|
this.$message.error("获取数据失败");
|
});
|
},
|
// 搜索按钮操作
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
// 重置按钮操作
|
resetQuery() {
|
this.$refs.queryForm.resetFields();
|
this.handleQuery();
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.infoid);
|
this.selectedRows = selection;
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
// 查看详情
|
handleView(row) {
|
this.$router.push({
|
path: "/case/allocationInfo",
|
query: { id: row.id, infoid: row.infoid }
|
});
|
},
|
// 新增按钮操作
|
handleCreate() {
|
this.$router.push("/case/allocationInfo");
|
},
|
// 修改按钮操作
|
handleUpdate(row) {
|
this.$router.push({
|
path: "/case/allocationInfo",
|
query: { id: row.id, infoid: row.infoid }
|
});
|
},
|
// 删除按钮操作
|
handleDelete(row) {
|
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 allocationdelete([selectedRow.infoid]);
|
})
|
.then(response => {
|
if (response.code === 200) {
|
this.$message.success("删除成功");
|
this.getList();
|
} else {
|
this.$message.error(response.msg || "删除失败");
|
}
|
})
|
.catch(() => {});
|
},
|
// 时间格式化
|
parseTime(time, pattern) {
|
if (!time) return "";
|
const format = pattern || "{y}-{m}-{d} {h}:{i}:{s}";
|
let date;
|
if (typeof time === "object") {
|
date = time;
|
} else {
|
if (typeof time === "string" && /^[0-9]+$/.test(time)) {
|
time = parseInt(time);
|
}
|
if (typeof time === "number" && time.toString().length === 10) {
|
time = time * 1000;
|
}
|
date = new Date(time);
|
}
|
const formatObj = {
|
y: date.getFullYear(),
|
m: date.getMonth() + 1,
|
d: date.getDate(),
|
h: date.getHours(),
|
i: date.getMinutes(),
|
s: date.getSeconds(),
|
a: date.getDay()
|
};
|
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
let value = formatObj[key];
|
if (key === "a") {
|
return ["日", "一", "二", "三", "四", "五", "六"][value];
|
}
|
if (result.length > 0 && value < 10) {
|
value = "0" + value;
|
}
|
return value || 0;
|
});
|
return time_str;
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.organ-allocation-list {
|
padding: 20px;
|
}
|
|
.search-card {
|
margin-bottom: 20px;
|
}
|
|
.tool-card {
|
margin-bottom: 20px;
|
}
|
|
.fixed-width .el-button {
|
margin: 0 5px;
|
}
|
</style>
|