Files
yudao-ui-admin-vben/apps/web-antdv-next/src/views/crm/business/detail/index.vue
YunaiV eb9b1c9364 fix(vben): 修复 antdv-next 与 ele 端差异问题
- 修复 pay 收银台二维码展示:ele 使用 useQRCode 渲染协议串二维码,并补齐两端 QR 弹窗打开逻辑
- 修复 ele 端 mp 消息语音、视频播放器组件对调问题
- 修复 ele 端 ERP 库存单据商品、仓库下拉选项不渲染问题
- 修复 ele 端系统菜单组件路径搜索过滤逻辑
- 修复 ele 端 IM 表情包抽屉打开后不加载表情列表问题
- 修复 ele 端文件配置 loading 关闭路径,避免成功或异常后持续转圈
- 修复 ele 端客户公海、合同配置等 CRM 表单文案不可见问题,并保持两端数字校验一致
- 修复 BPM、商城、字典等页面的组件适配和条件判断差异
- 启用 web-antdv-next typecheck 脚本,保持与 web-ele 一致
2026-06-26 17:30:58 -07:00

191 lines
5.8 KiB
Vue

<script setup lang="ts">
import type { CrmBusinessApi } from '#/api/crm/business';
import type { SystemOperateLogApi } from '#/api/system/operate-log';
import { onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { Page, useVbenModal } from '@vben/common-ui';
import { useTabs } from '@vben/hooks';
import { Card, TabPane, Tabs } from 'antdv-next';
import { getBusiness } from '#/api/crm/business';
import { getOperateLogPage } from '#/api/crm/operateLog';
import { BizTypeEnum } from '#/api/crm/permission';
import { useDescription } from '#/components/description';
import { OperateLog } from '#/components/operate-log';
import { ACTION_ICON, TableAction } from '#/components/table-action';
import { $t } from '#/locales';
import { ContactDetailsList } from '#/views/crm/contact/components';
import { ContractDetailsList } from '#/views/crm/contract/components';
import { FollowUp } from '#/views/crm/followup';
import { PermissionList, TransferForm } from '#/views/crm/permission';
import { ProductDetailsList } from '#/views/crm/product/components';
import Form from '../modules/form.vue';
import { useDetailSchema } from './data';
import BusinessDetailsInfo from './modules/info.vue';
import UpStatusForm from './modules/status-form.vue';
const route = useRoute();
const router = useRouter();
const tabs = useTabs();
const loading = ref(false); // 加载中
const businessId = ref(0); // 商机编号
const business = ref<CrmBusinessApi.Business>({} as CrmBusinessApi.Business); // 商机详情
const logList = ref<SystemOperateLogApi.OperateLog[]>([]);
const permissionListRef = ref<InstanceType<typeof PermissionList>>(); // 团队成员列表 Ref
const [Descriptions] = useDescription({
bordered: false,
column: 4,
schema: useDetailSchema(),
});
const [FormModal, formModalApi] = useVbenModal({
connectedComponent: Form,
destroyOnClose: true,
});
const [TransferModal, transferModalApi] = useVbenModal({
connectedComponent: TransferForm,
destroyOnClose: true,
});
const [UpStatusModal, upStatusModalApi] = useVbenModal({
connectedComponent: UpStatusForm,
destroyOnClose: true,
});
/** 加载详情 */
async function getBusinessDetail() {
loading.value = true;
try {
business.value = await getBusiness(businessId.value);
// 操作日志
const res = await getOperateLogPage({
bizType: BizTypeEnum.CRM_BUSINESS,
bizId: businessId.value,
});
logList.value = res.list;
} finally {
loading.value = false;
}
}
/** 返回列表页 */
function handleBack() {
tabs.closeCurrentTab();
router.push({ name: 'CrmBusiness' });
}
/** 编辑商机 */
function handleEdit() {
formModalApi.setData({ id: businessId.value }).open();
}
/** 转移商机 */
function handleTransfer() {
transferModalApi.setData({ bizType: BizTypeEnum.CRM_BUSINESS }).open();
}
/** 更新商机状态操作 */
async function handleUpdateStatus() {
upStatusModalApi.setData(business.value).open();
}
/** 加载数据 */
onMounted(() => {
businessId.value = Number(route.params.id);
getBusinessDetail();
});
</script>
<template>
<Page auto-content-height :title="business?.name" :loading="loading">
<FormModal @success="getBusinessDetail" />
<TransferModal @success="getBusinessDetail" />
<UpStatusModal @success="getBusinessDetail" />
<template #extra>
<TableAction
:actions="[
{
label: '返回',
type: 'default',
icon: 'lucide:arrow-left',
onClick: handleBack,
},
{
label: $t('ui.actionTitle.edit'),
type: 'primary',
icon: ACTION_ICON.EDIT,
auth: ['crm:business:update'],
ifShow: permissionListRef?.validateWrite,
onClick: handleEdit,
},
{
label: '变更商机状态',
type: 'primary',
ifShow: permissionListRef?.validateWrite,
onClick: handleUpdateStatus,
},
{
label: '转移',
type: 'primary',
ifShow: permissionListRef?.validateOwnerUser,
onClick: handleTransfer,
},
]"
/>
</template>
<Card class="min-h-[10%]">
<Descriptions :data="business" />
</Card>
<Card class="mt-4 min-h-[60%]">
<Tabs>
<TabPane tab="跟进记录" key="1" :force-render="true">
<FollowUp :biz-id="businessId" :biz-type="BizTypeEnum.CRM_BUSINESS" />
</TabPane>
<TabPane tab="详细资料" key="2" :force-render="true">
<BusinessDetailsInfo :business="business" />
</TabPane>
<TabPane tab="联系人" key="3" :force-render="true">
<ContactDetailsList
:biz-id="businessId"
:biz-type="BizTypeEnum.CRM_BUSINESS"
:business-id="businessId"
:customer-id="business.customerId"
/>
</TabPane>
<TabPane tab="产品" key="4" :force-render="true">
<ProductDetailsList
:biz-id="businessId"
:biz-type="BizTypeEnum.CRM_BUSINESS"
:business="business"
/>
</TabPane>
<TabPane tab="合同" key="5" :force-render="true">
<ContractDetailsList
:biz-id="businessId"
:biz-type="BizTypeEnum.CRM_BUSINESS"
/>
</TabPane>
<TabPane tab="操作日志" key="6" :force-render="true">
<OperateLog :log-list="logList" />
</TabPane>
<TabPane tab="团队成员" key="7" :force-render="true">
<PermissionList
ref="permissionListRef"
:biz-id="businessId"
:biz-type="BizTypeEnum.CRM_BUSINESS"
:show-action="true"
@quit-team="handleBack"
/>
</TabPane>
</Tabs>
</Card>
</Page>
</template>