备注-显示
@@ -524,6 +613,10 @@ export default {
remarkShow: false,
remarkRequired: false,
itemTypeDefault: '',
+ payAmountDefault: '',
+ deductAmountDefault: '',
+ auditAmountDefault: '',
+ isLastDefault: '',
},
rules: {
category: [
@@ -591,48 +684,45 @@ export default {
// 处理返回数据
if (res.data && Array.isArray(res.data)) {
- // 格式化表格数据
- this.tableData = res.data.map((item, index) => {
- return {
- index: index + 1,
- id: item.id,
- // 保存原始ID,用于编辑
- category_id: item.category,
- work_type_id: item.work_type,
- contract_type_id: item.contract_type,
- purchase_form_id: item.purchase_form,
- // 使用详细信息中的name字段,如果为空显示'-'
- category: item.category_detail?.value || '-',
- affairType: item.work_type_detail?.value || '-',
- contractType: item.contract_type_detail?.value || '-',
- purchaseForm: item.purchase_form_detail?.value || '-',
- purchaseWay: item.purchase_way || false,
- purchaseMethod: item.purchase_method,
- projectName: item.project_name || false,
- projectType: item.project_type || false,
- budgetPrice: item.budget_price || false,
- fundChannel: item.fund_channel || false,
- budgetPlan: item.budget_plan || false,
- request: item.flow_req || false,
- purchaseApproval: item.flow_purchase || false,
- tenderReview: item.flow_invite || false,
- contractSign: item.flow_join || false,
- prePaymentForm: item.before_contract_template?.name || '-',
- postPaymentForm: item.contract_template?.name || '-',
- // 保存支付表格ID
- before_contract_template_id: item.before_contract_template_id,
- contract_template_id: item.contract_template_id,
- // 添加合同配置字段
- is_simple_default: item.is_simple_default || 0,
- has_charge_default: item.has_charge_default || 0,
- is_plan_default: item.is_plan_default || 0,
- is_substitute_default: item.is_substitute_default || 0,
- edit_is_simple: item.edit_is_simple || 0,
- edit_has_charge: item.edit_has_charge || 0,
- edit_is_plan: item.edit_is_plan || 0,
- edit_is_substitute: item.edit_is_substitute || 0
- }
- })
+ this.tableData = res.data.map((item, index) => ({
+ // 原有自定义字段
+ index: index + 1,
+ id: item.id,
+ category_id: item.category,
+ work_type_id: item.work_type,
+ contract_type_id: item.contract_type,
+ purchase_form_id: item.purchase_form,
+ affairType: item.work_type_detail?.value || '-',
+ contractType: item.contract_type_detail?.value || '-',
+ purchaseForm: item.purchase_form_detail?.value || '-',
+ purchaseWay: item.purchase_way || false,
+ purchaseMethod: item.purchase_method,
+ projectName: item.project_name || false,
+ projectType: item.project_type || false,
+ budgetPrice: item.budget_price || false,
+ fundChannel: item.fund_channel || false,
+ budgetPlan: item.budget_plan || false,
+ request: item.flow_req || false,
+ purchaseApproval: item.flow_purchase || false,
+ tenderReview: item.flow_invite || false,
+ contractSign: item.flow_join || false,
+ prePaymentForm: item.before_contract_template?.name || '-',
+ postPaymentForm: item.contract_template?.name || '-',
+ before_contract_template_id: item.before_contract_template_id,
+ contract_template_id: item.contract_template_id,
+ is_simple_default: item.is_simple_default || 0,
+ has_charge_default: item.has_charge_default || 0,
+ is_plan_default: item.is_plan_default || 0,
+ is_substitute_default: item.is_substitute_default || 0,
+ edit_is_simple: item.edit_is_simple || 0,
+ edit_has_charge: item.edit_has_charge || 0,
+ edit_is_plan: item.edit_is_plan || 0,
+ edit_is_substitute: item.edit_is_substitute || 0,
+ // 合并接口所有字段
+ ...item,
+ // 最后强制category为自定义值,确保第一列合同分类不被覆盖
+ category: item.category_detail?.value || '-',
+ }))
} else {
this.tableData = []
}
@@ -874,7 +964,6 @@ export default {
has_charge_editable: true,
isBudget_editable: true,
is_substitute_editable: true,
- advancePayment: false,
payAmountShow: false,
payAmountRequired: false,
deductAmountShow: false,
@@ -890,6 +979,10 @@ export default {
remarkShow: false,
remarkRequired: false,
itemTypeDefault: '',
+ payAmountDefault: '',
+ deductAmountDefault: '',
+ auditAmountDefault: '',
+ isLastDefault: '',
}
// 使用搜索区域的解析逻辑
@@ -940,22 +1033,25 @@ export default {
has_charge: row.has_charge_default,
isBudget: row.is_plan_default,
is_substitute: row.is_substitute_default,
- advancePayment: row.advancePayment === true || row.advancePayment === 1,
- payAmountShow: row.payAmountShow === true || row.payAmountShow === 1,
- payAmountRequired: row.payAmountRequired === true || row.payAmountRequired === 1,
- deductAmountShow: row.deductAmountShow === true || row.deductAmountShow === 1,
- deductAmountRequired: row.deductAmountRequired === true || row.deductAmountRequired === 1,
- auditAmountShow: row.auditAmountShow === true || row.auditAmountShow === 1,
- auditAmountRequired: row.auditAmountRequired === true || row.auditAmountRequired === 1,
- realPayDateShow: row.realPayDateShow === true || row.realPayDateShow === 1,
- realPayDateRequired: row.realPayDateRequired === true || row.realPayDateRequired === 1,
- itemTypeShow: row.itemTypeShow === true || row.itemTypeShow === 1,
- itemTypeRequired: row.itemTypeRequired === true || row.itemTypeRequired === 1,
- isLastShow: row.isLastShow === true || row.isLastShow === 1,
- isLastRequired: row.isLastRequired === true || row.isLastRequired === 1,
- remarkShow: row.remarkShow === true || row.remarkShow === 1,
- remarkRequired: row.remarkRequired === true || row.remarkRequired === 1,
- itemTypeDefault: row.itemTypeDefault || '',
+ payAmountShow: row.show_apply_money === 1,
+ payAmountRequired: row.required_apply_money === 1,
+ deductAmountShow: row.show_discount_money === 1,
+ deductAmountRequired: row.required_discount_money === 1,
+ auditAmountShow: row.show_audit_money === 1,
+ auditAmountRequired: row.required_audit_money === 1,
+ realPayDateShow: row.show_act_date === 1,
+ realPayDateRequired: row.required_act_date === 1,
+ itemTypeShow: row.show_type === 1,
+ itemTypeRequired: row.required_type === 1,
+ isLastShow: row.show_is_end === 1,
+ isLastRequired: row.required_is_end === 1,
+ remarkShow: row.show_remark === 1,
+ remarkRequired: row.required_remark === 1,
+ payAmountDefault: row.default_apply_money ?? '',
+ deductAmountDefault: row.default_discount_money ?? '',
+ auditAmountDefault: row.default_audit_money ?? '',
+ isLastDefault: row.default_is_end !== undefined && row.default_is_end !== '' ? Number(row.default_is_end) : '',
+ itemTypeDefault: row.default_type !== undefined && row.default_type !== null ? String(row.default_type) : '',
}
// 保存原始支付表格值
@@ -1085,7 +1181,6 @@ export default {
flow_invite: this.form.tenderReview,
flow_join: this.form.contractSign,
-
// 新增参数
edit_is_simple: this.form.is_simple_editable ? 1 : 0,
edit_has_charge: this.form.has_charge_editable ? 1 : 0,
@@ -1096,21 +1191,26 @@ export default {
has_charge_default: this.form.has_charge,
is_plan_default: this.form.isBudget,
is_substitute_default: this.form.is_substitute,
- advancePayment: this.form.advancePayment ? 1 : 0,
- payAmountShow: this.form.payAmountShow ? 1 : 0,
- payAmountRequired: this.form.payAmountRequired ? 1 : 0,
- deductAmountShow: this.form.deductAmountShow ? 1 : 0,
- deductAmountRequired: this.form.deductAmountRequired ? 1 : 0,
- auditAmountShow: this.form.auditAmountShow ? 1 : 0,
- auditAmountRequired: this.form.auditAmountRequired ? 1 : 0,
- realPayDateShow: this.form.realPayDateShow ? 1 : 0,
- realPayDateRequired: this.form.realPayDateRequired ? 1 : 0,
- itemTypeShow: this.form.itemTypeShow ? 1 : 0,
- itemTypeRequired: this.form.itemTypeRequired ? 1 : 0,
- isLastShow: this.form.isLastShow ? 1 : 0,
- isLastRequired: this.form.isLastRequired ? 1 : 0,
- remarkShow: this.form.remarkShow ? 1 : 0,
- remarkRequired: this.form.remarkRequired ? 1 : 0
+
+ show_apply_money: this.form.payAmountShow,
+ required_apply_money: this.form.payAmountRequired,
+ show_discount_money: this.form.deductAmountShow,
+ required_discount_money: this.form.deductAmountRequired,
+ show_audit_money: this.form.auditAmountShow,
+ required_audit_money: this.form.auditAmountRequired,
+ show_act_date: this.form.realPayDateShow,
+ required_act_date: this.form.realPayDateRequired,
+ show_type: this.form.itemTypeShow,
+ required_type: this.form.itemTypeRequired,
+ default_type: this.form.itemTypeDefault,
+ show_is_end: this.form.isLastShow,
+ required_is_end: this.form.isLastRequired,
+ show_remark: this.form.remarkShow,
+ required_remark: this.form.remarkRequired,
+ default_apply_money: this.form.payAmountDefault,
+ default_discount_money: this.form.deductAmountDefault,
+ default_audit_money: this.form.auditAmountDefault,
+ default_is_end: this.form.isLastDefault,
}
// 如果是编辑模式
diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue
index 2498c03..619fc17 100644
--- a/src/views/contract/components/paymentRegistration.vue
+++ b/src/views/contract/components/paymentRegistration.vue
@@ -60,8 +60,11 @@
-
-
实付日期
+
+
+ *
+ 实付日期
+
@@ -70,9 +73,9 @@
-
+
- *申请付款金额
+ *申请付款金额
-
-
审计金额
+
-
+
- *本期扣款金额
+ *本期扣款金额
-
-
备注
+
+
+ *备注
+
@@ -113,9 +120,9 @@
-
+
- *款项类型
+ *款项类型
-
+
- *是否为最后一笔
+ *是否为最后一笔
@@ -139,7 +146,7 @@
-
+
项目完成时间
@@ -149,7 +156,7 @@
-
+
是否验收
@@ -300,30 +307,30 @@
form: {
audit_money: 0
},
- paymentRegistrationRules: {
- applyMoney: [{
- required: true,
- message: "必填"
- },
- {
- pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
- message: '必须为数字'
- }
- ],
- deductionMoney: [{
- required: true,
- message: "必填"
- },
- {
- pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
- message: '必须为数字'
- }
- ],
- type: [{
- required: true,
- message: "必选"
- }]
- },
+ // paymentRegistrationRules: {
+ // applyMoney: [{
+ // required: true,
+ // message: "必填"
+ // },
+ // {
+ // pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
+ // message: '必须为数字'
+ // }
+ // ],
+ // deductionMoney: [{
+ // required: true,
+ // message: "必填"
+ // },
+ // {
+ // pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
+ // message: '必须为数字'
+ // }
+ // ],
+ // type: [{
+ // required: true,
+ // message: "必选"
+ // }]
+ // },
planTable: [{
sortable: false,
width: 36,
@@ -352,6 +359,7 @@
],
showZoomedTable: false, // 控制放大表格弹窗的显示
hasPostPaymentForm: false, // 是否有事后支付表格
+ contract_category: {},
}
},
methods: {
@@ -370,7 +378,7 @@
}
},
checkIsEnd (e) {
- this.paymentRegistrationForm.isLast = (Number(this.totalMoney()) + Number(e)) >= (this.contract.money * 0.95);
+ // this.paymentRegistrationForm.isLast = (Number(this.totalMoney()) + Number(e)) >= (this.contract.money * 0.95);
},
async getPlanTypes() {
@@ -431,6 +439,82 @@
}
});
this.form.audit_money = this.contract.audit_money;
+ this.contract_category = this.contract.contract_category || {};
+ // 设置默认值
+ if (this.contract_category && this.contract_category.default_apply_money !== undefined) {
+ this.paymentRegistrationForm.applyMoney = this.contract_category.default_apply_money;
+ }
+ if (this.contract_category && this.contract_category.default_discount_money !== undefined) {
+ this.paymentRegistrationForm.deductionMoney = this.contract_category.default_discount_money;
+ }
+ if (this.contract_category && this.contract_category.default_audit_money !== undefined) {
+ this.paymentRegistrationForm.audit_money = this.contract_category.default_audit_money;
+ }
+ if (this.contract_category && this.contract_category.default_act_date !== undefined) {
+ this.paymentRegistrationForm.act_date = this.contract_category.default_act_date;
+ }
+ if (this.contract_category && this.contract_category.default_type !== undefined) {
+ this.paymentRegistrationForm.type = this.contract_category.default_type;
+ }
+ if (this.contract_category && this.contract_category.default_is_end !== undefined) {
+ this.paymentRegistrationForm.isLast = this.contract_category.default_is_end == 1 || this.contract_category.default_is_end === '1';
+ }
+ if (this.contract_category && this.contract_category.default_remark !== undefined) {
+ this.paymentRegistrationForm.remark = this.contract_category.default_remark;
+ }
+ // 动态生成rules
+ this.paymentRegistrationRules = {
+ applyMoney: [
+ {
+ required: this.contract_category.required_apply_money == 1,
+ message: '必填'
+ },
+ {
+ pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
+ message: '必须为数字'
+ }
+ ],
+ deductionMoney: [
+ {
+ required: this.contract_category.required_discount_money == 1,
+ message: '必填'
+ },
+ {
+ pattern: /(^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d{1,2})?$)/,
+ message: '必须为数字'
+ }
+ ],
+ audit_money: [
+ {
+ required: this.contract_category.required_audit_money == 1,
+ message: '必填'
+ }
+ ],
+ type: [
+ {
+ required: this.contract_category.required_type == 1,
+ message: '必选'
+ }
+ ],
+ isLast: [
+ {
+ required: this.contract_category.required_is_end == 1,
+ message: '必选'
+ }
+ ],
+ remark: [
+ {
+ required: this.contract_category.required_remark == 1,
+ message: '必填'
+ }
+ ],
+ act_date: [
+ {
+ required: this.contract_category.required_act_date == 1,
+ message: '必填'
+ }
+ ]
+ };
const res = await getFundLog({
contract_id: this.contract.id,
page: 1,
@@ -455,72 +539,87 @@
},
submit() {
- // 保存事后支付表格的数据
- if (this.contract.contract_template) {
- const dom = this.$refs.zoomedForms || this.$refs.zoomedTemplate;
- if (dom) {
- // 获取所有输入控件
- const inputs = dom.querySelectorAll('input, select, textarea');
-
- // 遍历所有输入控件,更新值到 HTML
- inputs.forEach(input => {
- const fieldName = input.getAttribute('data-field');
- if (fieldName) {
- const field = this.contract.contract_template.contract_template_fields.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 : '';
- // 更新 HTML 中的 checked 状态
- if (checkedInput) {
- checkedInput.setAttribute('checked', 'checked');
+ // 先进行表单校验
+ this.$refs['paymentRegistration'].$refs['elForm'].validate().then(res => {
+ if (res) {
+ // 保存事后支付表格的数据
+ if (this.contract.contract_template) {
+ const dom = this.$refs.zoomedForms || this.$refs.zoomedTemplate;
+ if (dom) {
+ // 获取所有输入控件
+ const inputs = dom.querySelectorAll('input, select, textarea');
+
+ // 遍历所有输入控件,更新值到 HTML
+ inputs.forEach(input => {
+ const fieldName = input.getAttribute('data-field');
+ if (fieldName) {
+ const field = this.contract.contract_template.contract_template_fields.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 : '';
+ // 更新 HTML 中的 checked 状态
+ if (checkedInput) {
+ checkedInput.setAttribute('checked', 'checked');
+ }
+ } else {
+ field.value = input.value;
+ // 更新 HTML 中的 value
+ input.setAttribute('value', input.value);
+ }
}
- } else {
- field.value = input.value;
- // 更新 HTML 中的 value
- input.setAttribute('value', input.value);
}
- }
- }
- });
+ });
- // 获取更新后的 HTML
- this.forms = dom.innerHTML;
- }
- }
+ // 获取更新后的 HTML
+ this.forms = dom.innerHTML;
+ }
+ }
- let data = {
- contract_id: this.contract.id,
- apply_money: this.paymentRegistrationForm.applyMoney,
- discount_money: this.paymentRegistrationForm.deductionMoney,
- type: this.paymentRegistrationForm.type,
- is_end: this.paymentRegistrationForm.isLast ? 1 : 0,
- remark: this.paymentRegistrationForm.remark,
- audit_money: this.paymentRegistrationForm.audit_money,
- end_time:this.paymentRegistrationForm.end_time,
- is_check:this.paymentRegistrationForm.isCheck ? 1 : 0,
- // 提交更新后的HTML和字段数据
- forms: this.forms,
- other_data: this.contract.contract_template?.contract_template_fields || []
- }
- addFundLog(data).then(res => {
- this.isShowPaymentRegistration = false
- //付款申请后同时更新一下合同中审计金额
- editorContract({
- id: this.contract.id,
- audit_money: this.form.audit_money,
- // 同时更新合同的事后支付表格数据
- forms: this.forms,
- other_data: this.contract.contract_template?.contract_template_fields || []
- }).then(r => {
- Message({
- type: 'success',
- message: "操作成功"
+ let data = {
+ contract_id: this.contract.id,
+ apply_money: this.paymentRegistrationForm.applyMoney,
+ discount_money: this.paymentRegistrationForm.deductionMoney,
+ type: this.paymentRegistrationForm.type,
+ is_end: this.paymentRegistrationForm.isLast ? 1 : 0,
+ remark: this.paymentRegistrationForm.remark,
+ audit_money: this.paymentRegistrationForm.audit_money,
+ end_time:this.paymentRegistrationForm.end_time,
+ is_check:this.paymentRegistrationForm.isCheck ? 1 : 0,
+ // 提交更新后的HTML和字段数据
+ forms: this.forms,
+ other_data: this.contract.contract_template?.contract_template_fields || []
+ }
+ addFundLog(data).then(res => {
+ this.isShowPaymentRegistration = false
+ //付款申请后同时更新一下合同中审计金额
+ editorContract({
+ id: this.contract.id,
+ audit_money: this.form.audit_money,
+ // 同时更新合同的事后支付表格数据
+ forms: this.forms,
+ other_data: this.contract.contract_template?.contract_template_fields || []
+ }).then(r => {
+ Message({
+ type: 'success',
+ message: "操作成功"
+ })
+ });
+ this.$refs['paymentRegistration'].reset()
})
+ } else {
+ this.$Message.warning({
+ content: '请填写完整信息',
+ duration: 1
+ });
+ }
+ }).catch(err => {
+ this.$Message.warning({
+ content: '请填写完整信息',
+ duration: 1
});
- this.$refs['paymentRegistration'].reset()
- })
+ });
},
//计划