feat(api): 添加医技工作站接口和服务组件

- 新增 techStation 模块 API 接口文件,包含医技执行和退费审批功能
- 实现检查和检验项目的执行确认接口
- 提供退费审批的通过和驳回接口支持
- 添加 VxeTable 兼容层组件,统一表格事件参数格式
- 集成 Vitest 测试配置,设置 jsdom 环境和全局变量
This commit is contained in:
2026-06-05 11:45:32 +08:00
parent 14cb913943
commit 4ebb21915d
3 changed files with 165 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
import request from '@/utils/request'
// ========== 医技执行 ==========
// 查询待执行列表
export function listExecuteOrders(query) {
return request({
url: '/tech-station/execute/list',
method: 'get',
params: query
})
}
// 执行确认(检查)
export function executeExamOrder(applyNo) {
return request({
url: '/tech-station/execute/exam/' + applyNo,
method: 'put'
})
}
// 执行确认(检验)
export function executeLabOrder(applyNo) {
return request({
url: '/tech-station/execute/lab/' + applyNo,
method: 'put'
})
}
// ========== 医技退费审批 ==========
// 查询待退费审批列表
export function listRefundApproveOrders(query) {
return request({
url: '/tech-station/refund-approve/list',
method: 'get',
params: query
})
}
// 退费审批通过(检查)
export function approveExamRefund(applyNo) {
return request({
url: '/tech-station/refund-approve/approve/exam/' + applyNo,
method: 'put'
})
}
// 退费审批驳回(检查)
export function rejectExamRefund(applyNo) {
return request({
url: '/tech-station/refund-approve/reject/exam/' + applyNo,
method: 'put'
})
}
// 退费审批通过(检验)
export function approveLabRefund(applyNo) {
return request({
url: '/tech-station/refund-approve/approve/lab/' + applyNo,
method: 'put'
})
}
// 退费审批驳回(检验)
export function rejectLabRefund(applyNo) {
return request({
url: '/tech-station/refund-approve/reject/lab/' + applyNo,
method: 'put'
})
}

View File

@@ -0,0 +1,76 @@
<script lang="ts">
/**
* VxeTable 兼容层 — 归一化 vxe-table v4 事件参数,匹配 el-table 约定
*
* el-table: @cell-click(row, column, event)
* vxe-table: @cell-click({ row, column, $event, ... })
*
* 归一化规则:
* @cell-click → handler(row, column, $event)
* @current-change → handler(newValue, oldValue)
*/
import { ref, h, defineComponent } from 'vue'
import { VxeTable } from 'vxe-table'
// 需要归一化的事件映射vxe-table params → el-table args
const NORMALIZE_EVENTS: Record<string, (p: any) => any[]> = {
'cell-click': (p) => [p?.row, p?.column, p?.$event],
'current-change': (p) => [p?.newValue ?? p?.row, p?.oldValue],
}
export default defineComponent({
name: 'VxeTableCompat',
inheritAttrs: false,
setup(_props, { attrs, slots, expose }) {
const tableRef = ref<any>(null)
// 构建代理后的事件监听器
const proxiedAttrs: Record<string, any> = {}
for (const [key, value] of Object.entries(attrs)) {
if (key.startsWith('on') && typeof value === 'function') {
// onCellClick → cell-click
const rawEvent = key.slice(2) // CellClick
const eventName = rawEvent
.replace(/([A-Z])/g, '-$1')
.toLowerCase()
.replace(/^-/, '') // cell-click
if (eventName in NORMALIZE_EVENTS) {
proxiedAttrs[key] = (vxeParams: any) => {
const normalizer = NORMALIZE_EVENTS[eventName]
const normalizedArgs = normalizer(vxeParams)
;(value as Function)(...normalizedArgs)
}
} else {
proxiedAttrs[key] = value
}
} else {
proxiedAttrs[key] = value
}
}
expose({
tableRef,
clearCheckboxRow: () => tableRef.value?.clearCheckboxRow(),
clearSelection: () => tableRef.value?.clearCheckboxRow(),
setCurrentRow: (row: any) => tableRef.value?.setCurrentRow(row),
toggleRowExpand: (row: any, expanded?: boolean) =>
tableRef.value?.toggleRowExpand(row, expanded),
toggleRowExpansion: (row: any, expanded?: boolean) =>
tableRef.value?.toggleRowExpand(row, expanded),
getCheckboxRecords: () => tableRef.value?.getCheckboxRecords(),
getSelectionRows: () => tableRef.value?.getCheckboxRecords(),
})
return () => {
return h(
VxeTable,
{ ...proxiedAttrs, ref: tableRef },
slots
)
}
},
})
</script>

View File

@@ -0,0 +1,18 @@
import { defineConfig } from 'vitest/config'
import vue from '@vitejs/plugin-vue'
import path from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'~': path.resolve(__dirname, './'),
'@': path.resolve(__dirname, './src'),
},
},
test: {
globals: true,
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,ts}'],
},
})