fix
This commit is contained in:
@@ -201,7 +201,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION) && isEntrustCenterChannel">
|
||||
<el-col :span="24" class="mb12" v-if="isPurchaseType(DEPT_PURCHASE_TYPE.BUSINESS_NEGOTIATION)">
|
||||
<el-form-item label="洽谈理由" prop="negotiationReason" required>
|
||||
<el-input
|
||||
v-model="dataForm.negotiationReason"
|
||||
@@ -932,7 +932,7 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-button v-if="!isFlowEmbed" @click="handleCancel">取消</el-button>
|
||||
<el-button v-if="!isEditMode && !flowSubmitDisabled" type="warning" @click="handleTempStore" :disabled="loading"> 暂存 </el-button>
|
||||
<el-button v-if="!flowSubmitDisabled" type="warning" @click="handleTempStore" :disabled="loading"> 暂存 </el-button>
|
||||
<!-- <el-button -->
|
||||
<!-- type="primary" -->
|
||||
<!-- @click="handleSubmit" -->
|
||||
@@ -1076,7 +1076,7 @@ const dataForm = reactive({
|
||||
|
||||
serviceInviteSelect: '',
|
||||
servicePublicSelectAuto: '',
|
||||
deptSelfMeetingMinutes: '', // 部门自行采购会议纪要
|
||||
deptSelfMeetingMinutes: '', // 部门会议纪要
|
||||
// 学校统一采购字段
|
||||
purchaseRequirement: '',
|
||||
meetingMinutes: '',
|
||||
@@ -1135,9 +1135,11 @@ const businessLeaderList = ref<any[]>([]);
|
||||
const representorTypeList = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
const helpDialogVisible = ref(false);
|
||||
/** 数据是否已加载完成(用于控制自动设置采购方式的逻辑) */
|
||||
const initialDataLoaded = ref(false);
|
||||
|
||||
// 文件类型映射(对应数据库 file_type 字段)
|
||||
// 10:商务洽谈纪要 20:市场采购纪要 30:网上商城采购相关材料 40:可行性论证报告 50:会议记录 60:其他材料 70:单一来源专家论证表 90:进口产品专家论证表 100:政府采购意向表 110:履约验收单 120:采购需求表 130:招标文件 140: 部门自行采购会议纪要
|
||||
// 10:商务洽谈纪要 20:市场采购纪要 30:网上商城采购相关材料 40:可行性论证报告 50:会议记录 60:其他材料 70:单一来源专家论证表 90:进口产品专家论证表 100:政府采购意向表 110:履约验收单 120:采购需求表 130:招标文件 140: 部门会议纪要
|
||||
const FILE_TYPE_MAP: Record<string, string> = {
|
||||
businessNegotiationTable: '10', // 商务洽谈纪要
|
||||
marketPurchaseMinutes: '20', // 市场采购纪要
|
||||
@@ -1162,7 +1164,7 @@ const FILE_TYPE_MAP: Record<string, string> = {
|
||||
serviceInviteSelectSchool: '120', // 服务商城项目需求模板(邀请比选 - 学校)- 采购需求表
|
||||
servicePublicSelectSchoolAuto: '120', // 服务商城项目需求模板(公开比选 - 学校 - 自动)- 采购需求表
|
||||
servicePublicSelectSchool: '120', // 服务商城项目需求模板(公开比选 - 学校)- 采购需求表
|
||||
deptSelfMeetingMinutes: '140', // 部门自行采购会议纪要
|
||||
deptSelfMeetingMinutes: '140', // 部门会议纪要
|
||||
};
|
||||
|
||||
// fileType -> 表单字段名数组(顺序与回填分配一致,同类型多字段时按此顺序分配)
|
||||
@@ -1395,9 +1397,42 @@ const calcEntrustCenterType = (): 'service_online' | 'other' | '' => {
|
||||
return 'other';
|
||||
};
|
||||
|
||||
// 监听品目/采购途径变化,自动设置委托采购中心方式,并清理无关字段
|
||||
// 监听采购途径变化,清理所有与采购方式相关的材料字段
|
||||
watch(
|
||||
[() => dataForm.purchaseChannel, () => dataForm.categoryCode, () => categoryTreeData.value],
|
||||
() => dataForm.purchaseChannel,
|
||||
(newChannel, oldChannel) => {
|
||||
// 仅在采购途径发生变化时清理
|
||||
if (newChannel === oldChannel) return;
|
||||
|
||||
// 编辑模式(dataForm.id存在)下,如果是首次加载数据(oldChannel为空),不清理
|
||||
// 首次加载时保持原有数据,用户手动切换时需要清理
|
||||
if (dataForm.id && !oldChannel) return;
|
||||
|
||||
// 采购途径变化时清空采购方式和所有材料字段
|
||||
// 避免"自行采购"切换回"委托采购中心采购"时,仍显示原"网上商城"对应的字段
|
||||
dataForm.purchaseType = '';
|
||||
dataForm.entrustCenterType = '';
|
||||
|
||||
// 自行采购的材料字段
|
||||
dataForm.businessNegotiationTable = '';
|
||||
dataForm.marketPurchaseMinutes = '';
|
||||
dataForm.onlineMallMaterials = '';
|
||||
dataForm.inquiryTemplate = '';
|
||||
dataForm.serviceInviteSelect = '';
|
||||
dataForm.servicePublicSelectAuto = '';
|
||||
// 委托采购中心的材料字段
|
||||
dataForm.serviceDirectSelect = '';
|
||||
dataForm.servicePublicSelect = '';
|
||||
dataForm.purchaseRequirementTemplate = '';
|
||||
dataForm.hasSupplier = '0';
|
||||
dataForm.suppliers = '';
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
// 监听品目变化,自动设置委托采购中心方式
|
||||
watch(
|
||||
[() => dataForm.categoryCode, () => categoryTreeData.value],
|
||||
() => {
|
||||
const nextType = calcEntrustCenterType();
|
||||
if (!nextType) return;
|
||||
@@ -1407,7 +1442,7 @@ watch(
|
||||
|
||||
dataForm.entrustCenterType = nextType;
|
||||
|
||||
// 切换时清理不相关字段,避免脏数据
|
||||
// 品目变化时清理不相关字段
|
||||
if (nextType === 'other') {
|
||||
dataForm.hasSupplier = '0';
|
||||
dataForm.suppliers = '';
|
||||
@@ -1497,6 +1532,11 @@ watch(
|
||||
() => isPurchaseCenter.value,
|
||||
],
|
||||
(newValues, oldValues) => {
|
||||
// 如果是初始化触发(oldValues 为 undefined)且是编辑模式(dataForm.id 存在),则跳过自动设置
|
||||
// 这样可以保持从后台加载的采购方式不变
|
||||
const isInitTrigger = oldValues === undefined || oldValues === null;
|
||||
const isEditModeWithData = isInitTrigger && dataForm.id;
|
||||
|
||||
const oldIsDeptPurchase = oldValues?.[2];
|
||||
const newIsDeptPurchase = newValues?.[2];
|
||||
|
||||
@@ -1512,8 +1552,9 @@ watch(
|
||||
return;
|
||||
}
|
||||
|
||||
// 部门自行采购 & 采购途径为“自行采购” & 特殊服务类目:固定网上商城(无论金额区间)
|
||||
if (isDeptSelfMallLocked.value) {
|
||||
// 部门自行采购 & 采购途径为自行采购 & 特殊服务类目:固定网上商城(无论金额区间)
|
||||
// 编辑模式下加载数据时保持原有值,用户手动切换时仍自动更新
|
||||
if (isDeptSelfMallLocked.value && !isEditModeWithData) {
|
||||
const onlineMallOption = purchaseTypeDeptList.value.find((item) => item.value === DEPT_PURCHASE_TYPE.ONLINE_MALL);
|
||||
if (onlineMallOption && dataForm.purchaseType !== onlineMallOption.value) {
|
||||
dataForm.purchaseType = onlineMallOption.value;
|
||||
@@ -1522,8 +1563,9 @@ watch(
|
||||
return;
|
||||
}
|
||||
|
||||
// 其他部门自行采购 & 采购途径为“自行采购”:在金额区间内自动推荐网上商城
|
||||
if (isAutoSelectPurchaseType.value && isDeptPurchase.value && !isEntrustCenterChannel.value) {
|
||||
// 其他部门自行采购 & 采购途径为"自行采购":在金额区间内自动推荐网上商城
|
||||
// 编辑模式下加载数据时保持原有值,用户手动切换时仍自动更新
|
||||
if (isAutoSelectPurchaseType.value && isDeptPurchase.value && !isEntrustCenterChannel.value && !isEditModeWithData) {
|
||||
const onlineMallOption = purchaseTypeDeptList.value.find((item) => item.value === DEPT_PURCHASE_TYPE.ONLINE_MALL);
|
||||
if (onlineMallOption && dataForm.purchaseType !== onlineMallOption.value) {
|
||||
dataForm.purchaseType = onlineMallOption.value;
|
||||
@@ -1939,7 +1981,7 @@ async function flowSubmitForm() {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'deptSelfMeetingMinutes', // 部门会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
@@ -2377,7 +2419,7 @@ const handleSubmit = async () => {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'deptSelfMeetingMinutes', // 部门会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
@@ -2477,7 +2519,7 @@ const handleTempStore = async () => {
|
||||
'purchaseRequirementTemplate',
|
||||
'serviceInviteSelect',
|
||||
'servicePublicSelectAuto',
|
||||
'deptSelfMeetingMinutes', // 部门自行采购会议纪要
|
||||
'deptSelfMeetingMinutes', // 部门会议纪要
|
||||
'purchaseRequirement',
|
||||
'meetingMinutes',
|
||||
'feasibilityReport',
|
||||
|
||||
Reference in New Issue
Block a user