:exit branch 'master' of http://git.zhenyangtang.com.cn/ZYT/zyt
This commit is contained in:
gr
2026-10-27 16:53:16 +08:00
367 changed files with 1024 additions and 342 deletions
+25 -8
View File
@@ -84,10 +84,18 @@
<el-icon v-else><ChatDotRound /></el-icon>
</button>
</el-tooltip>
<el-tooltip content="发起通话" placement="top">
<button class="row-icon-btn call" :disabled="webConsultationBlocked" @click="handleCall(row)">
<el-icon><Phone /></el-icon>
</button>
<el-tooltip :content="webConsultationBlocked ? webConsultationMessage : '发起通话'" placement="top">
<span class="row-call-action">
<button
class="row-icon-btn call"
:disabled="webConsultationBlocked"
:aria-label="webConsultationBlocked ? webConsultationMessage : '发起通话'"
@click="handleCall(row)"
>
<el-icon><Phone /></el-icon>
<span v-if="webConsultationBlocked">已停用</span>
</button>
</span>
</el-tooltip>
</div>
</div>
@@ -214,7 +222,7 @@ const DiagnosisEdit = defineAsyncComponent(() => import('@/views/tcm/diagnosis/e
const POLL_MS = 5_000
const PAGE_SIZE = 15
const { webConsultationBlocked, ensureWebConsultationAllowed } = useDoctorWebConsultation()
const { webConsultationBlocked, webConsultationMessage, ensureWebConsultationAllowed } = useDoctorWebConsultation()
interface QueueRow {
id: number
@@ -1010,16 +1018,25 @@ onUnmounted(() => {
font-size: 15px;
padding: 0;
}
.row-icon-btn:hover {
.row-call-action {
display: inline-flex;
}
.row-icon-btn.call:disabled {
width: auto;
gap: 4px;
padding: 0 6px;
font-size: 12px;
}
.row-icon-btn:hover:not(:disabled) {
background: var(--rx-accent-soft);
color: var(--rx-accent-strong);
border-color: var(--rx-accent);
transform: translateY(-1px);
}
.row-icon-btn:active {
.row-icon-btn:active:not(:disabled) {
transform: scale(0.92);
}
.row-icon-btn.notify:hover {
.row-icon-btn.notify:hover:not(:disabled) {
background: #fff7e6;
color: var(--rx-warning);
border-color: var(--rx-warning);
-2
View File
@@ -1,6 +1,5 @@
<template>
<div class="tcm-diagnosis">
<DoctorWebConsultationNotice />
<el-card class="filter-card !border-none" shadow="never">
<!-- 第一行:日期 + 患者搜索 -->
<div class="filter-main">
@@ -768,7 +767,6 @@
</template>
<script setup lang="ts" name="tcmDiagnosis">
import DoctorWebConsultationNotice from '@/components/doctor-web-consultation-notice/index.vue'
import { tcmDiagnosisLists, tcmDiagnosisDelete, tcmDiagnosisAssign, tcmDiagnosisGuahaoLogList, getAssistants, generateMiniProgramQrcode, generateOrderQrcode, getWechatChatRecords, addWechatChatRecord, deleteWechatChatRecord, getWechatExternalContact, fillIdCard, diagnosisReadonlyDetail } from '@/api/tcm'
import { orderCreate } from '@/api/order'
import { cancelAppointment } from '@/api/doctor'
+77 -2
View File
@@ -333,12 +333,87 @@ test('installer requests are public, deduplicated across notices, cached, and re
assert.equal(transport[1].withToken, false)
})
test('the actual reception, diagnosis and both appointment list entries compile with the shared notice', () => {
test('consultation entries retain the shared notice while the patient list compiles without it', () => {
for (const name of ['views/patient/reception/index.vue', 'views/tcm/diagnosis/index.vue', 'views/tcm/appointment/list.vue', 'views/tcm/appointment/list_h5.vue']) {
const { descriptor, errors } = parse(read(name), { filename: name })
assert.deepEqual(errors, [])
const script = compileScript(descriptor, { id: name })
assert.equal(script.bindings.DoctorWebConsultationNotice, 'setup-const')
assert.equal(script.bindings.DoctorWebConsultationNotice, name === 'views/tcm/diagnosis/index.vue' ? undefined : 'setup-const')
assert.deepEqual(compileTemplate({ source: descriptor.template.content, filename: name, id: name, compilerOptions: { bindingMetadata: script.bindings } }).errors, [])
}
})
test('reception makes doctor cutoff visible and blocks calls while preserving administrator and assistant access', async () => {
const { descriptor } = parse(read('views/patient/reception/index.vue'))
const script = compileScript(descriptor, { id: 'reception-cutoff' })
const template = compileTemplate({ source: descriptor.template.content, filename: 'reception.vue', id: 'reception-cutoff', compilerOptions: { bindingMetadata: script.bindings } })
assert.deepEqual(template.errors, [])
const render = moduleFrom(template.code).render
const passthrough = { setup: (_, { slots }) => () => vue.h('div', slots.default?.()) }
const lifecycle = { ...vue, onMounted() {}, onUnmounted() {}, defineAsyncComponent: () => passthrough }
let clock = cutoff - 1
const store = vue.reactive({ userInfo: { ...doctor, web_consultation_policy: schedule }, serverTimeOffsetMs: 0 })
const warnings = [], requests = [], opened = []
const feedback = { msgWarning: message => warnings.push(message) }
const hook = moduleFrom(read('hooks/useDoctorWebConsultation.ts'), name => {
if (name === 'vue') return lifecycle
if (name === '@/stores/modules/user') return { default: () => store }
if (name === '@/api/app') return {}
if (name === '@/utils/feedback') return { default: feedback }
if (name === '@/utils/doctor-web-consultation') return policy
throw new Error(name)
}, { Date: { now: () => clock } })
let onSignature = () => ({})
const state = moduleFrom(script.content, name => {
if (name === 'vue') return lifecycle
if (name === '@/hooks/useDoctorWebConsultation') return hook
if (name === '@/api/patient' || name === '@/api/doctor') return {}
if (name === '@/api/tcm') return { getCallSignature: async params => { requests.push(params); return onSignature() } }
if (name === '@/utils/feedback') return { default: feedback }
if (name === '@/utils/diag-display') return { formatGender: () => '男' }
if (name === '@/utils/diabetes-discovery-display') return {}
if (name === '@element-plus/icons-vue') return Object.fromEntries(['Phone', 'Search', 'ChatDotRound', 'Loading'].map(key => [key, passthrough]))
if (name.endsWith('.vue')) return { default: passthrough }
throw new Error(name)
}, { ref: vue.ref, computed: vue.computed, watch: vue.watch }).default.setup({}, { expose() {} })
const row = { id: 90, patient_id: 50, source_patient_id: 50, diagnosis_id: 70, patient_name: '测试患者', appointment_type: 'video' }
state.queue.value = [row]
state.chatDialogRef.value = { open: value => opened.push(value) }
async function markup() {
const app = vue.createSSRApp({ render: () => render({}, [], {}, vue.proxyRefs(state)) })
app.config.warnHandler = () => {}
for (const name of ['el-input', 'el-icon', 'el-tag', 'el-empty', 'el-dialog', 'el-button']) app.component(name, passthrough)
app.component('el-tooltip', { props: ['content'], setup: (props, { slots }) => () => vue.h('div', { 'data-tooltip': props.content }, slots.default?.()) })
for (const name of ['loading', 'perms']) app.directive(name, { getSSRProps: () => ({}) })
return renderToString(app)
}
assert.match(await markup(), /class="row-icon-btn call" aria-label="发起通话"/)
await state.handleCall(row)
assert.equal(requests.length, 1)
assert.equal(opened.length, 1)
// A signature that returns after the deadline must never open the calling window.
onSignature = () => { clock = cutoff; return {} }
await state.handleCall(row)
assert.equal(requests.length, 2)
assert.equal(opened.length, 1)
const expired = await markup()
assert.match(expired, /class="row-icon-btn call" disabled aria-label="[^"]*桌面应用/)
assert.match(expired, /<span>已停用<\/span>/)
assert.match(expired, /data-tooltip="[^"]*桌面应用/)
assert.doesNotMatch(expired, /class="row-icon-btn notify" disabled/)
await state.handleCall(row)
assert.equal(requests.length, 2)
assert.equal(opened.length, 1)
assert.equal(warnings.length, 2)
for (const identity of [{ root: 1, role_ids: [1] }, { root: 0, role_ids: [2] }]) {
Object.assign(store.userInfo, identity)
assert.match(await markup(), /class="row-icon-btn call" aria-label="发起通话"/)
assert.doesNotMatch(await markup(), /<span>已停用<\/span>/)
await state.handleCall(row)
}
assert.equal(requests.length, 4)
assert.equal(opened.length, 3)
})