<template>
|
<ContentWrap>
|
<!-- 搜索工作栏 -->
|
<el-form
|
class="-mb-15px"
|
:model="queryParams"
|
ref="queryFormRef"
|
:inline="true"
|
label-width="80px"
|
>
|
<el-form-item label="项目名称" prop="name">
|
<el-input
|
v-model="queryParams.name"
|
placeholder="请输入检查项目名称"
|
clearable
|
@keyup.enter="handleQuery"
|
class="!w-240px"
|
/>
|
</el-form-item>
|
<el-form-item>
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
<el-button
|
type="primary"
|
plain
|
@click="openForm('create')"
|
v-hasPermi="['ecg:check-type:create']"
|
>
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
</el-button>
|
<el-button
|
type="success"
|
plain
|
@click="handleExport"
|
:loading="exportLoading"
|
v-hasPermi="['ecg:check-type:export']"
|
>
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
</el-button>
|
</el-form-item>
|
</el-form>
|
</ContentWrap>
|
|
<!-- 列表 -->
|
<ContentWrap>
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
<!-- 需求9:不再显示数据库 id;改为显示**可编辑**的「排序序号」(越小越靠前) -->
|
<el-table-column label="排序序号" align="center" prop="sort" width="130px">
|
<template #default="scope">
|
<el-input-number
|
v-model="scope.row.sort"
|
:min="0"
|
:controls="false"
|
size="small"
|
style="width: 100%"
|
@change="handleSortChange(scope.row)"
|
/>
|
</template>
|
</el-table-column>
|
<el-table-column label="项目名称" align="center" prop="name" width="180px"/>
|
<el-table-column label="项目值" align="center" prop="value" />
|
<el-table-column label="候诊人数" align="center" prop="readyNum" />
|
<!-- <el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180px />-->
|
<el-table-column label="需要设备领用" align="center" prop="needDevReady">
|
<template #default="scope">
|
{{scope.row.needDevReady === 0 ? "不需要":"需要"}}
|
</template>
|
</el-table-column>
|
<el-table-column label="叫号列" align="center" prop="callingColumn" />
|
<el-table-column label="显示患者条码" align="center" prop="displayBarcode" />
|
<el-table-column label="需要确费" align="center" prop="expenseRecognition" />
|
<el-table-column label="时段预约人数" align="center" prop="timeslotBookNum" />
|
<el-table-column label="时段预留人数" align="center" prop="timeslotReservedNum" />
|
<el-table-column label="预约注意事项" align="center" prop="notes" />
|
<el-table-column label="序号前缀" align="center" prop="seqPrefix" />
|
<el-table-column label="亲和项目" align="center" prop="affinityCheckTypes" >
|
<template #default="scope">
|
<div v-for="(checkType, subIndex) in scope.row.affinityCheckTypes" :key="subIndex">
|
{{getCheckTypeName(checkType)}}
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" min-width="200px" fixed="right">
|
<template #default="scope">
|
<el-button
|
link
|
type="primary"
|
@click="openQueueSequenceForm(scope.row)"
|
v-hasPermi="['ecg:check-type:update']"
|
>
|
预约时段
|
</el-button>
|
<el-button
|
link
|
type="primary"
|
@click="openForm('update', scope.row.id)"
|
v-hasPermi="['ecg:check-type:update']"
|
>
|
编辑
|
</el-button>
|
<el-button
|
link
|
type="danger"
|
@click="handleDelete(scope.row.id)"
|
v-hasPermi="['ecg:check-type:delete']"
|
>
|
删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<!-- 分页 -->
|
<Pagination
|
:total="total"
|
v-model:page="queryParams.pageNo"
|
v-model:limit="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</ContentWrap>
|
|
<!-- 表单弹窗:添加/修改 -->
|
<CheckTypeForm ref="formRef" @success="getList" />
|
|
<!-- 预约时段维护弹窗:维护该检查项目各时段的取号规则(增/删/改) -->
|
<QueueSequenceForm ref="queueSequenceFormRef" />
|
</template>
|
|
<script setup lang="ts">
|
import {dateFormatter, dateFormatter2} from '@/utils/formatTime'
|
import download from '@/utils/download'
|
import { CheckTypeApi, CheckTypeVO } from '@/api/ecg/checktype'
|
import CheckTypeForm from './CheckTypeForm.vue'
|
import QueueSequenceForm from './QueueSequenceForm.vue'
|
import {useCheckTypeStore} from "@/store/modules/checkType";
|
import {getCheckTypeName} from "../../../utils/checkTypeFormatter";
|
|
/** 检查项目 列表 */
|
defineOptions({ name: 'CheckType' })
|
|
const message = useMessage() // 消息弹窗
|
const { t } = useI18n() // 国际化
|
|
const checkTypeStore = useCheckTypeStore();
|
|
const loading = ref(true) // 列表的加载中
|
const list = ref<CheckTypeVO[]>([]) // 列表的数据
|
const total = ref(0) // 列表的总页数
|
const queryParams = reactive({
|
pageNo: 1,
|
pageSize: 10,
|
name: undefined,
|
value: undefined,
|
readyNum: undefined,
|
createTime: [],
|
needDevReady: undefined,
|
callingColumn: undefined,
|
displayBarcode: undefined,
|
expenseRecognition: undefined,
|
timeslotBookNum: undefined,
|
timeslotReservedNum: undefined,
|
affinityCheckTypes: undefined
|
})
|
const queryFormRef = ref() // 搜索的表单
|
const exportLoading = ref(false) // 导出的加载中
|
|
/** 预约时段维护弹窗 */
|
const queueSequenceFormRef = ref()
|
/** 打开「预约时段」维护弹窗(传入整行,便于显示检查项目名称) */
|
const openQueueSequenceForm = (row: CheckTypeVO) => {
|
queueSequenceFormRef.value.open(row)
|
}
|
|
/**
|
* 需求9:列表内直接修改「排序序号」后保存。
|
*
|
* 仅提交 id 与 sort 两个字段 —— 后端 update 为「按非空字段更新」,
|
* 其余字段传 null 不会被覆盖,避免把整行数据回写造成意外。
|
*/
|
const handleSortChange = async (row: CheckTypeVO) => {
|
try {
|
await CheckTypeApi.updateCheckType({ id: row.id, sort: row.sort } as CheckTypeVO)
|
message.success('排序已更新')
|
await getList() // 重新拉取,使列表顺序按新的 sort 排好
|
} catch {
|
await getList() // 失败时回滚显示
|
}
|
}
|
|
/** 查询列表 */
|
const getList = async () => {
|
loading.value = true
|
try {
|
const data = await CheckTypeApi.getCheckTypePage(queryParams)
|
list.value = data.list
|
total.value = data.total
|
} finally {
|
loading.value = false
|
}
|
}
|
|
/** 搜索按钮操作 */
|
const handleQuery = () => {
|
queryParams.pageNo = 1
|
getList()
|
}
|
|
/** 重置按钮操作 */
|
const resetQuery = () => {
|
queryFormRef.value.resetFields()
|
handleQuery()
|
}
|
|
/** 添加/修改操作 */
|
const formRef = ref()
|
const openForm = (type: string, id?: number) => {
|
formRef.value.open(type, id)
|
}
|
|
/** 删除按钮操作 */
|
const handleDelete = async (id: number) => {
|
try {
|
// 删除的二次确认
|
await message.delConfirm()
|
// 发起删除
|
await CheckTypeApi.deleteCheckType(id)
|
message.success(t('common.delSuccess'))
|
// 刷新列表
|
await getList()
|
} catch {}
|
}
|
|
/** 导出按钮操作 */
|
const handleExport = async () => {
|
try {
|
// 导出的二次确认
|
await message.exportConfirm()
|
// 发起导出
|
exportLoading.value = true
|
const data = await CheckTypeApi.exportCheckType(queryParams)
|
download.excel(data, '检查项目.xls')
|
} catch {
|
} finally {
|
exportLoading.value = false
|
}
|
}
|
|
/** 初始化 **/
|
onMounted(() => {
|
getList()
|
})
|
</script>
|