feat(web): add Ant workspace tabs and harden page chrome

Persist workspace tabs in the app shell with Ant Design styling aligned to the desktop top bar, and fix tab bar layout flicker on select. Add shared PageHeader components, query helpers, and missing header state across CRM views; improve mobile shell layout and Vite HMR stability on Windows.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-25 16:53:04 +03:30
co-authored by Cursor
parent 1992474273
commit cc68b2d9f3
86 changed files with 5446 additions and 3885 deletions
+34 -112
View File
@@ -568,59 +568,33 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
<template>
<a-row :gutter="[24, 24]">
<a-col :span="24">
<a-flex justify="space-between" align="center" wrap="wrap" :gap="token.marginSM">
<a-space :size="12" align="start">
<a-button aria-label="بازگشت" @click="goBack">
<template #icon><ArrowLeftOutlined /></template>
</a-button>
<div>
<a-typography-title :level="3" :style="{ margin: 0 }">
{{ lead?.title || 'جزئیات لید' }}
</a-typography-title>
<a-typography-text type="secondary">
{{ lead ? `موبایل ${lead.mobile}` : 'در حال بارگذاری…' }}
</a-typography-text>
</div>
</a-space>
<a-space v-if="lead" :size="8" wrap>
<a-button
v-if="!editing"
:disabled="busy || !lead.mobile"
@click="smsOpen = true"
>
<PageHeader
:title="lead?.title || 'جزئیات لید'"
:subtitle="lead ? `موبایل ${lead.mobile}` : 'در حال بارگذاری…'"
:icon="UserAddOutlined"
:back-to="{ name: 'leads-board' }"
:primary-label="lead && !lead.convertedPersonId ? 'تبدیل به مشتری' : undefined"
:primary-icon="UserAddOutlined"
:primary-disabled="busy"
:menu-items="leadMenuItems"
@primary="convertLead"
@menu="onLeadMenu"
>
<template v-if="lead" #actions>
<a-button v-if="!editing" :disabled="busy || !lead.mobile" @click="smsOpen = true">
<template #icon><MessageOutlined /></template>
پیامک
</a-button>
<a-button v-if="!editing && canBehavior" @click="copilotOpen = !copilotOpen">
کمک برای ادامه مذاکره
پیامک
</a-button>
<a-button v-if="!editing" :disabled="busy" @click="startEdit">
<template #icon><EditOutlined /></template>
ویرایش
</a-button>
<a-button
v-if="!lead.convertedPersonId"
type="primary"
:disabled="busy"
@click="convertLead"
>
<template #icon><UserAddOutlined /></template>
تبدیل به مشتری
</a-button>
<a-button
v-if="!lead.archivedAt"
danger
:disabled="busy"
@click="archiveLead"
>
بایگانی
ویرایش
</a-button>
<a-button v-if="narrow" @click="moreOpen = true">
<template #icon><MoreOutlined /></template>
بیشتر
</a-button>
</a-space>
</a-flex>
</template>
</PageHeader>
</a-col>
<a-col v-if="lead && copilotOpen && canBehavior" :span="24">
@@ -734,17 +708,6 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
<a-input v-model:value="editForm.trade" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="12" :md="8">
<a-form-item label="سابقه فعالیت">
<a-select
v-model:value="editForm.activityExperience"
allow-clear
placeholder="اختیاری"
style="width: 100%"
:options="activityExperienceOptions"
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="یادداشت">
<a-textarea
@@ -817,9 +780,6 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
<span dir="ltr">{{ lead.instagram || '—' }}</span>
</a-descriptions-item>
<a-descriptions-item label="صنف">{{ lead.trade || '—' }}</a-descriptions-item>
<a-descriptions-item label="سابقه فعالیت">
{{ shownActivityExperience }}
</a-descriptions-item>
<a-descriptions-item label="منبع">
{{ lead.source || '—' }}
</a-descriptions-item>
@@ -952,7 +912,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
</a-typography-text>
</div>
<a-typography-paragraph v-if="ev.body" type="secondary">
<template v-if="ev.type === 'stage_changed'">دلیل: </template>{{ ev.body }}
{{ ev.body }}
</a-typography-paragraph>
</a-timeline-item>
</a-timeline>
@@ -1022,12 +982,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
/>
</a-form-item>
<a-button
block
:disabled="busy || stageId === lead.stageId"
:loading="busy"
@click="openStageMove"
>
<a-button block :disabled="busy" :loading="busy" @click="changeStage">
اعمال وضعیت
</a-button>
@@ -1173,13 +1128,7 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
:options="stages.map((s) => ({ value: s.id, label: s.name }))"
/>
</a-form-item>
<a-button
block
:disabled="busy || stageId === lead.stageId"
@click="openStageMove"
>
اعمال وضعیت
</a-button>
<a-button block :disabled="busy" @click="changeStage">اعمال وضعیت</a-button>
<template v-if="canAssignOthers">
<a-divider orientation="right">تخصیص کارشناس</a-divider>
@@ -1267,47 +1216,20 @@ onBeforeUnmount(() => narrowMq?.removeEventListener('change', syncNarrow));
</a-button>
</a-form>
</a-drawer>
</template>
<SmsComposeModal
:open="smsOpen"
title="ارسال پیامک"
:endpoint="`/leads/${lead.id}/sms`"
:history-endpoint="`/leads/${lead.id}/sms-history`"
:name="lead.contactName || lead.title"
:phone="lead.mobile || lead.phone || ''"
:record-title="lead.title"
:company="lead.trade ?? ''"
@close="smsOpen = false"
/>
</template>
</a-spin>
</a-col>
</a-row>
<a-modal
v-model:open="stageMoveOpen"
title="دلیل تغییر وضعیت"
ok-text="ثبت و انتقال"
cancel-text="انصراف"
destroy-on-close
:confirm-loading="busy"
:ok-button-props="{ disabled: !stageMoveReason.trim() }"
@ok="changeStage"
@cancel="cancelStageMove"
>
<a-flex vertical :gap="12">
<a-typography-text type="secondary">
انتقال از «{{ lead?.stageName || '—' }}» به «{{ stages.find((s) => s.id === stageId)?.name || '—' }}»
</a-typography-text>
<a-textarea
v-model:value="stageMoveReason"
:rows="4"
:maxlength="1000"
show-count
placeholder="دلیل تغییر وضعیت را بنویسید…"
/>
<a-alert v-if="stageMoveError" type="error" show-icon :message="stageMoveError" />
</a-flex>
</a-modal>
<SmsComposeModal
v-if="lead"
:open="smsOpen"
title="ارسال پیامک"
:endpoint="`/leads/${lead.id}/sms`"
:history-endpoint="`/leads/${lead.id}/sms-history`"
:name="lead.contactName || lead.title"
:phone="lead.mobile || lead.phone || ''"
:record-title="lead.title"
:company="lead.trade ?? ''"
@close="smsOpen = false"
/>
</template>