|
|
|
|
@ -354,7 +354,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 初始计算一次
|
|
|
|
|
// this.calculateTotal()
|
|
|
|
|
this.calculateTotal()
|
|
|
|
|
},
|
|
|
|
|
caculateRoadDay() {
|
|
|
|
|
const sdateInput = this.$refs.printtable.querySelector('input[data-field^="sdate"]')
|
|
|
|
|
@ -460,6 +460,41 @@ export default {
|
|
|
|
|
fenInput.value = fenTotal===0?'0':fenTotal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 统计各位后,进行进位处理
|
|
|
|
|
if (fenTotal >= 10) {
|
|
|
|
|
jiaoTotal += Math.floor(fenTotal / 10);
|
|
|
|
|
fenTotal = fenTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
if (jiaoTotal >= 10) {
|
|
|
|
|
yuanTotal += Math.floor(jiaoTotal / 10);
|
|
|
|
|
jiaoTotal = jiaoTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
if (yuanTotal >= 10) {
|
|
|
|
|
shiTotal += Math.floor(yuanTotal / 10);
|
|
|
|
|
yuanTotal = yuanTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
if (shiTotal >= 10) {
|
|
|
|
|
baiTotal += Math.floor(shiTotal / 10);
|
|
|
|
|
shiTotal = shiTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
if (baiTotal >= 10) {
|
|
|
|
|
qianTotal += Math.floor(baiTotal / 10);
|
|
|
|
|
baiTotal = baiTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
if (qianTotal >= 10) {
|
|
|
|
|
wanTotal += Math.floor(qianTotal / 10);
|
|
|
|
|
qianTotal = qianTotal % 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 进位后同步更新input显示
|
|
|
|
|
if (wanInput) wanInput.value = wanTotal === 0 ? '0' : wanTotal;
|
|
|
|
|
if (qianInput) qianInput.value = qianTotal === 0 ? '0' : qianTotal;
|
|
|
|
|
if (baiInput) baiInput.value = baiTotal === 0 ? '0' : baiTotal;
|
|
|
|
|
if (shiInput) shiInput.value = shiTotal === 0 ? '0' : shiTotal;
|
|
|
|
|
if (yuanInput) yuanInput.value = yuanTotal === 0 ? '0' : yuanTotal;
|
|
|
|
|
if (jiaoInput) jiaoInput.value = jiaoTotal === 0 ? '0' : jiaoTotal;
|
|
|
|
|
if (fenInput) fenInput.value = fenTotal === 0 ? '0' : fenTotal;
|
|
|
|
|
|
|
|
|
|
let otherTotal = wanTotal * 10000 + qianTotal * 1000 + baiTotal * 100 + shiTotal * 10 + yuanTotal + jiaoTotal * 0.1 + fenTotal * 0.01
|
|
|
|
|
|
|
|
|
|
let total = 0
|
|
|
|
|
@ -535,6 +570,7 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
span.textContent = displayText
|
|
|
|
|
const style = window.getComputedStyle(input)
|
|
|
|
|
// 先复制所有样式
|
|
|
|
|
span.style.cssText = style.cssText
|
|
|
|
|
;[
|
|
|
|
|
'width',
|
|
|
|
|
@ -553,11 +589,15 @@ export default {
|
|
|
|
|
].forEach(key => {
|
|
|
|
|
span.style[key] = style[key]
|
|
|
|
|
})
|
|
|
|
|
// 确保width和height与Input控件保持一致
|
|
|
|
|
span.style.width = '100%'
|
|
|
|
|
span.style.height = style.height
|
|
|
|
|
span.style.whiteSpace = 'normal'
|
|
|
|
|
span.style.wordBreak = 'break-all'
|
|
|
|
|
span.style.overflowWrap = 'break-word'
|
|
|
|
|
span.style.display = 'block'
|
|
|
|
|
span.style.width = '100%'
|
|
|
|
|
span.style.textAlign = 'center'
|
|
|
|
|
span.style.verticalAlign = 'middle'
|
|
|
|
|
input.parentNode.replaceChild(span, input)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
@ -566,6 +606,7 @@ export default {
|
|
|
|
|
const span = document.createElement('span')
|
|
|
|
|
span.textContent = select.options[select.selectedIndex]?.text || ''
|
|
|
|
|
const style = window.getComputedStyle(select)
|
|
|
|
|
// 先复制所有样式
|
|
|
|
|
span.style.cssText = style.cssText
|
|
|
|
|
;[
|
|
|
|
|
'width',
|
|
|
|
|
@ -584,7 +625,9 @@ export default {
|
|
|
|
|
].forEach(key => {
|
|
|
|
|
span.style[key] = style[key]
|
|
|
|
|
})
|
|
|
|
|
span.style.width = '100%'
|
|
|
|
|
// 确保width和height与select控件保持一致
|
|
|
|
|
span.style.width = style.width
|
|
|
|
|
span.style.height = style.height
|
|
|
|
|
span.style.display = 'block'
|
|
|
|
|
span.style.textAlign = 'center'
|
|
|
|
|
span.style.whiteSpace = 'pre-line' // 关键:自动换行
|
|
|
|
|
@ -596,6 +639,7 @@ export default {
|
|
|
|
|
const span = document.createElement('span')
|
|
|
|
|
span.textContent = textarea.value || ''
|
|
|
|
|
const style = window.getComputedStyle(textarea)
|
|
|
|
|
// 先复制所有样式
|
|
|
|
|
span.style.cssText = style.cssText
|
|
|
|
|
;[
|
|
|
|
|
'width',
|
|
|
|
|
@ -614,7 +658,9 @@ export default {
|
|
|
|
|
].forEach(key => {
|
|
|
|
|
span.style[key] = style[key]
|
|
|
|
|
})
|
|
|
|
|
span.style.width = '100%'
|
|
|
|
|
// 确保width和height与textarea控件保持一致
|
|
|
|
|
span.style.width = style.width
|
|
|
|
|
span.style.height = style.height
|
|
|
|
|
span.style.display = 'block'
|
|
|
|
|
span.style.textAlign = 'center'
|
|
|
|
|
span.style.whiteSpace = 'pre-line' // 关键:自动换行
|
|
|
|
|
@ -699,6 +745,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 替换控件为纯文本(保留样式)
|
|
|
|
|
this.replaceControls(printNode)
|
|
|
|
|
console.log('printNode', printNode.innerHTML)
|
|
|
|
|
|
|
|
|
|
// 计算并更新总金额
|
|
|
|
|
const amountInputs = printNode.querySelectorAll('input[data-field^="amount"]')
|
|
|
|
|
@ -756,8 +803,9 @@ export default {
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
.form-container { width: 100% !important; margin: 0 auto; }
|
|
|
|
|
table { width: 100%; border-collapse: collapse; }
|
|
|
|
|
td { border: 1px solid #000; padding: 8px; }
|
|
|
|
|
table { width: 100%; border-collapse: collapse;table-layout: fixed; text-align: center; margin: 0 auto; }
|
|
|
|
|
td { border: 1px solid #000; padding: 8px; min-width: 100px; word-break: break-all; text-align: center; vertical-align: middle; }
|
|
|
|
|
th { text-align: center; vertical-align: middle; }
|
|
|
|
|
@media print {
|
|
|
|
|
body {
|
|
|
|
|
width: ${pageWidth}mm;
|
|
|
|
|
|