| | |
| | | :inline="true" |
| | | label-width="100px" |
| | | > |
| | | <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="firstAssessState"> |
| | | <el-form-item label="评估状态" prop="assessState"> |
| | | <el-select |
| | | v-model="queryParams.firstAssessState" |
| | | v-model="queryParams.assessState" |
| | | placeholder="请选择评估状态" |
| | | clearable |
| | | style="width: 200px" |
| | | > |
| | | <el-option label="待评估" value="0" /> |
| | | <el-option label="评估中" value="1" /> |
| | | <el-option label="已完成" value="2" /> |
| | | <el-option label="已关闭" value="3" /> |
| | | <el-option label="待评估" value="1" /> |
| | | <el-option label="评估中" value="2" /> |
| | | <el-option label="已完成" value="3" /> |
| | | <el-option label="已关闭" value="4" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="申请时间" prop="applyTimeRange"> |
| | | <el-date-picker |
| | | v-model="applyTimeRange" |
| | | v-model="queryParams.applyTimeRange" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | |
| | | style="width: 240px" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="评估时间" prop="assessmentTimeRange"> |
| | | <el-form-item label="评估时间" prop="assessTimeRange"> |
| | | <el-date-picker |
| | | v-model="assessmentTimeRange" |
| | | v-model="queryParams.assessTimeRange" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | |
| | | <el-table-column |
| | | label="潜在捐献者姓名" |
| | | align="center" |
| | | prop="donorName" |
| | | prop="name" |
| | | width="120" |
| | | /> |
| | | <el-table-column label="性别" align="center" prop="gender" width="80"> |
| | | <el-table-column label="性别" align="center" prop="sex" width="80"> |
| | | <template slot-scope="scope"> |
| | | <!-- <dict-tag :options="genderOptions" :value="scope.row.gender" /> --> |
| | | <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="diagnosis" |
| | | prop="diagnosisname" |
| | | min-width="180" |
| | | show-overflow-tooltip |
| | | /> |
| | | <el-table-column |
| | | label="所在医疗机构" |
| | | align="center" |
| | | prop="hospitalName" |
| | | prop="treatmenthospitalname" |
| | | width="150" |
| | | show-overflow-tooltip |
| | | /> |
| | |
| | | <el-table-column |
| | | label="评估时间" |
| | | align="center" |
| | | prop="assessmentTime" |
| | | prop="assessTime" |
| | | width="120" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <span>{{ |
| | | scope.row.assessmentTime |
| | | ? parseTime(scope.row.assessmentTime, "{y}-{m}-{d}") |
| | | scope.row.assessTime |
| | | ? parseTime(scope.row.assessTime, "{y}-{m}-{d}") |
| | | : "-" |
| | | }}</span> |
| | | </template> |
| | |
| | | <el-table-column |
| | | label="评估状态" |
| | | align="center" |
| | | prop="firstAssessState" |
| | | prop="assessState" |
| | | width="100" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="statusFilter(scope.row.firstAssessState)"> |
| | | {{ statusTextFilter(scope.row.firstAssessState) }} |
| | | <el-tag :type="statusFilter(scope.row.assessState)"> |
| | | {{ statusTextFilter(scope.row.assessState) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | prop="coordinatorName" |
| | | width="100" |
| | | /> |
| | | <!-- <el-table-column |
| | | label="评估类型" |
| | | align="center" |
| | | prop="assessmentType" |
| | | width="100" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <dict-tag |
| | | :options="dict.type.assessment_Type" |
| | | :value="parseInt(scope.row.assessmentType)" |
| | | /> |
| | | </template> |
| | | </el-table-column> --> |
| | | <el-table-column |
| | | label="操作" |
| | | align="center" |
| | |
| | | > |
| | | <el-button |
| | | v-if=" |
| | | scope.row.firstAssessState === '0' || |
| | | scope.row.firstAssessState === '1' |
| | | scope.row.assessState === '1' || |
| | | scope.row.assessState === '2' |
| | | " |
| | | size="mini" |
| | | type="text" |
| | |
| | | >评估</el-button |
| | | > |
| | | <el-button |
| | | v-if="scope.row.firstAssessState === '2'" |
| | | v-if="scope.row.assessState === '3'" |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-check" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | // import { listAssessment, delAssessment, exportAssessment } from "@/api/case/assessment"; |
| | | import { |
| | | listAssessment, |
| | | delAssessment, |
| | | exportAssessment |
| | | } from "./mockAssessmentApi"; |
| | | import { evaluateBaseInfolist } from "@/api/businessApi/index"; |
| | | import Pagination from "@/components/Pagination"; |
| | | |
| | | export default { |
| | | name: "AssessmentList", |
| | | components: { Pagination }, |
| | | dicts: ["sys_user_sex", "assessment_Type"], |
| | | dicts: ["sys_user_sex"], |
| | | data() { |
| | | return { |
| | | // 遮罩层 |
| | |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | donorName: undefined, |
| | | name: undefined, |
| | | hospitalName: undefined, |
| | | coordinatorName: undefined, |
| | | firstAssessState: undefined, |
| | | |
| | | }, |
| | | applyTimeRange: [], |
| | | assessmentTimeRange: [], |
| | | // 性别选项 |
| | | genderOptions: [ |
| | | { value: "0", label: "男" }, |
| | | { value: "1", label: "女" } |
| | | ], |
| | | // 评估类型选项 |
| | | assessmentTypeOptions: [ |
| | | { value: "1", label: "初次评估" }, |
| | | { value: "2", label: "最终评估" } |
| | | ] |
| | | assessState: undefined, |
| | | applyTimeRange: [], |
| | | assessTimeRange: [] |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | // 状态过滤器 |
| | | statusFilter(status) { |
| | | const statusMap = { |
| | | "0": "warning", // 待评估 |
| | | "1": "primary", // 评估中 |
| | | "2": "success", // 已完成 |
| | | "3": "danger" // 已关闭 |
| | | "1": "warning", // 待评估 |
| | | "2": "primary", // 评估中 |
| | | "3": "success", // 已完成 |
| | | "4": "danger" // 已关闭 |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }, |
| | | statusTextFilter(status) { |
| | | const statusMap = { |
| | | "0": "待评估", |
| | | "1": "评估中", |
| | | "2": "已完成", |
| | | "3": "已关闭" |
| | | "1": "待评估", |
| | | "2": "评估中", |
| | | "3": "已完成", |
| | | "4": "已关闭" |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | }, |
| | | // 查询评估列表 |
| | | getList() { |
| | | async getList() { |
| | | this.loading = true; |
| | | evaluateBaseInfolist(this.queryParams); |
| | | listAssessment(this.queryParams) |
| | | .then(response => { |
| | | if (response.code === 200) { |
| | | this.assessmentList = response.data.rows; |
| | | this.total = response.data.total; |
| | | } else { |
| | | this.$message.error("获取数据失败"); |
| | | } |
| | | this.loading = false; |
| | | }) |
| | | .catch(error => { |
| | | console.error("获取评估列表失败:", error); |
| | | this.loading = false; |
| | | this.$message.error("获取数据失败"); |
| | | }); |
| | | try { |
| | | // 构建查询参数,映射到接口字段 |
| | | const requestParams = this.buildRequestParams(); |
| | | |
| | | const response = await evaluateBaseInfolist(requestParams); |
| | | |
| | | if (response.code === 200) { |
| | | // 处理接口返回的数据结构 |
| | | this.handleResponseData(response); |
| | | } else { |
| | | this.$message.error("获取数据失败:" + (response.msg || "未知错误")); |
| | | this.assessmentList = []; |
| | | this.total = 0; |
| | | } |
| | | } catch (error) { |
| | | console.error("获取评估列表失败:", error); |
| | | this.$message.error("获取数据失败"); |
| | | this.assessmentList = []; |
| | | this.total = 0; |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | // 构建请求参数 |
| | | buildRequestParams() { |
| | | const params = { |
| | | pageNum: this.queryParams.pageNum, |
| | | pageSize: this.queryParams.pageSize |
| | | }; |
| | | |
| | | // 映射查询条件到接口字段 |
| | | if (this.queryParams.name) { |
| | | params.name = this.queryParams.name; |
| | | } |
| | | if (this.queryParams.hospitalName) { |
| | | params.treatmenthospitalname = this.queryParams.hospitalName; |
| | | } |
| | | if (this.queryParams.coordinatorName) { |
| | | params.coordinatorName = this.queryParams.coordinatorName; |
| | | } |
| | | if (this.queryParams.assessState) { |
| | | params.assessState = this.queryParams.assessState; |
| | | } |
| | | |
| | | // 处理时间范围查询 |
| | | if (this.queryParams.applyTimeRange && this.queryParams.applyTimeRange.length === 2) { |
| | | params.startApplyTime = this.queryParams.applyTimeRange[0]; |
| | | params.endApplyTime = this.queryParams.applyTimeRange[1]; |
| | | } |
| | | |
| | | if (this.queryParams.assessTimeRange && this.queryParams.assessTimeRange.length === 2) { |
| | | params.startAssessTime = this.queryParams.assessTimeRange[0]; |
| | | params.endAssessTime = this.queryParams.assessTimeRange[1]; |
| | | } |
| | | |
| | | return params; |
| | | }, |
| | | // 处理接口响应数据 |
| | | handleResponseData(response) { |
| | | // 根据接口实际返回的数据结构进行调整 |
| | | if (response.data) { |
| | | if (Array.isArray(response.data)) { |
| | | // 如果返回的是数组 |
| | | this.assessmentList = response.data; |
| | | this.total = response.data.length; |
| | | } else if (response.data.rows) { |
| | | // 如果返回的是分页数据结构 |
| | | this.assessmentList = response.data.rows; |
| | | this.total = response.data.total; |
| | | } else if (Array.isArray(response.data.list)) { |
| | | // 如果返回的是list字段 |
| | | this.assessmentList = response.data.list; |
| | | this.total = response.data.total || response.data.list.length; |
| | | } else { |
| | | // 其他数据结构,尝试直接使用data |
| | | this.assessmentList = response.data; |
| | | this.total = response.total || response.data.length; |
| | | } |
| | | } else { |
| | | // 如果data为空,使用根级别的rows或list |
| | | if (Array.isArray(response.rows)) { |
| | | this.assessmentList = response.rows; |
| | | this.total = response.total; |
| | | } else if (Array.isArray(response.list)) { |
| | | this.assessmentList = response.list; |
| | | this.total = response.total; |
| | | } else { |
| | | this.assessmentList = []; |
| | | this.total = 0; |
| | | } |
| | | } |
| | | |
| | | // 确保assessmentList是数组 |
| | | if (!Array.isArray(this.assessmentList)) { |
| | | this.assessmentList = []; |
| | | } |
| | | }, |
| | | // 搜索按钮操作 |
| | | handleQuery() { |
| | |
| | | // 重置按钮操作 |
| | | resetQuery() { |
| | | this.$refs.queryForm.resetFields(); |
| | | this.handleQuery(); |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | // 多选框选中数据 |
| | | handleSelectionChange(selection) { |
| | |
| | | handleRowClick(row) { |
| | | this.$router.push({ |
| | | path: "/case/assessInfo", |
| | | query: { id: row.id } |
| | | query: { id: row.id, infoid: row.infoid } |
| | | }); |
| | | }, |
| | | // 查看详情 |
| | | handleView(row) { |
| | | this.$router.push({ path: "/case/assessInfo", query: { id: row.id } }); |
| | | this.$router.push({ |
| | | path: "/case/assessInfo", |
| | | query: { id: row.id, infoid: row.infoid } |
| | | }); |
| | | }, |
| | | // 进行评估 |
| | | handleAssess(row) { |
| | | this.$router.push({ |
| | | path: "/case/assessInfo", |
| | | query: { id: row.id, assess: true } |
| | | query: { id: row.id, infoid: row.infoid, assess: true } |
| | | }); |
| | | }, |
| | | // 确认评估 |
| | | handleConfirm(row) { |
| | | this.$confirm("确认完成该案例的评估吗?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | // 调用Mock确认API |
| | | this.$message.success("确认成功"); |
| | | // 刷新列表 |
| | | this.getList(); |
| | | }) |
| | | .catch(() => {}); |
| | | async handleConfirm(row) { |
| | | try { |
| | | await this.$confirm("确认完成该案例的评估吗?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }); |
| | | |
| | | // 这里需要调用确认评估接口,暂时模拟成功 |
| | | this.$message.success("确认成功"); |
| | | // 刷新列表 |
| | | this.getList(); |
| | | } catch (error) { |
| | | if (error !== 'cancel') { |
| | | console.error("确认失败:", error); |
| | | } |
| | | } |
| | | }, |
| | | // 新增按钮操作 |
| | | handleCreate() { |
| | |
| | | }, |
| | | // 修改按钮操作 |
| | | handleUpdate() { |
| | | if (this.ids.length === 0) return; |
| | | |
| | | const id = this.ids[0]; |
| | | this.$router.push({ path: "/case/assessment/edit", query: { id: id } }); |
| | | this.$router.push({ |
| | | path: "/case/assessment/edit", |
| | | query: { id: id } |
| | | }); |
| | | }, |
| | | // 删除按钮操作 - 使用Mock API |
| | | handleDelete() { |
| | | const ids = this.ids; |
| | | this.$confirm("是否确认删除选中的数据项?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return delAssessment(ids); |
| | | }) |
| | | .then(response => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功"); |
| | | this.getList(); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | // 导出按钮操作 - 使用Mock API |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$confirm("是否确认导出所有评估数据?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | this.loading = true; |
| | | return exportAssessment(queryParams); |
| | | }) |
| | | .then(response => { |
| | | if (response.code === 200) { |
| | | this.$message.success("导出成功,开始下载文件"); |
| | | // 模拟文件下载 |
| | | const link = document.createElement("a"); |
| | | link.href = response.data.downloadUrl; |
| | | link.download = "案例评估数据.xlsx"; |
| | | link.click(); |
| | | } |
| | | this.loading = false; |
| | | }) |
| | | .catch(() => { |
| | | this.loading = false; |
| | | // 删除按钮操作 |
| | | async handleDelete() { |
| | | if (this.ids.length === 0) return; |
| | | |
| | | try { |
| | | await this.$confirm("是否确认删除选中的数据项?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }); |
| | | |
| | | // 这里需要调用删除接口,暂时模拟成功 |
| | | this.$message.success("删除成功"); |
| | | this.getList(); |
| | | |
| | | } catch (error) { |
| | | if (error !== "cancel") { |
| | | console.error("删除失败:", error); |
| | | this.$message.error("删除失败"); |
| | | } |
| | | } |
| | | }, |
| | | // 导出按钮操作 |
| | | async handleExport() { |
| | | try { |
| | | await this.$confirm("是否确认导出所有评估数据?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }); |
| | | |
| | | this.loading = true; |
| | | |
| | | // 构建导出参数 |
| | | const exportParams = this.buildRequestParams(); |
| | | exportParams.pageSize = 10000; // 导出所有数据 |
| | | |
| | | // 获取导出数据 |
| | | const response = await evaluateBaseInfolist(exportParams); |
| | | |
| | | if (response.code === 200) { |
| | | // 处理导出数据 |
| | | this.exportDataToExcel(response.data); |
| | | this.$message.success("导出成功"); |
| | | } else { |
| | | this.$message.error("导出失败:" + (response.msg || "未知错误")); |
| | | } |
| | | |
| | | } catch (error) { |
| | | if (error !== "cancel") { |
| | | console.error("导出失败:", error); |
| | | this.$message.error("导出失败"); |
| | | } |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | // 导出数据到Excel |
| | | exportDataToExcel(data) { |
| | | // 这里实现导出逻辑,可以使用xlsx等库 |
| | | // 由于是前端导出,这里简单演示 |
| | | console.log("导出数据:", data); |
| | | // 实际项目中需要实现完整的Excel导出功能 |
| | | |
| | | // 模拟文件下载 |
| | | const blob = new Blob([JSON.stringify(data, null, 2)], { |
| | | type: 'application/vnd.ms-excel' |
| | | }); |
| | | const link = document.createElement('a'); |
| | | link.href = URL.createObjectURL(blob); |
| | | link.download = '医学评估数据.xlsx'; |
| | | link.click(); |
| | | }, |
| | | // 时间格式化 |
| | | parseTime(time, pattern) { |
| | | if (!time) return ""; |
| | | // 使用moment.js或简单格式化 |
| | | if (this.$moment) { |
| | | return this.$moment(time).format(pattern || "{y}-{m}-{d} {h}:{i}:{s}"); |
| | | } else { |
| | | // 简单格式化 |
| | | const date = new Date(time); |
| | | return `${date.getFullYear()}-${(date.getMonth() + 1) |
| | | .toString() |
| | | .padStart(2, "0")}-${date |
| | | .getDate() |
| | | .toString() |
| | | .padStart(2, "0")}`; |
| | | const date = new Date(time); |
| | | if (pattern) { |
| | | // 简单的模式匹配 |
| | | if (pattern === "{y}-{m}-{d}") { |
| | | return `${date.getFullYear()}-${(date.getMonth() + 1) |
| | | .toString() |
| | | .padStart(2, "0")}-${date |
| | | .getDate() |
| | | .toString() |
| | | .padStart(2, "0")}`; |
| | | } |
| | | } |
| | | return `${date.getFullYear()}-${(date.getMonth() + 1) |
| | | .toString() |
| | | .padStart(2, "0")}-${date |
| | | .getDate() |
| | | .toString() |
| | | .padStart(2, "0")} ${date |
| | | .getHours() |
| | | .toString() |
| | | .padStart(2, "0")}:${date |
| | | .getMinutes() |
| | | .toString() |
| | | .padStart(2, "0")}:${date |
| | | .getSeconds() |
| | | .toString() |
| | | .padStart(2, "0")}`; |
| | | } |
| | | } |
| | | }; |