|
|
|
|
@ -222,7 +222,7 @@
|
|
|
|
|
</Button>
|
|
|
|
|
<template v-if="scope.row.status != 2||hasEdit">
|
|
|
|
|
<Button class="slot-btns-item" size="small" type="primary"
|
|
|
|
|
@click="$refs['editor'].isShowEditor = true,$refs['editor'].getDetail(scope.row.id)">编辑
|
|
|
|
|
@click="handleEdit(scope.row)">编辑
|
|
|
|
|
</Button>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="hasEdit&&scope.row.status === 2">
|
|
|
|
|
@ -246,7 +246,7 @@
|
|
|
|
|
<!-- 新增合同模态框 -->
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="isShowAdd"
|
|
|
|
|
title="新增合同"
|
|
|
|
|
:title="isEditMode ? '编辑合同' : '新增合同'"
|
|
|
|
|
width="800"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
:closable="false"
|
|
|
|
|
@ -618,7 +618,8 @@ import {
|
|
|
|
|
getContract,
|
|
|
|
|
addContrant,
|
|
|
|
|
delContract,
|
|
|
|
|
checkContractName
|
|
|
|
|
checkContractName,
|
|
|
|
|
editorContract
|
|
|
|
|
} from "@/api/contract/contract"
|
|
|
|
|
import {
|
|
|
|
|
getparameter
|
|
|
|
|
@ -1283,6 +1284,8 @@ export default {
|
|
|
|
|
{ label: '服务合同', value: 'service' }
|
|
|
|
|
],
|
|
|
|
|
plan: [], // 添加这个来存储选中的预算计划
|
|
|
|
|
isEditMode: false, // 添加编辑模式标识
|
|
|
|
|
currentContractId: null, // 添加当前编辑的合同ID
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
@ -1879,8 +1882,8 @@ export default {
|
|
|
|
|
this.form.contract_template.template = this.$refs.afterPaymentForm.innerHTML;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 提交数据
|
|
|
|
|
const res = await addContrant({
|
|
|
|
|
// 准备提交数据
|
|
|
|
|
const submitData = {
|
|
|
|
|
category: this.form.category,
|
|
|
|
|
work_type: this.form.affairType,
|
|
|
|
|
contract_type: this.form.contractType,
|
|
|
|
|
@ -1905,7 +1908,18 @@ export default {
|
|
|
|
|
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
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 根据模式调用不同的接口
|
|
|
|
|
let res;
|
|
|
|
|
if (this.isEditMode) {
|
|
|
|
|
// 编辑模式
|
|
|
|
|
submitData.id = this.currentContractId;
|
|
|
|
|
res = await editorContract(submitData);
|
|
|
|
|
} else {
|
|
|
|
|
// 新增模式
|
|
|
|
|
res = await addContrant(submitData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.isShowAdd = false;
|
|
|
|
|
Message({
|
|
|
|
|
@ -2313,7 +2327,9 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
resetForm() {
|
|
|
|
|
this.currentStep = 1
|
|
|
|
|
this.currentStep = 1;
|
|
|
|
|
this.isEditMode = false;
|
|
|
|
|
this.currentContractId = null;
|
|
|
|
|
this.form = {
|
|
|
|
|
category: '',
|
|
|
|
|
affairType: '',
|
|
|
|
|
@ -2322,22 +2338,20 @@ export default {
|
|
|
|
|
purchaseSubForm: '',
|
|
|
|
|
purchaseMethod: '',
|
|
|
|
|
name: '',
|
|
|
|
|
type: '', // 项目类型
|
|
|
|
|
type: '',
|
|
|
|
|
moneyWay: [],
|
|
|
|
|
plan: [],
|
|
|
|
|
plan_display: '', // 预算计划显示文本
|
|
|
|
|
plan_display: '',
|
|
|
|
|
price: 0,
|
|
|
|
|
supply: '', // 承包商/供应商
|
|
|
|
|
// 流程控制字段
|
|
|
|
|
is_simple: 0, // 是否为简易流程
|
|
|
|
|
has_charge: 0, // 是否为河道处收费类项目
|
|
|
|
|
isBudget: 0, // 是否为预算内确定项目
|
|
|
|
|
is_substitute: 0, // 是否为代建项目
|
|
|
|
|
// 新增流程控制字段
|
|
|
|
|
request: 0, // 请示流程
|
|
|
|
|
purchaseApproval: 0, // 采购业务审批流程
|
|
|
|
|
tenderReview: 0, // 招标文件审查流程
|
|
|
|
|
contractSign: 0, // 合同会签流程
|
|
|
|
|
supply: '',
|
|
|
|
|
is_simple: 0,
|
|
|
|
|
has_charge: 0,
|
|
|
|
|
isBudget: 0,
|
|
|
|
|
is_substitute: 0,
|
|
|
|
|
request: 0,
|
|
|
|
|
purchaseApproval: 0,
|
|
|
|
|
tenderReview: 0,
|
|
|
|
|
contractSign: 0,
|
|
|
|
|
expenses: [
|
|
|
|
|
{
|
|
|
|
|
content: '',
|
|
|
|
|
@ -2346,15 +2360,15 @@ export default {
|
|
|
|
|
payee: ''
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
showAfterPayment: false, // 是否显示事后支付表格
|
|
|
|
|
contract_carry_department: [] // 新增执行科室字段
|
|
|
|
|
}
|
|
|
|
|
showAfterPayment: false,
|
|
|
|
|
contract_carry_department: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.affairTypeOptions = []
|
|
|
|
|
this.contractTypeOptions = []
|
|
|
|
|
this.purchaseFormOptions = []
|
|
|
|
|
this.purchaseSubFormOptions = []
|
|
|
|
|
this.purchaseMethodOptions = []
|
|
|
|
|
this.affairTypeOptions = [];
|
|
|
|
|
this.contractTypeOptions = [];
|
|
|
|
|
this.purchaseFormOptions = [];
|
|
|
|
|
this.purchaseSubFormOptions = [];
|
|
|
|
|
this.purchaseMethodOptions = [];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 获取分类配置
|
|
|
|
|
@ -2601,6 +2615,188 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 编辑按钮点击事件
|
|
|
|
|
async handleEdit(row) {
|
|
|
|
|
this.isEditMode = true;
|
|
|
|
|
this.currentContractId = row.id;
|
|
|
|
|
this.isShowAdd = true;
|
|
|
|
|
this.currentStep = 1;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 1. 先获取分类选项
|
|
|
|
|
await this.getCategoryOptions();
|
|
|
|
|
|
|
|
|
|
// 2. 获取合同详情
|
|
|
|
|
const res = await getContract({ id: row.id });
|
|
|
|
|
if (res && res.list && res.list.data && res.list.data.length > 0) {
|
|
|
|
|
const detail = res.list.data[0];
|
|
|
|
|
|
|
|
|
|
// 这里缺少合同分类, 先设置为20, 后续需要服务器返回该字段.
|
|
|
|
|
detail.category = 20;
|
|
|
|
|
|
|
|
|
|
// 3. 通过正常的流程来初始化下拉框
|
|
|
|
|
// 设置分类
|
|
|
|
|
if (detail.category) {
|
|
|
|
|
this.form.category = detail.category;
|
|
|
|
|
this.handleCategoryChange(detail.category);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置事项类型
|
|
|
|
|
if (detail.work_type) {
|
|
|
|
|
this.form.affairType = detail.work_type;
|
|
|
|
|
this.handleAffairTypeChange(detail.work_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置合同类型
|
|
|
|
|
if (detail.contract_type) {
|
|
|
|
|
this.form.contractType = detail.contract_type;
|
|
|
|
|
this.handleContractTypeChange(detail.contract_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置采购形式
|
|
|
|
|
if (detail.purchase_type_id) {
|
|
|
|
|
this.form.purchaseForm = detail.purchase_type_id;
|
|
|
|
|
this.handlePurchaseFormChange(detail.purchase_type_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 设置采购方式
|
|
|
|
|
if (detail.purchase_way_id) {
|
|
|
|
|
this.form.purchaseMethod = detail.purchase_way_id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存其他表单数据
|
|
|
|
|
this.form = {
|
|
|
|
|
...this.form,
|
|
|
|
|
type: detail.type,
|
|
|
|
|
isBudget: detail.is_plan,
|
|
|
|
|
is_simple: detail.is_simple,
|
|
|
|
|
has_charge: detail.has_charge,
|
|
|
|
|
is_substitute: detail.is_substitute,
|
|
|
|
|
supply: detail.supply,
|
|
|
|
|
price: detail.plan_price,
|
|
|
|
|
name: detail.name,
|
|
|
|
|
moneyWay: detail.money_way_id ? detail.money_way_id.split(',').map(Number) : [],
|
|
|
|
|
plan: detail.plans.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
label: item.name,
|
|
|
|
|
value: {
|
|
|
|
|
plan_id: item.id,
|
|
|
|
|
use_money: detail.plan_link ? detail.plan_link.filter(item1 => {
|
|
|
|
|
return item1.plan_id === item.id
|
|
|
|
|
})[0]?.use_money : 0,
|
|
|
|
|
new_money: item.money
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
contract_carry_department: detail.contract_carry_department.map(i => i.carry_department_id),
|
|
|
|
|
before_contract_template: detail.before_contract_template,
|
|
|
|
|
contract_template: detail.contract_template
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 设置预算计划显示文本
|
|
|
|
|
if (this.form.plan && this.form.plan.length > 0) {
|
|
|
|
|
this.form.plan_display = this.form.plan.map(item => item.label).join(', ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('初始化编辑数据失败:', error);
|
|
|
|
|
Message({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: '初始化编辑数据失败'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 新增按钮点击事件
|
|
|
|
|
handleAdd() {
|
|
|
|
|
this.isEditMode = false;
|
|
|
|
|
this.currentContractId = null;
|
|
|
|
|
this.isShowAdd = true;
|
|
|
|
|
this.currentStep = 1;
|
|
|
|
|
this.form = {
|
|
|
|
|
...this.form,
|
|
|
|
|
category: '',
|
|
|
|
|
affairType: '',
|
|
|
|
|
contractType: '',
|
|
|
|
|
purchaseForm: '',
|
|
|
|
|
purchaseMethod: '',
|
|
|
|
|
type: '',
|
|
|
|
|
isBudget: false,
|
|
|
|
|
is_simple: 0,
|
|
|
|
|
has_charge: 0,
|
|
|
|
|
is_substitute: 0,
|
|
|
|
|
supply: '',
|
|
|
|
|
price: '',
|
|
|
|
|
name: '',
|
|
|
|
|
moneyWay: [],
|
|
|
|
|
plan: [],
|
|
|
|
|
contract_carry_department: [],
|
|
|
|
|
before_contract_template: null,
|
|
|
|
|
contract_template: null
|
|
|
|
|
};
|
|
|
|
|
this.getCategoryOptions();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 新增获取合同详情方法
|
|
|
|
|
async getContractDetail(id) {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getContract({ id });
|
|
|
|
|
if (res && res.list && res.list.data && res.list.data.length > 0) {
|
|
|
|
|
const detail = res.list.data[0];
|
|
|
|
|
console.log("detail", detail);
|
|
|
|
|
// 填充表单数据
|
|
|
|
|
this.form = {
|
|
|
|
|
...this.form,
|
|
|
|
|
// 第一步的五个分类选择
|
|
|
|
|
category: detail.category,
|
|
|
|
|
affairType: detail.work_type,
|
|
|
|
|
contractType: detail.contract_type,
|
|
|
|
|
purchaseForm: detail.purchase_type_id, // 采购形式
|
|
|
|
|
purchaseMethod: detail.purchase_way_id, // 采购方式
|
|
|
|
|
// 其他基本信息
|
|
|
|
|
type: detail.type,
|
|
|
|
|
isBudget: detail.is_plan === 1,
|
|
|
|
|
is_simple: detail.is_simple,
|
|
|
|
|
has_charge: detail.has_charge,
|
|
|
|
|
is_substitute: detail.is_substitute,
|
|
|
|
|
supply: detail.supply,
|
|
|
|
|
price: detail.plan_price,
|
|
|
|
|
name: detail.name,
|
|
|
|
|
moneyWay: detail.money_way_id ? detail.money_way_id.split(',').map(Number) : [],
|
|
|
|
|
plan: detail.plans.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
label: item.name,
|
|
|
|
|
value: {
|
|
|
|
|
plan_id: item.id,
|
|
|
|
|
use_money: detail.plan_link ? detail.plan_link.filter(item1 => {
|
|
|
|
|
return item1.plan_id === item.id
|
|
|
|
|
})[0]?.use_money : 0,
|
|
|
|
|
new_money: item.money
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
contract_carry_department: detail.contract_carry_department.map(i => i.carry_department_id),
|
|
|
|
|
before_contract_template: detail.before_contract_template,
|
|
|
|
|
contract_template: detail.contract_template
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 设置预算计划显示文本
|
|
|
|
|
if (this.form.plan && this.form.plan.length > 0) {
|
|
|
|
|
this.form.plan_display = this.form.plan.map(item => item.label).join(', ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 确保停留在第一步
|
|
|
|
|
this.currentStep = 1;
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('获取合同详情失败:', error);
|
|
|
|
|
Message({
|
|
|
|
|
type: 'error',
|
|
|
|
|
message: '获取合同详情失败'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.window.width = screen.availWidth * 0.95
|
|
|
|
|
@ -3050,3 +3246,17 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
// ... existing styles ...
|
|
|
|
|
|
|
|
|
|
// 加宽 require 提示框
|
|
|
|
|
::v-deep .el-form-item__error {
|
|
|
|
|
width: 200px;
|
|
|
|
|
white-space: normal;
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
text-align: right;
|
|
|
|
|
right: 0;
|
|
|
|
|
left: auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|