转诊方优化
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
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:
@@ -226,6 +226,28 @@ const handleImportToPrescription = async () => {
|
||||
};
|
||||
|
||||
const emit = defineEmits(['import-success']);
|
||||
|
||||
// 获取答案的样式类:是=绿色,否=红色,其他=黄色
|
||||
const getAnswerClass = (answer) => {
|
||||
if (answer === '是') {
|
||||
return 'answer-yes';
|
||||
} else if (answer === '否') {
|
||||
return 'answer-no';
|
||||
} else {
|
||||
return 'answer-other';
|
||||
}
|
||||
};
|
||||
|
||||
// 获取答案的图标
|
||||
const getAnswerIcon = (answer) => {
|
||||
if (answer === '是') {
|
||||
return 'fas fa-check-circle';
|
||||
} else if (answer === '否') {
|
||||
return 'fas fa-times-circle';
|
||||
} else {
|
||||
return 'fas fa-question-circle';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -309,8 +331,8 @@ const emit = defineEmits(['import-success']);
|
||||
<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>
|
||||
<div class="answer-text" :class="getAnswerClass(qa.answer)">
|
||||
<i :class="getAnswerIcon(qa.answer)"></i>
|
||||
<span>{{ qa.answer }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -575,6 +597,15 @@ const emit = defineEmits(['import-success']);
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.answer-other {
|
||||
background: #fef3c7;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.answer-other i {
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.dark .questions-section {
|
||||
background: #1e293b;
|
||||
border-color: #334155;
|
||||
|
||||
@@ -109,6 +109,28 @@ const handleViewDetail = () => {
|
||||
emit('view-detail', transferInfo.value);
|
||||
};
|
||||
|
||||
// 获取答案的样式类:是=绿色,否=红色,其他=黄色
|
||||
const getAnswerClass = (answer) => {
|
||||
if (answer === '是') {
|
||||
return 'answer-yes';
|
||||
} else if (answer === '否') {
|
||||
return 'answer-no';
|
||||
} else {
|
||||
return 'answer-other';
|
||||
}
|
||||
};
|
||||
|
||||
// 获取答案的图标
|
||||
const getAnswerIcon = (answer) => {
|
||||
if (answer === '是') {
|
||||
return 'fas fa-check-circle';
|
||||
} else if (answer === '否') {
|
||||
return 'fas fa-times-circle';
|
||||
} else {
|
||||
return 'fas fa-question-circle';
|
||||
}
|
||||
};
|
||||
|
||||
// 将转接方药品数据转换成addProducts需要的格式
|
||||
const convertDrugDataForImport = (drug) => {
|
||||
// addProducts期望的数据结构:
|
||||
@@ -291,8 +313,8 @@ const handleImportToPrescription = async () => {
|
||||
<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>
|
||||
<div class="answer-text" :class="getAnswerClass(qa.answer)">
|
||||
<i :class="getAnswerIcon(qa.answer)"></i>
|
||||
<span>{{ qa.answer }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -542,6 +564,15 @@ const handleImportToPrescription = async () => {
|
||||
color: #dc2626;
|
||||
}
|
||||
|
||||
.answer-other {
|
||||
background: #fef3c7;
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.answer-other i {
|
||||
color: #d97706;
|
||||
}
|
||||
|
||||
.dark .questions-section {
|
||||
background: #1e293b;
|
||||
border-color: #334155;
|
||||
|
||||
@@ -24,6 +24,25 @@ const [Modal, modalApi] = useVbenModal({
|
||||
formApi.validate().then(async (e: any) => {
|
||||
if (e.valid) {
|
||||
const values = await formApi.getValues();
|
||||
|
||||
// 处理answers字段:将换行分隔的字符串转换为数组
|
||||
if (values.answers) {
|
||||
if (typeof values.answers === 'string') {
|
||||
// 按换行符分割,过滤空行,去除首尾空格
|
||||
values.answers = values.answers
|
||||
.split('\n')
|
||||
.map((item: string) => item.trim())
|
||||
.filter((item: string) => item.length > 0);
|
||||
}
|
||||
// 如果转换后为空数组,设置默认值
|
||||
if (!Array.isArray(values.answers) || values.answers.length === 0) {
|
||||
values.answers = ['是', '否'];
|
||||
}
|
||||
} else {
|
||||
// 如果没有提供,设置默认值
|
||||
values.answers = ['是', '否'];
|
||||
}
|
||||
|
||||
modalApi.setState({ loading: true, confirmLoading: true });
|
||||
const submitApi = isUpdate.value ? updateTransferQuestion : createTransferQuestion;
|
||||
submitApi(values)
|
||||
@@ -45,6 +64,26 @@ const [Modal, modalApi] = useVbenModal({
|
||||
const { values, update } = modalApi.getData<Record<string, any>>();
|
||||
if (values) {
|
||||
isUpdate.value = update;
|
||||
|
||||
// 处理answers字段:如果是数组或JSON字符串,转换为换行分隔的字符串
|
||||
if (values.answers) {
|
||||
if (Array.isArray(values.answers)) {
|
||||
values.answers = values.answers.join('\n');
|
||||
} else if (typeof values.answers === 'string' && values.answers.trim().startsWith('[')) {
|
||||
try {
|
||||
const parsed = JSON.parse(values.answers);
|
||||
if (Array.isArray(parsed)) {
|
||||
values.answers = parsed.join('\n');
|
||||
}
|
||||
} catch (e) {
|
||||
// 解析失败,保持原值
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 如果没有值,设置默认值
|
||||
values.answers = '是\n否';
|
||||
}
|
||||
|
||||
formApi.setValues(values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ export const modalFormProps: VbenFormProps = {
|
||||
},
|
||||
},
|
||||
layout: 'horizontal',
|
||||
showDefaultActions: false,
|
||||
schema: [
|
||||
{
|
||||
component: 'VbenInput',
|
||||
@@ -21,7 +22,7 @@ export const modalFormProps: VbenFormProps = {
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'VbenTextarea',
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入问题内容',
|
||||
rows: 3,
|
||||
@@ -30,6 +31,40 @@ export const modalFormProps: VbenFormProps = {
|
||||
label: '问题内容',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
placeholder: '请选择问题类型',
|
||||
options: [
|
||||
{
|
||||
label: '转接方问题',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '在线复诊问题',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '购药在线复诊问题',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultValue: 1,
|
||||
fieldName: 'type',
|
||||
label: '问题类型',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
componentProps: {
|
||||
placeholder: '请输入答案选项,每行一个(默认:是、否)',
|
||||
rows: 4,
|
||||
},
|
||||
fieldName: 'answers',
|
||||
label: '答案选项',
|
||||
defaultValue: '否\n是',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
|
||||
@@ -5,8 +5,10 @@ import { getTransferQuestionList } from '../api';
|
||||
interface RowType {
|
||||
id: number;
|
||||
question: string;
|
||||
answers: string | string[];
|
||||
sort: number;
|
||||
status: number;
|
||||
type: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
@@ -26,6 +28,12 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{ field: 'id', align: 'left', title: 'ID', width: 100 },
|
||||
{ field: 'question', align: 'left', title: '问题内容', minWidth: 300 },
|
||||
{
|
||||
field: 'type',
|
||||
title: '问题类型',
|
||||
width: 150,
|
||||
slots: { default: 'type' },
|
||||
},
|
||||
{ field: 'sort', title: '排序', width: 100 },
|
||||
{
|
||||
field: 'status',
|
||||
|
||||
@@ -116,6 +116,11 @@ const deleteApi = (row: any) => {
|
||||
{{ row.status === 1 ? '启用' : '禁用' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #type="{ row }">
|
||||
<Tag :color="row.type === 1 ? 'blue' : row.type === 2 ? 'orange' : 'purple'">
|
||||
{{ row.type === 1 ? '转接方问题' : row.type === 2 ? '在线复诊问题' : '购药在线复诊问题' }}
|
||||
</Tag>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
|
||||
Reference in New Issue
Block a user