diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index bcec73c..97ffb20 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -489,7 +489,7 @@ export default { // 移除必选验证规则 ], postPaymentForm: [ - { required: true, message: '请选择事后支付表格', trigger: 'change' } + // 移除必选验证规则 ] }, originalPrePaymentForm: '', diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 0f0675f..764c2ec 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -389,9 +389,9 @@ - - - + @@ -405,30 +405,13 @@ -
- - - - -
- - {{ getDepartmentName(id) }} - -
+ +
+ + {{ getDepartmentName(id) }} +
@@ -437,30 +420,13 @@ -
- - - - -
- - {{ getMoneyWayName(id) }} - -
+ +
+ + {{ getMoneyWayName(id) }} +
@@ -492,13 +458,23 @@
-
事前支付表格
-
+
+ 事前支付表格 + 放大 +
+
+
+
-
事后支付表格
-
+
+ 事后支付表格 + 放大 +
+
+
+
@@ -656,6 +632,24 @@ + + +
+
+
+
+
+
+
+
@@ -706,6 +700,31 @@ import govPlane from './components/govPlane.vue'; import { download } from '@/utils/downloadRequest' + +function syncFormDomToHtml(dom, contractTemplateFields) { + if (!dom) return ''; + const inputs = dom.querySelectorAll('input, select, textarea'); + inputs.forEach(input => { + const fieldName = input.getAttribute('data-field'); + if (fieldName && contractTemplateFields) { + const field = contractTemplateFields.find(f => f.field === fieldName); + if (field) { + if (input.type === 'checkbox' || input.type === 'radio') { + const checkedInput = dom.querySelector(`[data-field="${fieldName}"]:checked`); + field.value = checkedInput ? checkedInput.value : ''; + if (checkedInput) { + checkedInput.setAttribute('checked', 'checked'); + } + } else { + field.value = input.value; + input.setAttribute('value', input.value); + } + } + } + }); + return dom.innerHTML; +} + export default { components: { editor, @@ -1373,6 +1392,8 @@ export default { is_plan: true, // 预算内确定项目编辑权限 is_substitute: true // 代建项目编辑权限 }, + showPaymentFormPreview: false, + previewType: '', // 'before' or 'after' } }, methods: { @@ -2899,8 +2920,8 @@ export default { // 3. 通过正常的流程来初始化下拉框 // 设置分类 if (detail.contract_category) { - this.form.category = detail.contract_category; - this.handleCategoryChange(detail.contract_category); + this.form.category = detail.contract_category.category; + this.handleCategoryChange(detail.contract_category.category); } // 设置事项类型 @@ -3169,6 +3190,35 @@ export default { this.$Message.error('检查表单时发生错误'); } }, + openPaymentFormPreview(type) { + this.previewType = type; + if (type === 'before') { + const dom = this.$refs.beforePaymentForm; + if (dom && this.form.before_contract_template) { + this.form.before_forms = syncFormDomToHtml(dom, this.form.before_contract_template.contract_template_fields); + } + } else { + const dom = this.$refs.afterPaymentForm; + if (dom && this.form.contract_template) { + this.form.forms = syncFormDomToHtml(dom, this.form.contract_template.contract_template_fields); + } + } + this.showPaymentFormPreview = true; + }, + handlePaymentFormPreviewClose() { + if (this.previewType === 'before') { + const dom = this.$refs.previewBeforePaymentForm; + if (dom && this.form.before_contract_template) { + this.form.before_forms = syncFormDomToHtml(dom, this.form.before_contract_template.contract_template_fields); + } + } else { + const dom = this.$refs.previewAfterPaymentForm; + if (dom && this.form.contract_template) { + this.form.forms = syncFormDomToHtml(dom, this.form.contract_template.contract_template_fields); + } + } + this.showPaymentFormPreview = false; + }, }, mounted() { this.window.width = screen.availWidth * 0.95 @@ -3631,4 +3681,7 @@ export default { right: 0; left: auto; } + .payment-preview-modal { + z-index: 4000 !important; + }