From e8755d33c110d845f97d6ca018f89a00425d8665 Mon Sep 17 00:00:00 2001 From: lynn Date: Wed, 23 Apr 2025 17:31:33 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E6=8B=89=E5=8F=96=E7=AD=9B=E9=80=89=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/businessConfig/contractConfig.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index b51e30f..428dcbc 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -850,7 +850,8 @@ export default { // 获取支付表格选项 async getPaymentFormOptions() { try { - const res = await getContractFormList({}) + // 只请求已启用的支付表格(status=1) + const res = await getContractFormList({ status: 1 }) if (res.errcode !== undefined) { this.$message.error(res.errmsg || '获取支付表格选项失败') return @@ -862,7 +863,9 @@ export default { id: item.id, label: item.name || item.title || `附件${item.id}` })) - this.originalPaymentForm = res.data[0].id // 保存原始支付表格ID + if (res.data.length > 0) { + this.originalPaymentForm = res.data[0].id // 保存原始支付表格ID + } } else { this.paymentFormOptions = [] } From 8609b6e889b9050aca3fa283de1a488356eef56b Mon Sep 17 00:00:00 2001 From: lynn Date: Thu, 24 Apr 2025 19:13:40 +0800 Subject: [PATCH 02/16] =?UTF-8?q?8=E4=B8=AA=E8=A1=A8=E5=8D=95=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/businessConfig/EditPayForm.vue | 1466 +++++++++++--- src/views/businessConfig/contractConfig.vue | 6 +- src/views/contract/contractList_bk.vue | 1885 +++++++++++++++++++ 3 files changed, 3046 insertions(+), 311 deletions(-) create mode 100644 src/views/contract/contractList_bk.vue diff --git a/src/views/businessConfig/EditPayForm.vue b/src/views/businessConfig/EditPayForm.vue index a4421b7..abd08f4 100644 --- a/src/views/businessConfig/EditPayForm.vue +++ b/src/views/businessConfig/EditPayForm.vue @@ -173,7 +173,7 @@ export default { previewContent: '', // 预览内容 showEditDrawer: false, showPreviewModal: false, // 添加预览模态窗口控制变量 - currentTemplateIndex: 0, + currentTemplateIndex: 8, editForm: { field: '', // Renamed from name to field name: '', // Renamed from label to name (Chinese name) @@ -190,7 +190,7 @@ export default { content:'' }, { - name: '资金划拨审批单', + name: '苏州市河道管理处资金划拨审批单', content: `
@@ -198,14 +198,34 @@ export default { - - + + - + - + @@ -215,97 +235,201 @@ export default { - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - -
项目名称:\${projectName}本次为第\${paymentTimes}次付款 +
+ +
+
\${projectName}
+
本次为第 +
+ +
+
\${paymentTimes}
+
次付款
承包商/供货商:\${contractor} +
+ +
+
\${contractor}
+
合同服务时间:\${serviceTime} +
+ +
+
\${serviceTime}
+
付款情形
A 合同金额\${contractAmount}\${contractRemark} +
+ +
+
\${contractAmount}
+
+
+ +
+
\${contractRemark}
+
B 审计金额\${auditAmount}\${auditRemark} +
+ +
+
\${auditAmount}
+
+
+ +
+
\${auditRemark}
+
C 前期累计已付款\${previousPayment}\${previousPaymentRemark} +
+ +
+
\${previousPayment}
+
+
+ +
+
\${previousPaymentRemark}
+
D 本期拟款\${currentPayment}\${currentPaymentRemark} +
+ +
+
\${currentPayment}
+
+
+ +
+
\${currentPaymentRemark}
+
E 本期应付款\${currentDuePayment} -
-
- - - +
+
-
- - +
\${currentDuePayment}
+
+
+
- -
\${paymentType}
+
\${paymentType}
F 累计支付\${totalPaid}\${totalPaidRemark} +
+ +
+
\${totalPaid}
+
+
+ +
+
\${totalPaidRemark}
+
G 累计拟款\${totalPlanned}\${totalPlannedRemark} +
+ +
+
\${totalPlanned}
+
+
+ +
+
\${totalPlannedRemark}
+
H 质保金\${warranty} +
+ +
+
\${warranty}
+
+
+
+ + %,质保期 + + 年,需审计的以审计价为计费依据。 +
+
+
\${percent}%,质保期\${zbYear}年,需审计的以审计价为计费依据。 +
资金划支渠道:
业务科室:
-
  \${department}
+
+
+ +
+
\${department}
+
经办人:
-
  \${handler}
+
+
+ +
+
\${handler}
+
业务科室负责人:
-
  \${departmentHead}
+
+
+ +
+
\${departmentHead}
+
业务科室分管领导:
-
  \${departmentLeader}
+
+
+ +
+
\${departmentLeader}
+
财务审计科:
-
  \${financeDepartment}
+
+
+ +
+
\${financeDepartment}
+
财务审计科分管领导:
-
  \${financeLeader}
+
+
+ +
+
\${financeLeader}
+
单位负责人:
-
  \${unitLeader}
+
+
+ +
+
\${unitLeader}
+
@@ -318,170 +442,194 @@ export default {

苏州市河道管理处报销贴单

-
科室:\${department}
-
\${year}年\${month}月\${day}日
+
科室:
\${department}
+
\${date}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - -
用途说明金额报销(领款)人\${handler}附单据\${receipts}张
\${purpose1}\${amount1}
\${purpose2}\${amount2}科室负责人\${departmentHead}
\${purpose3}\${amount3}
\${purpose4}\${amount4}财审科审核\${financeApproval}
\${purpose5}\${amount5}
\${purpose6}\${amount6}分管领导审核\${leaderApproval}
\${purpose7}\${amount7}
\${purpose8}\${amount8}财务分管领导审核\${financeLeaderApproval}
\${purpose9}\${amount9}
合计\${total}单位负责人审批\${unitLeaderApproval}
报销金额(大写) -
- - - - - - - +
职工姓名 +
+
+
\${name}
+
退休/在职 +
+ +
+
\${status}
+
家属姓名 +
+ +
+
\${familyName}
+
与本人关系 +
+ +
+
\${relation}
-
-
` - }, - { - name: '苏州市河道管理处报销贴单', - content: ` -
-
-

苏州市河道管理处报销贴单

-
- 科室:\${department} - \${year}年\${month}月\${day}日 -
- - - - - - - - - - - - - - - - + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - + - - - + + + - - + - - - + + + - - - - + + + + - - + +
职工姓名\${name}退休/在职\${status}家属姓名\${familyName}与本人关系\${relation}
内容发票金额报销比例\${medicalActualAmount}\${name}内容发票金额报销比例 +
+ +
+
\${medicalActualAmount}
+
报销(领款)人 +
+ +
+
\${name}
+
门诊医药费\${medicalInvoiceValue}\${medicalReimbursementRatio}\${medicalActualAmount}门诊医药费 +
+ +
+
\${medicalInvoiceValue}
+
+
+ +
+
\${medicalReimbursementRatio}
+
+
+ +
+
\${medicalActualAmount}
+
住院医药费\${hospitalInvoiceValue}\${hospitalReimbursementRatio}\${hospitalActualAmount}科室负责人\${departmentHead}住院医药费 +
+ +
+
\${hospitalInvoiceValue}
+
+
+ +
+
\${hospitalReimbursementRatio}
+
+
+ +
+
\${hospitalActualAmount}
+
科室负责人 +
+ +
+
\${departmentHead}
+
儿童医药费\${childMedicalInvoiceValue}\${childMedicalReimbursementRatio}\${childMedicalActualAmount}财审科审核\${financialAudit}儿童医药费 +
+ +
+
\${childMedicalInvoiceValue}
+
+
+ +
+
\${childMedicalReimbursementRatio}
+
+
+ +
+
\${childMedicalActualAmount}
+
财审科审核 +
+ +
+
\${financialAudit}
+
幼托费用\${childcareInvoiceValue}幼托费用 \${childcareActualAmount}分管领导审核\${leaderAudit} +
+ +
+
\${childcareActualAmount}
+
分管领导审核 +
+ +
+
\${leaderAudit}
+
子女保险费\${childInsuranceInvoiceValue}子女保险费 \${childInsuranceActualAmount}财务分管领导审核\${financialLeaderAudit} +
+ +
+
\${childInsuranceActualAmount}
+
财务分管领导审核 +
+ +
+
\${financialLeaderAudit}
+
合计\${totalAmount}单位负责人审批\${unitLeaderAudit}合计 +
+ +
+
\${totalAmount}
+
单位负责人审批 +
+ +
+
\${unitLeaderAudit}
+
报销金额(大写)\${upperCaseAmount}报销金额(大写) +
+ +
+
\${upperCaseAmount}
+
@@ -489,7 +637,7 @@ export default {
` }, { - name: '公务接待结算单', + name: '苏州市河道管理处公务接待结算单', content: `
@@ -498,43 +646,94 @@ export default { 科室 - \${getDepartment} + +
+ +
+
\${getDepartment}
+ 事由 - \${getReason} + +
+ +
+
\${getReason}
+ 日期 - \${getDate} + +
+ +
+
\${getDate}
+ 就餐地点 - \${getDiningLocation} + +
+ +
+
\${getDiningLocation}
+ 就餐人数 接待人数 - \${getVisitorCount} + +
+ +
+
\${getVisitorCount}
+ 金额(元) 餐费 - \${getMealsFee} + +
+ +
+
\${getMealsFee}
+ 陪同人数 - \${getAccompanyCount} + +
+ +
+
\${getAccompanyCount}
+ 住宿费 - \${getAccommodationFee} - - - 科室经办人 - \${getHandler} - 综合科意见 - \${getComprehensiveOpinion} + +
+ +
+
\${getAccommodationFee}
+ - 分管领导意见 - \${getLeaderOpinion} + 经办人 + +
+ +
+
\${getOperator}
+ + 审核人 + +
+ +
+
\${getReviewer}
+ - 备注 - \${getRemark} + 备注 + +
+ +
+
\${getRemarks}
+ @@ -548,72 +747,85 @@ export default {

苏州市河道管理处会议审批表

- \${year}年 - \${month}月 - \${day}日 +
+ +
+
\${date}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
申请部门\${department}
会议名称\${meetingName}
会议类别\${meetingType}类会议
会议起止日期及天数\${duration}
会议地点\${location}
会议规模代表人数:\${representativeCount} 工作人员数:\${staffCount}
会议经费预算(元)\${totalBudget}
其中:住宿费\${accommodationFee}申请部门 +
+ +
+
\${department}
+
伙食费\${mealsFee}会议名称 +
+ +
+
\${meetingName}
+
租场费\${venueFee}会议时间 +
+ +
+
\${meetingTime}
+
其他费用\${otherFees}会议地点 +
+ +
+
\${meetingLocation}
+
科室负责人审核\${departmentApproval}参会人员 +
+ +
+
\${participants}
+
分管领导审核\${sectionApproval}会议内容 +
+ +
+
\${meetingContent}
+
综合科审核\${comprehensiveApproval}经办人 +
+ +
+
\${operator}
+
单位负责人审核\${unitApproval}审核人 +
+ +
+
\${reviewer}
+
@@ -629,42 +841,96 @@ export default { 申请科室 - \${department} - 申请理由 - \${reason} + +
+ +
+
\${department}
+ + 申请理由 + +
+ +
+
\${reason}
+ 申请日期 - \${applyDate} - + +
+ +
+
\${applyDate}
+ 预计就餐人数 接待人数 - \${visitorCount} + +
+ +
+
\${visitorCount}
+ 预计金额
(元) 餐费 - \${mealsFee} + +
+ +
+
\${mealsFee}
+ 陪同人数 - \${accompanyCount} + +
+ +
+
\${accompanyCount}
+ 住宿费 - \${accommodationFee} + +
+ +
+
\${accommodationFee}
+ 科室经办人 - \${handler} + +
+ +
+
\${handler}
+ 综合科意见 - \${comprehensiveOpinion} + +
+ +
+
\${comprehensiveOpinion}
+ 分管领导意见 - \${leaderOpinion} + +
+ +
+
\${leaderOpinion}
+ 备注 - \${remark} + +
+ +
+
\${remark}
+ @@ -681,49 +947,120 @@ export default { 费用发生地点: - \${location} + +
+ +
+
\${location}
+ 上期读数 - \${previousReading} + +
+ +
+
\${previousReading}
+ 实际使用水/电量 - \${usageAmount} + +
+ +
+
\${usageAmount}
+ 年 月 日读数 - \${currentReading} + +
+ +
+
\${currentReading}
+ 水/电费单价 - \${unitPrice} + +
+ +
+
\${unitPrice}
+ 总费用 - \${totalAmount}元 + +
+ +
+
\${totalAmount}元
+ 大写: - \${amountInWords} + +
+ +
+
\${amountInWords}
+ 借水/电单位 - \${borrower} + +
+ +
+
\${borrower}
+ 经办人 - \${handler} + +
+ +
+
\${handler}
+ 经办科室 - \${department} + +
+ +
+
\${department}
+ 科室负责人 - \${departmentHead} + +
+ +
+
\${departmentHead}
+ 发票预留电话 - \${phone} + +
+ +
+
\${phone}
+ 分管领导 - \${leader} + +
+ +
+
\${leader}
+
- 申请日期:\${applyDate} + 申请日期: +
+
+ +
+
\${applyDate}
+
@@ -737,7 +1074,12 @@ export default {

苏州市河道管理处定点办会结算单

-
年   月   日
+
+
+ +
+
\${date}
+
@@ -748,27 +1090,69 @@ export default { - + - + - + - + - + - + @@ -777,48 +1161,355 @@ export default { - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + + + + + + + +
申请部门\${department} +
+ +
+
\${department}
+
会议名称\${meetingName} +
+ +
+
\${meetingName}
+
会议类别(\${meetingType})类会议 + (
+
+ +
+
\${meetingType}
+
)类会议 +
会议起止日期及天数\${duration} +
+ +
+
\${duration}
+
会议地点\${location} +
+ +
+
\${location}
+
会议规模代表人数:\${representativeCount}     工作人员数:\${staffCount} + 代表人数: +
+
+ +
+
\${representativeCount}
+
+      工作人员数: +
+
+ +
+
\${staffCount}
+
+
会议经费预算(元)
合计\${budgetTotal}\${settlementTotal} +
+ +
+
\${budgetTotal}
+
+
+ +
+
\${settlementTotal}
+
其中:住宿费\${budgetAccommodation}\${settlementAccommodation} +
+ +
+
\${budgetAccommodation}
+
+
+ +
+
\${settlementAccommodation}
+
伙食费\${budgetMeals}\${settlementMeals} +
+ +
+
\${budgetMeals}
+
+
+ +
+
\${settlementMeals}
+
租场费\${budgetVenue}\${settlementVenue} +
+ +
+
\${budgetVenue}
+
+
+ +
+
\${settlementVenue}
+
其他费用\${budgetOther}\${settlementOther} +
+ +
+
\${budgetOther}
+
+
+ +
+
\${settlementOther}
+
科室负责人审核\${departmentApproval} +
+ +
+
\${departmentApproval}
+
分管领导审核\${leaderApproval} +
+ +
+
\${sectionApproval}
+
财审科审核\${financeApproval} +
+ +
+
\${financeApproval}
+
财审科分管领导审核\${financeLeaderApproval} +
+ +
+
\${financeLeaderApproval}
+
单位负责人审核\${unitLeaderApproval} +
+ +
+
\${unitLeaderApproval}
+
综合科审核 +
+ +
+
\${comprehensiveApproval}
+
+
+
` + }, + { + name: '苏州市河道管理处报销贴单1', + content: ` +
+
+

苏州市河道管理处报销贴单

+
+
科室:
\${department}
+
\${date}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
用途说明金额报销(领款)人 +
+ +
+
\${handler}
+
+
+ 附单据张 +
+
附单据\${receipts}张
+
+
+ +
+
\${purpose1}
+
+
+ +
+
\${amount1}
+
+
+ +
+
\${purpose2}
+
+
+ +
+
\${amount2}
+
科室负责人 +
+ +
+
\${departmentHead}
+
+
+ +
+
\${purpose3}
+
+
+ +
+
\${amount3}
+
+
+ +
+
\${purpose4}
+
+
+ +
+
\${amount4}
+
财审科审核 +
+ +
+
\${financeApproval}
+
+
+ +
+
\${purpose5}
+
+
+ +
+
\${amount5}
+
+
+ +
+
\${purpose6}
+
+
+ +
+
\${amount6}
+
分管领导审核 +
+ +
+
\${leaderApproval}
+
+
+ +
+
\${purpose7}
+
+
+ +
+
\${amount7}
+
+
+ +
+
\${purpose8}
+
+
+ +
+
\${amount8}
+
财务分管领导审核 +
+ +
+
\${financeLeaderApproval}
+
+
+ +
+
\${purpose9}
+
+
+ +
+
\${amount9}
+
合计 +
+ +
+
\${total}
+
单位负责人审批 +
+ +
+
\${unitLeaderApproval}
+
报销金额(大写) +
+ +
+
\${upperCaseAmount}
+
@@ -827,7 +1518,14 @@ export default { } ], docxContent: '', - docxUrl: '' + docxUrl: '', + placeholderMap: { + childInsuranceActualAmount: '请输入儿童保险实际金额', + financialLeaderAudit: '请输入财务分管领导审核意见', + totalAmount: '请输入合计金额', + unitLeaderAudit: '请输入单位负责人审批意见', + upperCaseAmount: '请输入报销金额(大写)' + }, } }, computed: { @@ -870,6 +1568,14 @@ export default { this.previewContent = this.codeContent this.handleRefresh() } + }, + 'editForm.options': { + handler(newVal) { + if (this.editForm.type === 'radio') { + // 当选项变化时,重置预览值 + this.radioPreviewValue = ''; + } + } } }, methods: { @@ -901,11 +1607,42 @@ export default { this.updateFieldMetadata(Array.from(variables)); - // 移除占位变量,保留其他内容用于预览 - processedContent = processedContent.replace(/\${[^}]+}/g, ''); - - // 移除所有 display:none 样式,使隐藏内容可见 - processedContent = processedContent.replace(/display:\s*none/g, 'display: block'); + // 替换占位变量为对应的输入控件 + // processedContent = processedContent.replace(/\${([^}]+)}/g, (match, field) => { + // const metadata = this.fieldMetadata[field]; + // if (!metadata) return match; + + // const baseStyle = 'width: 100%; height: 32px; padding: 4px 8px; border: 1px solid #DCDFE6; border-radius: 4px; background: #fff; color: #333; font-size: 14px; line-height: 1.5; box-shadow: 0 0 4px rgba(220, 223, 230, 0.2); text-align: center;'; + + // let inputHtml = ''; + // switch (metadata.type) { + // case 'text': + // inputHtml = ``; + // break; + // case 'number': + // inputHtml = ``; + // break; + // case 'date': + // inputHtml = ``; + // break; + // case 'select': + // const options = metadata.options.split(',').map(opt => + // `` + // ).join(''); + // inputHtml = ``; + // break; + // case 'checkbox': + // inputHtml = `
`; + // break; + // case 'radio': + // inputHtml = `
`; + // break; + // default: + // inputHtml = ``; + // } + + // return `
${inputHtml}
\${${field}}
`; + // }); this.previewContent = processedContent; }, @@ -933,15 +1670,105 @@ export default { console.log('正在编辑字段:', field.name); }, handleSaveField() { - const { field } = this.editForm; // Get field name - - if (this.fieldMetadata[field]) { // Use field name as key - this.fieldMetadata[field] = { ...this.editForm }; + if (!this.editForm.field || !this.editForm.name) { + this.$message.warning('请填写字段名称和显示名称') + return + } + + // 更新字段元数据 + this.fieldMetadata[this.editForm.field] = { + name: this.editForm.name, + type: this.editForm.type, + options: this.editForm.options } - this.generateFieldList(); + // 更新代码预览区 + const codeContent = this.codeContent + const fieldName = this.editForm.field + const fieldType = this.editForm.type + const fieldOptions = this.editForm.options + + // 查找所有包含该占位变量的元素 + const regex = new RegExp(`\\$\\{${fieldName}\\}`, 'g') + const matches = codeContent.match(regex) - this.showEditDrawer = false; + if (matches) { + // 根据字段类型生成对应的控件 + let controlHtml = '' + switch (fieldType) { + case 'text': + controlHtml = `` + break + case 'number': + controlHtml = `` + break + case 'select': + const options = fieldOptions.split(',').map(opt => opt.trim()) + controlHtml = `` + break + case 'date': + controlHtml = `` + break + case 'checkbox': + const checkboxOptions = fieldOptions.split(',').map(opt => opt.trim()) + controlHtml = `
+ ${checkboxOptions.map(opt => ` + + `).join('')} +
` + break + case 'radio': + const radioOptions = fieldOptions.split(',').map(opt => opt.trim()) + controlHtml = `
+ ${radioOptions.map(opt => ` + + `).join('')} +
` + break + } + + // 替换所有匹配的占位变量 + let newCodeContent = codeContent + // 使用更简单的正则表达式来匹配每个控件 + const controlRegex = new RegExp(`
[^<]*<[^>]*data-field="${fieldName}"[^>]*>[^<]*<\\/div>[^<]*
\\$\\{${fieldName}\\}<\\/div>`, 'g') + + newCodeContent = newCodeContent.replace(controlRegex, (match) => { + // 提取原有的字段名 + const fieldNameMatch = match.match(/]*>([^<]+)<\/td>/) + const originalFieldName = fieldNameMatch ? fieldNameMatch[1] : '' + + // 保留原有的字段名,只替换控件部分 + return `
${controlHtml}
\${${fieldName}}
` + }) + + // 更新代码预览区内容 + this.codeContent = newCodeContent + + // 更新模板内容 + this.templates[this.currentTemplateIndex].content = newCodeContent + + // 立即刷新预览区域 + this.handleRefresh() + } + + // 更新字段列表 + this.fieldList = Object.entries(this.fieldMetadata).map(([field, metadata]) => ({ + field, + name: metadata.name, + type: metadata.type, + options: metadata.options + })) + + this.showEditDrawer = false + this.$message.success('字段保存成功') }, getTypeDisplay(type) { const typeMap = { @@ -1239,9 +2066,21 @@ export default { // 处理图片样式 html = html.replace(/ { + const baseStyle = 'width: 100%; height: 32px; padding: 4px 8px; border: 1px solid #DCDFE6; border-radius: 4px; background: #fff; color: #333; font-size: 14px; line-height: 1.5; box-shadow: 0 0 4px rgba(220, 223, 230, 0.2); text-align: center;'; + return ` +
+ +
\${${field}}
+
+ `; + }); // 更新代码内容和预览内容 this.codeContent = html + this.previewContent = html // 提取变量并更新字段元数据 const variables = this.extractVariables(html) @@ -1254,7 +2093,6 @@ export default { this.$refs.codeEditor.setValue(html) } // 更新预览内容 - this.previewContent = html this.handleRefresh() }) } catch (error) { @@ -1533,6 +2371,18 @@ export default { color: #909399; font-size: 14px; } + +.radio-preview { + margin-top: 10px; + padding: 10px; + background-color: #f5f7fa; + border-radius: 4px; + + :deep(.el-radio) { + margin-right: 20px; + margin-bottom: 10px; + } +} diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index 428dcbc..dbd8b50 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -678,7 +678,7 @@ export default { this.loadEditOptions(row) // 打开抽屉 - this.dialogVisible = true + this.dialogVisible = true }) .catch(error => { console.error('加载支付表格选项失败:', error) @@ -802,7 +802,7 @@ export default { if (this.form.paymentForm && this.form.paymentForm !== this.originalPaymentForm) { submitData.contract_template_id = this.form.paymentForm } - } else { + } else { // 新增模式下,如果有支付表格值就添加 if (this.form.paymentForm) { submitData.contract_template_id = this.form.paymentForm @@ -816,7 +816,7 @@ export default { return } - this.$message.success('保存成功') + this.$message.success('保存成功') this.dialogVisible = false // 刷新列表数据 await this.getTableData() diff --git a/src/views/contract/contractList_bk.vue b/src/views/contract/contractList_bk.vue new file mode 100644 index 0000000..40b31fb --- /dev/null +++ b/src/views/contract/contractList_bk.vue @@ -0,0 +1,1885 @@ + + + + + From cf5ed38210f9106b6aa62327dd73fd579ba48df8 Mon Sep 17 00:00:00 2001 From: lynn Date: Thu, 24 Apr 2025 22:32:58 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/businessConfig/EditPayForm.vue | 364 +++++++++++++---------- 1 file changed, 207 insertions(+), 157 deletions(-) diff --git a/src/views/businessConfig/EditPayForm.vue b/src/views/businessConfig/EditPayForm.vue index abd08f4..ef6a8c1 100644 --- a/src/views/businessConfig/EditPayForm.vue +++ b/src/views/businessConfig/EditPayForm.vue @@ -441,190 +441,216 @@ export default { content: `

苏州市河道管理处报销贴单

-
+
科室:
\${department}
\${date}
+ + + + + + + - - + + + - - + - - + + - - - - - - - - - - - - + - + + + - + + +
\${amount3}
+ + - - - + - + + + + + - - + +
\${amount5}
+ - - - + + + + - + + + - - + +
\${amount7}
+ - - - - - + +
\${amount8}
+ + + - - - - - + +
\${amount9}
+ - - + - - + + +
\${unitLeaderApproval}
+ - - + - + +
附单据
\${receipts}
+ @@ -676,14 +669,14 @@ export default {
-
\${getDepartment}
+
\${department}
@@ -692,14 +685,14 @@ export default {
-
\${getDate}
+
\${date}
@@ -709,7 +702,7 @@ export default {
-
\${getVisitorCount}
+
\${visitorCount}
@@ -717,7 +710,7 @@ export default {
-
\${getMealsFee}
+
\${mealsFee}
@@ -726,14 +719,14 @@ export default {
-
\${getAccompanyCount}
+
\${accompanyCount}
@@ -742,14 +735,14 @@ export default {
-
\${getOperator}
+
\${operator}
@@ -758,7 +751,7 @@ export default {
-
\${getRemarks}
+
\${remarks}
@@ -1719,8 +1712,9 @@ export default { return } - // 更新字段元数据 + // 更新字段元数据,保留所有必要的属性 this.fieldMetadata[this.editForm.field] = { + field: this.editForm.field, // 确保保留字段名 name: this.editForm.name, type: this.editForm.type, options: this.editForm.options @@ -1785,11 +1779,6 @@ export default { const controlRegex = new RegExp(`
[^<]*<[^>]*data-field="${fieldName}"[^>]*>[^<]*<\\/div>[^<]*
\\$\\{${fieldName}\\}<\\/div>`, 'g') newCodeContent = newCodeContent.replace(controlRegex, (match) => { - // 提取原有的字段名 - const fieldNameMatch = match.match(/]*>([^<]+)<\/td>/) - const originalFieldName = fieldNameMatch ? fieldNameMatch[1] : '' - - // 保留原有的字段名,只替换控件部分 return `
${controlHtml}
\${${fieldName}}
` }) diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index dbd8b50..6ad0798 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -123,7 +123,18 @@ - + + + + + + + + - - - - - - - @@ -519,6 +541,11 @@ import { import { getparameter } from "@/api/system/dictionary" +import { + getContractCategoryTemplateBaseConfig, + getContractCategoryTemplateConfigParams, + getContractFormList +} from '@/api/businessConfig/businessConfig' import { listdeptNoAuth } from "@/api/system/department"; @@ -546,9 +573,9 @@ import paymentRegistration from "./components/paymentRegistration"; import contractSign from "@/views/contract/components/contractSign"; import contractPaymentRegistration from "@/views/contract/components/contractPaymentRegistration"; import govPlane from './components/govPlane.vue'; - import { - download - } from '@/utils/downloadRequest' +import { + download +} from '@/utils/downloadRequest' export default { components: { editor, @@ -556,7 +583,7 @@ export default { paymentRegistration, contractSign, contractPaymentRegistration, - govPlane + govPlane, }, data() { var planPass = (rule, value, callback) => { @@ -654,6 +681,20 @@ export default { left: 0 }, hasEdit: false, + // 添加控制显示/隐藏的变量 + showFields: { + purchaseMethod: true, + projectName: true, + projectType: true, + budgetPrice: true, + fundChannel: true, + budgetPlan: true, + request: true, + purchaseApproval: true, + tenderReview: true, + contractSign: true + }, + planSource: 'search', isShowPlanForSearch: false, options: [{ value: "", @@ -859,17 +900,13 @@ export default { } }, { - label: "资金来源", - width: 120, + label: "资金渠道", + width: 320, + align: "left", customFn: (row) => { - { return row.money_way_detail.map(item => { - return (< div> { - item.value - } < /div>) - }) - } - + return `
${item.value}
` + }).join('') } }, { @@ -877,16 +914,9 @@ export default { width: 320, align: "left", customFn: (row) => { - { return row.plans.map(item => { - return (< div> [{ - item.year - }] - { - item.name - } < /div>) - }) - } - + return `
[${item.year}] - ${item.name}
` + }).join('') } }, { @@ -912,16 +942,7 @@ export default { width: 140, customFn: (row) => { let per = ((((row.fund_log_total) / row.money) || 0) * 100)?.toFixed(2) || 0 - return (< - div style={ - { - 'color': per > 110 ? 'red' : 'green' - } - }> { - per - } % -
- ) + return `
${per}%
` } }, { @@ -1014,13 +1035,9 @@ export default { minWidth: 200, prop: "contract_carry_department", customFn: row => { - return ( -
- { row.contract_carry_department.map(i => { - return ({i.carry_department.name}) - }) } -
- ) + return row.contract_carry_department.map(i => { + return `${i.carry_department.name}` + }).join('') } } ], @@ -1132,75 +1149,46 @@ export default { //新增 isShowAdd: false, + currentStep: 1, form: { - name: "", - is_simple:0, - has_charge: 0, - supply: "", - money:0, - type: "", - methods: "", - modality: "", - price: 0, - fundingChannels: [], - isBudget: true, + category: '', + affairType: '', + contractType: '', + purchaseForm: '', + purchaseSubForm: '', + purchaseMethod: '', + name: '', + type: '', // 项目类型 + moneyWay: '', plan: [], - is_substitute: 0, - gov_plane_id: '', - contract_carry_department: [], - }, - plan: [], - rules: { - name: [{ - required: true, - message: "必填" - }], - supply:[ - { - validator:supplyPass, - trigger: 'change' - } - ], - money:[ - { - validator:moneyPass, - trigger: 'change' - } - ], - type:[ - { - validator: typePass, - trigger: 'change' - } - ], - methods:[ - { - validator:methodsPass, - trigger: 'change' - } - ], - modality:[ - { - validator:modalityPass, - trigger: 'change' - } - ], - price:[ + plan_display: '', // 预算计划显示文本 + price: 0, + supply: '', + // 流程控制字段 + is_simple: 0, // 是否为简易流程 + has_charge: 0, // 是否为河道处收费类项目 + isBudget: 0, // 是否为预算内确定项目 + is_substitute: 0, // 是否为代建项目 + // 新增流程控制字段 + request: 0, // 请示流程 + purchaseApproval: 0, // 采购业务审批流程 + tenderReview: 0, // 招标文件审查流程 + contractSign: 0, // 合同会签流程 + expenses: [ { - validator:pricePass, - trigger: 'change' + content: '', + amount: 0, + ratio: '', + payee: '' } - ], - - fundingChannels: [{ - required: true, - message: "必填" - }], - plan: [{ - validator: planPass, - trigger: 'change' - }] + ] }, + categoryOptions: [], + purchaseMethodsMap: {}, + affairTypeOptions: [], + contractTypeOptions: [], + purchaseFormOptions: [], + purchaseMethodOptions: [], isShowPlan: false, //新增中预算计划 plans: [], //预算数据 planSearch: { @@ -1211,6 +1199,11 @@ export default { plansPageIndex: 1, isShowEditor: false, + contractTypes: [ + { label: '设备采购', value: 'equipment' }, + { label: '工程合同', value: 'project' }, + { label: '服务合同', value: 'service' } + ], } }, methods: { @@ -1418,10 +1411,9 @@ export default { } }, //y验证合同的名称是否存在重复 - checkName(e) { - checkContractName({name: e}).then(res => { - console.log(res); - }) + checkName(name) { + // 暂时不调用 API,直接返回 + console.log('检查名称:', name) }, confirmPlanForSearch() { this.isShowPlanForSearch = false; @@ -1546,6 +1538,8 @@ export default { this.moneyWay = (await getparameter({ number: 'money_way' })).detail + + this.form.moneyWay = this.moneyWay }, //获取购买方式 async getPurchaseWay() { @@ -1626,19 +1620,30 @@ export default { this.isShowPlan = true await this.getBudgets() }, - async showPlanForSearch() { + async showPlanForSearch(search='search') { + console.log("sdfsdfsdfsdfsfsfsd:"+search) + this.planSource = search this.isShowPlanForSearch = true await this.getBudgets(); }, //选择计划 搜索 selectPlanForSearch(sel) { console.log(sel) + + if (this.planSource === 'search') { if (sel) { this.select.plan_id = sel.id; this.select.plan_name = sel.name; } else { this.select.plan_id = ""; this.select.plan_name = ""; + } + } else { + if (sel) { + this.form.plan_display = sel.name; + } else { + this.form.plan_display = ""; + } } }, //选择计划 @@ -1685,24 +1690,24 @@ export default { }, //确认计划选择 planSelect() { - if (this.plan.length === 0) { - Message({ - type: 'warning', - message: '选择计划不能为空' - }) + const selectedRows = this.$refs.planTable.getSelection() + if (!selectedRows || selectedRows.length === 0) { + this.$Message.warning('请选择至少一个预算计划') return } - for (let item of this.plan) { - console.log(item) - if (!item.value.use_money) { - Message({ - type: 'warning', - message: '金额不能为空' - }) - return - } - } - this.form.plan = this.plan + + // 更新选中的预算计划 + this.form.plan = selectedRows.map(item => ({ + id: item.id, + name: item.name, + money: item.money, + useMoney: item.useMoney || 0 + })) + + // 更新显示文本 + this.updatePlanDisplay() + + // 关闭弹框 this.isShowPlan = false }, @@ -1720,13 +1725,13 @@ export default { }, //确认计划选择搜索 planSelectForSearch() { - if (this.select.plan_id == "") { - Message({ - type: 'warning', - message: '选择计划不能为空' - }) - return - } + // if (this.select.plan_id == "") { + // Message({ + // type: 'warning', + // message: '选择计划不能为空' + // }) + // return + // } this.isShowPlanForSearch = false }, //默认选择计划 @@ -1746,36 +1751,49 @@ export default { } }, //提交新建 - submit() { - addContrant({ - type: this.form.type, - is_plan: this.form.isBudget ? 1 : 0, - purchase_type_id: this.form.methods, - purchase_way_id: this.form.modality, - money_way_id: `${this.form.fundingChannels.toString()}`, - plan_price: this.form.price, - name: this.form.name, - contract_plan_links: this.form.plan.map(item => { - return item.value - }), - is_substitute: this.form.is_substitute, - is_simple:this.form.is_simple, - has_charge: this.form.has_charge, - supply:this.form.supply, - money:this.form?.money, - status:this.form?.is_simple ? 2 : 1, - gov_plane_id: this.form.gov_plane_id, - contract_carry_department: this.form.contract_carry_department.map(i => ({carry_department_id: i})) - }).then(res => { - this.isShowAdd = false - Message({ - type: 'success', - message: '操作成功' - }) - this.$refs['addContract'].reset() - this.$refs['planTable'].clearSelection() - this.getContracts() - }) + async submit() { + try { + // 获取分类配置 + const res = await getContractCategoryTemplateBaseConfig() + if (res.errcode !== undefined) { + this.$message.error(res.errmsg || '获取分类配置失败') + return + } + + // 保存采购方式映射 + this.purchaseMethodsMap = res.purchase_methods || {} + + // 设置分类选项 - 从第二级开始(合同类、报销类、其他支出类) + this.categoryOptions = res.map?.[0]?.children || [] + + // 递归处理每一层的 children,确保所有层级都被正确解析 + const processChildren = (items) => { + if (!items) return + items.forEach(item => { + if (item.children) { + // 确保每个子项都有正确的 id 和 name + item.children = item.children.map(child => ({ + id: child.id, + name: child.name || child.value, // 添加对 value 字段的支持 + children: child.children || [] + })) + processChildren(item.children) + } + }) + } + + // 处理所有层级的 children + processChildren(this.categoryOptions) + + // 重置表单 + this.resetForm() + + // 打开模态框 + this.isShowAdd = true + } catch (error) { + console.error('获取分类配置失败:', error) + this.$message.error('获取分类配置失败') + } }, //删除合同 @@ -1790,6 +1808,394 @@ export default { this.getContracts() }) }, + handleCategoryChange() { + this.form.affairType = '' + this.form.contractType = '' + this.form.purchaseForm = '' + this.form.purchaseMethod = '' + this.updateTypeOptions() + }, + + handleAffairTypeChange() { + this.form.contractType = '' + this.form.purchaseForm = '' + this.form.purchaseMethod = '' + this.updateTypeOptions() + }, + + handleContractTypeChange() { + this.form.purchaseForm = '' + this.form.purchaseMethod = '' + this.updateTypeOptions() + }, + + handlePurchaseFormChange() { + this.form.purchaseMethod = '' + this.updateTypeOptions() + }, + + handlePurchaseMethodChange() { + this.updateTypeOptions() + }, + + updateTypeOptions() { + // 重置所有选项 + this.affairTypeOptions = [] + this.contractTypeOptions = [] + this.purchaseFormOptions = [] + this.purchaseMethodOptions = [] + this.purchaseSubFormOptions = [] + + // 获取当前选中的分类 + const selectedCategory = this.categoryOptions.find(item => item.id === this.form.category) + if (!selectedCategory) return + + // 更新事项类型选项 + this.affairTypeOptions = selectedCategory.children || [] + + // 获取当前选中的事项类型 + const selectedAffairType = this.affairTypeOptions.find(item => item.id === this.form.affairType) + if (!selectedAffairType) return + + // 更新合同类型选项 + this.contractTypeOptions = selectedAffairType.children || [] + + // 获取当前选中的合同类型 + const selectedContractType = this.contractTypeOptions.find(item => item.id === this.form.contractType) + if (!selectedContractType) return + + // 更新采购形式选项 + this.purchaseFormOptions = selectedContractType.children || [] + + // 获取当前选中的采购形式 + const selectedPurchaseForm = this.purchaseFormOptions.find(item => item.id === this.form.purchaseForm) + if (!selectedPurchaseForm) return + + // 更新采购子形式选项 + this.purchaseSubFormOptions = selectedPurchaseForm.children || [] + + // 获取当前选中的采购子形式 + const selectedPurchaseSubForm = this.purchaseSubFormOptions.find(item => item.id === this.form.purchaseSubForm) + + // 如果有采购子形式,使用其children作为采购方式 + if (selectedPurchaseSubForm && selectedPurchaseSubForm.children) { + this.purchaseMethodOptions = selectedPurchaseSubForm.children + } + // 如果没有采购子形式,使用采购形式的children作为采购方式 + else if (selectedPurchaseForm.children) { + this.purchaseMethodOptions = selectedPurchaseForm.children + } + }, + + nextStep() { + if (this.validateCurrentStep()) { + this.currentStep++ + } + }, + + prevStep() { + this.currentStep-- + }, + + validateCurrentStep() { + if (this.currentStep === 1) { + if (!this.form.category || !this.form.affairType || !this.form.contractType || + !this.form.purchaseForm || !this.form.purchaseMethod) { + this.$Message.warning('请填写所有必填项') + return false + } + + // 获取模版配置参数 + this.getTemplateConfig() + return false // 等待配置参数获取完成 + } else if (this.currentStep === 2) { + // 使用表单验证进行校验 + let isValid = false + this.$refs.basicInfoForm.validate(valid => { + isValid = valid + if (!valid) { + this.$Message.warning('请填写所有必填项') + } + }) + return isValid + } + return true + }, + + // 获取模版配置参数 + async getTemplateConfig() { + try { + const params = { + category: this.form.category, + work_type: this.form.affairType, + contract_type: this.form.contractType, + purchase_form: this.form.purchaseForm + } + + const res = await getContractCategoryTemplateConfigParams(params) + if (res.errcode !== undefined) { + this.$message.error(res.errmsg || '获取模版配置失败') + return + } + + // 根据返回的配置参数设置表单 + this.setFormConfig(res) + + // 进入下一步 + this.currentStep++ + } catch (error) { + console.error('获取模版配置失败:', error) + this.$message.error('获取模版配置失败') + } + }, + + // 设置表单配置 + setFormConfig(config) { + console.log('模版配置参数:', config) + + // 只更新显示/隐藏状态,不影响数据来源 + Object.assign(this.showFields, { + projectName: config.project_name === 1, // 项目名称 + projectType: config.project_type === 1, // 项目类型 + budgetPrice: config.budget_price === 1, // 预算价格 + fundChannel: config.fund_channel === 1, // 资金渠道 + budgetPlan: config.budget_plan === 1 // 预算计划 + }) + }, + + handleAddContract() { + this.isShowAdd = true; + // Call API to get category options + this.getCategoryOptions(); + // Reset form + this.resetForm(); + }, + + handleAddContractOk() { + if (this.currentStep < 2) { + // 第一步,执行验证并进入下一步 + if (this.validateCurrentStep()) { + this.currentStep++; + } + } else { + // 最后一步,执行提交 + if (this.validateCurrentStep()) { + this.submit() + } + } + }, + + handleAddContractCancel() { + this.resetForm() + this.isShowAdd = false + }, + + cancel() { + this.handleAddContractCancel() + }, + + resetForm() { + this.currentStep = 1 + this.form = { + category: '', + affairType: '', + contractType: '', + purchaseForm: '', + purchaseSubForm: '', + purchaseMethod: '', + name: '', + type: '', // 项目类型 + money_way_id: '', + plan: [], + plan_display: '', // 预算计划显示文本 + price: 0, + supply: '', + // 流程控制字段 + is_simple: 0, // 是否为简易流程 + has_charge: 0, // 是否为河道处收费类项目 + isBudget: 0, // 是否为预算内确定项目 + is_substitute: 0, // 是否为代建项目 + // 新增流程控制字段 + request: 0, // 请示流程 + purchaseApproval: 0, // 采购业务审批流程 + tenderReview: 0, // 招标文件审查流程 + contractSign: 0, // 合同会签流程 + expenses: [ + { + content: '', + amount: 0, + ratio: '', + payee: '' + } + ] + } + + this.affairTypeOptions = [] + this.contractTypeOptions = [] + this.purchaseFormOptions = [] + this.purchaseSubFormOptions = [] + this.purchaseMethodOptions = [] + }, + + // 获取分类配置 + async getCategoryOptions() { + try { + // 获取分类配置 + const res = await getContractCategoryTemplateBaseConfig() + if (res.errcode !== undefined) { + this.$message.error(res.errmsg || '获取分类配置失败') + return + } + + // 保存采购方式映射 + this.purchaseMethodsMap = res.purchase_methods || {} + + // 设置分类选项 - 从第二级开始(合同类、报销类、其他支出类) + this.categoryOptions = res.map?.[0]?.children || [] + + // 递归处理每一层的 children,确保所有层级都被正确解析 + const processChildren = (items) => { + if (!items) return + items.forEach(item => { + if (item.children) { + // 确保每个子项都有正确的 id 和 name + item.children = item.children.map(child => ({ + id: child.id, + name: child.name || child.value, // 添加对 value 字段的支持 + children: child.children || [] + })) + processChildren(item.children) + } + }) + } + + // 处理所有层级的 children + processChildren(this.categoryOptions) + + // 初始化其他选项 + this.updateTypeOptions() + } catch (error) { + console.error('获取分类配置失败:', error) + this.$message.error('获取分类配置失败') + } + }, + + // 初始化采购方式映射 + initPurchaseMethodsMap() { + this.purchaseMethodsMap = {} + // 递归遍历分类选项,构建采购方式映射 + const traverse = (items) => { + items.forEach(item => { + if (item.children) { + traverse(item.children) + } else { + // 如果是叶子节点,添加到映射中 + this.purchaseMethodsMap[item.id] = item.name + } + }) + } + traverse(this.categoryOptions) + }, + + // 获取分类名称的方法 + getCategoryName(id) { + const category = this.categoryOptions.find(item => item.id === id) + return category ? category.name : '' + }, + + getAffairTypeName(id) { + const category = this.categoryOptions.find(item => item.id === this.form.category) + if (category && category.children) { + const affairType = category.children.find(item => item.id === id) + return affairType ? affairType.name : '' + } + return '' + }, + + getContractTypeName(id) { + const category = this.categoryOptions.find(item => item.id === this.form.category) + if (category && category.children) { + const affairType = category.children.find(item => item.id === this.form.affairType) + if (affairType && affairType.children) { + const contractType = affairType.children.find(item => item.id === id) + return contractType ? contractType.name : '' + } + } + return '' + }, + + getPurchaseFormName(id) { + const category = this.categoryOptions.find(item => item.id === this.form.category) + if (category && category.children) { + const affairType = category.children.find(item => item.id === this.form.affairType) + if (affairType && affairType.children) { + const contractType = affairType.children.find(item => item.id === this.form.contractType) + if (contractType && contractType.children) { + const purchaseForm = contractType.children.find(item => item.id === id) + return purchaseForm ? purchaseForm.name : '' + } + } + } + return '' + }, + + getPurchaseMethodName(id) { + // 从嵌套结构中查找采购方式名称 + const category = this.categoryOptions.find(item => item.id === this.form.category) + if (category && category.children) { + const affairType = category.children.find(item => item.id === this.form.affairType) + if (affairType && affairType.children) { + const contractType = affairType.children.find(item => item.id === this.form.contractType) + if (contractType && contractType.children) { + const purchaseForm = contractType.children.find(item => item.id === this.form.purchaseForm) + if (purchaseForm && purchaseForm.children) { + // 如果有选择子表单,从子表单中查找 + if (this.form.purchaseSubForm) { + const purchaseSubForm = purchaseForm.children.find(item => item.id === this.form.purchaseSubForm) + if (purchaseSubForm && purchaseSubForm.children) { + const purchaseMethod = purchaseSubForm.children.find(item => item.id === id) + if (purchaseMethod) { + return purchaseMethod.name + } + } + } + + // 直接从采购形式中查找 + const purchaseMethod = purchaseForm.children.find(item => item.id === id) + if (purchaseMethod) { + return purchaseMethod.name + } + } + } + } + } + + // 备用:从映射中查找 + return this.purchaseMethodsMap[id] || '' + }, + + // 更新预算计划显示文本 + updatePlanDisplay() { + if (this.form.plan && this.form.plan.length > 0) { + this.form.plan_display = `已选择 ${this.form.plan.length} 个预算计划` + } else { + this.form.plan_display = '' + } + }, + // 新增方法:移除预算计划 + removePlan(plan) { + const index = this.form.plan.findIndex(item => item.id === plan.id) + if (index !== -1) { + this.form.plan.splice(index, 1) + + // 更新显示文本 + if (this.form.plan && this.form.plan.length > 0) { + this.form.plan_display = `已选择 ${this.form.plan.length} 个预算计划` + } else { + this.form.plan_display = '' + } + } + }, }, mounted() { this.window.width = screen.availWidth * 0.95 @@ -1802,10 +2208,8 @@ export default { this.user = response; if (that.userList.indexOf(response.username) != -1) { - that.hasEdit = true; } - }).catch(error => { }) this.getPurchaseType() @@ -1813,6 +2217,7 @@ export default { this.getDepartment() this.getPurchaseWay() this.getMoneyWay() + //页面激活后刷新合同列表 window.onfocus = () => { this.getContracts(false, true) @@ -1882,4 +2287,298 @@ export default { content: '(元)' } } + +.contract-add-modal { + :deep(.ivu-modal-content) { + border-radius: 8px; + overflow: hidden; + } + + :deep(.ivu-modal-header) { + background: #f8f8f9; + padding: 16px 24px; + border-bottom: 1px solid #e8eaec; + } + + :deep(.ivu-modal-body) { + padding: 24px; + } + + .steps-header { + display: flex; + justify-content: space-between; + margin-bottom: 32px; + padding: 0 20px; + + .step { + display: flex; + flex-direction: column; + align-items: center; + position: relative; + flex: 1; + + &:not(:last-child)::after { + content: ''; + position: absolute; + top: 16px; + left: 50%; + width: 100%; + height: 2px; + background: #e8eaec; + z-index: 1; + } + + .step-number { + width: 32px; + height: 32px; + border-radius: 50%; + background: #e8eaec; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 8px; + position: relative; + z-index: 2; + } + + .step-text { + color: #808695; + font-size: 14px; + } + + &.active { + .step-number { + background: #2d8cf0; + } + .step-text { + color: #2d8cf0; + font-weight: 500; + } + } + } + } + + .step-content { + padding: 0 20px; + } + + .form-group { + margin-bottom: 20px; + + .form-label { + display: block; + margin-bottom: 8px; + color: #515a6e; + font-weight: 500; + } + + .form-input { + width: 100%; + } + + .form-button { + width: 100%; + } + } + + .expense-table { + width: 100%; + border-collapse: collapse; + margin-top: 8px; + + th, td { + padding: 8px; + border: 1px solid #e8eaec; + text-align: center; + } + + th { + background: #f8f8f9; + color: #515a6e; + font-weight: 500; + } + + td { + .ivu-input { + border: none; + &:focus { + box-shadow: none; + } + } + } + } + + .step-actions { + display: flex; + justify-content: flex-end; + gap: 12px; + margin-top: 32px; + padding: 0 20px; + + .action-button { + min-width: 100px; + } + } +} + +.template-info { + background-color: #f5f7fa; + border-radius: 4px; + padding: 16px; + margin-bottom: 24px; + + .info-title { + font-size: 16px; + font-weight: 600; + color: #1f2937; + margin-bottom: 16px; + padding-bottom: 12px; + border-bottom: 1px solid #e5e7eb; + } + + .info-content { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); + gap: 16px; + + .info-item { + display: flex; + align-items: center; + + .label { + color: #4b5563; + font-weight: 500; + margin-right: 8px; + min-width: 84px; + } + + .value { + color: #1f2937; + } + } + } +} + +.form-section { + background-color: #ffffff; + border-radius: 4px; + padding: 20px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + + .section-title { + font-size: 16px; + font-weight: 600; + color: #1f2937; + margin-bottom: 20px; + padding-bottom: 12px; + border-bottom: 1px solid #e5e7eb; + } + + :deep(.el-form-item) { + margin-bottom: 20px; + + &:last-child { + margin-bottom: 0; + } + } + + :deep(.el-form-item__label) { + font-weight: 500; + color: #4b5563; + } + + :deep(.el-input), + :deep(.el-input-number), + :deep(.el-select) { + width: 100%; + } +} + +.helper-text { + margin-top: 8px; + color: #666; + font-size: 13px; + line-height: 1.4; +} + +.form-section { + & + .form-section { + margin-top: 24px; + } + + :deep(.el-radio-group) { + .el-radio { + margin-right: 30px; + + &:last-child { + margin-right: 0; + } + } + } +} + +.process-control-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 20px; + + .control-item { + background: #f9fafb; + border-radius: 4px; + padding: 16px; + + .control-label { + color: #4b5563; + font-weight: 500; + margin-bottom: 12px; + } + + .control-content { + .helper-text { + margin-top: 8px; + color: #666; + font-size: 13px; + line-height: 1.4; + } + } + + :deep(.el-radio-group) { + display: flex; + gap: 24px; + + .el-radio { + margin-right: 0; + } + } + } +} + +.plan-selector { + width: 100%; + + .plan-input { + width: 100%; + } + + .plan-tags { + margin-top: 8px; + display: flex; + flex-wrap: wrap; + gap: 8px; + + .el-tag { + margin-right: 0; + } + } +} + +.search-box { + margin-bottom: 16px; +} + +.plan-list { + height: 400px; + overflow-y: auto; +} From fbddbf82cd7d935032a769c8f904dd9a816c3f31 Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 25 Apr 2025 20:50:01 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=85=B3=E8=81=94?= =?UTF-8?q?=E9=A2=84=E7=AE=97=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/businessConfig/businessConfig.js | 9 + src/views/businessConfig/contractConfig.vue | 3 +- src/views/contract/contractList.vue | 641 ++++++++++---------- 3 files changed, 341 insertions(+), 312 deletions(-) diff --git a/src/api/businessConfig/businessConfig.js b/src/api/businessConfig/businessConfig.js index a71dd74..4cb4418 100644 --- a/src/api/businessConfig/businessConfig.js +++ b/src/api/businessConfig/businessConfig.js @@ -51,6 +51,15 @@ export function getContractCategoryTemplate(params) { }) } +// 获取合同分类模版配置参数 +export function getContractCategoryTemplateConfigParams(params) { + return request({ + method: 'get', + url: '/api/admin/contract-category/config', + params + }) +} + // 删除合同分类模版 export function deleteContractCategoryTemplate(id) { return request({ diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index 6ad0798..1b95c31 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -231,11 +231,10 @@
项目名称 项目类型 - 采购方式配置 + 预算价
- 预算价 资金渠道 关联预算计划
diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 4c8d769..1ed6736 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -268,215 +268,188 @@
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
-
- -
- -
-
已选合同模版类型
-
-
- 合同分类: - {{ getCategoryName(form.category) }} -
-
- 事务类型: - {{ getAffairTypeName(form.affairType) }} -
-
- 合同类型: - {{ getContractTypeName(form.contractType) }} -
-
- 采购形式: - {{ getPurchaseFormName(form.purchaseForm) }} -
-
- 采购方式: - {{ getPurchaseMethodName(form.purchaseMethod) }} + +
+ +
+
已选合同模版类型
+
+
+ 合同分类: + {{ getCategoryName(form.category) }} +
+
+ 事务类型: + {{ getAffairTypeName(form.affairType) }} +
+
+ 合同类型: + {{ getContractTypeName(form.contractType) }} +
+
+ 采购形式: + {{ getPurchaseFormName(form.purchaseForm) }} +
+
+ 采购方式: + {{ getPurchaseMethodName(form.purchaseMethod) }} +
-
- -
-
流程控制
-
-
-
是否为简易流程
-
- - - - -
(水电煤、报刊订阅、网络通讯、车辆使用等费用付款)
+ +
+
流程控制
+
+
+
是否为简易流程
+
+ + + + +
(水电煤、报刊订阅、网络通讯、车辆使用等费用付款)
+
-
-
-
是否为河道处收费类项目
-
- - - - +
+
是否为河道处收费类项目
+
+ + + + +
-
-
-
是否为预算内确定项目
-
- - - - +
+
是否为预算内确定项目
+
+ + + + +
-
-
-
是否为代建项目
-
- - - - +
+
是否为代建项目
+
+ + + + +
-
- -
-
基本信息
- - - - - - - - - - - - - - - - - - - - - - -
- - -
- - {{ item.name }} - + +
+
基本信息
+ + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + {{ item.label }} + +
-
- - + + +
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
职工姓名 + 用途说明金额报销(领款)人
- +
-
\${name}
-
退休/在职 +
\${handler}
+
- +
+ 附单据 + + +
-
\${status}
+
附单据\${receipts}张
家属姓名 +
- +
-
\${familyName}
+
\${purpose1}
与本人关系 +
- +
-
\${relation}
+
\${amount1}
内容发票金额报销比例 +
- +
-
\${medicalActualAmount}
+
\${purpose2}
报销(领款)人 +
- +
-
\${name}
+
\${amount2}
门诊医药费 + 科室负责人
- +
-
\${medicalInvoiceValue}
-
+
\${departmentHead}
+
- +
-
\${medicalReimbursementRatio}
-
-
- +
\${purpose3}
+
+
+
-
\${medicalActualAmount}
-
住院医药费 +
- +
-
\${hospitalInvoiceValue}
-
+
\${purpose4}
+
- +
-
\${hospitalReimbursementRatio}
-
+
\${amount4}
+
财审科审核 +
+ +
+
\${financeApproval}
+
- +
-
\${hospitalActualAmount}
-
科室负责人 +
\${purpose5}
+
- +
-
\${departmentHead}
-
儿童医药费 +
- +
-
\${childMedicalInvoiceValue}
-
+
\${purpose6}
+
+
+ +
+
\${amount6}
+
分管领导审核
- +
-
\${childMedicalReimbursementRatio}
-
+
\${leaderApproval}
+
- +
-
\${childMedicalActualAmount}
-
财审科审核 +
\${purpose7}
+
- +
-
\${financialAudit}
-
幼托费用 +
- +
-
\${childcareActualAmount}
-
分管领导审核 +
\${purpose8}
+
- +
-
\${leaderAudit}
-
财务分管领导审核 +
+ +
+
\${financeLeaderApproval}
+
子女保险费 +
- +
-
\${childInsuranceActualAmount}
-
财务分管领导审核 +
\${purpose9}
+
- +
-
\${financialLeaderAudit}
-
合计 + 合计
- +
-
\${totalAmount}
-
单位负责人审批 +
\${total}
+
单位负责人审批
- +
-
\${unitLeaderAudit}
-
报销金额(大写) + 报销金额(大写)
@@ -971,7 +997,14 @@ export default {
年 月 日读数 +
+
+
+
\${date1}
+
读数 +
+
@@ -1294,7 +1327,7 @@ export default {
` }, { - name: '苏州市河道管理处报销贴单1', + name: '苏州市河道管理处报销贴单', content: `
@@ -1323,11 +1356,8 @@ export default {
\${handler}
-
- 附单据张 -
-
附单据\${receipts}张
-
@@ -1605,44 +1635,58 @@ export default { variables.add(match[1]); } - this.updateFieldMetadata(Array.from(variables)); + // 保留现有的字段元数据,只更新新增的变量 + const existingMetadata = { ...this.fieldMetadata }; + variables.forEach(varName => { + if (!existingMetadata[varName]) { + existingMetadata[varName] = { + field: varName, + name: this.formatVariableName(varName), + type: 'text', + options: '', + }; + } + }); + + this.fieldMetadata = existingMetadata; + this.generateFieldList(); // 替换占位变量为对应的输入控件 - // processedContent = processedContent.replace(/\${([^}]+)}/g, (match, field) => { - // const metadata = this.fieldMetadata[field]; - // if (!metadata) return match; + processedContent = processedContent.replace(/\${([^}]+)}/g, (match, field) => { + const metadata = this.fieldMetadata[field]; + if (!metadata) return match; - // const baseStyle = 'width: 100%; height: 32px; padding: 4px 8px; border: 1px solid #DCDFE6; border-radius: 4px; background: #fff; color: #333; font-size: 14px; line-height: 1.5; box-shadow: 0 0 4px rgba(220, 223, 230, 0.2); text-align: center;'; + const baseStyle = 'width: 100%; height: 32px; padding: 4px 8px; border: 1px solid #DCDFE6; border-radius: 4px; background: #fff; color: #333; font-size: 14px; line-height: 1.5; box-shadow: 0 0 4px rgba(220, 223, 230, 0.2); text-align: center;'; - // let inputHtml = ''; - // switch (metadata.type) { - // case 'text': - // inputHtml = ``; - // break; - // case 'number': - // inputHtml = ``; - // break; - // case 'date': - // inputHtml = ``; - // break; - // case 'select': - // const options = metadata.options.split(',').map(opt => - // `` - // ).join(''); - // inputHtml = ``; - // break; - // case 'checkbox': - // inputHtml = `
`; - // break; - // case 'radio': - // inputHtml = `
`; - // break; - // default: - // inputHtml = ``; - // } + let inputHtml = ''; + switch (metadata.type) { + case 'text': + inputHtml = ``; + break; + case 'number': + inputHtml = ``; + break; + case 'date': + inputHtml = ``; + break; + case 'select': + const options = metadata.options.split(',').map(opt => + `` + ).join(''); + inputHtml = ``; + break; + case 'checkbox': + inputHtml = `
`; + break; + case 'radio': + inputHtml = `
`; + break; + default: + inputHtml = ``; + } - // return `
${inputHtml}
\${${field}}
`; - // }); + return `
${inputHtml}
\${${field}}
`; + }); this.previewContent = processedContent; }, @@ -1802,8 +1846,8 @@ export default { const params = { name: this.formName, - type: this.formatType === 1 ? 1 : 2, - template: this.formatType === 1 ? this.codeContent : null, + type: 1, // 强制使用HTML格式 + template: this.codeContent, // 使用转换后的HTML内容 // Add field metadata contract_template_fields: templateFields, // Other necessary fields @@ -1855,7 +1899,13 @@ export default { console.log('字段元数据已更新:', this.fieldMetadata); }, generateFieldList() { - this.fieldList = Object.values(this.fieldMetadata); + // 使用 Object.entries 来保持字段的原始顺序 + this.fieldList = Object.entries(this.fieldMetadata).map(([field, metadata]) => ({ + field, + name: metadata.name, + type: metadata.type, + options: metadata.options + })); }, formatVariableName(name) { return name From cfe75282b91498a5e1063dc401778dba379a811b Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 25 Apr 2025 09:57:22 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=8B=E5=89=8D?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/businessConfig/EditPayForm.vue | 41 ++--- src/views/businessConfig/contractConfig.vue | 156 +++++++++++++------- 2 files changed, 117 insertions(+), 80 deletions(-) diff --git a/src/views/businessConfig/EditPayForm.vue b/src/views/businessConfig/EditPayForm.vue index ef6a8c1..859c1e8 100644 --- a/src/views/businessConfig/EditPayForm.vue +++ b/src/views/businessConfig/EditPayForm.vue @@ -173,7 +173,7 @@ export default { previewContent: '', // 预览内容 showEditDrawer: false, showPreviewModal: false, // 添加预览模态窗口控制变量 - currentTemplateIndex: 8, + currentTemplateIndex:3, editForm: { field: '', // Renamed from name to field name: '', // Renamed from label to name (Chinese name) @@ -465,14 +465,7 @@ export default {
\${handler}
-
-
- 附单据 - - -
-
-
附单据\${receipts}张
+
附单据
\${receipts}
事由
-
\${getReason}
+
\${reason}
就餐地点
-
\${getDiningLocation}
+
\${diningLocation}
金额(元) 餐费
住宿费
-
\${getAccommodationFee}
+
\${accommodationFee}
审核人
-
\${getReviewer}
+
\${reviewer}
- - - - - - - - - - - - - - - - -
内容金额比例收款人
+ +
+ +
+
事前支付表格
+
+
+ +
+
事后支付表格
+
+
- -
- - - - +
+
@@ -485,28 +458,61 @@ + + + + + + @@ -1204,6 +1210,7 @@ export default { { label: '工程合同', value: 'project' }, { label: '服务合同', value: 'service' } ], + plan: [], // 添加这个来存储选中的预算计划 } }, methods: { @@ -1234,10 +1241,7 @@ export default { row.useMoney = 0 return } - let money = Number(row.update_money) == 0 ? Number(row.money) : Number(row.update_money); - console.log(e, money, row.use_money_total) - console.log(e <= (money - Number(row.use_money_total))) - if (e <= (money - Number(row.use_money_total))) { + if (e <= (Number(row.money) - Number(row.use_money_total))) { row.useMoney = e this.plan.forEach(item => { if (item.value.plan_id == row.id) { @@ -1620,32 +1624,68 @@ export default { this.isShowPlan = true await this.getBudgets() }, - async showPlanForSearch(search='search') { - console.log("sdfsdfsdfsdfsfsfsd:"+search) - this.planSource = search - this.isShowPlanForSearch = true - await this.getBudgets(); - }, - //选择计划 搜索 - selectPlanForSearch(sel) { - console.log(sel) - - if (this.planSource === 'search') { - if (sel) { - this.select.plan_id = sel.id; - this.select.plan_name = sel.name; - } else { - this.select.plan_id = ""; - this.select.plan_name = ""; - } + showPlanForSearch(source) { + this.planSource = source + this.isShowPlan = true + this.getBudgets() + // 初始化 plan 数组 + if (source === 'modal') { + this.plan = this.form.plan || [] } else { + this.plan = [] + } + }, + selectPlanForSearch(sel, row) { + if (this.planSource === 'modal') { if (sel) { - this.form.plan_display = sel.name; + let select = sel.map(item => { + let plan = this.plans.find(p => p.id === item.id) + return { + label: plan.name, + value: { + plan_id: plan.id, + use_money: plan.useMoney || 0, + new_money: plan.money + } + } + }) + this.plan = [...this.form.plan, ...select] + // 更新显示文本,显示所有已选择的计划 + this.form.plan_display = this.plan.map(item => item.label).join(', ') } else { - this.form.plan_display = ""; + this.plan = this.form.plan + // 更新显示文本,显示所有已选择的计划 + this.form.plan_display = this.plan.map(item => item.label).join(', ') } + } else { + this.select.plan_name = row.name + this.select.plan_id = row.id } }, + planSelectForSearch() { + if (this.plan.length === 0) { + Message({ + type: 'warning', + message: '选择计划不能为空' + }) + return + } + for (let item of this.plan) { + if (!item.value.use_money) { + Message({ + type: 'warning', + message: '金额不能为空' + }) + return + } + } + // 设置表单数据 + this.form.plan = this.plan + // 设置显示文本 + this.form.plan_display = this.plan.map(item => item.label).join(', ') + // 关闭对话框 + this.isShowPlan = false + }, //选择计划 selectPlan(sel, row) { console.log(sel) @@ -1660,87 +1700,49 @@ export default { } } }) - - - //说明被删除了 - if (sel.filter(plan => { - return plan.id == row.id - }).length == 0) { - this.delPlan({ - value: { - plan_id: row.id - } - }) - } - let _plan = JSON.parse(JSON.stringify(this.plan)); - - var _select = []; - select.map(item => { - if (_plan.filter(plan => { - return plan.value.plan_id == item.value.plan_id - }).length == 0) { - _select.push(item) - } - }); - - this.plan = [..._plan, ..._select] + this.plan = [...this.form.plan, ...select] } else { - this.plan = [] + this.plan = this.form.plan } }, //确认计划选择 planSelect() { - const selectedRows = this.$refs.planTable.getSelection() - if (!selectedRows || selectedRows.length === 0) { - this.$Message.warning('请选择至少一个预算计划') + if (this.plan.length === 0) { + Message({ + type: 'warning', + message: '选择计划不能为空' + }) return } - - // 更新选中的预算计划 - this.form.plan = selectedRows.map(item => ({ - id: item.id, - name: item.name, - money: item.money, - useMoney: item.useMoney || 0 - })) - - // 更新显示文本 - this.updatePlanDisplay() - - // 关闭弹框 + for (let item of this.plan) { + if (!item.value.use_money) { + Message({ + type: 'warning', + message: '金额不能为空' + }) + return + } + } + // 设置表单数据 + this.form.plan = this.plan + // 设置显示文本 + this.form.plan_display = this.plan.map(item => item.label).join(', ') + // 关闭对话框 this.isShowPlan = false }, delPlan(val) { - this.form.plan.map((item, index) => { - if (item.value.plan_id === val.value.plan_id) { - this.form.plan.splice(index, 1) - } - }) - this.plan.map((item, index) => { - if (item.value.plan_id === val.value.plan_id) { - this.plan.splice(index, 1) - } - }) - }, - //确认计划选择搜索 - planSelectForSearch() { - // if (this.select.plan_id == "") { - // Message({ - // type: 'warning', - // message: '选择计划不能为空' - // }) - // return - // } - this.isShowPlanForSearch = false + this.form.plan = this.form.plan.filter(item => item.value.plan_id !== val.value.plan_id) }, //默认选择计划 - toggleSelection(plans, type) { - + toggleSelection(plans) { if (plans) { this.plans.filter(plan => { if (plans.includes(plan.id)) { - plan.useMoney = this.plan[plans.indexOf(plan.id)].value.use_money + let selectedPlan = this.plan.find(item => item.value.plan_id === plan.id) + if (selectedPlan) { + plan.useMoney = selectedPlan.value.use_money + } return true } }).map(row => { @@ -1888,7 +1890,22 @@ export default { }, nextStep() { - if (this.validateCurrentStep()) { + // 验证当前步骤的表单 + if (this.currentStep === 2) { + this.$refs.basicInfoForm.validate((valid) => { + if (valid) { + // 如果显示预算计划字段,需要验证是否选择了预算计划 + if (this.showFields.budgetPlan && (!this.form.plan || this.form.plan.length === 0)) { + Message({ + type: 'warning', + message: '请选择关联预算计划' + }) + return + } + this.currentStep++ + } + }) + } else { this.currentStep++ } }, @@ -1961,6 +1978,14 @@ export default { fundChannel: config.fund_channel === 1, // 资金渠道 budgetPlan: config.budget_plan === 1 // 预算计划 }) + + // 保存支付表格模板 + if (config.before_contract_template) { + this.form.before_contract_template = config.before_contract_template + } + if (config.contract_template) { + this.form.contract_template = config.contract_template + } }, handleAddContract() { @@ -1972,26 +1997,16 @@ export default { }, handleAddContractOk() { - if (this.currentStep < 2) { - // 第一步,执行验证并进入下一步 - if (this.validateCurrentStep()) { - this.currentStep++; - } - } else { - // 最后一步,执行提交 - if (this.validateCurrentStep()) { - this.submit() - } - } + // 这个方法可以移除,因为功能已经被 nextStep 和 submit 方法替代 }, handleAddContractCancel() { - this.resetForm() - this.isShowAdd = false + // 这个方法可以移除,因为功能已经被 cancel 方法替代 }, cancel() { - this.handleAddContractCancel() + this.isShowAdd = false + this.resetForm() }, resetForm() { @@ -2183,18 +2198,13 @@ export default { } }, // 新增方法:移除预算计划 - removePlan(plan) { - const index = this.form.plan.findIndex(item => item.id === plan.id) - if (index !== -1) { - this.form.plan.splice(index, 1) - - // 更新显示文本 - if (this.form.plan && this.form.plan.length > 0) { - this.form.plan_display = `已选择 ${this.form.plan.length} 个预算计划` - } else { - this.form.plan_display = '' - } - } + removePlan(item) { + // 从 plan 数组中移除 + this.plan = this.plan.filter(p => p.value.plan_id !== item.value.plan_id) + // 从 form.plan 中移除 + this.form.plan = this.form.plan.filter(p => p.value.plan_id !== item.value.plan_id) + // 更新显示文本 + this.form.plan_display = this.plan.map(p => p.label).join(', ') }, }, mounted() { @@ -2581,4 +2591,15 @@ export default { height: 400px; overflow-y: auto; } + +.modal-footer { + display: flex; + justify-content: flex-end; + gap: 12px; + padding: 10px 0; + + .action-button { + min-width: 100px; + } +} From d591f28b36487df1e70f14ccb384e3da5feeadda Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 25 Apr 2025 21:36:27 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=88=E5=90=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 133 ++++++++++++++++------------ 1 file changed, 78 insertions(+), 55 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 1ed6736..8ab21fc 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -431,12 +431,12 @@
-
+
事前支付表格
-
+
事后支付表格
@@ -447,7 +447,8 @@
@@ -910,9 +911,7 @@ export default { width: 320, align: "left", customFn: (row) => { - return row.money_way_detail.map(item => { - return `
${item.value}
` - }).join('') + return row.money_way_detail.map(item => item.value).join(',') } }, { @@ -920,9 +919,7 @@ export default { width: 320, align: "left", customFn: (row) => { - return row.plans.map(item => { - return `
[${item.year}] - ${item.name}
` - }).join('') + return row.plans.map(item => `[${item.year}] - ${item.name}`).join(',') } }, { @@ -948,7 +945,7 @@ export default { width: 140, customFn: (row) => { let per = ((((row.fund_log_total) / row.money) || 0) * 100)?.toFixed(2) || 0 - return `
${per}%
` + return `${per}%` } }, { @@ -1041,9 +1038,7 @@ export default { minWidth: 200, prop: "contract_carry_department", customFn: row => { - return row.contract_carry_department.map(i => { - return `${i.carry_department.name}` - }).join('') + return row.contract_carry_department.map(i => i.carry_department.name).join(',') } } ], @@ -1754,48 +1749,53 @@ export default { }, //提交新建 async submit() { - try { - // 获取分类配置 - const res = await getContractCategoryTemplateBaseConfig() - if (res.errcode !== undefined) { - this.$message.error(res.errmsg || '获取分类配置失败') - return - } - - // 保存采购方式映射 - this.purchaseMethodsMap = res.purchase_methods || {} - - // 设置分类选项 - 从第二级开始(合同类、报销类、其他支出类) - this.categoryOptions = res.map?.[0]?.children || [] - - // 递归处理每一层的 children,确保所有层级都被正确解析 - const processChildren = (items) => { - if (!items) return - items.forEach(item => { - if (item.children) { - // 确保每个子项都有正确的 id 和 name - item.children = item.children.map(child => ({ - id: child.id, - name: child.name || child.value, // 添加对 value 字段的支持 - children: child.children || [] - })) - processChildren(item.children) - } - }) - } + addContrant({ + // 第一步的数据 + category: this.form.category, + work_type: this.form.affairType, + contract_type: this.form.contractType, + purchase_form: this.form.purchaseForm, + purchase_sub_form: this.form.purchaseSubForm, + purchase_method: this.form.purchaseMethod, - // 处理所有层级的 children - processChildren(this.categoryOptions) + // 第二步的数据 + type: this.form.type, + is_plan: this.form.isBudget ? 1 : 0, + purchase_type_id: this.form.methods, + purchase_way_id: this.form.modality, + money_way_id: `${this.form.moneyWay.toString()}`, + plan_price: this.form.price, + name: this.form.name, + contract_plan_links: this.form.plan.map(item => { + return item.value + }), + is_substitute: this.form.is_substitute, + is_simple: this.form.is_simple, + has_charge: this.form.has_charge, + supply: this.form.supply, + money: this.form.money, + status: this.form.is_simple ? 2 : 1, + gov_plane_id: this.form.gov_plane_id, + contract_carry_department: this.form.contract_carry_department?.map(i => ({carry_department_id: i})) || [], - // 重置表单 + // 第三步的数据 + before_contract_template: this.form.before_contract_template, + contract_template: this.form.contract_template + }).then(res => { + this.isShowAdd = false + Message({ + type: 'success', + message: '操作成功' + }) this.resetForm() - - // 打开模态框 - this.isShowAdd = true - } catch (error) { - console.error('获取分类配置失败:', error) - this.$message.error('获取分类配置失败') - } + this.$refs.planTable?.clearSelection() + this.getContracts() + }).catch(error => { + Message({ + type: 'error', + message: error.message || '提交失败' + }) + }) }, //删除合同 @@ -1891,7 +1891,16 @@ export default { nextStep() { // 验证当前步骤的表单 - if (this.currentStep === 2) { + if (this.currentStep === 1) { + // 验证第一步的必填项 + if (!this.form.category || !this.form.affairType || !this.form.contractType || + !this.form.purchaseForm || !this.form.purchaseMethod) { + this.$Message.warning('请填写所有必填项') + return + } + // 获取模版配置 + this.getTemplateConfig() + } else if (this.currentStep === 2) { this.$refs.basicInfoForm.validate((valid) => { if (valid) { // 如果显示预算计划字段,需要验证是否选择了预算计划 @@ -1911,7 +1920,13 @@ export default { }, prevStep() { - this.currentStep-- + if (this.currentStep === 3 && this.form.showAfterPayment && this.form.before_contract_template) { + // 如果在事后支付表格且有事前支付表格,则返回事前支付表格 + this.form.showAfterPayment = false + } else { + // 其他情况正常返回上一步 + this.currentStep-- + } }, validateCurrentStep() { @@ -1949,7 +1964,10 @@ export default { purchase_form: this.form.purchaseForm } + console.log('请求模版配置参数:', params) const res = await getContractCategoryTemplateConfigParams(params) + console.log('模版配置返回数据:', res) + if (res.errcode !== undefined) { this.$message.error(res.errmsg || '获取模版配置失败') return @@ -2042,7 +2060,8 @@ export default { ratio: '', payee: '' } - ] + ], + showAfterPayment: false // 是否显示事后支付表格 } this.affairTypeOptions = [] @@ -2206,6 +2225,10 @@ export default { // 更新显示文本 this.form.plan_display = this.plan.map(p => p.label).join(', ') }, + // 切换到事后支付表格 + nextPaymentStep() { + this.form.showAfterPayment = true + }, }, mounted() { this.window.width = screen.availWidth * 0.95 From b8f4e623565c69b590ef7c8e8f135d7f00a8a334 Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 25 Apr 2025 22:09:29 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=88=E5=90=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 8ab21fc..50ea5cd 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -1761,7 +1761,7 @@ export default { // 第二步的数据 type: this.form.type, is_plan: this.form.isBudget ? 1 : 0, - purchase_type_id: this.form.methods, + purchase_type_id: this.form.purchaseForm, // 修改这里,使用 purchaseForm 而不是 methods purchase_way_id: this.form.modality, money_way_id: `${this.form.moneyWay.toString()}`, plan_price: this.form.price, From e9ea05bbabda841c9bd30204f751bc7c717bb6d5 Mon Sep 17 00:00:00 2001 From: lynn Date: Sat, 26 Apr 2025 08:49:51 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=8B=E5=89=8D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E8=A1=A8=E6=A0=BC=E4=B8=BA=E5=8F=AF=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/businessConfig/contractConfig.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/views/businessConfig/contractConfig.vue b/src/views/businessConfig/contractConfig.vue index 1b95c31..ac3788e 100644 --- a/src/views/businessConfig/contractConfig.vue +++ b/src/views/businessConfig/contractConfig.vue @@ -253,7 +253,7 @@ - + - + Date: Sat, 26 Apr 2025 10:25:15 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E5=90=88=E5=90=8C=E7=9A=84=E5=90=84=E4=B8=AA=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=A0=B8=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 174 ++++++++++++++++++++++++---- 1 file changed, 152 insertions(+), 22 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 50ea5cd..93e9d98 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -308,7 +308,7 @@
-
已选合同模版类型
+
合同类型
合同分类: @@ -335,7 +335,7 @@
-
流程控制
+
合同配置
是否为简易流程
@@ -393,15 +393,75 @@ + + + + + + + + +
+ + + + +
+ + {{ getDepartmentName(id) }} + +
+
+
- - - +
+ + + + +
+ + {{ getMoneyWayName(id) }} + +
+
@@ -436,10 +496,15 @@
-
+
事后支付表格
+ +
+
无支付表格
+
当前选择的合同类型没有配置支付表格
+
@@ -447,8 +512,10 @@
@@ -1160,7 +1227,7 @@ export default { purchaseMethod: '', name: '', type: '', // 项目类型 - moneyWay: '', + moneyWay: [], plan: [], plan_display: '', // 预算计划显示文本 price: 0, @@ -1182,7 +1249,9 @@ export default { ratio: '', payee: '' } - ] + ], + showAfterPayment: false, // 是否显示事后支付表格 + contract_carry_department: [] // 新增执行科室字段 }, categoryOptions: [], purchaseMethodsMap: {}, @@ -1762,8 +1831,8 @@ export default { type: this.form.type, is_plan: this.form.isBudget ? 1 : 0, purchase_type_id: this.form.purchaseForm, // 修改这里,使用 purchaseForm 而不是 methods - purchase_way_id: this.form.modality, - money_way_id: `${this.form.moneyWay.toString()}`, + purchase_way_id: this.form.purchaseMethod, + money_way_id: this.form.moneyWay.toString(), // 修改这里,将数组转换为字符串 plan_price: this.form.price, name: this.form.name, contract_plan_links: this.form.plan.map(item => { @@ -1892,10 +1961,10 @@ export default { nextStep() { // 验证当前步骤的表单 if (this.currentStep === 1) { - // 验证第一步的必填项 - if (!this.form.category || !this.form.affairType || !this.form.contractType || - !this.form.purchaseForm || !this.form.purchaseMethod) { - this.$Message.warning('请填写所有必填项') + // 验证是否至少选择了一个下拉框 + if (!this.form.category && !this.form.affairType && !this.form.contractType && + !this.form.purchaseForm && !this.form.purchaseMethod) { + this.$Message.warning('请至少选择一个选项') return } // 获取模版配置 @@ -1958,10 +2027,10 @@ export default { async getTemplateConfig() { try { const params = { - category: this.form.category, - work_type: this.form.affairType, - contract_type: this.form.contractType, - purchase_form: this.form.purchaseForm + category: this.form.category || 0, + work_type: this.form.affairType || 0, + contract_type: this.form.contractType || 0, + purchase_form: this.form.purchaseForm || 0 } console.log('请求模版配置参数:', params) @@ -2038,11 +2107,11 @@ export default { purchaseMethod: '', name: '', type: '', // 项目类型 - money_way_id: '', + moneyWay: [], plan: [], plan_display: '', // 预算计划显示文本 price: 0, - supply: '', + supply: '', // 承包商/供应商 // 流程控制字段 is_simple: 0, // 是否为简易流程 has_charge: 0, // 是否为河道处收费类项目 @@ -2061,7 +2130,8 @@ export default { payee: '' } ], - showAfterPayment: false // 是否显示事后支付表格 + showAfterPayment: false, // 是否显示事后支付表格 + contract_carry_department: [] // 新增执行科室字段 } this.affairTypeOptions = [] @@ -2229,6 +2299,27 @@ export default { nextPaymentStep() { this.form.showAfterPayment = true }, + // 获取资金渠道名称的方法 + getMoneyWayName(id) { + const way = this.moneyWay.find(item => item.id === id) + return way ? way.value : '' + }, + + // 移除资金渠道 + removeMoneyWay(id) { + this.form.moneyWay = this.form.moneyWay.filter(item => item !== id) + }, + + // 获取科室名称的方法 + getDepartmentName(id) { + const dept = this.departments.find(item => item.id === id) + return dept ? dept.name : '' + }, + + // 移除科室 + removeDepartment(id) { + this.form.contract_carry_department = this.form.contract_carry_department.filter(item => item !== id) + }, }, mounted() { this.window.width = screen.availWidth * 0.95 @@ -2625,4 +2716,43 @@ export default { min-width: 100px; } } + +.no-payment-form { + padding: 20px; + text-align: center; + color: #909399; + font-size: 14px; + background-color: #f5f7fa; + border-radius: 4px; +} + +.money-way-selector { + width: 100%; + + .money-way-tags { + margin-top: 8px; + display: flex; + flex-wrap: wrap; + gap: 8px; + + .el-tag { + margin-right: 0; + } + } +} + +.department-selector { + width: 100%; + + .department-tags { + margin-top: 8px; + display: flex; + flex-wrap: wrap; + gap: 8px; + + .el-tag { + margin-right: 0; + } + } +} From 82cd17b82446bc2e8dbe23402054cbd47cd93e09 Mon Sep 17 00:00:00 2001 From: lynn Date: Sat, 26 Apr 2025 14:09:17 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=8B=E5=89=8D?= =?UTF-8?q?=E5=92=8C=E4=BA=8B=E5=90=8E=E6=94=AF=E4=BB=98=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=9A=84=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 400 ++++++++++++++++++++++++---- 1 file changed, 347 insertions(+), 53 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 93e9d98..917d96c 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -493,12 +493,12 @@
事前支付表格
-
+
事后支付表格
-
+
@@ -512,10 +512,18 @@
@@ -1818,53 +1826,102 @@ export default { }, //提交新建 async submit() { - addContrant({ - // 第一步的数据 - category: this.form.category, - work_type: this.form.affairType, - contract_type: this.form.contractType, - purchase_form: this.form.purchaseForm, - purchase_sub_form: this.form.purchaseSubForm, - purchase_method: this.form.purchaseMethod, - - // 第二步的数据 - type: this.form.type, - is_plan: this.form.isBudget ? 1 : 0, - purchase_type_id: this.form.purchaseForm, // 修改这里,使用 purchaseForm 而不是 methods - purchase_way_id: this.form.purchaseMethod, - money_way_id: this.form.moneyWay.toString(), // 修改这里,将数组转换为字符串 - plan_price: this.form.price, - name: this.form.name, - contract_plan_links: this.form.plan.map(item => { - return item.value - }), - is_substitute: this.form.is_substitute, - is_simple: this.form.is_simple, - has_charge: this.form.has_charge, - supply: this.form.supply, - money: this.form.money, - status: this.form.is_simple ? 2 : 1, - gov_plane_id: this.form.gov_plane_id, - contract_carry_department: this.form.contract_carry_department?.map(i => ({carry_department_id: i})) || [], - - // 第三步的数据 - before_contract_template: this.form.before_contract_template, - contract_template: this.form.contract_template - }).then(res => { - this.isShowAdd = false + try { + // 更新事前支付表格的 HTML 和值 + if (this.form.before_contract_template && + this.form.before_contract_template.contract_template_fields && + this.$refs.beforePaymentForm) { + const inputs = this.$refs.beforePaymentForm.querySelectorAll('input, select, textarea'); + inputs.forEach(input => { + const fieldName = input.getAttribute('data-field'); + if (fieldName) { + const field = this.form.before_contract_template.contract_template_fields.find(f => f.field === fieldName); + if (field) { + if (input.type === 'checkbox' || input.type === 'radio') { + const checkedInput = this.$refs.beforePaymentForm.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); + } + } + } + }); + this.form.before_contract_template.template = this.$refs.beforePaymentForm.innerHTML; + } + + // 更新事后支付表格的 HTML 和值 + if (this.form.contract_template && + this.form.contract_template.contract_template_fields && + this.$refs.afterPaymentForm) { + const inputs = this.$refs.afterPaymentForm.querySelectorAll('input, select, textarea'); + inputs.forEach(input => { + const fieldName = input.getAttribute('data-field'); + if (fieldName) { + const field = this.form.contract_template.contract_template_fields.find(f => f.field === fieldName); + if (field) { + if (input.type === 'checkbox' || input.type === 'radio') { + const checkedInput = this.$refs.afterPaymentForm.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); + } + } + } + }); + this.form.contract_template.template = this.$refs.afterPaymentForm.innerHTML; + } + + // 提交数据 + const res = await addContrant({ + category: this.form.category, + work_type: this.form.affairType, + contract_type: this.form.contractType, + purchase_form: this.form.purchaseForm, + purchase_sub_form: this.form.purchaseSubForm, + purchase_method: this.form.purchaseMethod, + type: this.form.type, + is_plan: this.form.isBudget ? 1 : 0, + purchase_type_id: this.form.purchaseForm, + purchase_way_id: this.form.purchaseMethod, + money_way_id: this.form.moneyWay.toString(), + plan_price: this.form.price, + name: this.form.name, + contract_plan_links: this.form.plan.map(item => item.value), + is_substitute: this.form.is_substitute, + is_simple: this.form.is_simple, + has_charge: this.form.has_charge, + supply: this.form.supply, + money: this.form.money, + status: this.form.is_simple ? 2 : 1, + gov_plane_id: this.form.gov_plane_id, + contract_carry_department: this.form.contract_carry_department?.map(i => ({carry_department_id: i})) || [], + before_contract_template: this.form.before_contract_template, + contract_template: this.form.contract_template + }); + + this.isShowAdd = false; Message({ type: 'success', message: '操作成功' - }) - this.resetForm() - this.$refs.planTable?.clearSelection() - this.getContracts() - }).catch(error => { + }); + this.resetForm(); + this.$refs.planTable?.clearSelection(); + this.getContracts(); + } catch (error) { + console.error('提交失败:', error); Message({ type: 'error', message: error.message || '提交失败' - }) - }) + }); + } }, //删除合同 @@ -1983,18 +2040,56 @@ export default { this.currentStep++ } }) - } else { + } else if (this.currentStep === 3) { this.currentStep++ } }, prevStep() { + // 如果在事后支付表格,先保存内容 + if (this.currentStep === 3 && this.form.showAfterPayment && + this.form.contract_template && + this.form.contract_template.contract_template_fields && + this.$refs.afterPaymentForm) { + // 获取所有输入控件 + const inputs = this.$refs.afterPaymentForm.querySelectorAll('input, select, textarea'); + + // 遍历所有输入控件,更新值到 HTML + inputs.forEach(input => { + const fieldName = input.getAttribute('data-field'); + if (fieldName) { + const field = this.form.contract_template.contract_template_fields.find(f => f.field === fieldName); + if (field) { + if (input.type === 'checkbox' || input.type === 'radio') { + // 对于复选框和单选框,需要找到选中的值 + const checkedInput = this.$refs.afterPaymentForm.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); + } + } + } + }); + + // 获取更新后的 HTML + const afterFormHtml = this.$refs.afterPaymentForm.innerHTML; + + // 更新模板 + this.form.contract_template.template = afterFormHtml; + } + if (this.currentStep === 3 && this.form.showAfterPayment && this.form.before_contract_template) { // 如果在事后支付表格且有事前支付表格,则返回事前支付表格 - this.form.showAfterPayment = false + this.form.showAfterPayment = false; } else { // 其他情况正常返回上一步 - this.currentStep-- + this.currentStep--; } }, @@ -2068,10 +2163,131 @@ export default { // 保存支付表格模板 if (config.before_contract_template) { - this.form.before_contract_template = config.before_contract_template + // 处理事前支付表格模板 + let beforeTemplate = config.before_contract_template.template; + if (beforeTemplate && config.before_contract_template.contract_template_fields) { + console.log('处理事前支付表格模板:', config.before_contract_template.contract_template_fields) + + // 遍历字段列表,为每个字段找到对应的控件 + config.before_contract_template.contract_template_fields.forEach(field => { + // 在模板中查找 data-field 属性值与字段名相同的控件 + const regex = new RegExp(`<[^>]*data-field="${field.field}"[^>]*>`, 'g'); + const matches = beforeTemplate.match(regex); + + if (matches) { + matches.forEach(match => { + // 获取控件类型 + let controlType = 'text'; + if (match.includes('type="number"')) controlType = 'number'; + else if (match.includes('type="date"')) controlType = 'date'; + else if (match.includes('type="checkbox"')) controlType = 'checkbox'; + else if (match.includes('type="radio"')) controlType = 'radio'; + else if (match.includes(' { + const optionRegex = new RegExp(`]*value="${opt.value}"[^>]*>`, 'g'); + const optionMatches = newControl.match(optionRegex); + if (optionMatches) { + optionMatches.forEach(optionMatch => { + const checked = field.value === opt.value ? 'checked' : ''; + newControl = newControl.replace(optionMatch, optionMatch.replace('>', ` ${checked}>`)); + }); + } + }); + } else { + // 对于其他控件,直接设置 value + if (!newControl.includes('value=')) { + newControl = newControl.replace('>', ` value="${field.value || ''}">`); + } else { + newControl = newControl.replace(/value="[^"]*"/, `value="${field.value || ''}"`); + } + } + + // 替换原控件 + beforeTemplate = beforeTemplate.replace(match, newControl); + }); + } + }); + } + this.form.before_contract_template = config.before_contract_template; + this.form.before_contract_template.template = beforeTemplate; } + if (config.contract_template) { - this.form.contract_template = config.contract_template + // 处理事后支付表格模板 + let afterTemplate = config.contract_template.template; + if (afterTemplate && config.contract_template.contract_template_fields) { + console.log('处理事后支付表格模板:', config.contract_template.contract_template_fields) + + // 遍历字段列表,为每个字段找到对应的控件 + config.contract_template.contract_template_fields.forEach(field => { + // 在模板中查找 data-field 属性值与字段名相同的控件 + const regex = new RegExp(`<[^>]*data-field="${field.field}"[^>]*>`, 'g'); + const matches = afterTemplate.match(regex); + + if (matches) { + matches.forEach(match => { + // 获取控件类型 + let controlType = 'text'; + if (match.includes('type="number"')) controlType = 'number'; + else if (match.includes('type="date"')) controlType = 'date'; + else if (match.includes('type="checkbox"')) controlType = 'checkbox'; + else if (match.includes('type="radio"')) controlType = 'radio'; + else if (match.includes(' { + const optionRegex = new RegExp(`]*value="${opt.value}"[^>]*>`, 'g'); + const optionMatches = newControl.match(optionRegex); + if (optionMatches) { + optionMatches.forEach(optionMatch => { + const checked = field.value === opt.value ? 'checked' : ''; + newControl = newControl.replace(optionMatch, optionMatch.replace('>', ` ${checked}>`)); + }); + } + }); + } else { + // 对于其他控件,直接设置 value + if (!newControl.includes('value=')) { + newControl = newControl.replace('>', ` value="${field.value || ''}">`); + } else { + newControl = newControl.replace(/value="[^"]*"/, `value="${field.value || ''}"`); + } + } + + // 替换原控件 + afterTemplate = afterTemplate.replace(match, newControl); + }); + } + }); + } + this.form.contract_template = config.contract_template; + this.form.contract_template.template = afterTemplate; } }, @@ -2297,7 +2513,42 @@ export default { }, // 切换到事后支付表格 nextPaymentStep() { - this.form.showAfterPayment = true + // 保存事前支付表格的数据 + if (this.form.before_contract_template && this.form.before_contract_template.contract_template_fields) { + // 获取所有输入控件 + const inputs = this.$refs.beforePaymentForm.querySelectorAll('input, select, textarea'); + + // 遍历所有输入控件,更新值到 HTML + inputs.forEach(input => { + const fieldName = input.getAttribute('data-field'); + if (fieldName) { + const field = this.form.before_contract_template.contract_template_fields.find(f => f.field === fieldName); + if (field) { + if (input.type === 'checkbox' || input.type === 'radio') { + // 对于复选框和单选框,需要找到选中的值 + const checkedInput = this.$refs.beforePaymentForm.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); + } + } + } + }); + + // 获取更新后的 HTML + const beforeFormHtml = this.$refs.beforePaymentForm.innerHTML; + console.log("被修改的模板", beforeFormHtml); + + // 更新模板 + this.form.before_contract_template.template = beforeFormHtml; + } + this.form.showAfterPayment = true; }, // 获取资金渠道名称的方法 getMoneyWayName(id) { @@ -2320,6 +2571,36 @@ export default { removeDepartment(id) { this.form.contract_carry_department = this.form.contract_carry_department.filter(item => item !== id) }, + + // 跳过事前支付表格 + skipPrePayment() { + this.form.showAfterPayment = true + }, + + // 跳过事后支付表格 + skipPostPayment() { + this.submit() + }, + + // 更新事前表格字段值 + updateBeforeFieldValue(field, value) { + if (this.form.before_contract_template && this.form.before_contract_template.contract_template_fields) { + const fieldObj = this.form.before_contract_template.contract_template_fields.find(f => f.field === field); + if (fieldObj) { + fieldObj.value = value; + } + } + }, + + // 更新事后表格字段值 + updateAfterFieldValue(field, value) { + if (this.form.contract_template && this.form.contract_template.contract_template_fields) { + const fieldObj = this.form.contract_template.contract_template_fields.find(f => f.field === field); + if (fieldObj) { + fieldObj.value = value; + } + } + }, }, mounted() { this.window.width = screen.availWidth * 0.95 @@ -2755,4 +3036,17 @@ export default { } } } + +.skip-option { + margin-top: 16px; + text-align: center; + + .el-button { + color: #909399; + + &:hover { + color: #409EFF; + } + } +} From a9a320ae899f97815086f80bdaf4e1064ad6cd4c Mon Sep 17 00:00:00 2001 From: lynn Date: Sat, 26 Apr 2025 15:26:56 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=88=E5=90=8C?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 266 +++++++++++++++++++++++++--- 1 file changed, 238 insertions(+), 28 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 917d96c..6fe154b 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -222,7 +222,7 @@ - -