转诊方优化
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled

This commit is contained in:
李琦
2026-02-07 11:12:43 +08:00
parent 99ea152081
commit dc9e629b31
8 changed files with 641 additions and 0 deletions

View File

@@ -297,6 +297,24 @@ const emit = defineEmits(['import-success']);
<div class="info-value">{{ transferInfo.transfer_reason }}</div>
</div>
</div>
<!-- 咨询问题和答案 -->
<div v-if="transferInfo.questions && transferInfo.questions.length > 0" class="questions-section">
<div class="section-title">
<i class="fas fa-question-circle"></i>
<span>咨询问题</span>
</div>
<div v-for="(qa, index) in transferInfo.questions" :key="index" class="question-item">
<div class="question-text">
<span class="question-number">{{ index + 1 }}.</span>
<span>{{ qa.question }}</span>
</div>
<div class="answer-text" :class="qa.answer === '是' ? 'answer-yes' : 'answer-no'">
<i :class="qa.answer === '是' ? 'fas fa-check-circle' : 'fas fa-times-circle'"></i>
<span>{{ qa.answer }}</span>
</div>
</div>
</div>
</div>
<!-- 卡片底部操作 -->
@@ -478,4 +496,96 @@ const emit = defineEmits(['import-success']);
background: #0f172a;
border-color: #334155;
}
/* 咨询问题区域 */
.questions-section {
margin-top: 16px;
padding: 16px;
background: #f8fafc;
border-radius: 12px;
border: 1px solid #e2e8f0;
}
.section-title {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 600;
color: #1e293b;
margin-bottom: 12px;
}
.section-title i {
color: #0A84FF;
font-size: 16px;
}
.question-item {
background: white;
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 12px;
border: 1px solid #e2e8f0;
}
.question-item:last-child {
margin-bottom: 0;
}
.question-text {
font-size: 14px;
color: #334155;
line-height: 1.6;
margin-bottom: 8px;
}
.question-number {
font-weight: 600;
color: #0A84FF;
margin-right: 4px;
}
.answer-text {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 500;
padding: 6px 12px;
border-radius: 6px;
width: fit-content;
}
.answer-yes {
background: #dcfce7;
color: #16a34a;
}
.answer-yes i {
color: #16a34a;
}
.answer-no {
background: #fee2e2;
color: #dc2626;
}
.answer-no i {
color: #dc2626;
}
.dark .questions-section {
background: #1e293b;
border-color: #334155;
}
.dark .question-item {
background: #0f172a;
border-color: #334155;
}
.dark .section-title {
color: #e2e8f0;
}
</style>

View File

@@ -273,6 +273,24 @@ const handleImportToPrescription = async () => {
<div class="info-label">转诊时间</div>
<div class="info-value">{{ transferInfo.transfer_time }}</div>
</div>
<!-- 咨询问题和答案 -->
<div v-if="transferInfo.questions && transferInfo.questions.length > 0" class="questions-section">
<div class="section-title">
<i class="fas fa-question-circle"></i>
<span>咨询问题</span>
</div>
<div v-for="(qa, index) in transferInfo.questions" :key="index" class="question-item">
<div class="question-text">
<span class="question-number">{{ index + 1 }}.</span>
<span>{{ qa.question }}</span>
</div>
<div class="answer-text" :class="qa.answer === '是' ? 'answer-yes' : 'answer-no'">
<i :class="qa.answer === '是' ? 'fas fa-check-circle' : 'fas fa-times-circle'"></i>
<span>{{ qa.answer }}</span>
</div>
</div>
</div>
</div>
<!-- 卡片底部操作 -->
@@ -439,4 +457,96 @@ const handleImportToPrescription = async () => {
.dark .transfer-prescription-message-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
/* 咨询问题区域 */
.questions-section {
margin-top: 16px;
padding: 12px;
background: #f8fafc;
border-radius: 8px;
border: 1px solid #e2e8f0;
}
.section-title {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 600;
color: #1e293b;
margin-bottom: 10px;
}
.section-title i {
color: #0A84FF;
font-size: 14px;
}
.question-item {
background: white;
padding: 10px 12px;
border-radius: 6px;
margin-bottom: 8px;
border: 1px solid #e2e8f0;
}
.question-item:last-child {
margin-bottom: 0;
}
.question-text {
font-size: 13px;
color: #334155;
line-height: 1.5;
margin-bottom: 6px;
}
.question-number {
font-weight: 600;
color: #0A84FF;
margin-right: 4px;
}
.answer-text {
display: flex;
align-items: center;
gap: 4px;
font-size: 12px;
font-weight: 500;
padding: 4px 10px;
border-radius: 4px;
width: fit-content;
}
.answer-yes {
background: #dcfce7;
color: #16a34a;
}
.answer-yes i {
color: #16a34a;
}
.answer-no {
background: #fee2e2;
color: #dc2626;
}
.answer-no i {
color: #dc2626;
}
.dark .questions-section {
background: #1e293b;
border-color: #334155;
}
.dark .question-item {
background: #0f172a;
border-color: #334155;
}
.dark .section-title {
color: #e2e8f0;
}
</style>

View File

@@ -0,0 +1,43 @@
import { requestClient } from '#/api/request';
const prefix = 'transfer-question/';
/**
* 获取转诊问题列表
* @param data
*/
export async function getTransferQuestionList(data: any) {
return requestClient.post<any>(`${prefix}list`, data);
}
/**
* 获取转诊问题详情
* @param id
*/
export async function getTransferQuestionInfo(id: number) {
return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}
/**
* 新增转诊问题
* @param data
*/
export async function createTransferQuestion(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}add`, data);
}
/**
* 更新转诊问题
* @param data
*/
export async function updateTransferQuestion(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}update`, data);
}
/**
* 删除转诊问题
* @param data
*/
export async function deleteTransferQuestion(data: Record<string, any>) {
return requestClient.post<any>(`${prefix}delete`, data);
}

