master
lion 24 hours ago
parent d5dd4b7051
commit ed4565a4cd

@ -1084,8 +1084,24 @@ export default {
let filledHtml = html
fields.forEach(field => {
if (field.link_field && field.value !== undefined && field.value !== null && field.value !== '') {
const fieldValue = String(field.value)
// 使0
const isSpecialField = field.field === 'auditAmount' || field.field === 'currentDuePayment' ||
field.field === 'currentPayment' || field.field === 'currentPaymentRemark' ||
field.field === 'totalPaid' || field.field === 'totalPlanned'
//
if (isSpecialField || (field.value !== undefined && field.value !== null && field.value !== '')) {
//
let fieldValue = ''
if (isSpecialField) {
if (field.field === 'currentPaymentRemark') {
fieldValue = String(field.value || '')
} else {
fieldValue = String(field.value || '0')
}
} else {
fieldValue = String(field.value)
}
// textarea
const textareaRegex = new RegExp(`(<textarea[^>]*data-field="${field.field}"[^>]*>)([\\s\\S]*?)(</textarea>)`, 'gi')
@ -1096,6 +1112,21 @@ export default {
}
// input, select
// checked
if (field.field === 'currentPaymentRemark') {
const radioNameMatch = filledHtml.match(new RegExp(`<input[^>]*data-field="${field.field}"[^>]*name="([^"]*)"[^>]*>`, 'i'))
if (radioNameMatch) {
const radioName = radioNameMatch[1]
//
const escapedRadioName = radioName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
// checked
const allRadioRegex = new RegExp(`(<input[^>]*name="${escapedRadioName}"[^>]*)checked[^>]*>`, 'gi')
filledHtml = filledHtml.replace(allRadioRegex, (match) => {
return match.replace(/\s+checked(\s|>)/g, '$1')
})
}
}
const singleTagRegex = new RegExp(`<([^>]*data-field="${field.field}"[^>]*)>`, 'gi')
filledHtml = filledHtml.replace(singleTagRegex, (match) => {
const controlType = this.getControlType(match)
@ -1103,9 +1134,24 @@ export default {
if (controlType === 'checkbox' || controlType === 'radio') {
// checked
const currentValue = this.getControlValue(match)
if (String(fieldValue) === String(currentValue)) {
const fieldValueTrimmed = String(fieldValue).trim()
const currentValueTrimmed = String(currentValue).trim()
if (field.field === 'currentPaymentRemark') {
console.log('HTML fill - currentPaymentRemark:', {
fieldValue: fieldValueTrimmed,
currentValue: currentValueTrimmed,
match: fieldValueTrimmed === currentValueTrimmed,
originalMatch: match
})
}
if (fieldValueTrimmed === currentValueTrimmed) {
if (!match.includes('checked')) {
return match.replace('>', ' checked>')
// > checked
const newMatch = match.replace(/(\s*)>/, ' checked$1>')
if (field.field === 'currentPaymentRemark') {
console.log('Added checked to HTML:', newMatch)
}
return newMatch
}
} else {
// checked
@ -1144,10 +1190,46 @@ export default {
//
initTemplateFieldsForTable(fields, contextData, tableIndex) {
// previousPayment totalPaid
let previousPaymentValue = 0
const previousPaymentField = fields.find(f => f.field === 'previousPayment')
if (previousPaymentField && previousPaymentField.link_field && contextData && contextData.other_data_fill && contextData.other_data_fill[previousPaymentField.link_field]) {
previousPaymentValue = parseFloat(contextData.other_data_fill[previousPaymentField.link_field]) || 0
}
// currentPayment totalPaid totalPlanned
const currentPaymentValue = parseFloat(this.paymentRegistrationForm.deductionMoney) || 0
//
fields.forEach(field => {
// link_fieldother_data_fill
if (field.link_field && contextData.other_data_fill[field.link_field]) {
// paymentRegistrationForm
if (field.field === 'auditAmount') {
// paymentRegistrationForm.audit_money 0
field.value = this.paymentRegistrationForm.audit_money || '0'
} else if (field.field === 'currentDuePayment') {
// paymentRegistrationForm.applyMoney 0
field.value = this.paymentRegistrationForm.applyMoney || '0'
} else if (field.field === 'currentPayment') {
// paymentRegistrationForm.deductionMoney 0
field.value = this.paymentRegistrationForm.deductionMoney || '0'
} else if (field.field === 'currentPaymentRemark') {
// paymentRegistrationForm.type
field.value = this.paymentRegistrationForm.type || ''
console.log('currentPaymentRemark field value:', field.value, 'from paymentRegistrationForm.type:', this.paymentRegistrationForm.type)
} else if (field.field === 'totalPaid') {
// previousPayment + currentPayment
const totalPaidValue = previousPaymentValue + currentPaymentValue
field.value = totalPaidValue.toString()
} else if (field.field === 'totalPlanned') {
// other_data_fill + currentPayment
let baseValue = 0
if (field.link_field && contextData && contextData.other_data_fill && contextData.other_data_fill[field.link_field]) {
baseValue = parseFloat(contextData.other_data_fill[field.link_field]) || 0
}
const totalPlannedValue = baseValue + currentPaymentValue
field.value = totalPlannedValue.toString()
} else if (field.link_field && contextData && contextData.other_data_fill && contextData.other_data_fill[field.link_field]) {
// other_data_fill
let value = contextData.other_data_fill[field.link_field]
// upper_money
@ -1166,18 +1248,86 @@ export default {
const dom = tableIndex === 1 ? this.$refs.mainTable1 : this.$refs.mainTable2
if (dom) {
//
const radioGroups = new Set()
fields.forEach(field => {
if (field.field === 'currentPaymentRemark') {
const input = dom.querySelector(`[data-field="${field.field}"]`)
if (input && input.type === 'radio' && input.name) {
radioGroups.add(input.name)
}
}
})
//
radioGroups.forEach(radioName => {
const allRadios = dom.querySelectorAll(`input[type="radio"][name="${radioName}"]`)
allRadios.forEach(radio => {
radio.checked = false
radio.removeAttribute('checked')
})
})
// DOM
fields.forEach(field => {
if (field.link_field && field.value !== undefined && field.value !== null && field.value !== '') {
if (field.field === 'currentPaymentRemark') {
// currentPaymentRemark
const fieldValueStr = String(field.value || '').trim()
console.log('Processing currentPaymentRemark, fieldValue:', fieldValueStr)
if (fieldValueStr) {
//
const allRadios = dom.querySelectorAll(`input[type="radio"][data-field="currentPaymentRemark"]`)
console.log('Found radios:', allRadios.length)
allRadios.forEach(radio => {
radio.checked = false
radio.removeAttribute('checked')
const inputValueStr = String(radio.value || '').trim()
console.log('Radio value:', inputValueStr, 'matches?', fieldValueStr === inputValueStr)
if (fieldValueStr === inputValueStr) {
radio.checked = true
radio.setAttribute('checked', 'checked')
// change UI
const changeEvent = new Event('change', { bubbles: true })
radio.dispatchEvent(changeEvent)
// click
const clickEvent = new Event('click', { bubbles: true })
radio.dispatchEvent(clickEvent)
console.log('currentPaymentRemark selected:', {
fieldValue: fieldValueStr,
inputValue: inputValueStr,
radio: radio
})
}
})
}
} else {
const input = dom.querySelector(`[data-field="${field.field}"]`)
if (input) {
if (input.type === 'checkbox' || input.type === 'radio') {
if (String(field.value) === input.value) {
if (!input) return
//
if (input.type === 'checkbox' || input.type === 'radio') {
//
if (field.value !== undefined && field.value !== null && field.value !== '') {
const fieldValueStr = String(field.value).trim()
const inputValueStr = String(input.value).trim()
if (fieldValueStr === inputValueStr) {
input.checked = true
input.setAttribute('checked', 'checked')
}
} else if (input.tagName.toLowerCase() === 'textarea') {
}
} else if (input.tagName.toLowerCase() === 'textarea') {
//
if (field.value !== undefined && field.value !== null) {
input.textContent = field.value
} else {
}
} else {
//
// 使0
if (field.field === 'auditAmount' || field.field === 'currentDuePayment' ||
field.field === 'currentPayment' || field.field === 'totalPaid' ||
field.field === 'totalPlanned') {
input.value = field.value || '0'
} else if (field.value !== undefined && field.value !== null && field.value !== '') {
input.value = field.value
}
}

@ -745,26 +745,26 @@ export default {
// value
//
if (this.getForms && this.getForms.includes('资金划拨审批单')) {
const amountFields = ['contractAmount', 'auditAmount', 'previousPayment', 'currentPayment', 'currentDuePayment', 'totalPaid', 'totalPlanned']
if (amountFields.includes(fieldName)) {
if (fieldName === 'previousPayment' && this.fundLog) {
// previousPaymentthis.fundLogtotal_act_money
input.setAttribute('value', this.fundLog.total_act_money)
} else if (fieldName === 'totalPaid' && this.fundLog) {
// totalPaidthis.fundLog.total_act_money + currentPayment
const currentPaymentInput = dom.querySelector('input[data-field="currentDuePayment"]')
console.log('currentPaymentInput',currentPaymentInput.value)
const currentPaymentValue = currentPaymentInput ? (parseFloat(currentPaymentInput.value) || 0) : 0
const totalPaidValue = (parseFloat(this.fundLog.total_act_money) || 0) + currentPaymentValue
input.setAttribute('value', totalPaidValue.toString())
} else if (!input.value || input.value === '') {
input.setAttribute('value', '0')
} else {
input.setAttribute('value', input.value)
}
} else {
input.setAttribute('value', input.value)
}
// const amountFields = ['contractAmount', 'auditAmount', 'previousPayment', 'currentPayment', 'currentDuePayment', 'totalPaid', 'totalPlanned']
// if (amountFields.includes(fieldName)) {
// if (fieldName === 'previousPayment' && this.fundLog) {
// // previousPaymentthis.fundLogtotal_act_money
// input.setAttribute('value', this.fundLog.total_act_money)
// } else if (fieldName === 'totalPaid' && this.fundLog) {
// // totalPaidthis.fundLog.total_act_money + currentPayment
// const currentPaymentInput = dom.querySelector('input[data-field="currentDuePayment"]')
// console.log('currentPaymentInput',currentPaymentInput.value)
// const currentPaymentValue = currentPaymentInput ? (parseFloat(currentPaymentInput.value) || 0) : 0
// const totalPaidValue = (parseFloat(this.fundLog.total_act_money) || 0) + currentPaymentValue
// input.setAttribute('value', totalPaidValue.toString())
// } else if (!input.value || input.value === '') {
// input.setAttribute('value', '0')
// } else {
// input.setAttribute('value', input.value)
// }
// } else {
// input.setAttribute('value', input.value)
// }
} else {
input.setAttribute('value', input.value)
}

@ -215,6 +215,7 @@
<!-- 新表格的付款登记 -->
<template v-if="scope.row.contract_category &&
scope.row.is_end === 0 &&
scope.row.contract_type !== 180 &&
(!scope.row.contract_category.flow_join || scope.row.join_status === 3) &&
(!scope.row.contract_category.flow_purchase || scope.row.purchase_status === 3) &&
(!scope.row.contract_category.flow_req || scope.row.req_status === 3) &&
@ -233,9 +234,8 @@
<!-- 如果是 履约文件-->
<!-- 那么必须财务审核通过-->
<template v-else>
<template v-if="scope.row.status === 2&&scope.row.is_end===0">
<template v-if="scope.row.status === 2&&scope.row.is_end===0 && scope.row.contract_type !== 180">
<template v-if="scope.row.is_assurance==1">
<template v-if="scope.row.assurance_status==1">
<Button
@ -260,7 +260,7 @@
</template>
</template>
<template v-if="scope.row.is_simple === 1&&scope.row.is_end === 0">
<template v-if="scope.row.is_simple === 1&&scope.row.is_end === 0 && scope.row.contract_type !== 180">
<Button
class="slot-btns-item"
size="small"

@ -810,6 +810,7 @@ export default {
if (row.contract) {
// formsbefore_forms,
if (row.contract.forms || row.contract.before_forms) {
console.log("printPaymentForm")
this.$refs['printPaymentForm'].getDetailFundLog(row.id)
this.$refs['printPaymentForm'].isShow = true
return
@ -819,6 +820,7 @@ export default {
// formsbefore_forms,
const rowIndex = 0 // this.list.findIndex(item => item.id === row.id);
if (rowIndex === 0) { //
console.log("printRegistration")
this.$refs['printRegistration'].getDetailFundLog(row.id)
this.$refs['printRegistration'].isShow = true
} else if (rowIndex === 1) { //

@ -241,7 +241,7 @@
>
重置
</Button>
<!-- <Button type="primary" style="margin-left: 10px"></Button>-->
<Button type="primary" style="margin-left: 10px" @click="downloadExel()"></Button>
</div>
</slot>
</lx-header>
@ -537,6 +537,9 @@ import {
getInfo
} from '@/api/user.js'
import { getContractCategoryTemplateBaseConfig } from '@/api/businessConfig/businessConfig'
import {
download
} from '@/utils/downloadRequest'
import editor from './components/editorContract'
import detail from './components/detailContract'
@ -1167,6 +1170,20 @@ export default {
this.select.pageIndex = 1
this.getContracts()
},
// Excel
downloadExel() {
download(
'/api/admin/contract/index',
'get', {
is_auth: 1,
is_export: 1,
...this.select,
contract_category: [null, this.select.contract_category],
page:1,
page_size:9999
},
'合同列表.xlsx')
},
clearSelectForSearch() {
this.select.plan_id = ''
this.select.plan_name = ''

Loading…
Cancel
Save