Merge branch 'dev' of https://gitee.com/yudaocode/yudao-ui-admin-vben into dev
This commit is contained in:
@@ -18,7 +18,7 @@ const routes: RouteRecordRaw[] = [
|
||||
title: '线索详情',
|
||||
activePath: '/crm/clue',
|
||||
},
|
||||
component: () => import('#/views/crm/clue/modules/detail.vue'),
|
||||
component: () => import('#/views/crm/clue/detail/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'customer/detail/:id',
|
||||
|
||||
@@ -140,6 +140,7 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||
{ label: '已转化', value: true },
|
||||
],
|
||||
},
|
||||
defaultValue: false,
|
||||
},
|
||||
{
|
||||
fieldName: 'mobile',
|
||||
@@ -170,7 +171,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
field: 'name',
|
||||
title: '线索名称',
|
||||
fixed: 'left',
|
||||
minWidth: 240,
|
||||
minWidth: 160,
|
||||
slots: {
|
||||
default: 'name',
|
||||
},
|
||||
@@ -178,7 +179,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'source',
|
||||
title: '线索来源',
|
||||
minWidth: 120,
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_CUSTOMER_SOURCE },
|
||||
@@ -192,22 +193,22 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'telephone',
|
||||
title: '电话',
|
||||
minWidth: 120,
|
||||
minWidth: 130,
|
||||
},
|
||||
{
|
||||
field: 'email',
|
||||
title: '邮箱',
|
||||
minWidth: 120,
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'detailAddress',
|
||||
title: '地址',
|
||||
minWidth: 120,
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'industryId',
|
||||
title: '客户行业',
|
||||
minWidth: 120,
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_CUSTOMER_INDUSTRY },
|
||||
@@ -216,34 +217,44 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
{
|
||||
field: 'level',
|
||||
title: '客户级别',
|
||||
minWidth: 120,
|
||||
minWidth: 135,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_CUSTOMER_LEVEL },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'ownerUserName',
|
||||
title: '负责人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'ownerUserDeptName',
|
||||
title: '所属部门',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'contactNextTime',
|
||||
title: '下次联系时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'contactLastTime',
|
||||
title: '最后跟进时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'contactLastContent',
|
||||
title: '最后跟进记录',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'ownerUserName',
|
||||
title: '负责人',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'ownerUserDeptName',
|
||||
title: '所属部门',
|
||||
minWidth: 100,
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
@@ -254,12 +265,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
title: '创建人',
|
||||
minWidth: 120,
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
|
||||
@@ -66,7 +66,11 @@ export function useDetailBaseSchema(): DescriptionItemSchema[] {
|
||||
{
|
||||
field: 'areaName',
|
||||
label: '地址',
|
||||
content: (data) => data?.areaName + data?.detailAddress,
|
||||
content: (data) => {
|
||||
const areaName = data.areaName ?? '';
|
||||
const detailAddress = data?.detailAddress ?? '';
|
||||
return [areaName, detailAddress].filter((item) => !!item).join(' ');
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'qq',
|
||||
@@ -7,7 +7,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { confirm, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { useTabs } from '@vben/hooks';
|
||||
import { ArrowLeft } from '@vben/icons';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, Card, message, Tabs } from 'ant-design-vue';
|
||||
|
||||
@@ -15,14 +15,15 @@ import { getClue, transformClue } from '#/api/crm/clue';
|
||||
import { getOperateLogPage } from '#/api/crm/operateLog';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
import { useDescription } from '#/components/description';
|
||||
// TODO @芋艿:要不要 AsyncOperateLog 风格?
|
||||
import { AsyncOperateLog } from '#/components/operate-log';
|
||||
import { FollowUp } from '#/views/crm/followup';
|
||||
import { PermissionList, TransferForm } from '#/views/crm/permission';
|
||||
|
||||
import { useDetailSchema } from './detail-data';
|
||||
import ClueForm from './form.vue';
|
||||
import ClueForm from '../modules/form.vue';
|
||||
import { useDetailSchema } from './data';
|
||||
|
||||
const ClueDetailsInfo = defineAsyncComponent(() => import('./detail-info.vue'));
|
||||
const ClueInfo = defineAsyncComponent(() => import('./modules/info.vue'));
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
@@ -30,13 +31,12 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabs = useTabs();
|
||||
|
||||
const clueId = ref(0);
|
||||
|
||||
const clue = ref<CrmClueApi.Clue>({} as CrmClueApi.Clue);
|
||||
const clueLogList = ref<SystemOperateLogApi.OperateLog[]>([]);
|
||||
const clueId = ref(0); // 线索编号
|
||||
const clue = ref<CrmClueApi.Clue>({} as CrmClueApi.Clue); // 线索详情
|
||||
const logList = ref<SystemOperateLogApi.OperateLog[]>([]); // 操作日志
|
||||
const permissionListRef = ref<InstanceType<typeof PermissionList>>(); // 团队成员列表 Ref
|
||||
|
||||
// 校验负责人权限和编辑权限
|
||||
/** 校验负责人权限和编辑权限 */
|
||||
const validateOwnerUser = computed(
|
||||
() => permissionListRef.value?.validateOwnerUser,
|
||||
);
|
||||
@@ -62,17 +62,19 @@ const [TransferModal, transferModalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
/** 加载线索详情 */
|
||||
async function loadClueDetail() {
|
||||
async function getClueDetail() {
|
||||
loading.value = true;
|
||||
const data = await getClue(clueId.value);
|
||||
clue.value = data;
|
||||
// 操作日志
|
||||
const logList = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CLUE,
|
||||
bizId: clueId.value,
|
||||
});
|
||||
clueLogList.value = logList.list;
|
||||
loading.value = false;
|
||||
try {
|
||||
clue.value = await getClue(clueId.value);
|
||||
// 操作日志
|
||||
const res = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_CLUE,
|
||||
bizId: clueId.value,
|
||||
});
|
||||
logList.value = res.list;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 返回列表页 */
|
||||
@@ -100,7 +102,6 @@ async function handleTransform(): Promise<boolean | undefined> {
|
||||
.then(async () => {
|
||||
const res = await transformClue(clueId.value);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
message.success('转化客户成功');
|
||||
resolve(true);
|
||||
} else {
|
||||
@@ -113,21 +114,21 @@ async function handleTransform(): Promise<boolean | undefined> {
|
||||
});
|
||||
}
|
||||
|
||||
// 加载数据
|
||||
/** 加载数据 */
|
||||
onMounted(() => {
|
||||
clueId.value = Number(route.params.id);
|
||||
loadClueDetail();
|
||||
clueId.value = route.params.id as number;
|
||||
getClueDetail();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height :title="clue?.name" :loading="loading">
|
||||
<FormModal @success="loadClueDetail" />
|
||||
<TransferModal @success="loadClueDetail" />
|
||||
<FormModal @success="getClueDetail" />
|
||||
<TransferModal @success="getClueDetail" />
|
||||
<template #extra>
|
||||
<div class="flex items-center gap-2">
|
||||
<Button @click="handleBack">
|
||||
<ArrowLeft class="size-5" />
|
||||
<IconifyIcon icon="lucide:arrow-left" />
|
||||
返回
|
||||
</Button>
|
||||
<Button
|
||||
@@ -154,13 +155,13 @@ onMounted(() => {
|
||||
<Descriptions :data="clue" />
|
||||
</Card>
|
||||
<Card class="mt-4 min-h-[60%]">
|
||||
<Tabs>
|
||||
<Tabs.TabPane tab="详细资料" key="1" :force-render="true">
|
||||
<ClueDetailsInfo :clue="clue" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="线索跟进" key="2" :force-render="true">
|
||||
<Tabs class="tabs-tight" :tab-bar-gutter="16">
|
||||
<Tabs.TabPane tab="跟进记录" key="1" :force-render="true">
|
||||
<FollowUp :biz-id="clueId" :biz-type="BizTypeEnum.CRM_CLUE" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="基本信息" key="2" :force-render="true">
|
||||
<ClueInfo :clue="clue" />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="团队成员" key="3" :force-render="true">
|
||||
<PermissionList
|
||||
ref="permissionListRef"
|
||||
@@ -171,7 +172,7 @@ onMounted(() => {
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane tab="操作日志" key="4" :force-render="true">
|
||||
<AsyncOperateLog :log-list="clueLogList" />
|
||||
<AsyncOperateLog :log-list="logList" />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</Card>
|
||||
@@ -6,10 +6,10 @@ import { Divider } from 'ant-design-vue';
|
||||
import { useDescription } from '#/components/description';
|
||||
import { useFollowUpDetailSchema } from '#/views/crm/followup/data';
|
||||
|
||||
import { useDetailBaseSchema } from './detail-data';
|
||||
import { useDetailBaseSchema } from '../data';
|
||||
|
||||
defineProps<{
|
||||
clue: CrmClueApi.Clue; // 线索信息
|
||||
clue: CrmClueApi.Clue;
|
||||
}>();
|
||||
|
||||
const [BaseDescriptions] = useDescription({
|
||||
@@ -34,6 +34,7 @@ const [SystemDescriptions] = useDescription({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- TODO @芋艿:为什么 p-4? -->
|
||||
<div class="p-4">
|
||||
<BaseDescriptions :data="clue" />
|
||||
<Divider />
|
||||
@@ -2,12 +2,13 @@
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmClueApi } from '#/api/crm/clue';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { Button, message } from 'ant-design-vue';
|
||||
import { Button, message, Tabs } from 'ant-design-vue';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { deleteClue, exportClue, getCluePage } from '#/api/crm/clue';
|
||||
@@ -17,6 +18,7 @@ import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const { push } = useRouter();
|
||||
const sceneType = ref('1');
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
@@ -24,10 +26,19 @@ const [FormModal, formModalApi] = useVbenModal({
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function onRefresh() {
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportClue({
|
||||
sceneType: sceneType.value,
|
||||
...(await gridApi.formApi.getValues()),
|
||||
});
|
||||
downloadFileFromBlobPart({ fileName: '线索.xls', source: data });
|
||||
}
|
||||
|
||||
/** 创建线索 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
@@ -46,26 +57,24 @@ async function handleDelete(row: CrmClueApi.Clue) {
|
||||
});
|
||||
try {
|
||||
await deleteClue(row.id as number);
|
||||
message.success({
|
||||
content: $t('ui.actionMessage.deleteSuccess', [row.name]),
|
||||
});
|
||||
onRefresh();
|
||||
message.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} catch {
|
||||
hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportClue(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '线索.xls', source: data });
|
||||
}
|
||||
|
||||
/** 查看线索详情 */
|
||||
function handleDetail(row: CrmClueApi.Clue) {
|
||||
push({ name: 'CrmClueDetail', params: { id: row.id } });
|
||||
}
|
||||
|
||||
/** 处理场景类型的切换 */
|
||||
function handleChangeSceneType(key: number | string) {
|
||||
sceneType.value = key.toString();
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
@@ -80,6 +89,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
return await getCluePage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
sceneType: sceneType.value,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
@@ -87,6 +97,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
@@ -109,8 +120,15 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
/>
|
||||
</template>
|
||||
|
||||
<FormModal @success="onRefresh" />
|
||||
<Grid table-title="线索列表">
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid>
|
||||
<template #top>
|
||||
<Tabs class="-mt-11" @change="handleChangeSceneType">
|
||||
<Tabs.TabPane tab="我负责的" key="1" />
|
||||
<Tabs.TabPane tab="我参与的" key="2" />
|
||||
<Tabs.TabPane tab="下属负责的" key="3" />
|
||||
</Tabs>
|
||||
</template>
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
@@ -163,3 +181,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
<style scoped>
|
||||
:deep(.vxe-toolbar div) {
|
||||
z-index: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -28,7 +28,6 @@ const [Form, formApi] = useVbenForm({
|
||||
},
|
||||
labelWidth: 100,
|
||||
},
|
||||
// 一共3列
|
||||
wrapperClass: 'grid-cols-2',
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
|
||||
Reference in New Issue
Block a user