|
|
|
|
@ -55,21 +55,21 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="承办人" prop="undertakeBy">
|
|
|
|
|
<el-select v-model="form.undertakeBy" placeholder="请选择承办人" :disabled="isFormDisabled" filterable clearable style="width: 100%">
|
|
|
|
|
<el-option v-for="item in userInfoList" :key="item.userId" :label="item.nickName" :value="item.userId" />
|
|
|
|
|
<el-form-item label="业务方向" prop="businessDirection">
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="form.businessDirection"
|
|
|
|
|
placeholder="请先选择合同,将自动带出原合同业务方向"
|
|
|
|
|
disabled
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="dict in business_direction" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="行业/大区" prop="industryRegion">
|
|
|
|
|
<el-input v-model="form.industryRegion" placeholder="请输入行业/大区" :disabled="isFormDisabled" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="承办部门" prop="undertakeDeptId">
|
|
|
|
|
<el-select v-model="form.undertakeDeptId" placeholder="请选择承办部门" :disabled="isFormDisabled" filterable clearable style="width: 100%">
|
|
|
|
|
<el-option v-for="item in deptInfoList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
|
|
|
|
|
<el-form-item label="承办人" prop="undertakeBy">
|
|
|
|
|
<el-select v-model="form.undertakeBy" placeholder="请选择承办人" :disabled="isFormDisabled" filterable clearable style="width: 100%">
|
|
|
|
|
<el-option v-for="item in userInfoList" :key="item.userId" :label="item.nickName" :value="item.userId" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
@ -108,7 +108,17 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="合同编号">
|
|
|
|
|
<el-input v-model="form.changeInfo.contractCode" placeholder="请输入合同编号" :disabled="isFormDisabled" />
|
|
|
|
|
<el-input v-model="form.changeInfo.contractCode" placeholder="请输入合同编号或点击生成" :disabled="isFormDisabled">
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="generateChangeContractCode"
|
|
|
|
|
:disabled="isFormDisabled || isChangeContractCodeGenerated"
|
|
|
|
|
>
|
|
|
|
|
生成合同编号
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -476,7 +486,6 @@ import type { PaymentStageVO } from '@/api/oa/base/paymentStage/types';
|
|
|
|
|
import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo';
|
|
|
|
|
import { getCrmPaymentAccountList } from '@/api/oa/crm/paymentAccount';
|
|
|
|
|
import { getUserList } from '@/api/system/user';
|
|
|
|
|
import { allListDept } from '@/api/system/dept';
|
|
|
|
|
import { getInfo } from '@/api/login';
|
|
|
|
|
import { getBasePrintTemplateList } from '@/api/oa/base/printTemplate';
|
|
|
|
|
import ApprovalButton from '@/components/Process/approvalButton.vue';
|
|
|
|
|
@ -485,7 +494,8 @@ import SubmitVerify from '@/components/Process/submitVerify.vue';
|
|
|
|
|
import FileUpload from '@/components/FileUpload/index.vue';
|
|
|
|
|
import SaleMaterialSelect from '@/components/SaleMaterialSelect/index.vue';
|
|
|
|
|
import ContractSelect from '@/components/ContractSelect/index.vue';
|
|
|
|
|
import { FlowCodeEnum } from '@/enums/OAEnum';
|
|
|
|
|
import { FlowCodeEnum, CodeRuleEnum } from '@/enums/OAEnum';
|
|
|
|
|
import { getRuleGenerateCode } from '@/api/system/codeRule';
|
|
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
@ -528,8 +538,6 @@ const customerInfoList = ref<any[]>([]);
|
|
|
|
|
const userInfoList = ref<any[]>([]);
|
|
|
|
|
const paymentAccountList = ref<any[]>([]);
|
|
|
|
|
const printTemplateList = ref<any[]>([]);
|
|
|
|
|
const deptInfoList = ref<any[]>([]);
|
|
|
|
|
|
|
|
|
|
// 变更后物料/付款方式列表(仅内容变更时使用)
|
|
|
|
|
const changeMaterialList = computed(() => form.value.changeMaterialList || []);
|
|
|
|
|
const changePaymentMethodList = computed(() => form.value.changePaymentMethodList || []);
|
|
|
|
|
@ -656,6 +664,8 @@ const saleMaterialSelectRef = ref<InstanceType<typeof SaleMaterialSelect>>();
|
|
|
|
|
|
|
|
|
|
const selectedContractName = ref<string>('');
|
|
|
|
|
const contractSelectRef = ref<InstanceType<typeof ContractSelect>>();
|
|
|
|
|
/** 变更后合同编号是否已通过「生成」获取(与合同编辑页规则一致,生成一次后禁用按钮) */
|
|
|
|
|
const isChangeContractCodeGenerated = ref(false);
|
|
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
@ -693,9 +703,8 @@ const form = ref<
|
|
|
|
|
changeMaterialList: undefined,
|
|
|
|
|
changePaymentMethodList: undefined,
|
|
|
|
|
changeCode: undefined,
|
|
|
|
|
undertakeDeptId: undefined,
|
|
|
|
|
undertakeBy: undefined,
|
|
|
|
|
industryRegion: undefined,
|
|
|
|
|
businessDirection: undefined,
|
|
|
|
|
sealLegalEntity: undefined
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
@ -744,6 +753,7 @@ async function onContractChange(contractId: string | number) {
|
|
|
|
|
form.value.contractName = c.contractName;
|
|
|
|
|
form.value.originalCustomerName = cAny.oneCustomerName || cAny.twoCustomerName;
|
|
|
|
|
form.value.originalContractAmount = c.totalPrice as any;
|
|
|
|
|
form.value.businessDirection = (c as any).businessDirection;
|
|
|
|
|
if (form.value.changeType === '1') {
|
|
|
|
|
form.value.changeContractCode = c.contractCode;
|
|
|
|
|
form.value.changeContractName = c.contractName;
|
|
|
|
|
@ -760,6 +770,23 @@ async function onContractChange(contractId: string | number) {
|
|
|
|
|
changePaymentId: undefined,
|
|
|
|
|
contractChangeId: undefined
|
|
|
|
|
}));
|
|
|
|
|
// 重新带出的是原合同编号,允许再次点「生成」换新编号
|
|
|
|
|
isChangeContractCodeGenerated.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 生成变更后合同编号(编码规则与合同编辑页相同) */
|
|
|
|
|
async function generateChangeContractCode() {
|
|
|
|
|
if (isChangeContractCodeGenerated.value || !form.value.changeInfo) return;
|
|
|
|
|
try {
|
|
|
|
|
const params = { codeRuleCode: CodeRuleEnum.CONTRACT } as any;
|
|
|
|
|
const res = await getRuleGenerateCode(params);
|
|
|
|
|
form.value.changeInfo.contractCode = res.msg;
|
|
|
|
|
isChangeContractCodeGenerated.value = true;
|
|
|
|
|
proxy?.$modal.msgSuccess('合同编号生成成功');
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('生成合同编号失败:', error);
|
|
|
|
|
proxy?.$modal.msgError('生成合同编号失败');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -840,12 +867,19 @@ async function loadDetail() {
|
|
|
|
|
form.value.changeInfo = d.changeInfo ? { ...d.changeInfo } : undefined;
|
|
|
|
|
form.value.changeMaterialList = (d.changeMaterialList || []).map((x: any) => ({ ...x }));
|
|
|
|
|
form.value.changePaymentMethodList = (d.changePaymentMethodList || []).map((x: any) => ({ ...x }));
|
|
|
|
|
form.value.undertakeDeptId = m.undertakeDeptId;
|
|
|
|
|
form.value.undertakeBy = m.undertakeBy;
|
|
|
|
|
form.value.industryRegion = m.industryRegion;
|
|
|
|
|
form.value.businessDirection = m.businessDirection;
|
|
|
|
|
form.value.sealLegalEntity = m.sealLegalEntity;
|
|
|
|
|
form.value.newContractId = m.newContractId;
|
|
|
|
|
selectedContractName.value = m.contractName || '';
|
|
|
|
|
// 变更后编号已与原合同编号不同(含已点生成或手改),则不再允许重复点生成
|
|
|
|
|
if (form.value.changeType === '1' && form.value.changeInfo?.contractCode != null && form.value.contractCode != null) {
|
|
|
|
|
const newCode = String(form.value.changeInfo.contractCode).trim();
|
|
|
|
|
const oldCode = String(form.value.contractCode).trim();
|
|
|
|
|
isChangeContractCodeGenerated.value = newCode !== '' && newCode !== oldCode;
|
|
|
|
|
} else {
|
|
|
|
|
isChangeContractCodeGenerated.value = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loadSelectOptions() {
|
|
|
|
|
@ -855,7 +889,6 @@ function loadSelectOptions() {
|
|
|
|
|
getUserList({} as any).then((res) => (userInfoList.value = res.data || []));
|
|
|
|
|
getCrmPaymentAccountList({}).then((res) => (paymentAccountList.value = res.data || []));
|
|
|
|
|
getBasePrintTemplateList({ templateType: '1' }).then((res) => (printTemplateList.value = res.data || []));
|
|
|
|
|
allListDept({} as any).then((res) => (deptInfoList.value = res.data || []));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----- 变更后物料:增删改 -----
|
|
|
|
|
@ -1033,9 +1066,8 @@ function buildPayload(changeStatus: '1' | '2'): ContractChangeSaveForm {
|
|
|
|
|
changeContractName: f.changeContractName,
|
|
|
|
|
customerName: f.customerName,
|
|
|
|
|
changeContractAmount: f.changeContractAmount,
|
|
|
|
|
undertakeDeptId: f.undertakeDeptId,
|
|
|
|
|
undertakeBy: f.undertakeBy,
|
|
|
|
|
industryRegion: f.industryRegion,
|
|
|
|
|
businessDirection: f.businessDirection,
|
|
|
|
|
sealLegalEntity: f.sealLegalEntity
|
|
|
|
|
};
|
|
|
|
|
if (f.changeType === '1') {
|
|
|
|
|
@ -1147,12 +1179,11 @@ onMounted(async () => {
|
|
|
|
|
} else {
|
|
|
|
|
form.value.changeType = '1';
|
|
|
|
|
form.value.flowStatus = 'draft';
|
|
|
|
|
// 新增时默认承办部门、承办人为当前登录用户
|
|
|
|
|
// 新增时默认承办人为当前登录用户
|
|
|
|
|
try {
|
|
|
|
|
const infoRes = await getInfo();
|
|
|
|
|
if (infoRes?.data?.user) {
|
|
|
|
|
const user = infoRes.data.user as any;
|
|
|
|
|
if (user.deptId != null) form.value.undertakeDeptId = user.deptId;
|
|
|
|
|
if (user.userId != null) form.value.undertakeBy = user.userId;
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|