View File

@@ -0,0 +1,61 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { message } from 'ant-design-vue';
import { useVbenForm } from '#/adapter/form';
import { createTransferQuestion, updateTransferQuestion } from '../api';
import { modalFormProps } from '../config/form';
const isUpdate = ref(false);
const gridApi = ref();
const [Form, formApi] = useVbenForm(modalFormProps);
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
onCancel() {
modalApi.close();
},
onConfirm: async () => {
formApi.validate().then(async (e: any) => {
if (e.valid) {
const values = await formApi.getValues();
modalApi.setState({ loading: true, confirmLoading: true });
const submitApi = isUpdate.value ? updateTransferQuestion : createTransferQuestion;
submitApi(values)
.then(() => {
message.success('保存成功');
gridApi.value?.reload();
modalApi.close();
})
.finally(() => {
modalApi.setState({ loading: false, confirmLoading: false });
});
}
});
await formApi.validateAndSubmitForm();
},
onOpenChange(isOpen: boolean) {
gridApi.value = isOpen ? modalApi.getData()?.gridApi : null;
if (isOpen) {
const { values, update } = modalApi.getData<Record<string, any>>();
if (values) {
isUpdate.value = update;
formApi.setValues(values);
}
}
},
});
</script>
<template>
<Modal
:title="`${isUpdate === true ? '编辑' : '新增'}转诊问题`"
class="w-[60%]"
>
<Form />
</Modal>
</template>

View File

@@ -0,0 +1,64 @@
import type { VbenFormProps } from '#/adapter/form';
export const modalFormProps: VbenFormProps = {
wrapperClass: 'grid-cols-12', // 24栅格,
commonConfig: {
formItemClass: 'col-span-12',
// 所有表单项
componentProps: {
class: 'w-full',
},
},
layout: 'horizontal',
schema: [
{
component: 'VbenInput',
fieldName: 'id',
label: 'ID',
dependencies: {
show: false,
triggerFields: ['id'],
},
},
{
component: 'VbenTextarea',
componentProps: {
placeholder: '请输入问题内容',
rows: 3,
},
fieldName: 'question',
label: '问题内容',
rules: 'required',
},
{
component: 'InputNumber',
componentProps: {
placeholder: '请输入排序(数字越小越靠前)',
min: 0,
},
defaultValue: 0,
fieldName: 'sort',
label: '排序',
rules: 'required',
},
{
component: 'RadioGroup',
componentProps: {
options: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
},
defaultValue: 1,
fieldName: 'status',
label: '状态',
rules: 'required',
},
],
};

View File

@@ -0,0 +1,45 @@
import type { VbenFormProps } from '#/adapter/form';
export const formOptions: VbenFormProps = {
// 默认展开
collapsed: false,
schema: [
{
component: 'VbenInput',
componentProps: {
placeholder: '输入问题内容',
},
defaultValue: '',
fieldName: 'question',
label: '问题内容',
},
{
component: 'VbenSelect',
componentProps: {
allowClear: true,
options: [
{
label: '启用',
value: 1,
},
{
label: '禁用',
value: 0,
},
],
placeholder: '请选择状态',
},
fieldName: 'status',
label: '状态',
},
],
// 控制表单是否显示折叠按钮
showCollapseButton: true,
submitButtonOptions: {
content: '查询',
},
// 是否在字段值改变时提交表单
submitOnChange: true,
// 按下回车时是否提交表单
submitOnEnter: false,
};

