\\$\\{${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 @@
-
+
+
+
+ {{ scope.row.prePaymentForm || '-' }}
+
+
+
+
+ {{ scope.row.postPaymentForm || '-' }}
+
+
+
编辑
@@ -242,8 +253,19 @@
-
-
+
+
+
+
+
+
+
+
+
{
- // 设置表单数据
- this.form = {
- id: row.id, // 记录ID,用于更新
- category: row.category_id, // 使用原始ID
- affairType: row.work_type_id, // 使用原始ID
- contractType: row.contract_type_id, // 使用原始ID
- purchaseForm: row.purchase_form_id, // 使用原始ID
- purchaseWay: row.purchaseWay === true || row.purchaseWay === 1,
- purchaseMethod: row.purchaseMethod === true || row.purchaseMethod === 1,
- projectName: row.projectName === true || row.projectName === 1,
- projectType: row.projectType === true || row.projectType === 1,
- budgetPrice: row.budgetPrice === true || row.budgetPrice === 1,
- fundChannel: row.fundChannel === true || row.fundChannel === 1,
- budgetPlan: row.budgetPlan === true || row.budgetPlan === 1,
- request: row.request === true || row.request === 1,
- purchaseApproval: row.purchaseApproval === true || row.purchaseApproval === 1,
- tenderReview: row.tenderReview === true || row.tenderReview === 1,
- contractSign: row.contractSign === true || row.contractSign === 1,
- paymentForm: row.paymentForm || ''
- }
-
- // 保存原始支付表格值
- this.originalPaymentForm = row.paymentForm
-
- // 加载下拉框选项
- this.loadEditOptions(row)
+ try {
+ // 先获取支付表格选项
+ await this.getPaymentFormOptions()
+
+ console.log('编辑行数据:', row) // 打印行数据,查看字段名
+
+ // 设置表单数据
+ this.form = {
+ id: row.id, // 记录ID,用于更新
+ category: row.category_id, // 使用原始ID
+ affairType: row.work_type_id, // 使用原始ID
+ contractType: row.contract_type_id, // 使用原始ID
+ purchaseForm: row.purchase_form_id, // 使用原始ID
+ purchaseWay: row.purchaseWay === true || row.purchaseWay === 1,
+ purchaseMethod: row.purchaseMethod === true || row.purchaseMethod === 1,
+ projectName: row.projectName === true || row.projectName === 1,
+ projectType: row.projectType === true || row.projectType === 1,
+ budgetPrice: row.budgetPrice === true || row.budgetPrice === 1,
+ fundChannel: row.fundChannel === true || row.fundChannel === 1,
+ budgetPlan: row.budgetPlan === true || row.budgetPlan === 1,
+ request: row.request === true || row.request === 1,
+ purchaseApproval: row.purchaseApproval === true || row.purchaseApproval === 1,
+ tenderReview: row.tenderReview === true || row.tenderReview === 1,
+ contractSign: row.contractSign === true || row.contractSign === 1,
+ prePaymentForm: row.before_contract_template_id || '',
+ postPaymentForm: row.contract_template_id || ''
+ }
+
+ // 保存原始支付表格值
+ this.originalPrePaymentForm = row.before_contract_template_id
+ this.originalPostPaymentForm = row.contract_template_id
+
+ // 加载下拉框选项
+ this.loadEditOptions(row)
+
+ // 确保表单数据已经设置
+ this.$nextTick(() => {
+ console.log('表单数据:', this.form)
+ console.log('支付表格选项:', this.paymentFormOptions)
// 打开抽屉
- this.dialogVisible = true
- })
- .catch(error => {
- console.error('加载支付表格选项失败:', error)
- this.$message.error('加载支付表格选项失败')
+ this.dialogVisible = true
})
+ } catch (error) {
+ console.error('加载数据失败:', error)
+ this.$message.error('加载数据失败')
+ }
},
// 加载编辑时的下拉框选项
@@ -798,14 +840,21 @@ export default {
// 只添加ID
submitData.id = this.form.id
- // 如果支付表格有值且与原始值不同,才添加到提交数据中
- if (this.form.paymentForm && this.form.paymentForm !== this.originalPaymentForm) {
- submitData.contract_template_id = this.form.paymentForm
+ // 如果事前支付表格有值且与原始值不同,才添加到提交数据中
+ if (this.form.prePaymentForm && this.form.prePaymentForm !== this.originalPrePaymentForm) {
+ submitData.before_contract_template_id = this.form.prePaymentForm
}
- } else {
+ // 如果事后支付表格有值且与原始值不同,才添加到提交数据中
+ if (this.form.postPaymentForm && this.form.postPaymentForm !== this.originalPostPaymentForm) {
+ submitData.contract_template_id = this.form.postPaymentForm
+ }
+ } else {
// 新增模式下,如果有支付表格值就添加
- if (this.form.paymentForm) {
- submitData.contract_template_id = this.form.paymentForm
+ if (this.form.prePaymentForm) {
+ submitData.before_contract_template_id = this.form.prePaymentForm
+ }
+ if (this.form.postPaymentForm) {
+ submitData.contract_template_id = this.form.postPaymentForm
}
}
@@ -816,7 +865,7 @@ export default {
return
}
- this.$message.success('保存成功')
+ this.$message.success('保存成功')
this.dialogVisible = false
// 刷新列表数据
await this.getTableData()
@@ -863,9 +912,8 @@ export default {
id: item.id,
label: item.name || item.title || `附件${item.id}`
}))
- if (res.data.length > 0) {
- this.originalPaymentForm = res.data[0].id // 保存原始支付表格ID
- }
+
+ console.log('支付表格选项:', this.paymentFormOptions)
} else {
this.paymentFormOptions = []
}
|