新增合同

master
lynn 1 year ago
parent f007ae4417
commit dee24ac102

@ -32,9 +32,9 @@
</div>
<div>
<span style="padding: 0 6px;word-break: keep-all;">服务商/供应商</span>
<span style="padding: 0 6px;word-break: keep-all;">供应商/付款对象</span>
<span>
<Input v-model="select.supply" clearable placeholder="请输入服务商/供应商" style="width: 200px"/>
<Input v-model="select.supply" clearable placeholder="请输入供应商/付款对象" style="width: 200px"/>
</span>
</div>
@ -422,11 +422,14 @@
<!-- 新增承包商/供应商输入框 -->
<el-form-item
label="承包商/供应商"
:label="formType === 'contract' ? '承包商/供应商' : '付款对象'"
prop="supply"
:rules="[{ required: form.is_simple === 1, message: '请输入承包商/供应商', trigger: 'submit' }]"
v-show="form.is_simple === 1">
<el-input v-model="form.supply" placeholder="请输入承包商/供应商"></el-input>
:rules="[{ required: true, message: formType === 'contract' ? '请输入承包商/供应商' : '请输入付款对象', trigger: 'submit' }]"
v-show="true">
<el-input
v-model="form.supply"
:placeholder="formType === 'contract' ? '请输入承包商/供应商' : '请输入付款对象'"
></el-input>
</el-form-item>
<!-- 新增执行科室选择 -->
@ -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;
}
},

Loading…
Cancel
Save