-
-
-
-
我方
-
-
-
- 我方{{
- detailState.partyState.partyA.companyName || "/"
- }}
-
-
- 电话{{
- detailState.partyState.partyA.contactPhone || "/"
- }}
-
-
- 公司地址{{
- detailState.partyState.partyA.registeredAddress || "/"
- }}
-
-
- 银行/账号{{
- detailState.partyState.partyA.bankAccount || "/"
- }}
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
- 合同名称{{ detailState.contractName || "未填写" }}
-
-
- 我方{{
- detailState.partyState.partyA.companyName || "未填写"
- }}
-
-
- 合同编号{{ detailState.contractCode || "未填写" }}
-
-
- 相对方{{ counterpartySummaryText }}
-
-
-
-
-
合同正文
-
-
- {{ contractBodyDisplayText }}
-
-
- {{ contractBodyHint }}
-
-
-
-
- 下载
-
-
-
-
-
-
签订依据附件
-
- 签订依据文件,对应法务 contractGistFile
-
-
-
-
-
授权委托书附件
-
- 当前签订方式需要上传授权委托书附件
-
-
-
-
- 下载 {{ item.name || item.fileName }}
-
-
-
-
-
-
-
其他附件
-
- 其他附件(可上传多个文件)
-
-
-
-
- 下载 {{ item.name || item.fileName }}
-
-
-
-
-
-
-
已签署文件
-
-
- {{ detailState.signedFileName || "已签署文件" }}
-
- 当前合同的签署完成版本
-
-
-
-
- 下载
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 合同属性
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 履行计划
-
-
+
+
+
+
+
+ {{ party.displayName }}{{ party.companyName || "/" }}
+
+
+ 主体编码{{ party.subjectCode || "/" }}
+
+
+ 电话{{ party.contactPhone || "/" }}
+
+
+ 公司地址{{ party.registeredAddress || "/" }}
+
+
+ 银行/账号{{ party.bankAccount || "/" }}
+
+
+
+
+
- 新增履行计划
+ 备选开票抬头选择
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ 相对方
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+ {{ party.displayName }}{{ party.companyName || "/" }}
+
+
+ 电话{{ party.contactPhone || "/" }}
+
+
+ 公司地址{{ party.registeredAddress || "/" }}
+
+
+ 银行/账号{{ party.bankAccount || "/" }}
+
+
+
+
+
+
+
+
+ 暂无相对方,请点击右上角“添加”
+
+
+
+ 当前为单方协议,无需维护相对方
+
+
+
+
+
+
合同起止时间
+
+ 固定期限
+ 无固定期限
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+ 合同名称{{ detailState.contractName || "未填写" }}
+
+
+ 我方{{ ourPartySummaryText }}
+
+
+ 合同编号{{ detailState.contractCode || "未填写" }}
+
+
+ 相对方{{ counterpartySummaryText }}
+
+
+
+
+
合同正文
+
+
+ {{ contractBodyDisplayText }}
+
+
+ {{ contractBodyHint }}
+
+
+
+
+ 下载
+
+
+
+
+
+
签订依据附件
+
+
+ 签订依据文件,对应法务 contractGistFile
+
+
+
+
+
+ 下载 {{ item.name || item.fileName }}
+
+
+
+
+
+
+
授权委托书附件
+
+
+ 当前签订方式需要上传授权委托书附件
+
+
+
+
+
+ 下载 {{ item.name || item.fileName }}
+
+
+
+
+
+
+
其他附件
+
+
+ 其他附件(可上传多个文件)
+
+
+
+
+
+ 下载 {{ item.name || item.fileName }}
+
+
+
+
+
+
+
已签署文件
+
+
+ {{ detailState.signedFileName || "已签署文件" }}
+
+
+ 当前合同的签署完成版本
+
+
+
+
+ 下载
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 合同属性
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 履行计划
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+ 暂无数据
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1044,7 +1189,6 @@ const contractCompanyOptions = ref([
// ========== 合同相关字典 ==========
-
const mandateTypeOptions = [
{ label: "海铁联运委托", value: "海铁联运委托" },
{ label: "一站式物流委托", value: "一站式物流委托" },
@@ -1069,8 +1213,8 @@ const paymentMethodOptions = [
];
const SELF_COMPANY_NAME = "浙港物流平台有限公司";
-const MAX_COUNTERPARTY_COUNT = 5;
-const COUNTERPARTY_ROLE_CODES = ["B", "C", "D", "E", "F"];
+const PARTY_ROLE_OUR = "OUR";
+const PARTY_ROLE_OPPOSITE = "OPPOSITE";
// ========== 工具函数 ==========
@@ -1082,7 +1226,9 @@ function formatDateTimeValue(value, endOfDay = false) {
function normalizeFileItem(item = {}) {
return {
- uid: item.uid || `file_${Date.now()}_${Math.random().toString(16).slice(2, 8)}`,
+ uid:
+ item.uid ||
+ `file_${Date.now()}_${Math.random().toString(16).slice(2, 8)}`,
name: item.name || item.fileName || "",
size: item.size ?? item.fileSize ?? 0,
status: item.status || "done",
@@ -1094,8 +1240,10 @@ function normalizeFileItem(item = {}) {
function normalizeBooleanValue(value) {
if (value === true || value === false) return value;
- if (value === 1 || value === "1" || value === "Y" || value === "true") return true;
- if (value === 0 || value === "0" || value === "N" || value === "false") return false;
+ if (value === 1 || value === "1" || value === "Y" || value === "true")
+ return true;
+ if (value === 0 || value === "0" || value === "N" || value === "false")
+ return false;
return false;
}
@@ -1136,7 +1284,8 @@ function getFileNameFromDetail(source, category) {
function splitFilesByCategory(source = {}) {
const sourceFiles = source.fileList || [];
- const bodyFile = sourceFiles.find((item) => item.fileCategory === "body") || {};
+ const bodyFile =
+ sourceFiles.find((item) => item.fileCategory === "body") || {};
return {
contractBodyFileName:
@@ -1203,7 +1352,8 @@ function restoreExtraAmounts(source = {}, current = {}) {
extraAmountFieldOptions.forEach((item) => {
const amount = source[item.amountField];
if (selectedCodes.includes(item.code) || amount || amount === 0) {
- result[`${item.key}Enabled`] = selectedCodes.includes(item.code) || amount > 0;
+ result[`${item.key}Enabled`] =
+ selectedCodes.includes(item.code) || amount > 0;
if (amount !== undefined && amount !== null) {
result[item.key] = amount;
}
@@ -1213,120 +1363,86 @@ function restoreExtraAmounts(source = {}, current = {}) {
return result;
}
-/** 深拷贝合同方状态 */
-function copyPartyState(input) {
- const source = input || {};
- const listState = buildPartyStateFromList(source.partyList);
- const sourcePartyA = source.partyA || source.parties?.A || {};
- const sourcePartyB = source.partyB || source.parties?.B || {};
- const sourcePartyC = source.partyC || source.parties?.C || {};
- const sourceCounterpartyList = Array.isArray(source.counterpartyList)
- ? source.counterpartyList
- : [
- String(sourcePartyB.companyName || "").trim() ? { ...sourcePartyB, roleKey: "B" } : null,
- String(sourcePartyC.companyName || "").trim() ? { ...sourcePartyC, roleKey: "C" } : null,
- ].filter(Boolean);
- const state = {
- isThreePartyContract: Boolean(source.isThreePartyContract),
- partyA: {
- roleKey: "A",
- roleName: "我方",
- displayName: "我方",
- ...sourcePartyA,
- companyName: sourcePartyA.companyName || SELF_COMPANY_NAME,
- },
- partyB: {
- roleKey: "B",
- roleName: "相对方",
- displayName: "相对方1",
- companyName: "",
- ...sourcePartyB,
- },
- partyC: {
- roleKey: "C",
- roleName: "相对方",
- displayName: "相对方2",
- companyName: "",
- ...sourcePartyC,
- },
- counterpartyList: sourceCounterpartyList.map((item, index) => ({
- ...createEmptyCounterparty(item.roleKey || COUNTERPARTY_ROLE_CODES[index]),
- ...item,
- roleKey: item.roleKey || COUNTERPARTY_ROLE_CODES[index],
- displayName: `相对方${index + 1}`,
- })),
+function createLocalId(prefix = "party") {
+ return `${prefix}_${Date.now()}_${Math.random().toString(16).slice(2, 8)}`;
+}
+
+function createEmptyParty(roleCode, index = 0) {
+ const isOur = roleCode === PARTY_ROLE_OUR;
+ return {
+ localId: createLocalId(isOur ? "our" : "opposite"),
+ roleCode,
+ roleName: isOur ? "我方" : "相对方",
+ displayName: isOur ? `我方主体${index + 1}` : `相对方${index + 1}`,
+ subjectCode: "",
+ partnerId: null,
+ customerSysid: null,
+ oppositeId: "",
+ companyName: "",
+ companyType: "",
+ oppositeCharacter: "",
+ oppCharacter: "",
+ companyNature: "",
+ organizationNature: "",
+ enterpriseNatureLevel2: "",
+ contactName: "",
+ contactPhone: "",
+ contactEmail: "",
+ contactAddress: "",
+ registeredAddress: "",
+ legalRepresentative: "",
+ creditCode: "",
+ bankName: "",
+ bankAccount: "",
+ naturalPersonIdType: "",
+ naturalPersonIdNumber: "",
+ isGroupInternal: false,
+ isHongKongMacaoTaiwan: false,
+ invoiceTitleOptions: [],
};
- if (listState) {
- state.partyA = { ...state.partyA, ...listState.partyA };
- state.counterpartyList = listState.counterpartyList.map((item) => ({ ...item }));
- state.partyB = { ...state.partyB, ...(state.counterpartyList[0] || {}) };
- state.partyC = { ...state.partyC, ...(state.counterpartyList[1] || {}) };
- state.isThreePartyContract = listState.isThreePartyContract;
- } else {
- state.partyB = { ...state.partyB, ...(state.counterpartyList[0] || {}) };
- state.partyC = { ...state.partyC, ...(state.counterpartyList[1] || {}) };
- }
- return state;
}
function mapLaunchPartyToFormParty(item = {}) {
- const roleIndex = COUNTERPARTY_ROLE_CODES.indexOf(item.roleCode || "B");
+ const roleCode =
+ String(item.roleCode || PARTY_ROLE_OPPOSITE).toUpperCase() ===
+ PARTY_ROLE_OUR
+ ? PARTY_ROLE_OUR
+ : PARTY_ROLE_OPPOSITE;
return {
- roleKey: item.roleCode || "B",
- roleName: item.roleName || "",
- displayName:
- item.roleCode === "A" ? "我方" : `相对方${roleIndex >= 0 ? roleIndex + 1 : 1}`,
- partnerId: item.partnerId || null,
- customerSysid: item.partnerId || null,
- oppositeId: item.oppositeId || "",
- companyName: item.companyName || "",
- companyType: item.companyType || "",
- oppositeCharacter: item.oppositeCharacter || "",
- oppCharacter: item.oppositeCharacter || "",
- companyNature: getCompanyNatureByOppositeCharacter(item.oppositeCharacter),
- contactName: item.contactName || "",
- contactPhone: item.contactPhone || "",
- contactEmail: item.contactEmail || "",
- contactAddress: item.contactAddress || "",
- registeredAddress: item.registeredAddress || "",
- legalRepresentative: item.legalRepresentative || "",
- creditCode: item.creditCode || "",
- bankName: item.bankName || "",
- bankAccount: item.bankAccount || "",
- naturalPersonIdType: item.naturalPersonIdType || "",
- naturalPersonIdNumber: item.naturalPersonIdNumber || "",
- isGroupInternal: item.isGroupInternal === "1" || item.isGroupInternal === true,
- isHongKongMacaoTaiwan:
- item.isHongKongMacaoTaiwan === "1" || item.isHongKongMacaoTaiwan === true,
+ ...createEmptyParty(roleCode),
+ ...item,
+ localId:
+ item.localId ||
+ createLocalId(roleCode === PARTY_ROLE_OUR ? "our" : "opposite"),
+ roleCode,
+ roleName: roleCode === PARTY_ROLE_OUR ? "我方" : "相对方",
+ subjectCode: item.subjectCode || "",
+ companyNature: getCompanyNatureByOppositeCharacter(
+ item.oppositeCharacter || item.oppCharacter,
+ ),
+ oppCharacter: item.oppositeCharacter || item.oppCharacter || "",
+ oppositeCharacter: item.oppositeCharacter || item.oppCharacter || "",
+ displayName: "",
+ customerSysid: item.customerSysid || item.partnerId || null,
};
}
function buildPartyStateFromList(list = []) {
if (!Array.isArray(list) || !list.length) return null;
const result = {
- isThreePartyContract: false,
- partyA: {},
- partyB: {},
- partyC: {},
+ ourPartyList: [],
counterpartyList: [],
};
list.forEach((item) => {
if (!item?.roleCode) return;
- if (item.roleCode === "A") {
- result.partyA = mapLaunchPartyToFormParty(item);
+ const mapped = mapLaunchPartyToFormParty(item);
+ if (mapped.roleCode === PARTY_ROLE_OUR) {
+ result.ourPartyList.push(mapped);
} else {
- result.counterpartyList.push(mapLaunchPartyToFormParty(item));
+ result.counterpartyList.push(mapped);
}
});
- result.counterpartyList = result.counterpartyList.map((item, index) => ({
- ...item,
- roleKey: item.roleKey || COUNTERPARTY_ROLE_CODES[index],
- displayName: `相对方${index + 1}`,
- }));
- result.partyB = result.counterpartyList[0] || {};
- result.partyC = result.counterpartyList[1] || {};
- result.isThreePartyContract = result.counterpartyList.length > 1;
- return result;
+ return normalizePartyState(result);
}
function getCompanyNatureByOppositeCharacter(value) {
@@ -1339,17 +1455,13 @@ function getCompanyNatureByOppositeCharacter(value) {
return map[String(value || "")] || "";
}
-function createEmptyCounterparty(roleKey) {
- return {
- roleKey,
- roleName: "相对方",
- displayName: `相对方${COUNTERPARTY_ROLE_CODES.indexOf(roleKey) + 1}`,
- companyName: "",
- };
-}
-
function isPartyFilled(party = {}) {
- const ignoreKeys = new Set(["roleKey", "roleName", "displayName"]);
+ const ignoreKeys = new Set([
+ "localId",
+ "roleCode",
+ "roleName",
+ "displayName",
+ ]);
return Object.entries(party).some(([key, value]) => {
if (ignoreKeys.has(key)) return false;
if (Array.isArray(value)) return value.length > 0;
@@ -1358,38 +1470,89 @@ function isPartyFilled(party = {}) {
});
}
-function buildCounterpartyRoleKeys(partyState) {
- const state = partyState || {};
- const sourceList = Array.isArray(state.counterpartyList)
- ? state.counterpartyList
- : COUNTERPARTY_ROLE_CODES.map((roleKey) => state[`party${roleKey}`]).filter(Boolean);
- return sourceList
+function normalizePartyArray(list = [], roleCode) {
+ return (Array.isArray(list) ? list : [])
.filter((party) => isPartyFilled(party))
- .map((party, index) => party.roleKey || COUNTERPARTY_ROLE_CODES[index])
- .slice(0, MAX_COUNTERPARTY_COUNT);
+ .map((party, index) => ({
+ ...createEmptyParty(roleCode, index),
+ ...party,
+ localId:
+ party.localId ||
+ createLocalId(roleCode === PARTY_ROLE_OUR ? "our" : "opposite"),
+ roleCode,
+ roleName: roleCode === PARTY_ROLE_OUR ? "我方" : "相对方",
+ displayName:
+ roleCode === PARTY_ROLE_OUR
+ ? `我方主体${index + 1}`
+ : `相对方${index + 1}`,
+ }));
}
function normalizePartyState(partyState) {
- const state = copyPartyState(partyState);
- state.partyA.companyName = state.partyA.companyName || SELF_COMPANY_NAME;
- state.counterpartyList = (Array.isArray(state.counterpartyList) ? state.counterpartyList : [])
- .filter((party) => isPartyFilled(party))
- .slice(0, MAX_COUNTERPARTY_COUNT)
- .map((party, index) => ({
- ...createEmptyCounterparty(party.roleKey || COUNTERPARTY_ROLE_CODES[index]),
- ...party,
- roleKey: party.roleKey || COUNTERPARTY_ROLE_CODES[index],
- displayName: `相对方${index + 1}`,
- }));
- state.partyB = state.counterpartyList[0] || createEmptyCounterparty("B");
- state.partyC = state.counterpartyList[1] || createEmptyCounterparty("C");
- state.isThreePartyContract = state.counterpartyList.length > 1;
+ const state = partyState || {};
+ const ourPartyList = normalizePartyArray(
+ Array.isArray(state.ourPartyList)
+ ? state.ourPartyList
+ : state.partyA
+ ? [state.partyA]
+ : [],
+ PARTY_ROLE_OUR,
+ );
+ const normalizedOurList = ourPartyList.length
+ ? ourPartyList
+ : [
+ {
+ ...createEmptyParty(PARTY_ROLE_OUR, 0),
+ companyName: SELF_COMPANY_NAME,
+ },
+ ];
+ const counterpartyList = normalizePartyArray(
+ state.counterpartyList,
+ PARTY_ROLE_OPPOSITE,
+ );
+ return {
+ partyA: { ...normalizedOurList[0] },
+ ourPartyList: normalizedOurList,
+ counterpartyList,
+ isThreePartyContract: counterpartyList.length > 1,
+ };
+}
+
+function applySubjectCodesToPartyState(partyState, signingSubjectCode) {
+ const state = normalizePartyState(partyState);
+ const codes = String(signingSubjectCode || "")
+ .split(",")
+ .map((item) => item.trim())
+ .filter(Boolean);
+ state.ourPartyList = state.ourPartyList.map((party, index) => ({
+ ...party,
+ subjectCode:
+ party.subjectCode || (codes.length === 1 ? codes[0] : codes[index] || ""),
+ }));
+ state.partyA = state.ourPartyList[0] || createEmptyParty(PARTY_ROLE_OUR, 0);
return state;
}
-function getPartyByRoleKey(partyState, roleKey) {
- if (roleKey === "A") return partyState.partyA;
- return (partyState.counterpartyList || []).find((item) => item.roleKey === roleKey);
+function copyPartyState(input) {
+ const source = input || {};
+ const listState = buildPartyStateFromList(source.partyList);
+ if (listState) {
+ return applySubjectCodesToPartyState(
+ listState,
+ source.signingSubjectCode ?? "",
+ );
+ }
+ return normalizePartyState({
+ ourPartyList: source.ourPartyList || (source.partyA ? [source.partyA] : []),
+ counterpartyList: source.counterpartyList || [],
+ isThreePartyContract: source.isThreePartyContract,
+ });
+}
+
+function getPartyByLocalId(list = [], localId) {
+ return (Array.isArray(list) ? list : []).find(
+ (item) => item.localId === localId,
+ );
}
/** 创建一条空的履行计划 */
@@ -1457,11 +1620,15 @@ function createContractFormData() {
templateFieldValues: {},
partyState: {
isThreePartyContract: false,
- partyA: { companyName: SELF_COMPANY_NAME },
- partyB: { companyName: "" },
- partyC: { companyName: "" },
+ ourPartyList: [
+ {
+ ...createEmptyParty(PARTY_ROLE_OUR, 0),
+ companyName: SELF_COMPANY_NAME,
+ },
+ ],
counterpartyList: [],
},
+ isSingleAgreement: "0",
isInvolveHongKongMacaoTaiwan: false,
isPublicTender: false,
isForeignRelatedSubject: false,
@@ -1501,7 +1668,10 @@ function copyContractFormData(data = {}) {
if (key === "extraAmounts") {
form.extraAmounts = restoreExtraAmounts(source, form.extraAmounts);
} else if (key === "templateFieldValues") {
- if (source.templateFieldValues && typeof source.templateFieldValues === "object") {
+ if (
+ source.templateFieldValues &&
+ typeof source.templateFieldValues === "object"
+ ) {
form.templateFieldValues = { ...source.templateFieldValues };
} else if (source.templateFieldValuesJson) {
try {
@@ -1518,7 +1688,7 @@ function copyContractFormData(data = {}) {
...item,
}));
} else if (key === "partyState") {
- form.partyState = normalizePartyState(source.partyState || source);
+ form.partyState = copyPartyState(source.partyState || source);
} else if (key === "otherAttachmentList") {
form.otherAttachmentList = fileState.otherAttachmentList;
} else if (key === "contractGistFileList") {
@@ -1540,13 +1710,23 @@ function copyContractFormData(data = {}) {
? source.contractBodyArrayBuffer.slice(0)
: null
: null;
- } else if (key === "signDate" || key === "sealDate" || key === "invoiceDate" || key === "receiveDate" || key === "activeDate") {
+ } else if (
+ key === "signDate" ||
+ key === "sealDate" ||
+ key === "invoiceDate" ||
+ key === "receiveDate" ||
+ key === "activeDate"
+ ) {
form[key] = source[key] ? String(source[key]).slice(0, 10) : form[key];
} else if (key === "assistDept") {
- form.assistDept = source.assistDept ?? source.assistDepartmentName ?? form.assistDept;
+ form.assistDept =
+ source.assistDept ?? source.assistDepartmentName ?? form.assistDept;
} else if (key === "signingSubjectCode") {
form.signingSubjectCode =
source.signingSubjectCode ?? source.orgId ?? form.signingSubjectCode;
+ } else if (key === "isSingleAgreement") {
+ form.isSingleAgreement =
+ source.isSingleAgreement ?? form.isSingleAgreement;
} else if (
[
"isInvolveHongKongMacaoTaiwan",
@@ -1583,7 +1763,7 @@ const otherAttachmentList = ref([]);
const gistAttachmentList = ref([]);
const authAttachmentUploadList = ref([]);
const bodyConfigModalRef = ref(null);
-const counterpartyRoleKeys = ref([]);
+const currentSelfParty = ref(null);
const companyProfileMap = {
扬州宏富特种材料有限公司: {
@@ -1626,10 +1806,16 @@ const companyProfileMap = {
const isViewMode = computed(() => modalMode.value === "view");
-const counterpartyParties = computed(() =>
- (detailState.value.partyState.counterpartyList || []).filter((party) =>
- counterpartyRoleKeys.value.includes(party.roleKey),
- ),
+const isSingleAgreementChecked = computed(
+ () => String(detailState.value.isSingleAgreement || "0") === "1",
+);
+
+const ourParties = computed(
+ () => detailState.value.partyState.ourPartyList || [],
+);
+
+const counterpartyParties = computed(
+ () => detailState.value.partyState.counterpartyList || [],
);
const counterpartySummaryText = computed(() =>
@@ -1640,11 +1826,36 @@ const counterpartySummaryText = computed(() =>
: "未填写",
);
-const contractBodyDisplayText = computed(() =>
- detailState.value.contractBodyFileName ||
- (creationMode.value === "manual"
- ? "点击上传合同正文 Word 文件"
- : templateName.value || "点击配置合同正文"),
+const ourPartySummaryText = computed(() =>
+ ourParties.value.length
+ ? ourParties.value
+ .map((party) => party.companyName || party.displayName)
+ .join(";")
+ : "未填写",
+);
+
+const allPartyDetails = computed(() => [
+ ...ourParties.value,
+ ...counterpartyParties.value,
+]);
+
+const signingSubjectCodeText = computed(() =>
+ ourParties.value
+ .map((party) => String(party.subjectCode || "").trim())
+ .filter(Boolean)
+ .join(","),
+);
+
+const currentSelfSubjectCode = computed(() =>
+ String(currentSelfParty.value?.subjectCode || "").trim(),
+);
+
+const contractBodyDisplayText = computed(
+ () =>
+ detailState.value.contractBodyFileName ||
+ (creationMode.value === "manual"
+ ? "点击上传合同正文 Word 文件"
+ : templateName.value || "点击配置合同正文"),
);
const contractBodyHint = computed(() =>
@@ -1676,36 +1887,46 @@ function syncUploadLists() {
status: item.status || "done",
}),
);
- authAttachmentUploadList.value = (detailState.value.authAttachmentList || []).map(
- (item, index) => ({
- uid: item.uid || `auth_${index + 1}`,
- name: item.name || item.fileName,
- size: item.size ?? item.fileSize,
- status: item.status || "done",
- }),
- );
+ authAttachmentUploadList.value = (
+ detailState.value.authAttachmentList || []
+ ).map((item, index) => ({
+ uid: item.uid || `auth_${index + 1}`,
+ name: item.name || item.fileName,
+ size: item.size ?? item.fileSize,
+ status: item.status || "done",
+ }));
}
function syncCounterpartyState() {
- detailState.value.partyState = normalizePartyState(detailState.value.partyState);
- counterpartyRoleKeys.value = buildCounterpartyRoleKeys(detailState.value.partyState);
- detailState.value.partyState.counterpartyList =
- detailState.value.partyState.counterpartyList || [];
- detailState.value.partyState.isThreePartyContract = counterpartyRoleKeys.value.length > 1;
+ detailState.value.partyState = normalizePartyState(
+ detailState.value.partyState,
+ );
refreshPartyDisplayMeta();
}
function refreshPartyDisplayMeta() {
- detailState.value.partyState.partyA.roleKey = "A";
- detailState.value.partyState.partyA.roleName = "我方";
- detailState.value.partyState.partyA.displayName = "我方";
-
- (detailState.value.partyState.counterpartyList || []).forEach((party, index) => {
- const roleKey = party.roleKey || COUNTERPARTY_ROLE_CODES[index];
- party.roleKey = roleKey;
- party.roleName = "相对方";
- party.displayName = `相对方${index + 1}`;
- });
+ detailState.value.partyState.ourPartyList = (
+ detailState.value.partyState.ourPartyList || []
+ ).map((party, index) => ({
+ ...party,
+ roleCode: PARTY_ROLE_OUR,
+ roleName: "我方",
+ displayName: `我方主体${index + 1}`,
+ }));
+ detailState.value.partyState.counterpartyList = (
+ detailState.value.partyState.counterpartyList || []
+ ).map((party, index) => ({
+ ...party,
+ roleCode: PARTY_ROLE_OPPOSITE,
+ roleName: "相对方",
+ displayName: `相对方${index + 1}`,
+ }));
+ detailState.value.partyState.partyA =
+ detailState.value.partyState.ourPartyList[0] ||
+ createEmptyParty(PARTY_ROLE_OUR, 0);
+ detailState.value.partyState.isThreePartyContract =
+ detailState.value.partyState.counterpartyList.length > 1;
+ detailState.value.signingSubjectCode = signingSubjectCodeText.value;
}
function resetCurrentState() {
@@ -1718,19 +1939,11 @@ function resetCurrentState() {
}
function showSearchTip(title) {
- if (title === "我方详情") {
- message.info("我方信息当前按登录组织只读带出,后续接入真实组织主数据后自动完善。");
- return;
- }
loadPartnerOptions();
- message.info(`${title}数据已从相对方管理加载,可直接在下拉框搜索选择。`);
+ message.info(`${title}数据已从客户/主体库加载,可直接在下拉框搜索选择。`);
}
function showInvoiceTitles(party, roleName) {
- if (roleName === "我方") {
- message.info("我方开票抬头当前不在发起页维护,后续建议从组织主数据自动带出。");
- return;
- }
const titles = party.invoiceTitleOptions || [];
message.info(
titles.length
@@ -1740,9 +1953,16 @@ function showInvoiceTitles(party, roleName) {
}
function filterPartnerOption(input, option) {
- const keyword = String(input || "").trim().toLowerCase();
+ const keyword = String(input || "")
+ .trim()
+ .toLowerCase();
if (!keyword) return true;
- return [option?.label, option?.value, option?.raw?.oppositeCode, option?.raw?.oppositeId]
+ return [
+ option?.label,
+ option?.value,
+ option?.raw?.oppositeCode,
+ option?.raw?.oppositeId,
+ ]
.filter(Boolean)
.some((item) => String(item).toLowerCase().includes(keyword));
}
@@ -1781,9 +2001,13 @@ function getEnterpriseNatureLevel2Label(value) {
function mapPartnerToParty(raw = {}, roleKey, companyName) {
const firstContact = raw.contacts?.[0] || {};
+ const roleCode =
+ roleKey === PARTY_ROLE_OUR ? PARTY_ROLE_OUR : PARTY_ROLE_OPPOSITE;
return {
+ ...createEmptyParty(roleCode),
partnerId: raw.customerSysid || null,
customerSysid: raw.customerSysid || null,
+ subjectCode: raw.orgId == null ? "" : String(raw.orgId),
oppositeId: raw.oppositeId || "",
companyName: raw.customerNameC || companyName || "",
companyType: getRelativeTypeLabel(raw.relativeType),
@@ -1791,7 +2015,9 @@ function mapPartnerToParty(raw = {}, roleKey, companyName) {
oppCharacter: raw.oppositeCharacter || "",
companyNature: getCompanyNatureByOppositeCharacter(raw.oppositeCharacter),
organizationNature: getOrganizationNatureLabel(raw.natureOfEnterpriseOrg),
- enterpriseNatureLevel2: getEnterpriseNatureLevel2Label(raw.natureOfEnterpriseOrgLev),
+ enterpriseNatureLevel2: getEnterpriseNatureLevel2Label(
+ raw.natureOfEnterpriseOrgLev,
+ ),
creditCode: raw.customerTaxno || "",
tinNo: raw.tinCode || "",
countryCode: raw.country || "",
@@ -1809,24 +2035,59 @@ function mapPartnerToParty(raw = {}, roleKey, companyName) {
isGroupInternal: raw.groupFlag === "Y" || raw.isJtn === "1",
isHongKongMacaoTaiwan: raw.gatFlag === "Y" || raw.isSgat === "1",
invoiceTitleOptions: raw.customerNameC ? [raw.customerNameC] : [],
- roleKey,
- roleName: roleKey === "A" ? "我方" : "相对方",
- displayName: roleKey === "A" ? "我方" : roleKey === "C" ? "相对方2" : "相对方1",
+ roleCode,
+ roleName: roleCode === PARTY_ROLE_OUR ? "我方" : "相对方",
};
}
-function handleCompanySelect(roleKey, companyName, option = {}) {
- const party =
- roleKey === "A"
- ? detailState.value.partyState.partyA
- : getPartyByRoleKey(detailState.value.partyState, roleKey);
+function getPartyOptions(roleCode) {
+ const baseOptions = contractCompanyOptions.value || [];
+ if (roleCode !== PARTY_ROLE_OUR) {
+ return baseOptions;
+ }
+ const selfParty = currentSelfParty.value;
+ if (!selfParty?.companyName) {
+ return baseOptions;
+ }
+ const exists = baseOptions.some(
+ (item) => item.value === selfParty.companyName,
+ );
+ if (exists) {
+ return baseOptions;
+ }
+ return [
+ {
+ label: `${selfParty.companyName}(当前主体)`,
+ value: selfParty.companyName,
+ raw: {
+ customerNameC: selfParty.companyName,
+ orgId: selfParty.subjectCode,
+ officephone: selfParty.contactPhone,
+ emailAddress: selfParty.contactEmail,
+ customerAddress: selfParty.contactAddress,
+ customerRegaddr: selfParty.registeredAddress,
+ customerBank: selfParty.bankName,
+ customerBankaccount: selfParty.bankAccount,
+ legalPersonName: selfParty.legalRepresentative,
+ customerTaxno: selfParty.creditCode,
+ },
+ },
+ ...baseOptions,
+ ];
+}
+
+function handleCompanySelect(party, companyName, option = {}) {
if (!party) return;
const rawPartner =
option?.raw ||
- contractCompanyOptions.value.find((item) => item.value === companyName)?.raw;
+ contractCompanyOptions.value.find((item) => item.value === companyName)
+ ?.raw;
if (rawPartner) {
- Object.assign(party, mapPartnerToParty(rawPartner, roleKey, companyName));
+ Object.assign(
+ party,
+ mapPartnerToParty(rawPartner, party.roleCode, companyName),
+ );
refreshPartyDisplayMeta();
return;
}
@@ -1838,19 +2099,32 @@ function handleCompanySelect(roleKey, companyName, option = {}) {
}
Object.assign(party, {
- companyName,
- contactPhone: party.contactPhone || profile.contactPhone,
- registeredAddress: party.registeredAddress || profile.registeredAddress,
- bankAccount: party.bankAccount || profile.bankAccount,
- bankName: party.bankName || profile.bankName,
- contactName: party.contactName || profile.contactName,
- legalRepresentative:
- party.legalRepresentative || profile.legalRepresentative,
- creditCode: party.creditCode || profile.creditCode,
- oppCharacter:
- party.oppCharacter ||
- (String(party.companyNature || "").includes("个人") ? "2" : "1"),
- });
+ companyName,
+ subjectCode: party.subjectCode || "",
+ contactPhone: party.contactPhone || profile.contactPhone,
+ registeredAddress: party.registeredAddress || profile.registeredAddress,
+ bankAccount: party.bankAccount || profile.bankAccount,
+ bankName: party.bankName || profile.bankName,
+ contactName: party.contactName || profile.contactName,
+ legalRepresentative:
+ party.legalRepresentative || profile.legalRepresentative,
+ creditCode: party.creditCode || profile.creditCode,
+ oppCharacter:
+ party.oppCharacter ||
+ (String(party.companyNature || "").includes("个人") ? "2" : "1"),
+ });
+}
+
+function handleAddOurParty() {
+ detailState.value.partyState.ourPartyList =
+ detailState.value.partyState.ourPartyList || [];
+ detailState.value.partyState.ourPartyList.push(
+ createEmptyParty(
+ PARTY_ROLE_OUR,
+ detailState.value.partyState.ourPartyList.length,
+ ),
+ );
+ refreshPartyDisplayMeta();
}
function handleContractTypeChange(value) {
@@ -1862,39 +2136,33 @@ function handleContractTypeCodeChange(value) {
}
function handleAddCounterparty() {
- if (counterpartyRoleKeys.value.length >= MAX_COUNTERPARTY_COUNT) {
- message.warning(`最多支持添加 ${MAX_COUNTERPARTY_COUNT} 个相对方`);
- return;
- }
-
- const nextRoleKey = COUNTERPARTY_ROLE_CODES.find(
- (roleKey) => !counterpartyRoleKeys.value.includes(roleKey),
- );
- if (!nextRoleKey) return;
-
detailState.value.partyState.counterpartyList =
detailState.value.partyState.counterpartyList || [];
detailState.value.partyState.counterpartyList.push(
- createEmptyCounterparty(nextRoleKey),
+ createEmptyParty(
+ PARTY_ROLE_OPPOSITE,
+ detailState.value.partyState.counterpartyList.length,
+ ),
);
- counterpartyRoleKeys.value = [...counterpartyRoleKeys.value, nextRoleKey];
- detailState.value.partyState.isThreePartyContract = counterpartyRoleKeys.value.length > 1;
refreshPartyDisplayMeta();
}
-function handleRemoveCounterparty(roleKey) {
- detailState.value.partyState.counterpartyList =
- (detailState.value.partyState.counterpartyList || [])
- .filter((item) => item.roleKey !== roleKey)
- .map((item, index) => ({
- ...item,
- roleKey: COUNTERPARTY_ROLE_CODES[index],
- displayName: `相对方${index + 1}`,
- }));
- counterpartyRoleKeys.value = detailState.value.partyState.counterpartyList.map(
- (item) => item.roleKey,
- );
- detailState.value.partyState.isThreePartyContract = counterpartyRoleKeys.value.length > 1;
+function handleRemoveOurParty(localId) {
+ detailState.value.partyState.ourPartyList = (
+ detailState.value.partyState.ourPartyList || []
+ ).filter((item) => item.localId !== localId);
+ if (!detailState.value.partyState.ourPartyList.length) {
+ detailState.value.partyState.ourPartyList = [
+ createEmptyParty(PARTY_ROLE_OUR, 0),
+ ];
+ }
+ refreshPartyDisplayMeta();
+}
+
+function handleRemoveCounterparty(localId) {
+ detailState.value.partyState.counterpartyList = (
+ detailState.value.partyState.counterpartyList || []
+ ).filter((item) => item.localId !== localId);
refreshPartyDisplayMeta();
}
@@ -2017,7 +2285,9 @@ function handleBodyConfigSave(payload = {}) {
if (modalMode.value === "edit" && detailState.value.id) {
const errorMessage = validateState();
if (errorMessage) {
- message.success("合同正文配置已保存到当前页面,请继续完善主信息后再保存合同草稿。");
+ message.success(
+ "合同正文配置已保存到当前页面,请继续完善主信息后再保存合同草稿。",
+ );
return;
}
@@ -2037,7 +2307,9 @@ function handleBodyConfigSave(payload = {}) {
return;
}
- message.success("合同正文配置已保存到当前页面,请继续点击底部“保存”提交合同草稿。");
+ message.success(
+ "合同正文配置已保存到当前页面,请继续点击底部“保存”提交合同草稿。",
+ );
}
function addPerformancePlan() {
@@ -2050,10 +2322,24 @@ function removePerformancePlan(id) {
}
function validateState() {
- if (!detailState.value.partyState.partyA.companyName?.trim())
- return "请确认我方信息";
- if (!counterpartyRoleKeys.value.length) return "请至少添加一个相对方";
if (
+ !ourParties.value.length ||
+ ourParties.value.some((party) => !party.companyName?.trim())
+ )
+ return "请确认我方信息";
+ if (
+ currentSelfSubjectCode.value &&
+ !ourParties.value.some(
+ (party) =>
+ String(party.subjectCode || "").trim() === currentSelfSubjectCode.value,
+ )
+ ) {
+ return "当前登录主体必须包含在我方主体中";
+ }
+ if (!isSingleAgreementChecked.value && !counterpartyParties.value.length)
+ return "请至少添加一个相对方";
+ if (
+ !isSingleAgreementChecked.value &&
counterpartyParties.value.some((party) => !party.companyName?.trim())
)
return "请选择相对方";
@@ -2106,7 +2392,11 @@ function validateState() {
if (!detailState.value.sealType) return "请选择签订方式";
if (!detailState.value.textSource) return "请选择文本来源";
// needAmendments 必填(文档要求)
- if (!detailState.value.needAmendments || detailState.value.needAmendments === "") return "请选择是否需修订条款";
+ if (
+ !detailState.value.needAmendments ||
+ detailState.value.needAmendments === ""
+ )
+ return "请选择是否需修订条款";
if (!detailState.value.paymentDirection) return "请选择收支方向";
if (!detailState.value.contractTypeCode) return "请选择合同类型编码";
if (!detailState.value.executorAccount?.trim()) return "请填写合同执行人";
@@ -2125,11 +2415,17 @@ function validateState() {
if (!plan.planMatter?.trim()) return "请填写履行计划的履行事项";
if (!plan.planWhere?.trim()) return "请填写履行计划的履约条件";
if (!plan.planTime) return "请选择履行计划的节点日期";
- if (plan.planDay === null || plan.planDay === undefined || plan.planDay === "")
+ if (
+ plan.planDay === null ||
+ plan.planDay === undefined ||
+ plan.planDay === ""
+ )
return "请填写履行计划的提醒提前天数";
if (
!["0", "3"].includes(detailState.value.valuationMode) &&
- (plan.planMoney === null || plan.planMoney === undefined || plan.planMoney === "")
+ (plan.planMoney === null ||
+ plan.planMoney === undefined ||
+ plan.planMoney === "")
)
return "请填写履行计划的款项金额";
}
@@ -2168,32 +2464,11 @@ function handleSave() {
function buildLaunchRecord() {
const partyList = [];
- const partyA = detailState.value.partyState.partyA || {};
- partyList.push({
- roleCode: "A",
- roleName: "甲方",
- companyName: partyA.companyName,
- companyType: partyA.companyType,
- oppositeCharacter:
- partyA.oppCharacter ||
- (String(partyA.companyNature || "").includes("个人") ? "2" : "1"),
- contactName: partyA.contactName,
- contactPhone: partyA.contactPhone,
- contactEmail: partyA.contactEmail,
- contactAddress: partyA.contactAddress,
- registeredAddress: partyA.registeredAddress,
- legalRepresentative: partyA.legalRepresentative,
- creditCode: partyA.creditCode,
- bankName: partyA.bankName,
- bankAccount: partyA.bankAccount,
- naturalPersonIdType: partyA.naturalPersonIdType,
- naturalPersonIdNumber: partyA.naturalPersonIdNumber,
- });
-
- counterpartyParties.value.forEach((party, index) => {
+ ourParties.value.forEach((party) => {
partyList.push({
- roleCode: party.roleKey || COUNTERPARTY_ROLE_CODES[index],
- roleName: party.displayName || `相对方${index + 1}`,
+ roleCode: PARTY_ROLE_OUR,
+ roleName: "我方",
+ subjectCode: party.subjectCode || "",
partnerId: party.partnerId || party.customerSysid || null,
oppositeId: party.oppositeId,
companyName: party.companyName,
@@ -2217,6 +2492,35 @@ function buildLaunchRecord() {
});
});
+ if (!isSingleAgreementChecked.value) {
+ counterpartyParties.value.forEach((party) => {
+ partyList.push({
+ roleCode: PARTY_ROLE_OPPOSITE,
+ roleName: "相对方",
+ partnerId: party.partnerId || party.customerSysid || null,
+ oppositeId: party.oppositeId,
+ companyName: party.companyName,
+ companyType: party.companyType,
+ oppositeCharacter:
+ party.oppCharacter ||
+ (String(party.companyNature || "").includes("个人") ? "2" : "1"),
+ contactName: party.contactName,
+ contactPhone: party.contactPhone,
+ contactEmail: party.contactEmail,
+ contactAddress: party.contactAddress,
+ registeredAddress: party.registeredAddress,
+ legalRepresentative: party.legalRepresentative,
+ creditCode: party.creditCode,
+ bankName: party.bankName,
+ bankAccount: party.bankAccount,
+ naturalPersonIdType: party.naturalPersonIdType,
+ naturalPersonIdNumber: party.naturalPersonIdNumber,
+ isGroupInternal: party.isGroupInternal ? "1" : "0",
+ isHongKongMacaoTaiwan: party.isHongKongMacaoTaiwan ? "1" : "0",
+ });
+ });
+ }
+
const fileList = [];
if (detailState.value.contractBodyFileName) {
fileList.push({
@@ -2255,14 +2559,20 @@ function buildLaunchRecord() {
});
});
- const extraAmountPayload = buildExtraAmountPayload(detailState.value.extraAmounts);
+ const extraAmountPayload = buildExtraAmountPayload(
+ detailState.value.extraAmounts,
+ );
return {
id: detailState.value.id || null,
contractCode: detailState.value.contractCode,
contractName: detailState.value.contractName,
- contractType: getOptionLabel(contractTypeOptions, detailState.value.contractType),
- contractTypeCode: detailState.value.contractTypeCode || detailState.value.contractType,
+ contractType: getOptionLabel(
+ contractTypeOptions,
+ detailState.value.contractType,
+ ),
+ contractTypeCode:
+ detailState.value.contractTypeCode || detailState.value.contractType,
contractSource: detailState.value.contractSource || "ECP",
creationMode: creationMode.value,
templateId: templateKey.value || null,
@@ -2296,6 +2606,7 @@ function buildLaunchRecord() {
dateType: detailState.value.dateType || "0",
isAddit: detailState.value.mainContractCode ? 1 : 2,
isElectron: detailState.value.isElectron || "1",
+ isSingleAgreement: detailState.value.isSingleAgreement || "0",
paymentDirection: detailState.value.paymentDirection || "0",
isMajorContract: detailState.value.isMajorContract ? 1 : 0,
isOpenBidding: detailState.value.isPublicTender ? 1 : 0,
@@ -2303,9 +2614,12 @@ function buildLaunchRecord() {
isShare: detailState.value.isShared ? "1" : "0",
contractNature: detailState.value.isForeignRelatedSubject ? "1" : "0",
isSgat: detailState.value.isInvolveHongKongMacaoTaiwan ? "1" : "0",
- biddingNo: detailState.value.isPublicTender ? detailState.value.biddingNo || "" : "",
+ biddingNo: detailState.value.isPublicTender
+ ? detailState.value.biddingNo || ""
+ : "",
contractGistRemark: detailState.value.contractGistRemark || "",
- bodySummary: detailState.value.bodySummary || detailState.value.primaryContent || "",
+ bodySummary:
+ detailState.value.bodySummary || detailState.value.primaryContent || "",
contractTextFileName: detailState.value.contractBodyFileName || "",
contractTextFilePath: detailState.value.contractBodyFilePath || "",
contractTextFileType: detailState.value.contractBodyFileType || "docx",
@@ -2320,54 +2634,91 @@ function buildLaunchRecord() {
detailState.value.templateFieldValues || {},
),
remindDays: 3,
- signingSubjectCode: detailState.value.signingSubjectCode || "",
+ signingSubjectCode:
+ signingSubjectCodeText.value ||
+ detailState.value.signingSubjectCode ||
+ "",
extraAmounts: { ...detailState.value.extraAmounts },
...extraAmountPayload,
partyList,
fileList,
- performancePlans: (detailState.value.performancePlans || []).map((item) => ({
- planMatter: item.planMatter,
- planWhere: item.planWhere,
- planTime: formatDateTimeValue(item.planTime),
- planDay: item.planDay,
- planMoney: item.planMoney,
- planSubjectCode: item.planSubjectCode,
- planSubjectName: item.planSubjectName,
- executorUnitId: item.executorUnitId || null,
- planDetail: item.planDetail,
- planStatus: "0",
- })),
+ performancePlans: (detailState.value.performancePlans || []).map(
+ (item) => ({
+ planMatter: item.planMatter,
+ planWhere: item.planWhere,
+ planTime: formatDateTimeValue(item.planTime),
+ planDay: item.planDay,
+ planMoney: item.planMoney,
+ planSubjectCode: item.planSubjectCode,
+ planSubjectName: item.planSubjectName,
+ executorUnitId: item.executorUnitId || null,
+ planDetail: item.planDetail,
+ planStatus: "0",
+ }),
+ ),
};
}
function applySelfProfile(profile = {}) {
- detailState.value.partyState.partyA = {
- ...detailState.value.partyState.partyA,
- companyName: profile.orgName || detailState.value.partyState.partyA.companyName,
- contactPhone: profile.contactPhone || detailState.value.partyState.partyA.contactPhone,
- contactEmail: profile.contactEmail || detailState.value.partyState.partyA.contactEmail,
- contactAddress: profile.contactAddress || detailState.value.partyState.partyA.contactAddress,
- registeredAddress:
- profile.registeredAddress || detailState.value.partyState.partyA.registeredAddress,
- bankName: profile.bankName || detailState.value.partyState.partyA.bankName,
- bankAccount: profile.bankAccount || detailState.value.partyState.partyA.bankAccount,
- legalRepresentative:
- profile.legalRepresentative || detailState.value.partyState.partyA.legalRepresentative,
- creditCode: profile.creditCode || detailState.value.partyState.partyA.creditCode,
- invoiceTitleOptions:
- profile.invoiceTitleOptions || detailState.value.partyState.partyA.invoiceTitleOptions || [],
+ const firstOurParty =
+ detailState.value.partyState.ourPartyList?.[0] ||
+ createEmptyParty(PARTY_ROLE_OUR, 0);
+ currentSelfParty.value = {
+ ...createEmptyParty(PARTY_ROLE_OUR, 0),
+ companyName: profile.orgName || SELF_COMPANY_NAME,
+ subjectCode: profile.id || "",
+ contactPhone: profile.contactPhone || "",
+ contactEmail: profile.contactEmail || "",
+ contactAddress: profile.contactAddress || "",
+ registeredAddress: profile.registeredAddress || "",
+ bankName: profile.bankName || "",
+ bankAccount: profile.bankAccount || "",
+ legalRepresentative: profile.legalRepresentative || "",
+ creditCode: profile.creditCode || "",
+ invoiceTitleOptions: profile.invoiceTitleOptions || [],
};
+ const shouldHydrateFirstParty =
+ !firstOurParty.companyName ||
+ firstOurParty.companyName === SELF_COMPANY_NAME ||
+ firstOurParty.companyName === profile.orgName;
+ if (!shouldHydrateFirstParty) {
+ return;
+ }
+ detailState.value.partyState.ourPartyList = [
+ {
+ ...firstOurParty,
+ companyName: profile.orgName || firstOurParty.companyName,
+ subjectCode: profile.id || firstOurParty.subjectCode,
+ contactPhone: profile.contactPhone || firstOurParty.contactPhone,
+ contactEmail: profile.contactEmail || firstOurParty.contactEmail,
+ contactAddress: profile.contactAddress || firstOurParty.contactAddress,
+ registeredAddress:
+ profile.registeredAddress || firstOurParty.registeredAddress,
+ bankName: profile.bankName || firstOurParty.bankName,
+ bankAccount: profile.bankAccount || firstOurParty.bankAccount,
+ legalRepresentative:
+ profile.legalRepresentative || firstOurParty.legalRepresentative,
+ creditCode: profile.creditCode || firstOurParty.creditCode,
+ invoiceTitleOptions:
+ profile.invoiceTitleOptions || firstOurParty.invoiceTitleOptions || [],
+ },
+ ...(detailState.value.partyState.ourPartyList || []).slice(1),
+ ];
+ refreshPartyDisplayMeta();
}
async function showModal(context = {}, mode = "create") {
modalMode.value = mode || "create";
- const source = context.detailState ||
+ const source =
+ context.detailState ||
(Object.keys(context || {}).length ? context : createContractFormData());
creationMode.value =
context.creationMode ||
source.creationMode ||
- (source.contractBodyArrayBuffer || source.contractBodyFilePath ? "manual" : "template");
+ (source.contractBodyArrayBuffer || source.contractBodyFilePath
+ ? "manual"
+ : "template");
templateKey.value = context.templateKey || source.templateId || "";
templateName.value = context.templateName || source.templateName || "";
detailState.value = copyContractFormData(source);
@@ -2386,7 +2737,9 @@ function loadPartnerOptions() {
value: item.customerNameC,
raw: item,
}));
- contractCompanyOptions.value = options.length ? options : contractCompanyOptions.value;
+ contractCompanyOptions.value = options.length
+ ? options
+ : contractCompanyOptions.value;
});
}
diff --git a/src/views/contract/launch/components/ContractTemplateFillDemoModal.vue b/src/views/contract/launch/components/ContractTemplateFillDemoModal.vue
index 6cd0027..10ba189 100644
--- a/src/views/contract/launch/components/ContractTemplateFillDemoModal.vue
+++ b/src/views/contract/launch/components/ContractTemplateFillDemoModal.vue
@@ -130,11 +130,7 @@
导出 Word
-
+
保存
@@ -176,7 +172,6 @@