feat(签署文书): 统一签署态文书样式并精简演示种子为单份麻精同意书
This commit is contained in:
@@ -43,37 +43,31 @@ export interface SigningPdfInput {
|
||||
*
|
||||
* 实测(签署工作台导出的 PDF,html2canvas 1.4):页面上明明印着「与患者关系:文本框 配偶」、
|
||||
* 签名图也画出来了,导出的位图里这些却全是空白,只剩胶囊的边框和底色——
|
||||
* 填写项胶囊 `.sign-field` 与控件容器 `.sign-field__control` 都是 `display: inline-flex`,
|
||||
* 而 html2canvas 1.4 不实现 flex 布局,容器内文本的落点算不出来,
|
||||
* 于是连同 `<input>` 的取值、签名 `<img>` 一起被丢掉(连 `<p>` 里的「待签名」提示也不见了)。
|
||||
* 当时填写项胶囊与它的控件容器都是 `display: inline-flex`,html2canvas 算不出容器内
|
||||
* 文本的落点,于是连同取值与签名 `<img>` 一起被丢掉。
|
||||
*
|
||||
* 换成 `inline-block` 后内容全部回来,于是这里把这两层降级。**只在导出克隆体上改**:
|
||||
* 屏幕上的版式一行不动,PDF 也不会丢内容;`.sign-doc-header` 那层 flex 实测不受影响,不动它。
|
||||
* 现在填写项已按原型口径改成 `display: inline-block`(.docfld / .docopt,
|
||||
* 见 styles/signing-document.css),这条降级只剩系统页眉那一层:
|
||||
* 它是 flex 排的一行患者信息,导出前改成 block + inline-block,
|
||||
* 并用等效的 margin 补回原来的项间距,保证页眉在 PDF 里不丢字。
|
||||
*
|
||||
* gap 在 inline-block 下失效,所以把原来的 4px 项间距、align-items: center、
|
||||
* 签名位的 justify-content: center 用等效的 inline 写法补回来,导出结果与屏幕观感一致。
|
||||
* **只在导出克隆体上改**:屏幕上的版式一行不动。
|
||||
*/
|
||||
function applyExportFlexFallback(root: HTMLElement) {
|
||||
root.querySelectorAll<HTMLElement>('.sign-field, .sign-field__control').forEach((element) => {
|
||||
element.style.display = 'inline-block'
|
||||
})
|
||||
const header = root.querySelector<HTMLElement>('.sign-doc-header')
|
||||
|
||||
// 胶囊原来是 inline-flex + gap: 4px,项名与控件之间的间距要自己补
|
||||
root.querySelectorAll<HTMLElement>('.sign-field__label').forEach((element) => {
|
||||
element.style.marginRight = '4px'
|
||||
})
|
||||
if (!header) {
|
||||
return
|
||||
}
|
||||
|
||||
root.querySelectorAll<HTMLElement>('.sign-field__control').forEach((element) => {
|
||||
// 原来是 align-items: center
|
||||
element.style.verticalAlign = 'middle'
|
||||
})
|
||||
header.style.display = 'block'
|
||||
|
||||
// 签名位原来是 justify-content: center,inline-block 下改用 text-align 居中
|
||||
root
|
||||
.querySelectorAll<HTMLElement>('.sign-field--signature .sign-field__control')
|
||||
.forEach((element) => {
|
||||
element.style.textAlign = 'center'
|
||||
})
|
||||
// gap: 10px 18px 在 inline-block 下失效,用 margin 补回来
|
||||
root.querySelectorAll<HTMLElement>('.sign-doc-header__item').forEach((item) => {
|
||||
item.style.display = 'inline-block'
|
||||
item.style.marginRight = '18px'
|
||||
item.style.marginBottom = '6px'
|
||||
})
|
||||
}
|
||||
|
||||
/** 量固定页眉的高度(含下外边距)——它是每页要重复的那一条 */
|
||||
|
||||
Reference in New Issue
Block a user