1.0.93 合同内容变更提交修改流程。

dev
yinq 2 days ago
parent add7a006c6
commit 58d1824160

@ -94,7 +94,7 @@ export const saveContractChange = (data: ContractChangeSaveForm): AxiosPromise<n
}; };
/** /**
* * 使 HTBG
* @param data * @param data
*/ */
export const contractChangeSubmitAndFlowStart = ( export const contractChangeSubmitAndFlowStart = (
@ -107,6 +107,20 @@ export const contractChangeSubmitAndFlowStart = (
}); });
}; };
/**
* HTBGOAC
* @param data + changeInfo + changeMaterialList + changePaymentMethodList
*/
export const contractChangeContentSubmit = (
data: ContractChangeSaveForm
): AxiosPromise<ContractChangeVO> => {
return request({
url: '/oa/erp/contractChange/submitContentChange',
method: 'post',
data
});
};
/** /**
* +++ * +++
* @param contractChangeId * @param contractChangeId

@ -9,6 +9,11 @@ export interface ContractChangeVO {
*/ */
contractId: string | number; contractId: string | number;
/**
* ID=1
*/
newContractId?: string | number;
/** /**
* *
*/ */
@ -172,6 +177,11 @@ export interface ContractChangeForm extends BaseEntity {
*/ */
contractId?: string | number; contractId?: string | number;
/**
* ID=1
*/
newContractId?: string | number;
/** /**
* *
*/ */
@ -289,6 +299,7 @@ export interface ContractChangeSaveForm {
contractChangeId?: string | number; contractChangeId?: string | number;
contractId: string | number; contractId: string | number;
changeType: string; changeType: string;
newContractId?: string | number;
changeCode?: string; changeCode?: string;
changeReason: string; changeReason: string;
applyTime?: string; applyTime?: string;

@ -209,6 +209,11 @@ export interface ContractInfoVO {
*/ */
contractTemplateFlag: string; contractTemplateFlag: string;
/**
* ID
*/
originalContractId?: string | number;
} }
export interface ContractInfoForm extends BaseEntity { export interface ContractInfoForm extends BaseEntity {

@ -1,7 +1,7 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<!-- 审批按钮组件参考 contractInfo/edit.vue --> <!-- 审批按钮组件内容变更且已提交变更状态=3时不显示 -->
<el-card shadow="never" style="margin-top: 0"> <el-card v-if="showApprovalCard" shadow="never" style="margin-top: 0">
<approvalButton <approvalButton
@submitForm="submitForm" @submitForm="submitForm"
@approvalVerifyOpen="approvalVerifyOpen" @approvalVerifyOpen="approvalVerifyOpen"
@ -13,11 +13,13 @@
:mode="false" :mode="false"
/> />
</el-card> </el-card>
<el-card v-if="!showApprovalCard" shadow="never" style="margin-top: 0">
<el-button style="float: right" @click="goBack"></el-button>
</el-card>
<el-card shadow="never"> <el-card shadow="never">
<template #header> <template #header>
<span>{{ isEdit ? '编辑合同变更' : '合同变更申请' }}</span> <span>{{ isEdit ? '编辑合同变更' : '合同变更申请' }}</span>
<el-button class="float-right" link @click="goBack"></el-button>
</template> </template>
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px"> <el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
<el-row :gutter="20"> <el-row :gutter="20">
@ -33,6 +35,11 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="原合同编号">
<el-input v-model="form.contractCode" disabled />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="选择合同" prop="contractId"> <el-form-item label="选择合同" prop="contractId">
<el-input <el-input
@ -185,9 +192,26 @@
</el-col> </el-col>
<el-col :span="12" v-show="form.changeInfo.contractTemplateFlag !== '1'"> <el-col :span="12" v-show="form.changeInfo.contractTemplateFlag !== '1'">
<el-form-item label="合同模板"> <el-form-item label="合同模板">
<el-select v-model="form.changeInfo.templateId" placeholder="请选择合同模板" :disabled="isFormDisabled" filterable style="width: 100%"> <div class="flex gap-2 items-center" style="width: 100%">
<el-option v-for="item in printTemplateList" :key="item.templateId" :label="item.templateName + '-' + (item.version || '')" :value="item.templateId" /> <el-select v-model="form.changeInfo.templateId" placeholder="请选择合同模板" :disabled="isFormDisabled" filterable style="flex: 1">
</el-select> <el-option
v-for="item in printTemplateList"
:key="item.templateId"
:label="item.templateName + '-' + item.version"
:value="item.templateId"
/>
</el-select>
<el-button
link
type="primary"
icon="Download"
:disabled="!form.changeInfo.templateId || !form.contractId"
@click="handleContractTemplateDownload"
style="font-weight: 600"
>
查看模板
</el-button>
</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -442,7 +466,7 @@
import { Search } from '@element-plus/icons-vue'; import { Search } from '@element-plus/icons-vue';
import { getContractInfo } from '@/api/oa/erp/contractInfo'; import { getContractInfo } from '@/api/oa/erp/contractInfo';
import type { ContractInfoVO } from '@/api/oa/erp/contractInfo/types'; import type { ContractInfoVO } from '@/api/oa/erp/contractInfo/types';
import { saveContractChange, getContractChangeDetail, contractChangeSubmitAndFlowStart } from '@/api/oa/erp/contractChange'; import { saveContractChange, getContractChangeDetail, contractChangeSubmitAndFlowStart, contractChangeContentSubmit } from '@/api/oa/erp/contractChange';
import type { ContractChangeSaveForm } from '@/api/oa/erp/contractChange/types'; import type { ContractChangeSaveForm } from '@/api/oa/erp/contractChange/types';
import type { ContractMaterialForm } from '@/api/oa/erp/contractMaterial/types'; import type { ContractMaterialForm } from '@/api/oa/erp/contractMaterial/types';
import type { ContractPaymentMethodForm } from '@/api/oa/erp/contractPaymentMethod/types'; import type { ContractPaymentMethodForm } from '@/api/oa/erp/contractPaymentMethod/types';
@ -635,6 +659,7 @@ const contractSelectRef = ref<InstanceType<typeof ContractSelect>>();
const isEdit = computed(() => !!(routeParams.value.id && (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval'))); const isEdit = computed(() => !!(routeParams.value.id && (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval')));
const isFormDisabled = computed(() => routeParams.value.type === 'view' || routeParams.value.type === 'approval'); const isFormDisabled = computed(() => routeParams.value.type === 'view' || routeParams.value.type === 'approval');
const showApprovalCard = computed(() => !(form.value.changeStatus === '3' && form.value.changeType === '1'));
const form = ref< const form = ref<
ContractChangeSaveForm & { ContractChangeSaveForm & {
@ -643,10 +668,12 @@ const form = ref<
changePaymentMethodList?: any[]; changePaymentMethodList?: any[];
flowStatus?: string; flowStatus?: string;
changeCode?: string; changeCode?: string;
newContractId?: string | number;
} }
>({ >({
contractChangeId: undefined, contractChangeId: undefined,
contractId: undefined as any, contractId: undefined as any,
newContractId: undefined,
changeType: '1', changeType: '1',
changeReason: '', changeReason: '',
applyTime: undefined, applyTime: undefined,
@ -683,6 +710,16 @@ function goBack() {
router.push({ path: '/contract/contractChange' }); router.push({ path: '/contract/contractChange' });
} }
/** 合同模板下载/查看(仿照合同修改页) */
function handleContractTemplateDownload() {
if (!form.value.changeInfo?.templateId) return;
console.log(form.value);
router.push({
path: '/contract/contractView',
query: { templateId: form.value.changeInfo.templateId, contractId: form.value.newContractId }
});
}
/** 打开合同选择弹框 */ /** 打开合同选择弹框 */
function openContractSelect() { function openContractSelect() {
if (isFormDisabled.value) return; if (isFormDisabled.value) return;
@ -807,6 +844,7 @@ async function loadDetail() {
form.value.undertakeBy = m.undertakeBy; form.value.undertakeBy = m.undertakeBy;
form.value.industryRegion = m.industryRegion; form.value.industryRegion = m.industryRegion;
form.value.sealLegalEntity = m.sealLegalEntity; form.value.sealLegalEntity = m.sealLegalEntity;
form.value.newContractId = m.newContractId;
selectedContractName.value = m.contractName || ''; selectedContractName.value = m.contractName || '';
} }
@ -1002,7 +1040,7 @@ function buildPayload(changeStatus: '1' | '2'): ContractChangeSaveForm {
return payload; return payload;
} }
/** 审批栏:提交(暂存 / 提交审批),仿照合同 contractInfo/edit 提交流程,提交审批走新接口 contractChangeSubmitAndFlowStart */ /** 审批栏:提交(暂存 / 提交审批)。内容变更走 contractChangeContentSubmit 不走 HTBG解除合同走 contractChangeSubmitAndFlowStart */
function submitForm(status: string, _mode: boolean) { function submitForm(status: string, _mode: boolean) {
formRef.value?.validate((valid: boolean) => { formRef.value?.validate((valid: boolean) => {
if (!valid) return; if (!valid) return;
@ -1010,35 +1048,60 @@ function submitForm(status: string, _mode: boolean) {
proxy?.$modal.msgError('内容变更请先选择合同,以加载变更后合同信息'); proxy?.$modal.msgError('内容变更请先选择合同,以加载变更后合同信息');
return; return;
} }
if (status !== 'draft' && form.value.changeType === '1') {
const newCode = (form.value.changeInfo?.contractCode ?? '').trim();
const oldCode = (form.value.contractCode ?? '').trim();
if (newCode === oldCode) {
proxy?.$modal.msgError('合同内容变更时,变更后合同编号必须与原合同编号不同');
return;
}
}
buttonLoading.value = true; buttonLoading.value = true;
if (status !== 'draft') { if (status !== 'draft') {
//
const payload = buildPayload('2'); const payload = buildPayload('2');
payload.flowCode = FlowCodeEnum.CONTRACT_CHANGE_CODE; if (form.value.changeType === '1') {
payload.flowStatus = 'waiting'; // HTBG OAC
payload.variables = { contractChangeContentSubmit(payload)
contractChangeId: form.value.contractChangeId, .then((res) => {
changeCode: form.value.changeCode || '', if (res.data) {
contractName: form.value.contractName, form.value.contractChangeId = res.data.contractChangeId;
changeReason: form.value.changeReason form.value.changeStatus = res.data.changeStatus ?? '3';
}; form.value.flowStatus = res.data.flowStatus ?? 'content_submitted';
payload.bizExt = { }
businessTitle: '合同变更', proxy?.$modal.msgSuccess('操作成功,已生成新合同,请在合同管理中提交新合同审批');
businessCode: form.value.changeCode || '合同变更' goBack();
}; })
contractChangeSubmitAndFlowStart(payload) .finally(() => {
.then((res) => { buttonLoading.value = false;
if (res.data) { });
form.value.contractChangeId = res.data.contractChangeId; } else {
form.value.changeStatus = '2'; // HTBG
form.value.flowStatus = res.data.flowStatus ?? 'waiting'; payload.flowCode = FlowCodeEnum.CONTRACT_CHANGE_CODE;
} payload.flowStatus = 'waiting';
proxy?.$modal.msgSuccess('操作成功'); payload.variables = {
goBack(); contractChangeId: form.value.contractChangeId,
}) changeCode: form.value.changeCode || '',
.finally(() => { contractName: form.value.contractName,
buttonLoading.value = false; changeReason: form.value.changeReason
}); };
payload.bizExt = {
businessTitle: '合同解除',
businessCode: form.value.changeCode || ''
};
contractChangeSubmitAndFlowStart(payload)
.then((res) => {
if (res.data) {
form.value.contractChangeId = res.data.contractChangeId;
form.value.changeStatus = '2';
form.value.flowStatus = res.data.flowStatus ?? 'waiting';
}
proxy?.$modal.msgSuccess('操作成功');
goBack();
})
.finally(() => {
buttonLoading.value = false;
});
}
} else { } else {
// //
const payload = buildPayload('1'); const payload = buildPayload('1');

@ -68,7 +68,7 @@
<el-table-column label="原合同金额" align="center" prop="originalContractAmount" width="120" v-if="columns[7].visible" /> <el-table-column label="原合同金额" align="center" prop="originalContractAmount" width="120" v-if="columns[7].visible" />
<el-table-column label="变更后合同编号" align="center" prop="changeContractCode" width="140" v-if="columns[8].visible" /> <el-table-column label="变更后合同编号" align="center" prop="changeContractCode" width="140" v-if="columns[8].visible" />
<el-table-column label="变更后合同名称" align="center" prop="changeContractName" min-width="160" show-overflow-tooltip v-if="columns[9].visible" /> <el-table-column label="变更后合同名称" align="center" prop="changeContractName" min-width="160" show-overflow-tooltip v-if="columns[9].visible" />
<el-table-column label="客户名称" align="center" prop="customerName" min-width="120" show-overflow-tooltip v-if="columns[10].visible" /> <el-table-column label="客户名称" align="center" prop="customerName" min-width="180" show-overflow-tooltip v-if="columns[10].visible" />
<el-table-column label="变更后合同金额" align="center" prop="changeContractAmount" width="120" v-if="columns[11].visible" /> <el-table-column label="变更后合同金额" align="center" prop="changeContractAmount" width="120" v-if="columns[11].visible" />
<el-table-column label="变更原因" align="center" prop="changeReason" min-width="160" show-overflow-tooltip v-if="columns[12].visible" /> <el-table-column label="变更原因" align="center" prop="changeReason" min-width="160" show-overflow-tooltip v-if="columns[12].visible" />
<el-table-column label="申请时间" align="center" prop="applyTime" width="160" v-if="columns[13].visible"> <el-table-column label="申请时间" align="center" prop="applyTime" width="160" v-if="columns[13].visible">
@ -155,11 +155,11 @@ const columns = ref<FieldOption[]>([
{ key: 3, label: '原合同ID', visible: false }, { key: 3, label: '原合同ID', visible: false },
{ key: 4, label: '原合同编号', visible: true }, { key: 4, label: '原合同编号', visible: true },
{ key: 5, label: '原合同名称', visible: true }, { key: 5, label: '原合同名称', visible: true },
{ key: 6, label: '原客户名称', visible: true }, { key: 6, label: '原客户名称', visible: false },
{ key: 7, label: '原合同金额', visible: false }, { key: 7, label: '原合同金额', visible: false },
{ key: 8, label: '变更后合同编号', visible: false }, { key: 8, label: '变更后合同编号', visible: true },
{ key: 9, label: '变更后合同名称', visible: false }, { key: 9, label: '变更后合同名称', visible: true },
{ key: 10, label: '客户名称', visible: false }, { key: 10, label: '客户名称', visible: true },
{ key: 11, label: '变更后合同金额', visible: false }, { key: 11, label: '变更后合同金额', visible: false },
{ key: 12, label: '变更原因', visible: false }, { key: 12, label: '变更原因', visible: false },
{ key: 13, label: '申请时间', visible: true }, { key: 13, label: '申请时间', visible: true },

Loading…
Cancel
Save