From fbddbf82cd7d935032a769c8f904dd9a816c3f31 Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 25 Apr 2025 20:50:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=85=B3=E8=81=94=E9=A2=84?= =?UTF-8?q?=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 }} + +
-
- - + + +
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - - - - - - - - - - - - - - - - -
内容金额比例收款人
+ +
+ +
+
事前支付表格
+
+
+ +
+
事后支付表格
+
+
- -
- - - - +
+
@@ -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; + } +}