diff --git a/src/api/oa/crm/crmQuoteInfo/types.ts b/src/api/oa/crm/crmQuoteInfo/types.ts index 8dc0a25..6252b8d 100644 --- a/src/api/oa/crm/crmQuoteInfo/types.ts +++ b/src/api/oa/crm/crmQuoteInfo/types.ts @@ -69,6 +69,11 @@ export interface CrmQuoteInfoVO { */ deliveryPeriod: number; + /** + * 质保期 + */ + warrantyPeriod: number; + /** * 交付/交货方式 */ @@ -114,6 +119,11 @@ export interface CrmQuoteInfoVO { */ totalIncludingTax: number; + /** + * 客户ID + */ + customerId: string | number; + /** * 客户方联系人ID */ @@ -272,6 +282,11 @@ export interface CrmQuoteInfoForm extends BaseEntity { */ deliveryPeriod?: number; + /** + * 质保期 + */ + warrantyPeriod?: number; + /** * 交付/交货方式 */ @@ -317,6 +332,16 @@ export interface CrmQuoteInfoForm extends BaseEntity { */ totalIncludingTax?: number; + /** + * 客户ID + */ + customerId?: string | number; + + /** + * 客户名称 + */ + customerName?: string; + /** * 客户方联系人ID */ @@ -480,6 +505,11 @@ export interface CrmQuoteInfoQuery extends PageQuery { */ deliveryPeriod?: number; + /** + * 质保期 + */ + warrantyPeriod?: number; + /** * 交付/交货方式 */ @@ -525,6 +555,16 @@ export interface CrmQuoteInfoQuery extends PageQuery { */ totalIncludingTax?: number; + /** + * 客户ID + */ + customerId?: string | number; + + /** + * 客户名称 + */ + customerName?: string; + /** * 客户方联系人ID */ diff --git a/src/views/oa/crm/crmQuoteInfo/edit.vue b/src/views/oa/crm/crmQuoteInfo/edit.vue index 4b59702..f45b41e 100644 --- a/src/views/oa/crm/crmQuoteInfo/edit.vue +++ b/src/views/oa/crm/crmQuoteInfo/edit.vue @@ -101,6 +101,11 @@ + + + + + @@ -109,7 +114,7 @@ - + @@ -176,7 +181,7 @@ @@ -211,13 +216,6 @@ - - - - 上传附件 -
支持格式:.rar .zip .doc .docx .pdf,单个文件不超过20MB
-
-
@@ -343,19 +341,27 @@ 客户方信息 + + + + + + + @@ -488,6 +494,7 @@ import { addCrmQuoteInfo, getCrmQuoteInfo, quoteSubmitAndFlowStart, updateCrmQuo import { CrmQuoteInfoForm } from '@/api/oa/crm/crmQuoteInfo/types'; import type { CrmQuoteMaterialForm } from '@/api/oa/crm/crmQuoteMaterial/types'; import { getCrmCustomerContactList } from '@/api/oa/crm/customerContact'; +import { getCrmCustomerInfoList } from '@/api/oa/crm/customerInfo'; import { getCrmSupplierInfoList } from '@/api/oa/crm/crmSupplierInfo'; import { getBaseUnitInfoList } from '@/api/oa/base/unitInfo'; import { getBasePrintTemplateList } from '@/api/oa/base/printTemplate'; @@ -498,8 +505,8 @@ import SubmitVerify from '@/components/Process/submitVerify.vue'; import { FlowCodeEnum } from '@/enums/OAEnum'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; -const { business_direction, currency_type, quote_category, contract_type, material_flag, wf_business_status, payment_method } = toRefs( - proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'contract_type', 'material_flag', 'wf_business_status', 'payment_method') +const { business_direction, currency_type, quote_category, contract_type, material_flag, wf_business_status } = toRefs( + proxy?.useDict('business_direction', 'currency_type', 'quote_category', 'contract_type', 'material_flag', 'wf_business_status') ); const router = useRouter(); @@ -530,11 +537,14 @@ const form = reactive({ validFrom: undefined, validTo: undefined, deliveryPeriod: undefined, + warrantyPeriod: undefined, deliveryMethod: undefined, paymentMethod: undefined, currencyType: undefined, taxIncludedInfo: undefined, taxRate: undefined, + customerId: undefined, + customerName: undefined, customerContactId: undefined, customerContactName: undefined, customerContactPhone: undefined, @@ -550,14 +560,27 @@ const form = reactive({ const rules = { quoteName: [{ required: true, message: '报价单名称不能为空', trigger: 'blur' }], - customerContactId: [{ required: true, message: '请选择客户联系人', trigger: 'change' }] + customerId: [{ required: true, message: '请选择客户名称', trigger: 'change' }] }; // 下拉数据 +const customerList = ref([]); const customerContactList = ref([]); const supplierList = ref([]); const printTemplateList = ref([]); const DEFAULT_SUPPLIER_ID = 1; +const filteredCustomerContactList = computed(() => { + if (!form.customerId) { + return customerContactList.value; + } + return customerContactList.value.filter((item: any) => String(item.customerId) === String(form.customerId)); +}); +const paymentMethodOptions = ['电汇', '银行承兑(6个月内)', '电汇/银行承兑(6个月内)', '商业承兑']; + +const setQuoteDateToday = () => { + const d = new Date(); + form.quoteDate = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')} 00:00:00`; +}; // 单位下拉数据 const unitInfoList = ref([]); @@ -849,10 +872,26 @@ const onIncludingPriceChange = (row: any, val: number) => { // 选中联系人后,自动带出姓名、电话、邮箱(可编辑,不影响再次选择) const onCustomerContactChanged = (id: any) => { const c = customerContactList.value.find((x: any) => x.contactId === id); + if (c?.customerId) { + form.customerId = c.customerId; + form.customerName = c.customerName || form.customerName; + } form.customerContactName = c?.contactName || ''; form.customerContactPhone = c?.phoneNumber || ''; form.customerContactEmail = c?.email || ''; }; +const onCustomerChanged = (customerId: any) => { + const customer = customerList.value.find((item: any) => String(item.customerId) === String(customerId)); + form.customerName = customer?.customerName || ''; + const currentContact = customerContactList.value.find((item: any) => item.contactId === form.customerContactId); + if (currentContact && String(currentContact.customerId) === String(customerId)) { + return; + } + form.customerContactId = undefined; + form.customerContactName = ''; + form.customerContactPhone = ''; + form.customerContactEmail = ''; +}; // 供应商选择变化处理 const onSupplierChanged = (supplierId: any) => { const supplier = supplierList.value.find((x: any) => x.supplierId === supplierId); @@ -1000,6 +1039,8 @@ onMounted(async () => { routeParams.value = { ...route.query }; // 下拉数据初始化 + const customerRes = await getCrmCustomerInfoList({}); + customerList.value = customerRes.data || []; const contactRes = await getCrmCustomerContactList({}); customerContactList.value = contactRes.data || []; // 加载供应商列表(计划内供应商) @@ -1016,9 +1057,15 @@ onMounted(async () => { form.quoteId = id as any; const res = await getCrmQuoteInfo(id as any); Object.assign(form, res.data); - console.log('crmQuoteInfo/edit.vue数据加载成功,ossId:', form.ossId); // 添加调试日志 // 编辑模式:已存在编号则禁用生成 isCodeGenerated.value = !!form.quoteCode; + if (!form.customerId && form.customerContactId) { + const currentContact = customerContactList.value.find((item: any) => item.contactId === form.customerContactId); + if (currentContact?.customerId) { + form.customerId = currentContact.customerId; + form.customerName = currentContact.customerName || form.customerName; + } + } // 根据已有联系人ID回填姓名、电话、邮箱(若后端已返回则保持) if (!form.customerContactPhone || !form.customerContactEmail || !form.customerContactName) { onCustomerContactChanged(form.customerContactId); @@ -1057,6 +1104,7 @@ onMounted(async () => { } // 新增模式:如已有编号则禁用生成按钮 if (!id) { + setQuoteDateToday(); applyDefaultSupplier(); isCodeGenerated.value = !!form.quoteCode; } diff --git a/src/views/oa/crm/crmQuoteInfo/index.vue b/src/views/oa/crm/crmQuoteInfo/index.vue index ca87aba..a5ee0c2 100644 --- a/src/views/oa/crm/crmQuoteInfo/index.vue +++ b/src/views/oa/crm/crmQuoteInfo/index.vue @@ -10,131 +10,11 @@ - - - - - - - 搜索 重置 @@ -160,9 +40,6 @@ >删除 - - - - + - - - - - + + + - + - - - - - - + + + + + + - + - + - + - - - - + + + + + - + - - - + + + - +