fix: crm bugs

pull/158/head
xingyu4j 2025-06-26 15:46:07 +08:00
parent 69ae45ee6d
commit dcd5f463a6
5 changed files with 43 additions and 9 deletions

View File

@ -15,7 +15,10 @@ import {
getBusinessPageByContact, getBusinessPageByContact,
getBusinessPageByCustomer, getBusinessPageByCustomer,
} from '#/api/crm/business'; } from '#/api/crm/business';
import { createContactBusinessList } from '#/api/crm/contact'; import {
createContactBusinessList,
deleteContactBusinessList,
} from '#/api/crm/contact';
import { BizTypeEnum } from '#/api/crm/permission'; import { BizTypeEnum } from '#/api/crm/permission';
import { $t } from '#/locales'; import { $t } from '#/locales';
@ -73,7 +76,7 @@ async function handleDeleteContactBusinessList() {
content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`, content: `确定要将${checkedRows.value.map((item) => item.name).join(',')}解除关联吗?`,
}) })
.then(async () => { .then(async () => {
const res = await createContactBusinessList({ const res = await deleteContactBusinessList({
contactId: props.bizId, contactId: props.bizId,
businessIds: checkedRows.value.map((item) => item.id), businessIds: checkedRows.value.map((item) => item.id),
}); });

View File

@ -26,9 +26,10 @@ const [Form, formApi] = useVbenForm({
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
}, },
formItemClass: 'col-span-2', labelWidth: 100,
labelWidth: 120,
}, },
// 3
wrapperClass: 'grid-cols-2',
layout: 'horizontal', layout: 'horizontal',
schema: useFormSchema(), schema: useFormSchema(),
showDefaultActions: false, showDefaultActions: false,

View File

@ -5,7 +5,10 @@ import { useUserStore } from '@vben/stores';
import { getContractSimpleList } from '#/api/crm/contract'; import { getContractSimpleList } from '#/api/crm/contract';
import { getCustomerSimpleList } from '#/api/crm/customer'; import { getCustomerSimpleList } from '#/api/crm/customer';
import { getReceivablePlanSimpleList } from '#/api/crm/receivable/plan'; import {
getReceivablePlan,
getReceivablePlanSimpleList,
} from '#/api/crm/receivable/plan';
import { getSimpleUserList } from '#/api/system/user'; import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, getDictOptions } from '#/utils'; import { DICT_TYPE, getDictOptions } from '#/utils';
@ -25,7 +28,6 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'no', fieldName: 'no',
label: '回款编号', label: '回款编号',
component: 'Input', component: 'Input',
rules: 'required',
componentProps: { componentProps: {
placeholder: '保存时自动生成', placeholder: '保存时自动生成',
disabled: true, disabled: true,
@ -105,6 +107,12 @@ export function useFormSchema(): VbenFormSchema[] {
value: item.id, value: item.id,
})), })),
placeholder: '请选择回款期数', placeholder: '请选择回款期数',
onChange: async (value: any) => {
const plan = await getReceivablePlan(value);
values.returnTime = plan?.returnTime;
values.price = plan?.price;
values.returnType = plan?.returnType;
},
} as any; } as any;
} }
}, },

View File

@ -1,14 +1,17 @@
import type { VbenFormSchema } from '#/adapter/form'; import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table'; import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { useUserStore } from '@vben/stores';
import { floatToFixed2 } from '@vben/utils'; import { floatToFixed2 } from '@vben/utils';
import { getContractSimpleList } from '#/api/crm/contract'; import { getContractSimpleList } from '#/api/crm/contract';
import { getCustomerSimpleList } from '#/api/crm/customer'; import { getCustomerSimpleList } from '#/api/crm/customer';
import { getSimpleUserList } from '#/api/system/user';
import { DICT_TYPE, getDictOptions } from '#/utils'; import { DICT_TYPE, getDictOptions } from '#/utils';
/** 新增/修改的表单 */ /** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] { export function useFormSchema(): VbenFormSchema[] {
const userStore = useUserStore();
return [ return [
{ {
fieldName: 'customerId', fieldName: 'customerId',
@ -63,6 +66,24 @@ export function useFormSchema(): VbenFormSchema[] {
disabled: true, disabled: true,
}, },
}, },
{
fieldName: 'ownerUserId',
label: '负责人',
component: 'ApiSelect',
componentProps: {
api: () => getSimpleUserList(),
fieldNames: {
label: 'nickname',
value: 'id',
},
},
dependencies: {
triggerFields: ['id'],
disabled: (values) => !values.id,
},
defaultValue: userStore.userInfo?.id,
rules: 'required',
},
{ {
fieldName: 'price', fieldName: 'price',
label: '计划回款金额', label: '计划回款金额',
@ -81,6 +102,9 @@ export function useFormSchema(): VbenFormSchema[] {
rules: 'required', rules: 'required',
componentProps: { componentProps: {
placeholder: '请选择计划回款日期', placeholder: '请选择计划回款日期',
showTime: false,
valueFormat: 'x',
format: 'YYYY-MM-DD',
}, },
}, },
{ {
@ -247,7 +271,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{ {
title: '操作', title: '操作',
field: 'actions', field: 'actions',
width: 180, width: 220,
fixed: 'right', fixed: 'right',
slots: { default: 'actions' }, slots: { default: 'actions' },
}, },

View File

@ -195,8 +195,6 @@ function onChangeSceneType(key: number | string) {
auth: ['crm:receivable-plan:update'], auth: ['crm:receivable-plan:update'],
onClick: handleEdit.bind(null, row), onClick: handleEdit.bind(null, row),
}, },
]"
:drop-down-actions="[
{ {
label: $t('common.delete'), label: $t('common.delete'),
type: 'link', type: 'link',