事后支付表格
@@ -173,9 +175,9 @@
@@ -349,9 +351,24 @@
}
],
showZoomedTable: false, // 控制放大表格弹窗的显示
+ hasPostPaymentForm: false, // 是否有事后支付表格
}
},
methods: {
+ getDefaultPaymentRegistrationForm() {
+ return {
+ applyMoney: "",
+ deductionMoney: "",
+ audit_money: "",
+ act_date: '',
+ type: "",
+ isLast: false,
+ end_time:'',
+ isCheck:false,
+ plan: [],
+ remark: ""
+ }
+ },
checkIsEnd (e) {
this.paymentRegistrationForm.isLast = (Number(this.totalMoney()) + Number(e)) >= (this.contract.money * 0.95);
},
@@ -406,7 +423,6 @@
this.contract = await detailContract({
id: info.id
});
-
this.paymentRegistrationForm.plan = this.contract.plans.map(item => {
return {
plan_id: item.id,
@@ -414,29 +430,27 @@
new_money: item.money,
}
});
-
this.form.audit_money = this.contract.audit_money;
-
const res = await getFundLog({
contract_id: this.contract.id,
page: 1,
page_size: 999
})
-
this.payment = res.data;
- console.log(this.contract.contract_template)
- console.log(this.contract.forms)
- // 获取合同模板和表单数据
- if (this.contract.contract_template) {
+ // 判断是否有事后支付表格模板
+ if (this.contract.contract_template && this.contract.contract_template.template) {
+ this.hasPostPaymentForm = true;
+ this.currentStep = 1;
this.contractTemplate = this.contract.contract_template.template;
this.forms = this.contract.forms;
-
- // 确保 contract_template_fields 存在
if (!this.contract.contract_template.contract_template_fields) {
this.contract.contract_template.contract_template_fields = this.contract.other_data || [];
}
-
- console.log('Contract template fields:', this.contract.contract_template.contract_template_fields);
+ } else {
+ this.hasPostPaymentForm = false;
+ this.currentStep = 1;
+ this.contractTemplate = null;
+ this.forms = null;
}
},
@@ -561,17 +575,32 @@
}
},
nextStep() {
- // 使用和提交一样的验证逻辑
- this.$refs['paymentRegistration'].$refs['elForm'].validate().then(res => {
- if (res) {
- this.currentStep = 2;
+ // 如果有事后支付表格,下一步不做表单校验,直接切换 currentStep=2
+ if (this.hasPostPaymentForm) {
+ // 保存事后支付表格HTML数据,参考 openZoomedTable 逻辑
+ const dom = this.$refs.zoomedForms || this.$refs.zoomedTemplate;
+ if (dom && this.contract.contract_template) {
+ this.forms = syncFormDomToHtml(dom, this.contract.contract_template.contract_template_fields);
+ this.contract.forms = this.forms;
}
- }).catch(err => {
- this.$Message.warning({
- content: '请填写完整信息',
- duration: 1
- });
- });
+ this.currentStep = 2;
+ } else {
+ // 没有事后支付表格时,下一步其实就是提交,校验在 submit 里
+ if (this.$refs['paymentRegistration'] && this.$refs['paymentRegistration'].$refs['elForm']) {
+ this.$refs['paymentRegistration'].$refs['elForm'].validate().then(res => {
+ if (res) {
+ this.submit();
+ }
+ }).catch(err => {
+ this.$Message.warning({
+ content: '请填写完整信息',
+ duration: 1
+ });
+ });
+ } else {
+ this.submit();
+ }
+ }
},
resetForm() {
@@ -611,6 +640,13 @@
if (newVal) {
this.getBudgets();
this.currentStep = 1; // 重置到第一步
+ this.paymentRegistrationForm = this.getDefaultPaymentRegistrationForm(); // 每次弹窗打开时重置表单
+ // 重置校验状态,避免立刻弹出必填项提示
+ this.$nextTick(() => {
+ if (this.$refs.paymentRegistration && this.$refs.paymentRegistration.$refs.elForm) {
+ this.$refs.paymentRegistration.$refs.elForm.resetFields();
+ }
+ });
}
}
},
diff --git a/src/views/contract/components/printPaymentForm.vue b/src/views/contract/components/printPaymentForm.vue
index c46e8c2..bec9292 100644
--- a/src/views/contract/components/printPaymentForm.vue
+++ b/src/views/contract/components/printPaymentForm.vue
@@ -6,6 +6,7 @@
事前审批表格
事后支付表格
+ 财务审核表
@@ -18,10 +19,46 @@