View File

@@ -0,0 +1,76 @@
import type { VxeGridProps } from '#/adapter/vxe-table';
import { getTransferQuestionList } from '../api';
interface RowType {
id: number;
question: string;
sort: number;
status: number;
created_at: string;
updated_at: string;
}
export const gridOptions: VxeGridProps<RowType> = {
checkboxConfig: {
highlight: true,
labelField: '',
},
columnConfig: {
useKey: true,
},
rowConfig: {
useKey: true,
},
columns: [
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'question', align: 'left', title: '问题内容', minWidth: 300 },
{ field: 'sort', title: '排序', width: 100 },
{
field: 'status',
title: '状态',
width: 100,
slots: { default: 'status' },
},
{ field: 'created_at', title: '创建时间', width: 180 },
{ field: 'updated_at', title: '更新时间', width: 180 },
{
type: 'html',
align: 'right',
title: '操作',
slots: { default: 'action' },
width: 200,
},
],
keepSource: true,
pagerConfig: {},
proxyConfig: {
ajax: {
// 请求后端接口方法
query: async ({ page }, formValues) => {
return await getTransferQuestionList({
page: page.currentPage,
pageSize: page.pageSize,
...formValues,
});
},
},
},
height: 'auto',
border: false,
toolbarConfig: {
// 是否显示搜索表单控制按钮
// @ts-ignore 正式环境时有完整的类型声明
search: true,
refresh: true, // 刷新
print: false, // 打印
export: false, // 导出
// custom: true, // 自定义列
zoom: true, // 最大化最小化
slots: {
buttons: 'toolbar-buttons',
},
},
showOverflow: false,
};

View File

@@ -0,0 +1,132 @@
<script lang="ts" setup>
import type { VxeGridListeners } from '#/adapter/vxe-table';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { Button, message, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { TableAction } from '#/components/table-action';
import { deleteTransferQuestion } from './api';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
import { gridOptions } from './config/table';
const hasTopTableDropDownActions = ref(false);
const gridEvents: VxeGridListeners<any> = {
checkboxChange() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
checkboxAll() {
// eslint-disable-next-line no-use-before-define
const records = gridApi.grid.getCheckboxRecords();
hasTopTableDropDownActions.value = records.length > 0;
},
};
const [Grid, gridApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents,
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: FormModalDemo,
});
const showModal = (data = {}, isUpdate = false) => {
formModalApi.setData({
// 表单值
values: data,
update: isUpdate,
gridApi,
});
formModalApi.open();
};
const deleteApi = (row: any) => {
let ids = [];
if (row) {
ids.push(row.id);
} else {
ids = gridApi.grid.getCheckboxRecords().map((item) => item.id);
}
deleteTransferQuestion({ ids }).then(() => {
message.success('删除成功!');
gridApi.reload();
});
};
</script>
<template>
<Page auto-content-height title="转诊问题配置">
<FormModal />
<Grid>
<template #toolbar-buttons>
<TableAction
:actions="[
{
label: '新增',
type: 'primary',
icon: 'ant-design:plus-outlined',
onClick: showModal.bind(null),
},
]"
:drop-down-actions="[
{
label: '删除',
icon: 'ant-design:delete-outlined',
ifShow: hasTopTableDropDownActions,
popConfirm: {
title: '确定删除吗',
confirm: deleteApi.bind(null, false),
},
},
]"
>
<template #more>
<Button style="margin-left: 16px">
批量操作
</Button>
</template>
</TableAction>
</template>
<template #status="{ row }">
<Tag :color="row.status === 1 ? 'green' : 'red'">
{{ row.status === 1 ? '启用' : '禁用' }}
</Tag>
</template>
<template #action="{ row }">
<TableAction
:actions="[
{
label: '编辑',
type: 'link',
icon: 'uil:edit',
size: 'small',
onClick: showModal.bind(null, row, true),
},
]"
:drop-down-actions="[
{
label: '删除',
type: 'link',
icon: 'ant-design:delete-outlined',
size: 'small',
popConfirm: {
title: '确定删除吗',
confirm: deleteApi.bind(null, row),
},
},
]"
/>
</template>
</Grid>
</Page>
</template>