|
|
|
|
@ -141,7 +141,7 @@ export default {
|
|
|
|
|
isShow: false,
|
|
|
|
|
currentForm: 'post',
|
|
|
|
|
fundLog: null,
|
|
|
|
|
printOrientation: 'portrait' // 默认横向
|
|
|
|
|
printOrientation: 'portrait' // 默认纵向
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
@ -173,7 +173,19 @@ export default {
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
if (newVal) {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.setupAmountListeners()
|
|
|
|
|
// 检查 printtable 是否存在
|
|
|
|
|
if (this.$refs.printtable) {
|
|
|
|
|
this.setupAmountListeners()
|
|
|
|
|
// 界面打开后,根据表单内容设置打印方向
|
|
|
|
|
const hasTravelExpense = this.getForms && this.getForms.includes('差旅报销单');
|
|
|
|
|
if (hasTravelExpense) {
|
|
|
|
|
this.printOrientation = 'landscape';
|
|
|
|
|
console.log('检测到差旅报销单,设置为横向打印');
|
|
|
|
|
} else {
|
|
|
|
|
this.printOrientation = 'portrait';
|
|
|
|
|
console.log('其他表单,设置为纵向打印');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -354,8 +366,8 @@ export default {
|
|
|
|
|
|
|
|
|
|
// 监听 total 输入框的变化
|
|
|
|
|
const totalInput = dom.querySelector('input[data-field="total"]')
|
|
|
|
|
console.log('totalInput', totalInput.value)
|
|
|
|
|
if (totalInput) {
|
|
|
|
|
console.log('totalInput', totalInput.value)
|
|
|
|
|
totalInput.removeEventListener('input', this.updateUpperCaseFromTotal)
|
|
|
|
|
totalInput.removeEventListener('change', this.updateUpperCaseFromTotal)
|
|
|
|
|
totalInput.removeEventListener('blur', this.updateUpperCaseFromTotal)
|
|
|
|
|
@ -371,6 +383,7 @@ export default {
|
|
|
|
|
caculateRoadDay() {
|
|
|
|
|
const sdateInput = this.$refs.printtable.querySelector('input[data-field^="sdate"]')
|
|
|
|
|
const edateInput = this.$refs.printtable.querySelector('input[data-field^="edate"]')
|
|
|
|
|
if (!sdateInput || !edateInput) return
|
|
|
|
|
const sdate = sdateInput.value
|
|
|
|
|
const edate = edateInput.value
|
|
|
|
|
if (sdate && edate) {
|
|
|
|
|
@ -684,7 +697,8 @@ export default {
|
|
|
|
|
const textareas = element.getElementsByTagName('textarea')
|
|
|
|
|
Array.from(textareas).forEach(textarea => {
|
|
|
|
|
const span = document.createElement('span')
|
|
|
|
|
span.textContent = textarea.value || ''
|
|
|
|
|
// 优先使用 textContent,如果没有则使用 value
|
|
|
|
|
span.textContent = textarea.textContent || textarea.value || ''
|
|
|
|
|
const style = window.getComputedStyle(textarea)
|
|
|
|
|
// 先复制所有样式
|
|
|
|
|
span.style.cssText = style.cssText
|
|
|
|
|
@ -779,8 +793,14 @@ export default {
|
|
|
|
|
checkedInput.setAttribute('checked', 'checked')
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// 对于其他类型的输入,直接设置value
|
|
|
|
|
input.setAttribute('value', input.value)
|
|
|
|
|
if (input.tagName.toLowerCase() === 'textarea') {
|
|
|
|
|
// textarea 是双标签,内容在标签之间,不使用 value 属性
|
|
|
|
|
input.textContent = input.value || ''
|
|
|
|
|
console.log('textarea fieldName:' + fieldName + "--- " + input.value)
|
|
|
|
|
} else {
|
|
|
|
|
// 对于其他类型的输入,直接设置value
|
|
|
|
|
input.setAttribute('value', input.value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|