|
|
@@ -139,6 +139,13 @@
|
|
|
<el-link type="primary" @click="handleView(scope.row)">{{ scope.row.quoteTitle }}</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column v-if="isColumnVisible('quoteType')" label="报价类型" align="center" prop="quoteType" width="110">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tag :type="getQuoteTypeTag(scope.row.quoteType)">
|
|
|
+ {{ getQuoteTypeLabel(scope.row.quoteType) }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
v-if="isColumnVisible('customerName')"
|
|
|
label="客户名称"
|
|
|
@@ -490,6 +497,11 @@
|
|
|
<el-descriptions :column="2" border>
|
|
|
<el-descriptions-item label="报价单号">{{ detailQuote?.quoteNo }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="报价单标题">{{ detailQuote?.quoteTitle }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="报价类型">
|
|
|
+ <el-tag :type="getQuoteTypeTag(detailQuote?.quoteType)">
|
|
|
+ {{ getQuoteTypeLabel(detailQuote?.quoteType) }}
|
|
|
+ </el-tag>
|
|
|
+ </el-descriptions-item>
|
|
|
<el-descriptions-item label="客户名称">
|
|
|
<el-link type="primary" @click="handleDetailViewCustomer">{{ detailQuote?.customerName }}</el-link>
|
|
|
</el-descriptions-item>
|
|
|
@@ -827,11 +839,31 @@ const userStore = useUserStore();
|
|
|
// 字典数据
|
|
|
const { crm_quote_status, crm_product_unit } = toRefs<any>(proxy!.useDict('crm_quote_status', 'crm_product_unit'));
|
|
|
|
|
|
+const quoteTypeMap: Record<string, { label: string; tag: 'success' | 'warning' }> = {
|
|
|
+ sales: { label: '销售', tag: 'success' },
|
|
|
+ purchase: { label: '采购', tag: 'warning' }
|
|
|
+};
|
|
|
+
|
|
|
+const getQuoteTypeLabel = (type?: string) => {
|
|
|
+ if (!type) {
|
|
|
+ return quoteTypeMap.sales.label;
|
|
|
+ }
|
|
|
+ return quoteTypeMap[type]?.label || quoteTypeMap.sales.label;
|
|
|
+};
|
|
|
+
|
|
|
+const getQuoteTypeTag = (type?: string) => {
|
|
|
+ if (!type) {
|
|
|
+ return quoteTypeMap.sales.tag;
|
|
|
+ }
|
|
|
+ return quoteTypeMap[type]?.tag || quoteTypeMap.sales.tag;
|
|
|
+};
|
|
|
+
|
|
|
// 列配置相关
|
|
|
const COLUMN_STORAGE_KEY = 'crm_quote_visible_columns';
|
|
|
|
|
|
// 定义所有列配置(顺序代表显示顺序)
|
|
|
const tableColumns = ref([
|
|
|
+ { prop: 'quoteType', label: '报价类型', fixed: false },
|
|
|
{ prop: 'customerName', label: '客户名称', fixed: false },
|
|
|
{ prop: 'opportunityName', label: '商机名称', fixed: false },
|
|
|
{ prop: 'contactName', label: '联系人', fixed: false },
|
|
|
@@ -861,7 +893,7 @@ const tableColumns = ref([
|
|
|
]);
|
|
|
|
|
|
// 默认显示的列(现有字段)
|
|
|
-const defaultVisibleColumns = ['customerName', 'finalAmount', 'status', 'validityDays', 'ownerUserName', 'quoteDate', 'createTime'];
|
|
|
+const defaultVisibleColumns = ['quoteType', 'customerName', 'finalAmount', 'status', 'validityDays', 'ownerUserName', 'quoteDate', 'createTime'];
|
|
|
|
|
|
// 当前显示的列
|
|
|
const visibleColumns = ref<string[]>([]);
|
|
|
@@ -1575,10 +1607,30 @@ const generateQuoteTemplate = (quote: QuoteVO, supplierInfo?: SupplierInfoVO): s
|
|
|
const supplierShortName = supplierInfo?.shortName || quote.supplierShortName || '';
|
|
|
const supplierName = supplierInfo?.supplierName || quote.supplierName || '安庆市山峡化工有限公司';
|
|
|
|
|
|
+ const quoteType = (quote.quoteType as string) || 'sales';
|
|
|
+ const isPurchaseQuote = quoteType === 'purchase';
|
|
|
+ const quoteTypeLabel = isPurchaseQuote ? '采购' : '销售';
|
|
|
+
|
|
|
+ const customerName = quote.customerName || '';
|
|
|
+ const customerContactName = quote.contactName || '';
|
|
|
+ const customerContactPhone = quote.contactMobile || '';
|
|
|
+ const supplierContactName = quote.ownerUserName || '';
|
|
|
+ const supplierContactPhone = (quote as any).ownerUserMobile || '';
|
|
|
+
|
|
|
+ const demandName = isPurchaseQuote ? supplierName : customerName;
|
|
|
+ const supplyName = isPurchaseQuote ? customerName : supplierName;
|
|
|
+ const demandContactDisplay = addSpaceBetweenChars(
|
|
|
+ isPurchaseQuote ? supplierContactName : customerContactName
|
|
|
+ );
|
|
|
+ const supplyContactDisplayName = addSpaceBetweenChars(
|
|
|
+ isPurchaseQuote ? customerContactName : supplierContactName
|
|
|
+ );
|
|
|
+ const supplyContactPhone = isPurchaseQuote ? customerContactPhone : supplierContactPhone;
|
|
|
+
|
|
|
// 根据供应商编码决定是否显示Logo和背景图片
|
|
|
const showLogo = supplierCode === 'SX';
|
|
|
- // 根据供应商编码决定标题
|
|
|
- const quoteTitle = supplierCode === 'SX' ? '山峡销售报价单' : `${supplierShortName || supplierName}销售报价单`;
|
|
|
+ const brandName = showLogo ? '山峡' : (supplierShortName || supplierName || '山峡');
|
|
|
+ const quoteTitle = `${brandName}${quoteTypeLabel}报价单`;
|
|
|
// 根据供应商编码选择印章图片
|
|
|
const sealImg = supplierCode === 'SX' ? yzImg : supplierCode === 'YD' ? ydImg : null;
|
|
|
|
|
|
@@ -1628,12 +1680,14 @@ const generateQuoteTemplate = (quote: QuoteVO, supplierInfo?: SupplierInfoVO): s
|
|
|
<div style="flex: 1; text-align: left;">编 号: ${quote.quoteNo}</div>
|
|
|
</div>
|
|
|
<div style="display: flex; justify-content: space-between; margin-bottom: 3px;">
|
|
|
- <div style="flex: 1; text-align: left;">需 方: ${quote.customerName}</div>
|
|
|
- <div style="flex: 1; text-align: left;">供 方: ${supplierName}</div>
|
|
|
+ <div style="flex: 1; text-align: left;">需 方: ${demandName}</div>
|
|
|
+ <div style="flex: 1; text-align: left;">供 方: ${supplyName}</div>
|
|
|
</div>
|
|
|
<div style="display: flex; justify-content: space-between;">
|
|
|
- <div style="flex: 1; text-align: left;">联系人: ${addSpaceBetweenChars(quote.contactName || '')}</div>
|
|
|
- <div style="flex: 1; text-align: left;">联系人: ${addSpaceBetweenChars(quote.ownerUserName || '')} / ${(quote as any).ownerUserMobile || ''}</div>
|
|
|
+ <div style="flex: 1; text-align: left;">联系人: ${demandContactDisplay}</div>
|
|
|
+ <div style="flex: 1; text-align: left;">
|
|
|
+ 联系人: ${supplyContactDisplayName}${supplyContactPhone ? ` / ${supplyContactPhone}` : ''}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -1734,6 +1788,9 @@ const handleGenerateQuote = async (row?: QuoteVO) => {
|
|
|
// 获取完整的报价单详情(包含产品列表)
|
|
|
const res = await getQuote(id);
|
|
|
const quoteDetail = res.data;
|
|
|
+ if (!quoteDetail.quoteType) {
|
|
|
+ quoteDetail.quoteType = 'sales';
|
|
|
+ }
|
|
|
|
|
|
console.log('报价单详情数据:', quoteDetail);
|
|
|
|
|
|
@@ -2065,6 +2122,9 @@ const getDetailForDrawer = async () => {
|
|
|
try {
|
|
|
const res = await getQuote(currentDetailId.value);
|
|
|
detailQuote.value = res.data;
|
|
|
+ if (detailQuote.value && !detailQuote.value.quoteType) {
|
|
|
+ detailQuote.value.quoteType = 'sales';
|
|
|
+ }
|
|
|
|
|
|
// 加载附件信息
|
|
|
if (detailQuote.value?.attachments) {
|