This commit is contained in:
Your Name
2026-08-12 18:26:42 +08:00
parent 26839c2957
commit 18ed3c48fa
346 changed files with 431 additions and 342 deletions
@@ -2649,7 +2649,28 @@ async function handleDownloadSlip() {
windowWidth: node.scrollWidth,
windowHeight: node.scrollHeight,
width: node.scrollWidth,
height: node.scrollHeight
height: node.scrollHeight,
/** 克隆节点上再兜一层:加高行高,避免药材/底部文字被切边 */
onclone: (_doc, cloned) => {
if (!(cloned instanceof HTMLElement)) return
cloned.querySelectorAll<HTMLElement>('.rx-herb-cell').forEach((el) => {
el.style.lineHeight = '2.5'
})
cloned.querySelectorAll<HTMLElement>('.rx-herbs').forEach((el) => {
el.style.rowGap = '12px'
})
cloned.querySelectorAll<HTMLElement>('.rx-text').forEach((el) => {
el.style.lineHeight = '2.1'
})
cloned.querySelectorAll<HTMLElement>('.rx-bot-meta-val, .rx-hospital-line, .rx-bot-cell').forEach((el) => {
el.style.overflow = 'visible'
el.style.lineHeight = '1.85'
})
cloned.querySelectorAll<HTMLElement>('.rx-hospital-row').forEach((el) => {
el.style.paddingTop = '12px'
el.style.paddingBottom = '14px'
})
}
})
const imgData = canvas.toDataURL('image/jpeg', 0.95)
const pdf = new jsPDF({ unit: 'mm', format: 'a4', orientation: 'portrait' })
@@ -4978,7 +4978,28 @@ async function capturePrescriptionSlipCanvas(): Promise<HTMLCanvasElement> {
width: el.scrollWidth,
height: el.scrollHeight,
ignoreElements: (node: Element) =>
node instanceof HTMLElement && node.classList.contains('cf-slip-no-export')
node instanceof HTMLElement && node.classList.contains('cf-slip-no-export'),
/** 克隆节点上再兜一层:加高行高,避免药材/底部文字被切边 */
onclone: (_doc, cloned) => {
if (!(cloned instanceof HTMLElement)) return
cloned.querySelectorAll<HTMLElement>('.rx-herb-cell').forEach((node) => {
node.style.lineHeight = '2.5'
})
cloned.querySelectorAll<HTMLElement>('.rx-herbs').forEach((node) => {
node.style.rowGap = '12px'
})
cloned.querySelectorAll<HTMLElement>('.rx-text').forEach((node) => {
node.style.lineHeight = '2.1'
})
cloned.querySelectorAll<HTMLElement>('.rx-bot-meta-val, .rx-hospital-line, .rx-bot-cell').forEach((node) => {
node.style.overflow = 'visible'
node.style.lineHeight = '1.85'
})
cloned.querySelectorAll<HTMLElement>('.rx-hospital-row').forEach((node) => {
node.style.paddingTop = '12px'
node.style.paddingBottom = '14px'
})
}
})
}
@@ -5673,7 +5673,28 @@ async function capturePrescriptionSlipCanvas(): Promise<HTMLCanvasElement> {
width: el.scrollWidth,
height: el.scrollHeight,
ignoreElements: (node: Element) =>
node instanceof HTMLElement && node.classList.contains('cf-slip-no-export')
node instanceof HTMLElement && node.classList.contains('cf-slip-no-export'),
/** 克隆节点上再兜一层:加高行高,避免药材/底部文字被切边 */
onclone: (_doc, cloned) => {
if (!(cloned instanceof HTMLElement)) return
cloned.querySelectorAll<HTMLElement>('.rx-herb-cell').forEach((node) => {
node.style.lineHeight = '2.5'
})
cloned.querySelectorAll<HTMLElement>('.rx-herbs').forEach((node) => {
node.style.rowGap = '12px'
})
cloned.querySelectorAll<HTMLElement>('.rx-text').forEach((node) => {
node.style.lineHeight = '2.1'
})
cloned.querySelectorAll<HTMLElement>('.rx-bot-meta-val, .rx-hospital-line, .rx-bot-cell').forEach((node) => {
node.style.overflow = 'visible'
node.style.lineHeight = '1.85'
})
cloned.querySelectorAll<HTMLElement>('.rx-hospital-row').forEach((node) => {
node.style.paddingTop = '12px'
node.style.paddingBottom = '14px'
})
}
})
}