feat(activities): step through the same desk list from a detail
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import type {
|
||||
ActivityDto,
|
||||
@@ -41,7 +41,7 @@ const emit = defineEmits<{
|
||||
stagesChanged: [];
|
||||
add: [stageId: string];
|
||||
error: [message: string];
|
||||
menuDeal: [activity: ActivityDto];
|
||||
menuDeal: [activity: ActivityDto, stageId?: string];
|
||||
toggleSelect: [activityId: string];
|
||||
bulkDelete: [];
|
||||
}>();
|
||||
@@ -217,7 +217,7 @@ function findActivity(id: string) {
|
||||
|
||||
function onMenuActivity(id: string) {
|
||||
const item = findActivity(id);
|
||||
if (item) emit('menuDeal', item);
|
||||
if (item) emit('menuDeal', item, findStageOf(id));
|
||||
}
|
||||
|
||||
function onDragStart(deal: PipelineDeal, event: DragEvent) {
|
||||
@@ -389,14 +389,26 @@ async function onAddStage(name: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
function openActivity(id: string) {
|
||||
const query: Record<string, string> = {};
|
||||
for (const key of ['board', 'view', 'desk', 'filter', 'stage', 'q', 'typeDefId', 'status', 'assigneeId', 'title', 'customer', 'due']) {
|
||||
const value = route.query[key];
|
||||
if (typeof value === 'string' && value) query[key] = value;
|
||||
}
|
||||
const query: Record<string, string> = {
|
||||
from: 'desk',
|
||||
nav: crypto.randomUUID(),
|
||||
view: 'board',
|
||||
};
|
||||
const source = props.params;
|
||||
if (source.filter) query.filter = source.filter;
|
||||
if (source.boardId) query.board = source.boardId;
|
||||
if (source.desk) query.desk = source.desk;
|
||||
if (source.q) query.q = source.q;
|
||||
if (source.typeDefId) query.typeDefId = source.typeDefId;
|
||||
else if (source.type) query.type = source.type;
|
||||
if (source.status) query.status = source.status;
|
||||
if (source.assigneeId) query.assigneeId = source.assigneeId;
|
||||
if (source.title) query.title = source.title;
|
||||
if (source.customer) query.customer = source.customer;
|
||||
if (source.due) query.due = source.due;
|
||||
const columnId = findStageOf(id);
|
||||
if (columnId) query.stage = columnId;
|
||||
void router.push({ name: 'activity-detail', params: { id }, query });
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user