1.1.66 合同信息添加合同激活时的字段:客户合同编号、最终客户、对人民币汇率、合同激活的抄送人员。

dev
yinq 1 week ago
parent a45fd58cd0
commit eafe86a54a

@ -230,6 +230,37 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<template v-if="isContractActivated">
<el-col :span="12">
<el-form-item label="客户合同编号">
<el-input v-model="form.customerContractCode" disabled placeholder="-" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="最终客户">
<el-input :model-value="finalCustomerDisplay" disabled placeholder="-" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="对人民币汇率">
<el-input-number
v-model="form.rmbExchangeRate"
:min="0"
:precision="4"
:step="0.0001"
controls-position="right"
disabled
placeholder="-"
style="width: 100%"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="激活抄送人员">
<el-input :model-value="activatePeopleDisplay" disabled placeholder="-" />
</el-form-item>
</el-col>
</template>
<!-- <el-col :span="12">--> <!-- <el-col :span="12">-->
<!-- <el-form-item label="流程状态" prop="flowStatus">--> <!-- <el-form-item label="流程状态" prop="flowStatus">-->
<!-- <el-input v-model="form.flowStatus" placeholder="请输入流程状态" />--> <!-- <el-input v-model="form.flowStatus" placeholder="请输入流程状态" />-->
@ -384,7 +415,14 @@
<el-button type="primary" icon="Plus" v-if="!isFormDisabled" @click="handleAddPaymentMethod" <el-button type="primary" icon="Plus" v-if="!isFormDisabled" @click="handleAddPaymentMethod"
>新增付款方式 >新增付款方式
</el-button> </el-button>
<el-form-item label="付款形式" prop="paymentMethod" style="margin-bottom: 0; width: 360px"> <el-form
ref="contractPaymentFormRef"
:model="form"
:rules="rules"
label-width="120px"
style="margin-bottom: 0; width: 360px"
>
<el-form-item label="付款形式" prop="paymentMethod" style="margin-bottom: 0">
<el-select <el-select
v-model="form.paymentMethod" v-model="form.paymentMethod"
placeholder="请选择付款形式" placeholder="请选择付款形式"
@ -400,6 +438,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form>
</div> </div>
<el-table :data="contractPaymentMethodList" v-loading="buttonLoading" border> <el-table :data="contractPaymentMethodList" v-loading="buttonLoading" border>
<el-table-column label="序号" align="center" prop="sortOrder" width="80" /> <el-table-column label="序号" align="center" prop="sortOrder" width="80" />
@ -837,6 +876,7 @@ import { MaterialInfoForm } from '@/api/oa/base/materialInfo/types';
import { getBasePaymentStageList } from '@/api/oa/base/paymentStage'; import { getBasePaymentStageList } from '@/api/oa/base/paymentStage';
import type { PaymentStageVO } from '@/api/oa/base/paymentStage/types'; import type { PaymentStageVO } from '@/api/oa/base/paymentStage/types';
import { getCrmPaymentAccountList } from '@/api/oa/crm/paymentAccount'; import { getCrmPaymentAccountList } from '@/api/oa/crm/paymentAccount';
import { listContractOrder } from '@/api/oa/erp/contractOrder';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const route = useRoute(); const route = useRoute();
@ -883,6 +923,7 @@ const paymentMethodOptions = [
const buttonLoading = ref(false); const buttonLoading = ref(false);
const contractInfoFormRef = ref<ElFormInstance>(); const contractInfoFormRef = ref<ElFormInstance>();
const contractPaymentFormRef = ref<ElFormInstance>();
// //
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>(); const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
@ -971,6 +1012,52 @@ const getUserInfoListSelect = async () => {
userInfoList.value = res.data; userInfoList.value = res.data;
}; };
/** 合同激活抄送人员 ID 列表(来自合同订单项目) */
const activatePeopleIds = ref<string[]>([]);
/** 合同是否已激活 */
const isContractActivated = computed(() => String(form.value.contractStatus) === '5');
/** 最终客户展示名称 */
const finalCustomerDisplay = computed(() => {
const name = (form.value as any).finalCustomerName;
if (name) return name;
const id = (form.value as any).finalCustomerId;
if (!id) return '';
const customer = customerInfoList.value.find((c: any) => String(c.customerId) === String(id));
return customer?.customerName || String(id);
});
/** 合同激活抄送人员展示名称 */
const activatePeopleDisplay = computed(() => {
if (!activatePeopleIds.value.length) return '';
return activatePeopleIds.value
.map((id) => {
const user = userInfoList.value.find((u: any) => String(u.userId) === String(id));
return user?.nickName || id;
})
.join(',');
});
/** 加载合同激活抄送人员 */
const loadActivatePeople = async (contractId: string | number) => {
try {
const orderRes = await listContractOrder({ contractId, pageNum: 1, pageSize: 10 } as any);
const orders = (orderRes as any).rows || [];
const peopleId = orders[0]?.peopleId;
if (peopleId) {
activatePeopleIds.value = String(peopleId)
.split(',')
.map((id) => id.trim())
.filter(Boolean);
} else {
activatePeopleIds.value = [];
}
} catch {
activatePeopleIds.value = [];
}
};
/** 付款节点下拉列表(回款阶段) */ /** 付款节点下拉列表(回款阶段) */
const paymentStageList = ref<PaymentStageVO[]>([]); const paymentStageList = ref<PaymentStageVO[]>([]);
const getPaymentStageListSelect = async () => { const getPaymentStageListSelect = async () => {
@ -1307,7 +1394,7 @@ const data = reactive<{ form: ContractInfoFormEx; rules: any }>({
shipMethod: [{ required: true, message: '运输方式不能为空', trigger: 'blur' }], shipMethod: [{ required: true, message: '运输方式不能为空', trigger: 'blur' }],
deliveryStart: [{ required: true, message: '发货/交货期不能为空', trigger: 'blur' }], deliveryStart: [{ required: true, message: '发货/交货期不能为空', trigger: 'blur' }],
signingPlace: [{ required: true, message: '签订地点不能为空', trigger: 'blur' }], signingPlace: [{ required: true, message: '签订地点不能为空', trigger: 'blur' }],
paymentMethod: [{ required: true, message: '请选择付款形式', trigger: 'blur' }] paymentMethod: [{ required: true, message: '请选择付款形式', trigger: 'change' }]
} }
}); });
@ -1478,11 +1565,25 @@ const handleFile = () => {
ossFileModel.value = form.value.ossId as any; ossFileModel.value = form.value.ossId as any;
}; };
const validateFormRef = (formRef: ElFormInstance | undefined) =>
new Promise<boolean>((resolve) => {
if (!formRef) {
resolve(true);
return;
}
formRef.validate((valid: boolean) => resolve(valid));
});
/** 提交按钮 */ /** 提交按钮 */
const submitForm = (status: string, mode: boolean) => { const submitForm = async (status: string, mode: boolean) => {
try { try {
contractInfoFormRef.value?.validate(async (valid: boolean) => { const [mainValid, paymentValid] = await Promise.all([
if (valid) { validateFormRef(contractInfoFormRef.value),
validateFormRef(contractPaymentFormRef.value)
]);
if (!mainValid || !paymentValid) {
return;
}
const paymentList = (form.value as any).contractPaymentMethodList; const paymentList = (form.value as any).contractPaymentMethodList;
if (!Array.isArray(paymentList) || paymentList.length === 0) { if (!Array.isArray(paymentList) || paymentList.length === 0) {
proxy?.$modal.msgWarning('请维护合同付款方式'); proxy?.$modal.msgWarning('请维护合同付款方式');
@ -1516,8 +1617,6 @@ const submitForm = (status: string, mode: boolean) => {
proxy?.$tab.closePage(); proxy?.$tab.closePage();
router.go(-1); router.go(-1);
} }
}
});
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} finally { } finally {
@ -1886,6 +1985,9 @@ onMounted(async () => {
proxy?.$modal.loading('正在加载数据,请稍后...'); proxy?.$modal.loading('正在加载数据,请稍后...');
const res = await getContractInfo(id); const res = await getContractInfo(id);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
if (isContractActivated.value) {
await loadActivatePeople(id);
}
proxy?.$modal.closeLoading(); proxy?.$modal.closeLoading();

Loading…
Cancel
Save