Fix Bug #505: AI修复
This commit is contained in:
116
openhis-ui-vue3/src/views/inpatient/nurse/order-verify/index.vue
Normal file
116
openhis-ui-vue3/src/views/inpatient/nurse/order-verify/index.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<div class="order-verify-container">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>医嘱校对 - 已校对</span>
|
||||
<div class="header-actions">
|
||||
<el-tooltip
|
||||
:content="returnTooltip"
|
||||
placement="top"
|
||||
:disabled="!isReturnDisabled"
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
:disabled="isReturnDisabled"
|
||||
@click="handleBatchReturn"
|
||||
data-cy="batch-return-btn"
|
||||
>
|
||||
退回
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="verifiedOrders"
|
||||
@selection-change="handleSelectionChange"
|
||||
row-key="id"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="drugName" label="药品名称" />
|
||||
<el-table-column prop="execStatus" label="执行状态" />
|
||||
<el-table-column prop="dispenseStatus" label="发药状态" />
|
||||
<el-table-column label="操作" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tooltip
|
||||
:content="row.dispenseStatus === 'DISPENSED' || row.execStatus === 'EXECUTED'
|
||||
? '该药品已由药房发放,请先执行退药处理,不可直接退回'
|
||||
: ''"
|
||||
placement="top"
|
||||
:disabled="!(row.dispenseStatus === 'DISPENSED' || row.execStatus === 'EXECUTED')"
|
||||
>
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
:disabled="row.dispenseStatus === 'DISPENSED' || row.execStatus === 'EXECUTED'"
|
||||
@click="handleSingleReturn(row.id)"
|
||||
:data-cy="`return-btn-${row.id}`"
|
||||
>
|
||||
退回
|
||||
</el-button>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import axios from 'axios'
|
||||
|
||||
const verifiedOrders = ref([])
|
||||
const selectedOrders = ref([])
|
||||
|
||||
const isReturnDisabled = computed(() => {
|
||||
if (selectedOrders.value.length === 0) return true
|
||||
// 只要选中列表中有一条已发药或已执行,批量按钮即置灰
|
||||
return selectedOrders.value.some(
|
||||
(o) => o.dispenseStatus === 'DISPENSED' || o.execStatus === 'EXECUTED'
|
||||
)
|
||||
})
|
||||
|
||||
const returnTooltip = computed(() => {
|
||||
return isReturnDisabled.value ? '该药品已由药房发放,请先执行退药处理,不可直接退回' : ''
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const res = await axios.get('/api/inpatient/orders/verified')
|
||||
verifiedOrders.value = res.data
|
||||
})
|
||||
|
||||
const handleSelectionChange = (selection) => {
|
||||
selectedOrders.value = selection
|
||||
}
|
||||
|
||||
const handleSingleReturn = async (orderId) => {
|
||||
await doReturn([orderId])
|
||||
}
|
||||
|
||||
const handleBatchReturn = async () => {
|
||||
const ids = selectedOrders.value.map((o) => o.id)
|
||||
await doReturn(ids)
|
||||
}
|
||||
|
||||
const doReturn = async (ids) => {
|
||||
try {
|
||||
await axios.post('/api/inpatient/orders/return', ids)
|
||||
ElMessage.success('退回成功')
|
||||
// 刷新列表
|
||||
const res = await axios.get('/api/inpatient/orders/verified')
|
||||
verifiedOrders.value = res.data
|
||||
selectedOrders.value = []
|
||||
} catch (err) {
|
||||
ElMessage.error(err.response?.data?.message || '退回失败')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.order-verify-container { padding: 20px; }
|
||||
.card-header { display: flex; justify-content: space-between; align-items: center; }
|
||||
</style>
|
||||
@@ -58,9 +58,40 @@ describe('Bug #561 Regression', { tags: ['@bug561', '@regression'] }, () => {
|
||||
// 模拟进入医嘱详情页
|
||||
cy.visit('/outpatient/doctor/order/1001')
|
||||
cy.wait('@getOrderDetail')
|
||||
|
||||
// 验证总量单位正确显示为“次”,而非“null”
|
||||
cy.get('[data-cy="order-total-display"]').should('contain', '1 次')
|
||||
cy.get('[data-cy="order-total-display"]').should('not.contain', 'null')
|
||||
cy.get('[data-cy="total-unit-display"]').should('contain', '次')
|
||||
})
|
||||
})
|
||||
|
||||
describe('Bug #505 Regression', { tags: ['@bug505', '@regression'] }, () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('/inpatient/nurse/order-verify')
|
||||
// Mock 已校对列表数据:包含已发药和未发药医嘱
|
||||
cy.intercept('GET', '/api/inpatient/orders/verified', {
|
||||
statusCode: 200,
|
||||
body: [
|
||||
{ id: 1001, drugName: '头孢哌酮钠舒巴坦钠', execStatus: 'EXECUTED', dispenseStatus: 'DISPENSED' },
|
||||
{ id: 1002, drugName: '生理盐水', execStatus: 'UNEXECUTED', dispenseStatus: 'UNDISPENSED' }
|
||||
]
|
||||
}).as('getVerifiedOrders')
|
||||
})
|
||||
|
||||
it('should disable return button and show warning for dispensed orders', () => {
|
||||
cy.wait('@getVerifiedOrders')
|
||||
|
||||
// 验证已发药医嘱:退回按钮置灰,悬停显示提示
|
||||
cy.get('[data-cy="order-row-1001"]').within(() => {
|
||||
cy.get('[data-cy="return-btn"]').should('be.disabled')
|
||||
cy.get('[data-cy="return-btn"]').trigger('mouseenter')
|
||||
cy.get('.el-tooltip__popper').should('contain', '该药品已由药房发放,请先执行退药处理,不可直接退回')
|
||||
})
|
||||
|
||||
// 验证未发药医嘱:退回按钮可用
|
||||
cy.get('[data-cy="order-row-1002"]').within(() => {
|
||||
cy.get('[data-cy="return-btn"]').should('not.be.disabled')
|
||||
})
|
||||
|
||||
// 验证勾选已发药医嘱后,顶部批量退回按钮自动置灰
|
||||
cy.get('[data-cy="order-checkbox-1001"]').click()
|
||||
cy.get('[data-cy="batch-return-btn"]').should('be.disabled')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user