完成差旅报销单

master
linyongLynn 3 months ago
parent 05bcc9e00c
commit d070cc04b8

@ -528,8 +528,17 @@ function syncFormDomToHtml(dom, contractTemplateFields) {
checkedInput.setAttribute('checked', 'checked')
}
} else {
field.value = input.value
input.setAttribute('value', input.value)
if (input.tagName.toLowerCase() === 'textarea') {
// textarea 使 value
field.value = input.value || input.textContent || ''
console.log('fieldName:'+fieldName+"--- "+field.value)
// textarea
input.textContent = field.value
} else {
field.value = input.value
console.log('fieldName:'+fieldName+"--- "+input.value)
input.setAttribute('value', input.value)
}
}
}
}
@ -1303,8 +1312,9 @@ export default {
openZoomedTable() {
const dom = this.$refs.mainTable
if (dom && this.contract.contract_template) {
console.log(this.contract.contract_template.contract_template_fields)
//console.log(this.contract.contract_template.contract_template_fields)
this.forms = syncFormDomToHtml(dom, this.contract.contract_template.contract_template_fields)
console.log('forms:'+this.forms)
this.contract.forms = this.forms
}
this.zoomedDialogVisible = true

@ -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)
}
}
}
})

@ -838,8 +838,17 @@ function syncFormDomToHtml(dom, contractTemplateFields) {
checkedInput.setAttribute('checked', 'checked')
}
} else {
field.value = input.value
input.setAttribute('value', input.value)
if (input.tagName.toLowerCase() === 'textarea') {
// textarea 使 value
field.value = input.value || input.textContent || ''
console.log('fieldName:'+fieldName+"--- "+field.value)
// textarea
input.textContent = field.value
} else {
field.value = input.value
console.log('fieldName:'+fieldName+"--- "+input.value)
input.setAttribute('value', input.value)
}
}
}
}

Loading…
Cancel
Save