From dee24ac102d55c042f7cb4b5c024fe89bb559a1c Mon Sep 17 00:00:00 2001 From: lynn Date: Fri, 6 Jun 2025 11:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/contractList.vue | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index ee4a729..fae1163 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -32,9 +32,9 @@
- 服务商/供应商 + 供应商/付款对象 - +
@@ -422,11 +422,14 @@ - + :rules="[{ required: true, message: formType === 'contract' ? '请输入承包商/供应商' : '请输入付款对象', trigger: 'submit' }]" + v-show="true"> + @@ -1422,6 +1425,7 @@ export default { }, showPaymentFormPreview: false, previewType: '', // 'before' or 'after' + formType: 'contract', // 默认类型 } }, methods: { @@ -2103,7 +2107,8 @@ export default { submitData.purchase_type_id = this.form.purchaseForm submitData.purchase_way_id = this.form.purchaseMethod submitData.plan_price = this.form.price - + submitData.is_contract = this.formType === 'contract' ? 1 : 0 + // 处理事前支付模板 if (this.form.skipBeforeTemplate && !this.isEditMode) { // 如果用户选择跳过,提交空的模板和字段列表 @@ -3309,34 +3314,30 @@ export default { this.getContracts(); }, // 添加按分类新增合同的方法 - async handleAddContractByCategory(category) { - // 先设置 loading 状态 + async handleAddContractByCategory(type) { + this.formType = type; this.loading = true; - try { - // 显示弹窗 + // 1. 获取当前用户所在部门id + const userDeptId = this.$store.state.user.info.department_id; + // 2. 显示弹窗、初始化表单 this.isShowAdd = true; this.isEditMode = false; this.isFromPayment = false; - - // 等待获取分类配置 await this.getCategoryOptions(); - - // 重置表单 this.resetForm(); - - // 根据分类自动选择对应的选项 + // 3. 默认选中用户部门 + if (userDeptId) { + this.form.contract_carry_department = [userDeptId]; + } + // ...后续自动选择分类等逻辑... if (this.categoryOptions && this.categoryOptions.length > 0) { - // 找到对应分类的选项 const categoryOption = this.categoryOptions.find(item => { const name = item.name || item.value || ''; - return name.includes(category === 'contract' ? '合同' : - category === 'reimbursement' ? '报销' : '其他支出'); + return name.includes(type === 'contract' ? '合同' : type === 'reimbursement' ? '报销' : '其他支出'); }); - if (categoryOption) { this.form.category = categoryOption.id; - // 触发分类变更,自动选择后续选项 this.handleCategoryChange(); } } @@ -3344,7 +3345,6 @@ export default { console.error('加载数据失败:', error); this.$message.error('加载数据失败'); } finally { - // 无论成功失败都关闭 loading this.loading = false; } },