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

View File

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

View File

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

View File

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

View File

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