feat(documents): 新增填写项占位符并修正手动按钮类型

This commit is contained in:
yelan
2026-10-07 15:02:00 +08:00
parent 3ab71e4231
commit 715b9a03ab
@@ -77,7 +77,34 @@ const message = reactive({ text: '', tone: '' as '' | 'ok' | 'warn' })
* 那种位置必须有占位符,否则签署时不会回填(系统不会另外在文书上插患者信息)。 * 那种位置必须有占位符,否则签署时不会回填(系统不会另外在文书上插患者信息)。
*/ */
const AUTO_FILL_LABELS = ['患者姓名', '性别', '年龄', '就诊号', '与患者关系', '签署日期'] const AUTO_FILL_LABELS = ['患者姓名', '性别', '年龄', '就诊号', '与患者关系', '签署日期']
const MANUAL_LABELS = ['签名', '勾选项']
/**
* 自行填写 / 签名按钮。三项的取值都来自现场采集,没有系统来源,因此都不查目录、
* 一律走自定义项(custom:…,字段键由 insertField 按正文占用情况当场分配):
* - 签名:插入独立签名位,可重复插入并改名;
* - 勾选项:勾选 / 单选控件,选项在右侧面板里配置;
* - 填写项:自由文本输入框,签署时由患者或家属现场填写。
*
* kind 必须逐项写死:这三项在目录里都查不到,兜底出来的类型不会自己变成想要的那个
* (findPreset 只认目录与签名),一律兜成 checkbox 会让填写项插出来是个勾选框。
*/
const MANUAL_BUTTONS: Array<{ label: string; kind: SigningFieldKind; title: string }> = [
{
label: '签名',
kind: 'signature',
title: '插入独立签名位置,可改名为患者签名、家属签名或医生签名',
},
{
label: '勾选项',
kind: 'checkbox',
title: '签署时由患者逐项勾选;点正文里的胶囊可配置多个选项',
},
{
label: '填写项',
kind: 'text',
title: '签署时由患者或家属现场填写;点正文里的胶囊可改名称与是否必填',
},
]
function findPreset(label: string): SigningFieldDef | null { function findPreset(label: string): SigningFieldDef | null {
if (label === '签名') { if (label === '签名') {
@@ -100,12 +127,13 @@ const autoFillButtons = computed(() =>
) )
const manualButtons = computed(() => const manualButtons = computed(() =>
MANUAL_LABELS.map((label) => ({ MANUAL_BUTTONS.map(({ label, kind, title }) => ({
label, label,
title,
field: findPreset(label) ?? { field: findPreset(label) ?? {
id: `custom:${label}`, id: `custom:${label}`,
label, label,
kind: 'checkbox' as SigningFieldKind, kind,
required: false, required: false,
options: [], options: [],
}, },
@@ -762,16 +790,14 @@ function requestClose() {
type="button" type="button"
class="pb-chip" class="pb-chip"
:class="`is-${button.field.kind}`" :class="`is-${button.field.kind}`"
:title=" :title="button.title"
button.field.kind === 'signature'
? '插入独立签名位置,可改名为患者签名、家属签名或医生签名'
: '签署时由患者逐项勾选;点正文里的胶囊可配置多个选项'
"
@click="insertField(button.field)" @click="insertField(button.field)"
> >
[{{ button.label }}] [{{ button.label }}]
</button> </button>
<span class="pb-note"> 签名可重复插入并自定义名称;勾选项在签署时填写 </span> <span class="pb-note">
签名可重复插入并自定义名称;勾选项与填写项在签署时填写
</span>
</div> </div>
</template> </template>
</EditorWangPane> </EditorWangPane>
@@ -1129,8 +1155,9 @@ function requestClose() {
color: #9a5f00; color: #9a5f00;
} }
/* 占位符按钮:颜色与正文里胶囊的配色一一对应(蓝=自动填、橙=签名、绿=勾选), /* 占位符按钮:颜色与正文里胶囊的配色一一对应(蓝=文本、橙=签名、绿=勾选),
点之前就知道会插进一个什么样的胶囊 */ 点之前就知道会插进一个什么样的胶囊。文本蓝同时用于 HIS 自动填充项与「填写项」:
两者落进正文都是同一个文本胶囊,颜色按控件类型走,不按取值来源分 */
.pb-chip { .pb-chip {
padding: 3px 7px; padding: 3px 7px;
font-size: 12px; font-size: 12px;
@@ -1154,6 +1181,10 @@ function requestClose() {
border-color: #0f9d6c; border-color: #0f9d6c;
} }
.pb-chip.is-text {
color: var(--brand);
}
.pb-chip:hover { .pb-chip:hover {
background: var(--brand-l); background: var(--brand-l);
} }