mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vben.git
synced 2025-12-30 10:32:25 +00:00
feat:【ele】【crm】初始化界面
This commit is contained in:
3
apps/web-ele/src/components/operate-log/index.ts
Normal file
3
apps/web-ele/src/components/operate-log/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as OperateLog } from './operate-log.vue';
|
||||
|
||||
export type { OperateLogProps } from './typing';
|
||||
50
apps/web-ele/src/components/operate-log/operate-log.vue
Normal file
50
apps/web-ele/src/components/operate-log/operate-log.vue
Normal file
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import type { OperateLogProps } from './typing';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictLabel, getDictObj } from '@vben/hooks';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { ElTag, ElTimeline, ElTimelineItem } from 'element-plus';
|
||||
|
||||
defineOptions({ name: 'OperateLogV2' });
|
||||
|
||||
withDefaults(defineProps<OperateLogProps>(), {
|
||||
logList: () => [],
|
||||
});
|
||||
|
||||
function getUserTypeColor(userType: number) {
|
||||
const dict = getDictObj(DICT_TYPE.USER_TYPE, userType);
|
||||
if (dict && dict.colorType) {
|
||||
return `hsl(var(--${dict.colorType}))`;
|
||||
}
|
||||
return 'hsl(var(--primary))';
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
<ElTimeline>
|
||||
<ElTimelineItem
|
||||
v-for="log in logList"
|
||||
:key="log.id"
|
||||
:color="getUserTypeColor(log.userType)"
|
||||
>
|
||||
<template #dot>
|
||||
<p
|
||||
:style="{ backgroundColor: getUserTypeColor(log.userType) }"
|
||||
class="absolute left-1 top-0 flex h-5 w-5 items-center justify-center rounded-full text-xs text-white"
|
||||
>
|
||||
{{ getDictLabel(DICT_TYPE.USER_TYPE, log.userType)[0] }}
|
||||
</p>
|
||||
</template>
|
||||
<p class="ml-2">{{ formatDateTime(log.createTime) }}</p>
|
||||
<p class="ml-2 mt-2">
|
||||
<ElTag :color="getUserTypeColor(log.userType)">
|
||||
{{ log.userName }}
|
||||
</ElTag>
|
||||
{{ log.action }}
|
||||
</p>
|
||||
</ElTimelineItem>
|
||||
</ElTimeline>
|
||||
</div>
|
||||
</template>
|
||||
5
apps/web-ele/src/components/operate-log/typing.ts
Normal file
5
apps/web-ele/src/components/operate-log/typing.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
|
||||
export interface OperateLogProps {
|
||||
logList: SystemOperateLogApi.OperateLog[]; // 操作日志列表
|
||||
}
|
||||
90
apps/web-ele/src/router/routes/modules/crm.ts
Normal file
90
apps/web-ele/src/router/routes/modules/crm.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/crm',
|
||||
name: 'CrmCenter',
|
||||
meta: {
|
||||
title: '客户管理',
|
||||
icon: 'simple-icons:civicrm',
|
||||
keepAlive: true,
|
||||
hideInMenu: true,
|
||||
},
|
||||
children: [
|
||||
// {
|
||||
// path: 'clue/detail/:id',
|
||||
// name: 'CrmClueDetail',
|
||||
// meta: {
|
||||
// title: '线索详情',
|
||||
// activePath: '/crm/clue',
|
||||
// },
|
||||
// component: () => import('#/views/crm/clue/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'customer/detail/:id',
|
||||
// name: 'CrmCustomerDetail',
|
||||
// meta: {
|
||||
// title: '客户详情',
|
||||
// activePath: '/crm/customer',
|
||||
// },
|
||||
// component: () => import('#/views/crm/customer/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'business/detail/:id',
|
||||
// name: 'CrmBusinessDetail',
|
||||
// meta: {
|
||||
// title: '商机详情',
|
||||
// activePath: '/crm/business',
|
||||
// },
|
||||
// component: () => import('#/views/crm/business/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'contract/detail/:id',
|
||||
// name: 'CrmContractDetail',
|
||||
// meta: {
|
||||
// title: '合同详情',
|
||||
// activePath: '/crm/contract',
|
||||
// },
|
||||
// component: () => import('#/views/crm/contract/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'receivable-plan/detail/:id',
|
||||
// name: 'CrmReceivablePlanDetail',
|
||||
// meta: {
|
||||
// title: '回款计划详情',
|
||||
// activePath: '/crm/receivable-plan',
|
||||
// },
|
||||
// component: () => import('#/views/crm/receivable/plan/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'receivable/detail/:id',
|
||||
// name: 'CrmReceivableDetail',
|
||||
// meta: {
|
||||
// title: '回款详情',
|
||||
// activePath: '/crm/receivable',
|
||||
// },
|
||||
// component: () => import('#/views/crm/receivable/detail/index.vue'),
|
||||
// },
|
||||
// {
|
||||
// path: 'contact/detail/:id',
|
||||
// name: 'CrmContactDetail',
|
||||
// meta: {
|
||||
// title: '联系人详情',
|
||||
// activePath: '/crm/contact',
|
||||
// },
|
||||
// component: () => import('#/views/crm/contact/detail/index.vue'),
|
||||
// },
|
||||
{
|
||||
path: 'product/detail/:id',
|
||||
name: 'CrmProductDetail',
|
||||
meta: {
|
||||
title: '产品详情',
|
||||
activePath: '/crm/product',
|
||||
},
|
||||
component: () => import('#/views/crm/product/detail/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default routes;
|
||||
194
apps/web-ele/src/views/crm/followup/data.ts
Normal file
194
apps/web-ele/src/views/crm/followup/data.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { getBusinessPageByCustomer } from '#/api/crm/business';
|
||||
import { getContactPageByCustomer } from '#/api/crm/contact';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(
|
||||
bizId: Ref<number | undefined>,
|
||||
): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'bizId',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'bizType',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'type',
|
||||
label: '跟进类型',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.CRM_FOLLOW_UP_TYPE, 'number'),
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'nextTime',
|
||||
label: '下次联系时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'x',
|
||||
class: '!w-full',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'content',
|
||||
label: '跟进内容',
|
||||
component: 'Textarea',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'picUrls',
|
||||
label: '图片',
|
||||
component: 'ImageUpload',
|
||||
},
|
||||
{
|
||||
fieldName: 'fileUrls',
|
||||
label: '附件',
|
||||
component: 'FileUpload',
|
||||
},
|
||||
{
|
||||
fieldName: 'contactIds',
|
||||
label: '关联联系人',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
if (!bizId.value) {
|
||||
return [];
|
||||
}
|
||||
const res = await getContactPageByCustomer({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
customerId: bizId.value,
|
||||
});
|
||||
return res.list;
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
mode: 'multiple',
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'businessIds',
|
||||
label: '关联商机',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
if (!bizId.value) {
|
||||
return [];
|
||||
}
|
||||
const res = await getBusinessPageByCustomer({
|
||||
pageNo: 1,
|
||||
pageSize: 100,
|
||||
customerId: bizId.value,
|
||||
});
|
||||
return res.list;
|
||||
},
|
||||
labelField: 'name',
|
||||
valueField: 'id',
|
||||
mode: 'multiple',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(
|
||||
bizType: number,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{ field: 'creatorName', title: '跟进人' },
|
||||
{
|
||||
field: 'type',
|
||||
title: '跟进类型',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_FOLLOW_UP_TYPE },
|
||||
},
|
||||
},
|
||||
{ field: 'content', title: '跟进内容' },
|
||||
{
|
||||
field: 'nextTime',
|
||||
title: '下次联系时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'contacts',
|
||||
title: '关联联系人',
|
||||
visible: bizType === BizTypeEnum.CRM_CUSTOMER,
|
||||
slots: { default: 'contacts' },
|
||||
},
|
||||
{
|
||||
field: 'businesses',
|
||||
title: '关联商机',
|
||||
visible: bizType === BizTypeEnum.CRM_CUSTOMER,
|
||||
slots: { default: 'businesses' },
|
||||
},
|
||||
{
|
||||
field: 'actions',
|
||||
title: '操作',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的系统字段 */
|
||||
export function useFollowUpDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'ownerUserName',
|
||||
label: '负责人',
|
||||
},
|
||||
{
|
||||
field: 'contactLastContent',
|
||||
label: '最后跟进记录',
|
||||
},
|
||||
{
|
||||
field: 'contactLastTime',
|
||||
label: '最后跟进时间',
|
||||
render: (val) => formatDateTime(val) as string,
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
label: '创建人',
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
label: '创建时间',
|
||||
render: (val) => formatDateTime(val) as string,
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
label: '更新时间',
|
||||
render: (val) => formatDateTime(val) as string,
|
||||
},
|
||||
];
|
||||
}
|
||||
1
apps/web-ele/src/views/crm/followup/index.ts
Normal file
1
apps/web-ele/src/views/crm/followup/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as FollowUp } from './index.vue';
|
||||
165
apps/web-ele/src/views/crm/followup/index.vue
Normal file
165
apps/web-ele/src/views/crm/followup/index.vue
Normal file
@@ -0,0 +1,165 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmFollowUpApi } from '#/api/crm/followup';
|
||||
|
||||
import { watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteFollowUpRecord,
|
||||
getFollowUpRecordPage,
|
||||
} from '#/api/crm/followup';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns } from './data';
|
||||
import FollowUpRecordForm from './modules/form.vue';
|
||||
|
||||
/** 跟进记录列表 */
|
||||
defineOptions({ name: 'FollowUpRecord' });
|
||||
|
||||
const props = defineProps<{
|
||||
bizId: number;
|
||||
bizType: number;
|
||||
}>();
|
||||
|
||||
const { push } = useRouter();
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 添加跟进记录 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData({ bizId: props.bizId, bizType: props.bizType }).open();
|
||||
}
|
||||
|
||||
/** 删除跟进记录 */
|
||||
async function handleDelete(row: CrmFollowUpApi.FollowUpRecord) {
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: $t('ui.actionMessage.deleting', [row.id]),
|
||||
});
|
||||
try {
|
||||
await deleteFollowUpRecord(row.id);
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.id]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
loadingInstance.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开联系人详情 */
|
||||
function openContactDetail(id: number) {
|
||||
push({ name: 'CrmContactDetail', params: { id } });
|
||||
}
|
||||
|
||||
/** 打开商机详情 */
|
||||
function openBusinessDetail(id: number) {
|
||||
push({ name: 'CrmBusinessDetail', params: { id } });
|
||||
}
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: FollowUpRecordForm,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
columns: useGridColumns(props.bizType),
|
||||
height: 600,
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
return await getFollowUpRecordPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
bizType: props.bizType,
|
||||
bizId: props.bizId,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
},
|
||||
} as VxeTableGridOptions<CrmFollowUpApi.FollowUpRecord>,
|
||||
});
|
||||
|
||||
/** 监听业务 ID 变化 */
|
||||
watch(
|
||||
() => props.bizId,
|
||||
() => {
|
||||
gridApi.query();
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '写跟进',
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
onClick: handleCreate,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #contacts="{ row }">
|
||||
<ElButton
|
||||
v-for="contact in row.contacts || []"
|
||||
:key="`contact-${contact.id}`"
|
||||
type="primary"
|
||||
link
|
||||
class="ml-2"
|
||||
@click="openContactDetail(contact.id)"
|
||||
>
|
||||
{{ contact.name }}
|
||||
</ElButton>
|
||||
</template>
|
||||
<template #businesses="{ row }">
|
||||
<ElButton
|
||||
v-for="business in row.businesses || []"
|
||||
:key="`business-${business.id}`"
|
||||
type="primary"
|
||||
link
|
||||
class="ml-2"
|
||||
@click="openBusinessDetail(business.id)"
|
||||
>
|
||||
{{ business.name }}
|
||||
</ElButton>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
link: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.id]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</template>
|
||||
81
apps/web-ele/src/views/crm/followup/modules/form.vue
Normal file
81
apps/web-ele/src/views/crm/followup/modules/form.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmFollowUpApi } from '#/api/crm/followup';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createFollowUpRecord } from '#/api/crm/followup';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
const bizId = ref<number>();
|
||||
const bizType = ref<number>();
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 120,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(bizId),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as CrmFollowUpApi.FollowUpRecord;
|
||||
try {
|
||||
await createFollowUpRecord(data);
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<CrmFollowUpApi.FollowUpRecord>();
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
if (data.bizId && data.bizType) {
|
||||
bizId.value = data.bizId;
|
||||
bizType.value = data.bizType;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
// 设置到 values
|
||||
await formApi.setValues(data);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal title="添加跟进记录" class="w-2/5">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
2
apps/web-ele/src/views/crm/permission/index.ts
Normal file
2
apps/web-ele/src/views/crm/permission/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as PermissionList } from './modules/list.vue';
|
||||
export { default as TransferForm } from './modules/transfer-form.vue';
|
||||
233
apps/web-ele/src/views/crm/permission/modules/data.ts
Normal file
233
apps/web-ele/src/views/crm/permission/modules/data.ts
Normal file
@@ -0,0 +1,233 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
|
||||
import { BizTypeEnum, PermissionLevelEnum } from '#/api/crm/permission';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useTransferFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'newOwnerUserId',
|
||||
label: '选择新负责人',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'oldOwnerHandler',
|
||||
label: '老负责人',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '加入团队',
|
||||
value: true,
|
||||
},
|
||||
{
|
||||
label: '移除',
|
||||
value: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'oldOwnerPermissionLevel',
|
||||
label: '老负责人权限级别',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(
|
||||
DICT_TYPE.CRM_PERMISSION_LEVEL,
|
||||
'number',
|
||||
).filter((dict) => dict.value !== PermissionLevelEnum.OWNER),
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['oldOwnerHandler'],
|
||||
show: (values) => values.oldOwnerHandler,
|
||||
trigger(values) {
|
||||
if (!values.oldOwnerHandler) {
|
||||
values.oldOwnerPermissionLevel = undefined;
|
||||
}
|
||||
},
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'toBizTypes',
|
||||
label: '同时转移',
|
||||
component: 'CheckboxGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '联系人',
|
||||
value: BizTypeEnum.CRM_CONTACT,
|
||||
},
|
||||
{
|
||||
label: '商机',
|
||||
value: BizTypeEnum.CRM_BUSINESS,
|
||||
},
|
||||
{
|
||||
label: '合同',
|
||||
value: BizTypeEnum.CRM_CONTRACT,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'bizId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'ids',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'userId',
|
||||
label: '选择人员',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['ids'],
|
||||
show: (values) => {
|
||||
return values.ids === undefined;
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'level',
|
||||
label: '权限级别',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(
|
||||
DICT_TYPE.CRM_PERMISSION_LEVEL,
|
||||
'number',
|
||||
).filter((dict) => dict.value !== PermissionLevelEnum.OWNER),
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
fieldName: 'bizType',
|
||||
label: 'Crm 类型',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '联系人',
|
||||
value: BizTypeEnum.CRM_CONTACT,
|
||||
},
|
||||
{
|
||||
label: '商机',
|
||||
value: BizTypeEnum.CRM_BUSINESS,
|
||||
},
|
||||
{
|
||||
label: '合同',
|
||||
value: BizTypeEnum.CRM_CONTRACT,
|
||||
},
|
||||
],
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'toBizTypes',
|
||||
label: '同时添加至',
|
||||
component: 'CheckboxGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{
|
||||
label: '联系人',
|
||||
value: BizTypeEnum.CRM_CONTACT,
|
||||
},
|
||||
{
|
||||
label: '商机',
|
||||
value: BizTypeEnum.CRM_BUSINESS,
|
||||
},
|
||||
{
|
||||
label: '合同',
|
||||
value: BizTypeEnum.CRM_CONTRACT,
|
||||
},
|
||||
],
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['ids', 'bizType'],
|
||||
show: (values) => {
|
||||
return (
|
||||
values.ids === undefined &&
|
||||
values.bizType === BizTypeEnum.CRM_CUSTOMER
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
type: 'checkbox',
|
||||
width: 50,
|
||||
},
|
||||
{
|
||||
field: 'nickname',
|
||||
title: '姓名',
|
||||
},
|
||||
{
|
||||
field: 'deptName',
|
||||
title: '部门',
|
||||
},
|
||||
{
|
||||
field: 'postNames',
|
||||
title: '岗位',
|
||||
},
|
||||
{
|
||||
field: 'level',
|
||||
title: '权限级别',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_PERMISSION_LEVEL },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '加入时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
];
|
||||
}
|
||||
90
apps/web-ele/src/views/crm/permission/modules/form.vue
Normal file
90
apps/web-ele/src/views/crm/permission/modules/form.vue
Normal file
@@ -0,0 +1,90 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createPermission, updatePermission } from '#/api/crm/permission';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from './data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<CrmPermissionApi.Permission>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.ids
|
||||
? $t('ui.actionTitle.edit', ['团队成员'])
|
||||
: $t('ui.actionTitle.create', ['团队成员']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as CrmPermissionApi.Permission;
|
||||
try {
|
||||
await (formData.value?.ids
|
||||
? updatePermission(data)
|
||||
: createPermission(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData();
|
||||
if (!data || !data.bizType || !data.bizId) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = {
|
||||
ids: data.ids ?? (data.id ? [data.id] : undefined),
|
||||
userId: undefined,
|
||||
bizType: data.bizType,
|
||||
bizId: data.bizId,
|
||||
level: data.level,
|
||||
};
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-2/5" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
265
apps/web-ele/src/views/crm/permission/modules/list.vue
Normal file
265
apps/web-ele/src/views/crm/permission/modules/list.vue
Normal file
@@ -0,0 +1,265 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
import { confirm, useVbenModal } from '@vben/common-ui';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deletePermissionBatch,
|
||||
deleteSelfPermission,
|
||||
getPermissionList,
|
||||
PermissionLevelEnum,
|
||||
} from '#/api/crm/permission';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns } from './data';
|
||||
import Form from './form.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
bizId: number; // 模块数据编号
|
||||
bizType: number; // 模块类型
|
||||
showAction: boolean; // 是否展示操作按钮
|
||||
}>();
|
||||
|
||||
const emits = defineEmits<{
|
||||
(e: 'quitTeam'): void;
|
||||
}>();
|
||||
|
||||
const gridData = ref<CrmPermissionApi.Permission[]>([]);
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
const validateOwnerUser = ref(false); // 负责人权限
|
||||
const validateWrite = ref(false); // 编辑权限
|
||||
const isPool = ref(false); // 是否是公海
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
const checkedRows = ref<CrmPermissionApi.Permission[]>([]);
|
||||
function setCheckedRows({
|
||||
records,
|
||||
}: {
|
||||
records: CrmPermissionApi.Permission[];
|
||||
}) {
|
||||
if (records.some((item) => item.level === PermissionLevelEnum.OWNER)) {
|
||||
ElMessage.warning('不能选择负责人!');
|
||||
gridApi.grid.setAllCheckboxRow(false);
|
||||
return;
|
||||
}
|
||||
checkedRows.value = records;
|
||||
}
|
||||
|
||||
/** 新建团队成员 */
|
||||
function handleCreate() {
|
||||
formModalApi
|
||||
.setData({
|
||||
bizType: props.bizType,
|
||||
bizId: props.bizId,
|
||||
})
|
||||
.open();
|
||||
}
|
||||
|
||||
/** 编辑团队成员 */
|
||||
function handleEdit() {
|
||||
if (checkedRows.value.length === 0) {
|
||||
ElMessage.error('请先选择团队成员后操作!');
|
||||
return;
|
||||
}
|
||||
if (checkedRows.value.length > 1) {
|
||||
ElMessage.error('只能选择一个团队成员进行编辑!');
|
||||
return;
|
||||
}
|
||||
formModalApi
|
||||
.setData({
|
||||
bizType: props.bizType,
|
||||
bizId: props.bizId,
|
||||
id: checkedRows.value[0]?.id,
|
||||
level: checkedRows.value[0]?.level,
|
||||
})
|
||||
.open();
|
||||
}
|
||||
|
||||
/** 删除团队成员 */
|
||||
function handleDelete() {
|
||||
if (checkedRows.value.length === 0) {
|
||||
ElMessage.error('请先选择团队成员后操作!');
|
||||
return;
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
confirm({
|
||||
content: `你要将${checkedRows.value.map((item) => item.nickname).join(',')}移出团队吗?`,
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deletePermissionBatch(
|
||||
checkedRows.value.map((item) => item.id!),
|
||||
);
|
||||
if (res) {
|
||||
// 提示并返回成功
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
handleRefresh();
|
||||
resolve(true);
|
||||
} else {
|
||||
reject(new Error('移出失败'));
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
reject(new Error('取消操作'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 退出团队 */
|
||||
async function handleQuit() {
|
||||
const permission = gridApi.grid
|
||||
.getData()
|
||||
.find(
|
||||
(item) =>
|
||||
item.id === userStore.userInfo?.id &&
|
||||
item.level === PermissionLevelEnum.OWNER,
|
||||
);
|
||||
if (permission) {
|
||||
ElMessage.warning('负责人不能退出团队!');
|
||||
return;
|
||||
}
|
||||
|
||||
const userPermission = gridApi.grid
|
||||
.getData()
|
||||
.find((item) => item.id === userStore.userInfo?.id);
|
||||
if (!userPermission) {
|
||||
ElMessage.warning('你不是团队成员!');
|
||||
return;
|
||||
}
|
||||
await deleteSelfPermission(userPermission.id!);
|
||||
ElMessage.success('退出团队成员成功!');
|
||||
emits('quitTeam');
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async (_params) => {
|
||||
const res = await getPermissionList({
|
||||
bizId: props.bizId,
|
||||
bizType: props.bizType,
|
||||
});
|
||||
gridData.value = res;
|
||||
return res;
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<CrmPermissionApi.Permission>,
|
||||
gridEvents: {
|
||||
checkboxAll: setCheckedRows,
|
||||
checkboxChange: setCheckedRows,
|
||||
},
|
||||
});
|
||||
|
||||
defineExpose({
|
||||
openForm: handleCreate,
|
||||
validateOwnerUser,
|
||||
validateWrite,
|
||||
isPool,
|
||||
});
|
||||
|
||||
watch(
|
||||
() => gridData.value,
|
||||
(data) => {
|
||||
isPool.value = false;
|
||||
if (data.length > 0) {
|
||||
isPool.value = data.some(
|
||||
(item) => item.level === PermissionLevelEnum.OWNER,
|
||||
);
|
||||
validateOwnerUser.value = false;
|
||||
validateWrite.value = false;
|
||||
const userId = userStore.userInfo?.id;
|
||||
gridData.value
|
||||
.filter((item) => item.userId === userId)
|
||||
.forEach((item) => {
|
||||
if (item.level === PermissionLevelEnum.OWNER) {
|
||||
validateOwnerUser.value = true;
|
||||
validateWrite.value = true;
|
||||
} else if (item.level === PermissionLevelEnum.WRITE) {
|
||||
validateWrite.value = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 特殊:没有成员的情况下,说明没有负责人,是公海
|
||||
isPool.value = true;
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.create'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
ifShow: validateOwnerUser,
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.EDIT,
|
||||
ifShow: validateOwnerUser,
|
||||
onClick: handleEdit,
|
||||
disabled: checkedRows.length === 0,
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
icon: ACTION_ICON.DELETE,
|
||||
ifShow: validateOwnerUser,
|
||||
onClick: handleDelete,
|
||||
disabled: checkedRows.length === 0,
|
||||
},
|
||||
{
|
||||
label: '退出团队',
|
||||
type: 'danger',
|
||||
ifShow: !validateOwnerUser,
|
||||
onClick: handleQuit,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</div>
|
||||
</template>
|
||||
120
apps/web-ele/src/views/crm/permission/modules/transfer-form.vue
Normal file
120
apps/web-ele/src/views/crm/permission/modules/transfer-form.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmPermissionApi } from '#/api/crm/permission';
|
||||
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { transferBusiness } from '#/api/crm/business';
|
||||
import { transferClue } from '#/api/crm/clue';
|
||||
import { transferContact } from '#/api/crm/contact';
|
||||
import { transferContract } from '#/api/crm/contract';
|
||||
import { transferCustomer } from '#/api/crm/customer';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useTransferFormSchema } from './data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
|
||||
const bizType = defineModel<number>('bizType');
|
||||
|
||||
const getTitle = computed(() => {
|
||||
switch (bizType.value) {
|
||||
case BizTypeEnum.CRM_BUSINESS: {
|
||||
return '商机转移';
|
||||
}
|
||||
case BizTypeEnum.CRM_CLUE: {
|
||||
return '线索转移';
|
||||
}
|
||||
case BizTypeEnum.CRM_CONTACT: {
|
||||
return '联系人转移';
|
||||
}
|
||||
case BizTypeEnum.CRM_CONTRACT: {
|
||||
return '合同转移';
|
||||
}
|
||||
case BizTypeEnum.CRM_CUSTOMER: {
|
||||
return '客户转移';
|
||||
}
|
||||
default: {
|
||||
return '转移';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 120,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useTransferFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as CrmPermissionApi.TransferReq;
|
||||
try {
|
||||
switch (bizType.value) {
|
||||
case BizTypeEnum.CRM_BUSINESS: {
|
||||
return await transferBusiness(data);
|
||||
}
|
||||
case BizTypeEnum.CRM_CLUE: {
|
||||
return await transferClue(data);
|
||||
}
|
||||
case BizTypeEnum.CRM_CONTACT: {
|
||||
return await transferContact(data);
|
||||
}
|
||||
case BizTypeEnum.CRM_CONTRACT: {
|
||||
return await transferContract(data);
|
||||
}
|
||||
case BizTypeEnum.CRM_CUSTOMER: {
|
||||
return await transferCustomer(data);
|
||||
}
|
||||
default: {
|
||||
ElMessage.error('【转移失败】没有转移接口');
|
||||
throw new Error('【转移失败】没有转移接口');
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
await formApi.resetForm();
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<{ bizType: number }>();
|
||||
if (!data || !data.bizType) {
|
||||
return;
|
||||
}
|
||||
bizType.value = data.bizType;
|
||||
await formApi.setFieldValue('id', data.bizType);
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle" class="w-2/5">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
95
apps/web-ele/src/views/crm/product/category/data.ts
Normal file
95
apps/web-ele/src/views/crm/product/category/data.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmProductCategoryApi } from '#/api/crm/product/category';
|
||||
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { getProductCategoryList } from '#/api/crm/product/category';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'parentId',
|
||||
label: '上级分类',
|
||||
component: 'ApiTreeSelect',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
api: async () => {
|
||||
const data = await getProductCategoryList();
|
||||
data.unshift({
|
||||
id: 0,
|
||||
name: '顶级分类',
|
||||
} as CrmProductCategoryApi.ProductCategory);
|
||||
return handleTree(data);
|
||||
},
|
||||
fieldNames: { label: 'name', value: 'id', children: 'children' },
|
||||
placeholder: '请选择上级分类',
|
||||
showSearch: true,
|
||||
treeDefaultExpandAll: true,
|
||||
},
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '分类名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入分类名称',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '分类名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
placeholder: '请输入分类名称',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 表格列配置 */
|
||||
export function useGridColumns(): VxeTableGridOptions<CrmProductCategoryApi.ProductCategory>['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
title: '分类名称',
|
||||
treeNode: true,
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
title: '分类编号',
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
},
|
||||
{
|
||||
field: 'actions',
|
||||
title: '操作',
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
slots: {
|
||||
default: 'actions',
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
168
apps/web-ele/src/views/crm/product/category/index.vue
Normal file
168
apps/web-ele/src/views/crm/product/category/index.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmProductCategoryApi } from '#/api/crm/product/category';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { DocAlert, Page, useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProductCategory,
|
||||
getProductCategoryList,
|
||||
} from '#/api/crm/product/category';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 切换树形展开/收缩状态 */
|
||||
const isExpanded = ref(false);
|
||||
function handleExpand() {
|
||||
isExpanded.value = !isExpanded.value;
|
||||
gridApi.grid.setAllTreeExpand(isExpanded.value);
|
||||
}
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 创建分类 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 添加下级分类 */
|
||||
function handleAppend(row: CrmProductCategoryApi.ProductCategory) {
|
||||
formModalApi.setData({ parentId: row.id }).open();
|
||||
}
|
||||
|
||||
/** 编辑分类 */
|
||||
function handleEdit(row: CrmProductCategoryApi.ProductCategory) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除分类 */
|
||||
async function handleDelete(row: CrmProductCategoryApi.ProductCategory) {
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: $t('ui.actionMessage.deleting', [row.name]),
|
||||
});
|
||||
try {
|
||||
await deleteProductCategory(row.id!);
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
loadingInstance.close();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async (_, formValues) => {
|
||||
return await getProductCategoryList(formValues);
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
treeConfig: {
|
||||
parentField: 'parentId',
|
||||
rowField: 'id',
|
||||
transform: true,
|
||||
expandAll: true,
|
||||
reserve: true,
|
||||
},
|
||||
} as VxeTableGridOptions<CrmProductCategoryApi.ProductCategory>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<template #doc>
|
||||
<DocAlert
|
||||
title="【产品】产品管理、产品分类"
|
||||
url="https://doc.iocoder.cn/crm/product/"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid>
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['分类']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['crm:product-category:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: isExpanded ? '收缩' : '展开',
|
||||
type: 'primary',
|
||||
onClick: handleExpand,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '新增下级',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['crm:product-category:create'],
|
||||
onClick: handleAppend.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['crm:product-category:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
link: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['crm:product-category:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
92
apps/web-ele/src/views/crm/product/category/modules/form.vue
Normal file
92
apps/web-ele/src/views/crm/product/category/modules/form.vue
Normal file
@@ -0,0 +1,92 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmProductCategoryApi } from '#/api/crm/product/category';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import {
|
||||
createProductCategory,
|
||||
getProductCategory,
|
||||
updateProductCategory,
|
||||
} from '#/api/crm/product/category';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<CrmProductCategoryApi.ProductCategory>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['产品分类'])
|
||||
: $t('ui.actionTitle.create', ['产品分类']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as CrmProductCategoryApi.ProductCategory;
|
||||
try {
|
||||
await (formData.value?.id
|
||||
? updateProductCategory(data)
|
||||
: createProductCategory(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
let data = modalApi.getData<CrmProductCategoryApi.ProductCategory>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
if (data.id) {
|
||||
data = await getProductCategory(data.id);
|
||||
}
|
||||
// 设置到 values
|
||||
formData.value = data;
|
||||
await formApi.setValues(data);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-2/5" :title="getTitle">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
111
apps/web-ele/src/views/crm/product/components/data.ts
Normal file
111
apps/web-ele/src/views/crm/product/components/data.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
|
||||
/** 产品详情列表的列定义 */
|
||||
export function useDetailListColumns(
|
||||
showBusinessPrice: boolean,
|
||||
): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'productName',
|
||||
title: '产品名称',
|
||||
},
|
||||
{
|
||||
field: 'productNo',
|
||||
title: '产品条码',
|
||||
},
|
||||
{
|
||||
field: 'productUnit',
|
||||
title: '产品单位',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'productPrice',
|
||||
title: '产品价格(元)',
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'businessPrice',
|
||||
title: '商机价格(元)',
|
||||
formatter: 'formatAmount2',
|
||||
visible: showBusinessPrice,
|
||||
},
|
||||
{
|
||||
field: 'contractPrice',
|
||||
title: '合同价格(元)',
|
||||
formatter: 'formatAmount2',
|
||||
visible: !showBusinessPrice,
|
||||
},
|
||||
{
|
||||
field: 'count',
|
||||
title: '数量',
|
||||
formatter: 'formatAmount3',
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '合计金额(元)',
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 产品编辑表格的列定义 */
|
||||
export function useProductEditTableColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{ type: 'seq', title: '序号', minWidth: 50 },
|
||||
{
|
||||
field: 'productId',
|
||||
title: '产品名称',
|
||||
minWidth: 100,
|
||||
slots: { default: 'productId' },
|
||||
},
|
||||
{
|
||||
field: 'productNo',
|
||||
title: '条码',
|
||||
minWidth: 150,
|
||||
},
|
||||
{
|
||||
field: 'productUnit',
|
||||
title: '单位',
|
||||
minWidth: 100,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'productPrice',
|
||||
title: '价格(元)',
|
||||
minWidth: 100,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
field: 'sellingPrice',
|
||||
title: '售价(元)',
|
||||
minWidth: 100,
|
||||
slots: { default: 'sellingPrice' },
|
||||
},
|
||||
{
|
||||
field: 'count',
|
||||
title: '数量',
|
||||
minWidth: 100,
|
||||
slots: { default: 'count' },
|
||||
},
|
||||
{
|
||||
field: 'totalPrice',
|
||||
title: '合计',
|
||||
minWidth: 100,
|
||||
formatter: 'formatAmount2',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 80,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<!-- 产品列表:用于【商机】【合同】详情中,展示它们关联的产品列表 -->
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { erpPriceInputFormatter } from '@vben/utils';
|
||||
|
||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { getBusiness } from '#/api/crm/business';
|
||||
import { getContract } from '#/api/crm/contract';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
|
||||
import { useDetailListColumns } from './data';
|
||||
|
||||
/** 组件入参 */
|
||||
const props = defineProps<{
|
||||
bizId: number;
|
||||
bizType: BizTypeEnum;
|
||||
}>();
|
||||
|
||||
/** 整单折扣 */
|
||||
const discountPercent = ref(0);
|
||||
/** 产品总金额 */
|
||||
const totalProductPrice = ref(0);
|
||||
|
||||
/** 构建产品列表表格 */
|
||||
const [Grid] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
columns: useDetailListColumns(props.bizType === BizTypeEnum.CRM_BUSINESS),
|
||||
height: 600,
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async (_params) => {
|
||||
const data =
|
||||
props.bizType === BizTypeEnum.CRM_BUSINESS
|
||||
? await getBusiness(props.bizId)
|
||||
: await getContract(props.bizId);
|
||||
discountPercent.value = data.discountPercent;
|
||||
totalProductPrice.value = data.totalProductPrice;
|
||||
return data.products;
|
||||
},
|
||||
},
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
keepSource: true,
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
} as VxeTableGridOptions<CrmProductApi.Product>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<Grid />
|
||||
<div class="flex flex-col items-end justify-end">
|
||||
<span class="ml-4 font-bold text-red-500">
|
||||
{{ `产品总金额:${erpPriceInputFormatter(totalProductPrice)}元` }}
|
||||
</span>
|
||||
<span class="font-bold text-red-500">
|
||||
{{ `整单折扣:${erpPriceInputFormatter(discountPercent)}%` }}
|
||||
</span>
|
||||
<span class="font-bold text-red-500">
|
||||
{{
|
||||
`实际金额:${erpPriceInputFormatter(totalProductPrice * (1 - discountPercent / 100))}元`
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
203
apps/web-ele/src/views/crm/product/components/edit-table.vue
Normal file
203
apps/web-ele/src/views/crm/product/components/edit-table.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmBusinessApi } from '#/api/crm/business';
|
||||
import type { CrmContractApi } from '#/api/crm/contract';
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { nextTick, onMounted, ref, watch } from 'vue';
|
||||
|
||||
import { erpPriceMultiply } from '@vben/utils';
|
||||
|
||||
import { ElInputNumber, ElOption, ElSelect } from 'element-plus';
|
||||
|
||||
import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
import { getProductSimpleList } from '#/api/crm/product';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useProductEditTableColumns } from './data';
|
||||
|
||||
const props = defineProps<{
|
||||
bizType: BizTypeEnum;
|
||||
products?:
|
||||
| CrmBusinessApi.BusinessProduct[]
|
||||
| CrmContractApi.ContractProduct[];
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(['update:products']);
|
||||
|
||||
/** 表格内部数据 */
|
||||
const tableData = ref<any[]>([]);
|
||||
|
||||
/** 添加产品行 */
|
||||
function handleAdd() {
|
||||
gridApi.grid.insertAt(null, -1);
|
||||
}
|
||||
|
||||
/** 删除产品行 */
|
||||
function handleDelete(row: CrmProductApi.Product) {
|
||||
gridApi.grid.remove(row);
|
||||
}
|
||||
|
||||
/** 切换产品时同步基础信息 */
|
||||
function handleProductChange(productId: any, row: any) {
|
||||
const product = productOptions.value.find((p) => p.id === productId);
|
||||
if (!product) {
|
||||
return;
|
||||
}
|
||||
row.productUnit = product.unit;
|
||||
row.productNo = product.no;
|
||||
row.productPrice = product.price;
|
||||
row.sellingPrice = product.price;
|
||||
row.count = 0;
|
||||
row.totalPrice = 0;
|
||||
handleUpdateValue(row);
|
||||
}
|
||||
|
||||
/** 金额变动时重新计算合计 */
|
||||
function handlePriceChange(row: any) {
|
||||
row.totalPrice = erpPriceMultiply(row.sellingPrice, row.count) ?? 0;
|
||||
handleUpdateValue(row);
|
||||
}
|
||||
|
||||
/** 将最新数据写回并通知父组件 */
|
||||
function handleUpdateValue(row: any) {
|
||||
const index = tableData.value.findIndex((item) => item.id === row.id);
|
||||
if (props.bizType === BizTypeEnum.CRM_BUSINESS) {
|
||||
row.businessPrice = row.sellingPrice;
|
||||
} else if (props.bizType === BizTypeEnum.CRM_CONTRACT) {
|
||||
row.contractPrice = row.sellingPrice;
|
||||
}
|
||||
if (index === -1) {
|
||||
row.id = tableData.value.length + 1;
|
||||
tableData.value.push(row);
|
||||
} else {
|
||||
tableData.value[index] = row;
|
||||
}
|
||||
emit('update:products', [...tableData.value]);
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions: {
|
||||
editConfig: {
|
||||
trigger: 'click',
|
||||
mode: 'cell',
|
||||
},
|
||||
columns: useProductEditTableColumns(),
|
||||
data: tableData.value,
|
||||
border: true,
|
||||
showOverflow: true,
|
||||
autoResize: true,
|
||||
keepSource: true,
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
pagerConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
toolbarConfig: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/** 监听外部传入的列数据 */
|
||||
watch(
|
||||
() => props.products,
|
||||
async (products) => {
|
||||
if (!products) {
|
||||
return;
|
||||
}
|
||||
await nextTick();
|
||||
tableData.value = products;
|
||||
if (props.bizType === BizTypeEnum.CRM_BUSINESS) {
|
||||
tableData.value.forEach((item) => {
|
||||
item.sellingPrice = item.businessPrice;
|
||||
});
|
||||
} else if (props.bizType === BizTypeEnum.CRM_CONTRACT) {
|
||||
tableData.value.forEach((item) => {
|
||||
item.sellingPrice = item.contractPrice;
|
||||
});
|
||||
}
|
||||
await gridApi.grid.reloadData(tableData.value);
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
);
|
||||
|
||||
/** 产品下拉选项 */
|
||||
const productOptions = ref<CrmProductApi.Product[]>([]);
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(async () => {
|
||||
productOptions.value = await getProductSimpleList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Grid class="w-full">
|
||||
<template #productId="{ row }">
|
||||
<ElSelect
|
||||
v-model="row.productId"
|
||||
:field-names="{ label: 'name', value: 'id' }"
|
||||
class="w-full"
|
||||
@change="handleProductChange($event, row)"
|
||||
>
|
||||
<ElOption
|
||||
v-for="option in productOptions"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"
|
||||
/>
|
||||
</ElSelect>
|
||||
</template>
|
||||
<template #sellingPrice="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.sellingPrice"
|
||||
:min="0.001"
|
||||
:precision="2"
|
||||
controls-position="right"
|
||||
class="!w-full"
|
||||
@change="handlePriceChange(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #count="{ row }">
|
||||
<ElInputNumber
|
||||
v-model="row.count"
|
||||
:min="0.001"
|
||||
:precision="3"
|
||||
controls-position="right"
|
||||
class="!w-full"
|
||||
@change="handlePriceChange(row)"
|
||||
/>
|
||||
</template>
|
||||
<template #bottom>
|
||||
<TableAction
|
||||
class="mt-4 flex justify-center"
|
||||
:actions="[
|
||||
{
|
||||
label: '添加产品',
|
||||
type: 'default',
|
||||
onClick: handleAdd,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
link: true,
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</template>
|
||||
2
apps/web-ele/src/views/crm/product/components/index.ts
Normal file
2
apps/web-ele/src/views/crm/product/components/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as ProductDetailsList } from './detail-list.vue';
|
||||
export { default as ProductEditTable } from './edit-table.vue';
|
||||
231
apps/web-ele/src/views/crm/product/data.ts
Normal file
231
apps/web-ele/src/views/crm/product/data.ts
Normal file
@@ -0,0 +1,231 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
|
||||
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
|
||||
import { getDictOptions } from '@vben/hooks';
|
||||
import { useUserStore } from '@vben/stores';
|
||||
import { handleTree } from '@vben/utils';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
import { getProductCategoryList } from '#/api/crm/product/category';
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
|
||||
/** 新增/修改的表单 */
|
||||
export function useFormSchema(): VbenFormSchema[] {
|
||||
const userStore = useUserStore();
|
||||
return [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'name',
|
||||
label: '产品名称',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品名称',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'ownerUserId',
|
||||
label: '负责人',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
triggerFields: ['id'],
|
||||
disabled: (values) => values.id,
|
||||
},
|
||||
componentProps: {
|
||||
api: getSimpleUserList,
|
||||
labelField: 'nickname',
|
||||
valueField: 'id',
|
||||
placeholder: '请选择负责人',
|
||||
clearable: true,
|
||||
},
|
||||
defaultValue: userStore.userInfo?.id,
|
||||
},
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'no',
|
||||
label: '产品编码',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品编码',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'ApiTreeSelect',
|
||||
fieldName: 'categoryId',
|
||||
label: '产品类型',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
api: async () => {
|
||||
const data = await getProductCategoryList();
|
||||
return handleTree(data);
|
||||
},
|
||||
fieldNames: { label: 'name', value: 'id', children: 'children' },
|
||||
placeholder: '请选择产品类型',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'unit',
|
||||
label: '产品单位',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.CRM_PRODUCT_UNIT, 'number'),
|
||||
placeholder: '请选择产品单位',
|
||||
clearable: true,
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
fieldName: 'price',
|
||||
label: '价格(元)',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
min: 0,
|
||||
precision: 2,
|
||||
step: 0.1,
|
||||
placeholder: '请输入产品价格',
|
||||
controlsPosition: 'right',
|
||||
class: '!w-full',
|
||||
},
|
||||
},
|
||||
{
|
||||
component: 'Textarea',
|
||||
fieldName: 'description',
|
||||
label: '产品描述',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品描述',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '上架状态',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.CRM_PRODUCT_STATUS, 'number'),
|
||||
},
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的搜索表单 */
|
||||
export function useGridFormSchema(): VbenFormSchema[] {
|
||||
return [
|
||||
{
|
||||
fieldName: 'name',
|
||||
label: '产品名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入产品名称',
|
||||
clearable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
fieldName: 'status',
|
||||
label: '上架状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
clearable: true,
|
||||
placeholder: '请选择上架状态',
|
||||
options: getDictOptions(DICT_TYPE.CRM_PRODUCT_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 列表的字段 */
|
||||
export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
title: '产品编号',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '产品名称',
|
||||
minWidth: 240,
|
||||
slots: { default: 'name' },
|
||||
},
|
||||
{
|
||||
field: 'categoryName',
|
||||
title: '产品类型',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
title: '产品单位',
|
||||
minWidth: 120,
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_PRODUCT_UNIT },
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
title: '产品编码',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
title: '价格(元)',
|
||||
formatter: 'formatAmount2',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: '产品描述',
|
||||
minWidth: 200,
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '上架状态',
|
||||
cellRender: {
|
||||
name: 'CellDict',
|
||||
props: { type: DICT_TYPE.CRM_PRODUCT_STATUS },
|
||||
},
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'ownerUserName',
|
||||
title: '负责人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
field: 'creatorName',
|
||||
title: '创建人',
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
formatter: 'formatDateTime',
|
||||
minWidth: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
slots: { default: 'actions' },
|
||||
},
|
||||
];
|
||||
}
|
||||
72
apps/web-ele/src/views/crm/product/detail/data.ts
Normal file
72
apps/web-ele/src/views/crm/product/detail/data.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { h } from 'vue';
|
||||
|
||||
import { DICT_TYPE } from '@vben/constants';
|
||||
import { erpPriceInputFormatter } from '@vben/utils';
|
||||
|
||||
import { DictTag } from '#/components/dict-tag';
|
||||
|
||||
/** 详情页的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'categoryName',
|
||||
label: '产品类别',
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
label: '产品单位',
|
||||
render: (val) =>
|
||||
h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_UNIT, value: val }),
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
label: '产品价格(元)',
|
||||
render: (val) => erpPriceInputFormatter(val),
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
label: '产品编码',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的基础字段 */
|
||||
export function useDetailBaseSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'name',
|
||||
label: '产品名称',
|
||||
},
|
||||
{
|
||||
field: 'no',
|
||||
label: '产品编码',
|
||||
},
|
||||
{
|
||||
field: 'price',
|
||||
label: '价格(元)',
|
||||
render: (val) => erpPriceInputFormatter(val),
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
label: '产品描述',
|
||||
},
|
||||
{
|
||||
field: 'categoryName',
|
||||
label: '产品类型',
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
label: '是否上下架',
|
||||
render: (val) =>
|
||||
h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_STATUS, value: val }),
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
label: '产品单位',
|
||||
render: (val) =>
|
||||
h(DictTag, { type: DICT_TYPE.CRM_PRODUCT_UNIT, value: val }),
|
||||
},
|
||||
];
|
||||
}
|
||||
89
apps/web-ele/src/views/crm/product/detail/index.vue
Normal file
89
apps/web-ele/src/views/crm/product/detail/index.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<script setup lang="ts">
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { useTabs } from '@vben/hooks';
|
||||
|
||||
import { ElButton, ElCard, ElTabPane, ElTabs } from 'element-plus';
|
||||
|
||||
import { getOperateLogPage } from '#/api/crm/operateLog';
|
||||
import { BizTypeEnum } from '#/api/crm/permission';
|
||||
import { getProduct } from '#/api/crm/product';
|
||||
import { useDescription } from '#/components/description';
|
||||
import { OperateLog } from '#/components/operate-log';
|
||||
|
||||
import { useDetailSchema } from './data';
|
||||
import Info from './modules/info.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const tabs = useTabs();
|
||||
|
||||
const loading = ref(false); // 加载中
|
||||
const productId = ref(0); // 产品编号
|
||||
const product = ref<CrmProductApi.Product>({} as CrmProductApi.Product); // 产品详情
|
||||
const logList = ref<SystemOperateLogApi.OperateLog[]>([]); // 操作日志
|
||||
|
||||
const [Descriptions] = useDescription({
|
||||
bordered: false,
|
||||
column: 4,
|
||||
class: 'mx-4',
|
||||
schema: useDetailSchema(),
|
||||
});
|
||||
|
||||
/** 加载详情 */
|
||||
async function getProductDetail() {
|
||||
loading.value = true;
|
||||
try {
|
||||
product.value = await getProduct(productId.value);
|
||||
// 操作日志
|
||||
const res = await getOperateLogPage({
|
||||
bizType: BizTypeEnum.CRM_PRODUCT,
|
||||
bizId: productId.value,
|
||||
});
|
||||
logList.value = res.list;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
/** 返回列表页 */
|
||||
function handleBack() {
|
||||
tabs.closeCurrentTab();
|
||||
router.push({ name: 'CrmProduct' });
|
||||
}
|
||||
|
||||
/** 加载数据 */
|
||||
onMounted(() => {
|
||||
productId.value = Number(route.params.id);
|
||||
getProductDetail();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height :title="product?.name" :loading="loading">
|
||||
<template #extra>
|
||||
<div class="flex items-center gap-2">
|
||||
<ElButton @click="handleBack"> 返回 </ElButton>
|
||||
</div>
|
||||
</template>
|
||||
<ElCard class="min-h-[10%]">
|
||||
<Descriptions :data="product" />
|
||||
</ElCard>
|
||||
<ElCard class="mt-4 min-h-[60%]">
|
||||
<ElTabs>
|
||||
<ElTabPane label="详细资料" name="1">
|
||||
<Info :product="product" />
|
||||
</ElTabPane>
|
||||
<ElTabPane label="操作日志" name="2">
|
||||
<OperateLog :log-list="logList" />
|
||||
</ElTabPane>
|
||||
</ElTabs>
|
||||
</ElCard>
|
||||
</Page>
|
||||
</template>
|
||||
25
apps/web-ele/src/views/crm/product/detail/modules/info.vue
Normal file
25
apps/web-ele/src/views/crm/product/detail/modules/info.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { useDescription } from '#/components/description';
|
||||
|
||||
import { useDetailBaseSchema } from '../data';
|
||||
|
||||
defineProps<{
|
||||
product: CrmProductApi.Product; // 产品信息
|
||||
}>();
|
||||
|
||||
const [ProductDescriptions] = useDescription({
|
||||
title: '基本信息',
|
||||
bordered: false,
|
||||
column: 4,
|
||||
class: 'mx-4',
|
||||
schema: useDetailBaseSchema(),
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-4">
|
||||
<ProductDescriptions :data="product" />
|
||||
</div>
|
||||
</template>
|
||||
157
apps/web-ele/src/views/crm/product/index.vue
Normal file
157
apps/web-ele/src/views/crm/product/index.vue
Normal file
@@ -0,0 +1,157 @@
|
||||
<script lang="ts" setup>
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
import { Page, useVbenModal } from '@vben/common-ui';
|
||||
import { downloadFileFromBlobPart } from '@vben/utils';
|
||||
|
||||
import { ElButton, ElLoading, ElMessage } from 'element-plus';
|
||||
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
import {
|
||||
deleteProduct,
|
||||
exportProduct,
|
||||
getProductPage,
|
||||
} from '#/api/crm/product';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useGridColumns, useGridFormSchema } from './data';
|
||||
import Form from './modules/form.vue';
|
||||
|
||||
const { push } = useRouter();
|
||||
|
||||
const [FormModal, formModalApi] = useVbenModal({
|
||||
connectedComponent: Form,
|
||||
destroyOnClose: true,
|
||||
});
|
||||
|
||||
/** 刷新表格 */
|
||||
function handleRefresh() {
|
||||
gridApi.query();
|
||||
}
|
||||
|
||||
/** 导出表格 */
|
||||
async function handleExport() {
|
||||
const data = await exportProduct(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '产品.xls', source: data });
|
||||
}
|
||||
|
||||
/** 打开详情 */
|
||||
function handleDetail(row: CrmProductApi.Product) {
|
||||
push({ name: 'CrmProductDetail', params: { id: row.id } });
|
||||
}
|
||||
|
||||
/** 创建产品 */
|
||||
function handleCreate() {
|
||||
formModalApi.setData(null).open();
|
||||
}
|
||||
|
||||
/** 编辑产品 */
|
||||
function handleEdit(row: CrmProductApi.Product) {
|
||||
formModalApi.setData(row).open();
|
||||
}
|
||||
|
||||
/** 删除产品 */
|
||||
async function handleDelete(row: CrmProductApi.Product) {
|
||||
const loadingInstance = ElLoading.service({
|
||||
text: $t('ui.actionMessage.deleting', [row.name]),
|
||||
});
|
||||
try {
|
||||
await deleteProduct(row.id!);
|
||||
ElMessage.success($t('ui.actionMessage.deleteSuccess', [row.name]));
|
||||
handleRefresh();
|
||||
} finally {
|
||||
loadingInstance.close();
|
||||
}
|
||||
}
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
formOptions: {
|
||||
schema: useGridFormSchema(),
|
||||
},
|
||||
gridOptions: {
|
||||
columns: useGridColumns(),
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues) => {
|
||||
return await getProductPage({
|
||||
pageNo: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
...formValues,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
isHover: true,
|
||||
},
|
||||
toolbarConfig: {
|
||||
refresh: true,
|
||||
search: true,
|
||||
},
|
||||
} as VxeTableGridOptions<CrmProductApi.Product>,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="handleRefresh" />
|
||||
<Grid table-title="产品列表">
|
||||
<template #toolbar-tools>
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('ui.actionTitle.create', ['产品']),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.ADD,
|
||||
auth: ['crm:product:create'],
|
||||
onClick: handleCreate,
|
||||
},
|
||||
{
|
||||
label: $t('ui.actionTitle.export'),
|
||||
type: 'primary',
|
||||
icon: ACTION_ICON.DOWNLOAD,
|
||||
auth: ['crm:product:export'],
|
||||
onClick: handleExport,
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
<template #name="{ row }">
|
||||
<ElButton type="primary" link @click="handleDetail(row)">
|
||||
{{ row.name }}
|
||||
</ElButton>
|
||||
</template>
|
||||
<template #actions="{ row }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: $t('common.edit'),
|
||||
type: 'primary',
|
||||
link: true,
|
||||
icon: ACTION_ICON.EDIT,
|
||||
auth: ['crm:product:update'],
|
||||
onClick: handleEdit.bind(null, row),
|
||||
},
|
||||
{
|
||||
label: $t('common.delete'),
|
||||
type: 'danger',
|
||||
link: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
auth: ['crm:product:delete'],
|
||||
popConfirm: {
|
||||
title: $t('ui.actionMessage.deleteConfirm', [row.name]),
|
||||
confirm: handleDelete.bind(null, row),
|
||||
},
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</Grid>
|
||||
</Page>
|
||||
</template>
|
||||
82
apps/web-ele/src/views/crm/product/modules/form.vue
Normal file
82
apps/web-ele/src/views/crm/product/modules/form.vue
Normal file
@@ -0,0 +1,82 @@
|
||||
<script lang="ts" setup>
|
||||
import type { CrmProductApi } from '#/api/crm/product';
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { createProduct, getProduct, updateProduct } from '#/api/crm/product';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { useFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<CrmProductApi.Product>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['产品'])
|
||||
: $t('ui.actionTitle.create', ['产品']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
},
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 80,
|
||||
},
|
||||
layout: 'horizontal',
|
||||
schema: useFormSchema(),
|
||||
showDefaultActions: false,
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as CrmProductApi.Product;
|
||||
try {
|
||||
await (formData.value?.id ? updateProduct(data) : createProduct(data));
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
ElMessage.success($t('ui.actionMessage.operationSuccess'));
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
formData.value = undefined;
|
||||
return;
|
||||
}
|
||||
// 加载数据
|
||||
const data = modalApi.getData<CrmProductApi.Product>();
|
||||
if (!data || !data.id) {
|
||||
return;
|
||||
}
|
||||
modalApi.lock();
|
||||
try {
|
||||
formData.value = await getProduct(data.id);
|
||||
// 设置到 values
|
||||
await formApi.setValues(formData.value);
|
||||
} finally {
|
||||
modalApi.unlock();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal :title="getTitle" class="w-2/5">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
Reference in New Issue
Block a user