fix(pipeline): hide prior-only sales paths from current work
The board lists a pipeline in current work only when it has a deal in that period, and keeps archive-only paths for the prior-data view. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -177,7 +177,9 @@ function findAccent(dealId: string): PipelineStage['color'] {
|
||||
}
|
||||
|
||||
async function loadPipelines() {
|
||||
const { data } = await api.get<PipelineDto[]>('/pipelines');
|
||||
const { data } = await api.get<PipelineDto[]>('/pipelines', {
|
||||
params: { forLens: '1' },
|
||||
});
|
||||
pipelines.value = data;
|
||||
}
|
||||
|
||||
@@ -186,16 +188,23 @@ async function load() {
|
||||
error.value = '';
|
||||
try {
|
||||
await loadPipelines();
|
||||
const pipelineId =
|
||||
typeof route.query.pipelineId === 'string'
|
||||
? route.query.pipelineId
|
||||
: undefined;
|
||||
const requested =
|
||||
typeof route.query.pipelineId === 'string' ? route.query.pipelineId : '';
|
||||
const pipelineId = pipelines.value.some((item) => item.id === requested)
|
||||
? requested
|
||||
: pipelines.value[0]?.id;
|
||||
if (!pipelineId) {
|
||||
boardPipelineId.value = '';
|
||||
stages.value = [];
|
||||
if (requested) await router.replace({ name: 'pipeline', query: {} });
|
||||
return;
|
||||
}
|
||||
const { data } = await api.get<PipelineBoardDto>('/pipelines/board', {
|
||||
params: pipelineId ? { pipelineId } : undefined,
|
||||
params: { pipelineId },
|
||||
});
|
||||
boardPipelineId.value = data.pipeline.id;
|
||||
stages.value = mapBoardToStages(data, formatDealDate);
|
||||
if (!pipelineId || pipelineId !== data.pipeline.id) {
|
||||
if (requested !== data.pipeline.id) {
|
||||
await router.replace({
|
||||
name: 'pipeline',
|
||||
query: { pipelineId: data.pipeline.id },
|
||||
|
||||
Reference in New Issue
Block a user