fix: bugs
parent
d94dbe73e1
commit
2855eb4e08
|
@ -5,6 +5,7 @@ import { requestClient } from '#/api/request';
|
||||||
export namespace CrmBusinessStatusApi {
|
export namespace CrmBusinessStatusApi {
|
||||||
/** 商机状态信息 */
|
/** 商机状态信息 */
|
||||||
export interface BusinessStatusType {
|
export interface BusinessStatusType {
|
||||||
|
[x: string]: any;
|
||||||
id?: number;
|
id?: number;
|
||||||
name: string;
|
name: string;
|
||||||
percent: number;
|
percent: number;
|
||||||
|
|
|
@ -121,10 +121,9 @@ export function putCustomerPool(id: number) {
|
||||||
|
|
||||||
/** 更新客户的成交状态 */
|
/** 更新客户的成交状态 */
|
||||||
export function updateCustomerDealStatus(id: number, dealStatus: boolean) {
|
export function updateCustomerDealStatus(id: number, dealStatus: boolean) {
|
||||||
return requestClient.put('/crm/customer/update-deal-status', {
|
return requestClient.put(
|
||||||
id,
|
`/crm/customer/update-deal-status?id=${id}&dealStatus=${dealStatus}`,
|
||||||
dealStatus,
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 进入公海客户提醒的客户列表 */
|
/** 进入公海客户提醒的客户列表 */
|
||||||
|
|
|
@ -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 { erpPriceMultiply } from '@vben/utils';
|
import { erpPriceMultiply } from '@vben/utils';
|
||||||
|
|
||||||
|
import { z } from '#/adapter/form';
|
||||||
import { getBusinessStatusTypeSimpleList } from '#/api/crm/business/status';
|
import { getBusinessStatusTypeSimpleList } from '#/api/crm/business/status';
|
||||||
import { getCustomerSimpleList } from '#/api/crm/customer';
|
import { getCustomerSimpleList } from '#/api/crm/customer';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -35,6 +38,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -50,7 +54,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
},
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['id'],
|
triggerFields: ['id'],
|
||||||
disabled: (values) => !values.customerId,
|
disabled: (values) => values.customerDefault,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
|
@ -103,8 +107,9 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: z.number().min(0).optional().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'discountPercent',
|
fieldName: 'discountPercent',
|
||||||
|
@ -114,15 +119,19 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
min: 0,
|
min: 0,
|
||||||
precision: 2,
|
precision: 2,
|
||||||
},
|
},
|
||||||
rules: 'required',
|
rules: z.number().min(0).max(100).optional().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'totalPrice',
|
fieldName: 'totalPrice',
|
||||||
label: '折扣后金额',
|
label: '折扣后金额',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
|
componentProps: {
|
||||||
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['totalProductPrice', 'discountPercent'],
|
triggerFields: ['totalProductPrice', 'discountPercent'],
|
||||||
disabled: () => true,
|
|
||||||
trigger(values, form) {
|
trigger(values, form) {
|
||||||
const discountPrice =
|
const discountPrice =
|
||||||
erpPriceMultiply(
|
erpPriceMultiply(
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
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 { getAreaTree } from '#/api/system/area';
|
import { getAreaTree } from '#/api/system/area';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -46,6 +49,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
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 { getSimpleContactList } from '#/api/crm/contact';
|
import { getSimpleContactList } from '#/api/crm/contact';
|
||||||
import { getCustomerSimpleList } from '#/api/crm/customer';
|
import { getCustomerSimpleList } from '#/api/crm/customer';
|
||||||
import { getAreaTree } from '#/api/system/area';
|
import { getAreaTree } from '#/api/system/area';
|
||||||
|
@ -9,6 +11,7 @@ import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -35,6 +38,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'customerId',
|
fieldName: 'customerId',
|
||||||
|
|
|
@ -60,6 +60,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<CrmContactApi.Contact>();
|
const data = modalApi.getData<CrmContactApi.Contact>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
|
// 设置到 values
|
||||||
|
await formApi.setValues(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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 { erpPriceMultiply, floatToFixed2 } from '@vben/utils';
|
import { erpPriceMultiply, floatToFixed2 } from '@vben/utils';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
|
@ -12,6 +13,7 @@ import { DICT_TYPE } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -27,7 +29,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
placeholder: '保存时自动生成',
|
placeholder: '保存时自动生成',
|
||||||
disabled: () => true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -50,6 +52,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -58,22 +61,45 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'businessId',
|
fieldName: 'businessId',
|
||||||
label: '商机名称',
|
label: '商机名称',
|
||||||
component: 'ApiSelect',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getSimpleBusinessList,
|
options: [],
|
||||||
labelField: 'name',
|
|
||||||
valueField: 'id',
|
|
||||||
placeholder: '请选择商机',
|
placeholder: '请选择商机',
|
||||||
},
|
},
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['customerId'],
|
||||||
|
disabled: (values) => !values.customerId,
|
||||||
|
async componentProps(values) {
|
||||||
|
if (!values.customerId) {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
placeholder: '请选择客户',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const res = await getSimpleBusinessList();
|
||||||
|
const list = res.filter(
|
||||||
|
(item) => item.customerId === values.customerId,
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
options: list.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id,
|
||||||
|
})),
|
||||||
|
placeholder: '请选择商机',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'orderDate',
|
fieldName: 'orderDate',
|
||||||
|
@ -117,17 +143,39 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'signContactId',
|
fieldName: 'signContactId',
|
||||||
label: '客户签约人',
|
label: '客户签约人',
|
||||||
component: 'ApiSelect',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getSimpleContactList,
|
options: [],
|
||||||
labelField: 'name',
|
|
||||||
valueField: 'id',
|
|
||||||
placeholder: '请选择客户签约人',
|
placeholder: '请选择客户签约人',
|
||||||
},
|
},
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['customerId'],
|
||||||
|
disabled: (values) => !values.customerId,
|
||||||
|
async componentProps(values) {
|
||||||
|
if (!values.customerId) {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
placeholder: '请选择客户',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const res = await getSimpleContactList();
|
||||||
|
const list = res.filter(
|
||||||
|
(item) => item.customerId === values.customerId,
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
options: list.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id,
|
||||||
|
})),
|
||||||
|
placeholder: '请选择客户签约人',
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
|
@ -150,25 +198,31 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
},
|
},
|
||||||
|
rules: z.number().min(0).optional().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'discountPercent',
|
fieldName: 'discountPercent',
|
||||||
label: '整单折扣(%)',
|
label: '整单折扣(%)',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
rules: z.number().min(0).max(100).default(0),
|
|
||||||
componentProps: {
|
componentProps: {
|
||||||
min: 0,
|
min: 0,
|
||||||
precision: 2,
|
precision: 2,
|
||||||
},
|
},
|
||||||
|
rules: z.number().min(0).max(100).optional().default(0),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'totalPrice',
|
fieldName: 'totalPrice',
|
||||||
label: '折扣后金额',
|
label: '折扣后金额',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
|
componentProps: {
|
||||||
|
min: 0,
|
||||||
|
precision: 2,
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['totalProductPrice', 'discountPercent'],
|
triggerFields: ['totalProductPrice', 'discountPercent'],
|
||||||
disabled: () => true,
|
|
||||||
trigger(values, form) {
|
trigger(values, form) {
|
||||||
const discountPrice =
|
const discountPrice =
|
||||||
erpPriceMultiply(
|
erpPriceMultiply(
|
||||||
|
@ -203,9 +257,11 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
label: '客户',
|
label: '客户',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -223,20 +279,20 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||||
{
|
{
|
||||||
title: '合同名称',
|
title: '合同名称',
|
||||||
field: 'name',
|
field: 'name',
|
||||||
minWidth: 150,
|
minWidth: 220,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
slots: { default: 'name' },
|
slots: { default: 'name' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '客户名称',
|
title: '客户名称',
|
||||||
field: 'customerName',
|
field: 'customerName',
|
||||||
minWidth: 150,
|
minWidth: 240,
|
||||||
slots: { default: 'customerName' },
|
slots: { default: 'customerName' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '商机名称',
|
title: '商机名称',
|
||||||
field: 'businessName',
|
field: 'businessName',
|
||||||
minWidth: 150,
|
minWidth: 220,
|
||||||
slots: { default: 'businessName' },
|
slots: { default: 'businessName' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,15 @@ function onRefresh() {
|
||||||
|
|
||||||
/** 创建合同 */
|
/** 创建合同 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi
|
||||||
|
.setData(
|
||||||
|
props.bizType === BizTypeEnum.CRM_CUSTOMER
|
||||||
|
? {
|
||||||
|
customerId: props.bizId,
|
||||||
|
}
|
||||||
|
: { businessId: props.bizId },
|
||||||
|
)
|
||||||
|
.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查看合同详情 */
|
/** 查看合同详情 */
|
||||||
|
|
|
@ -90,6 +90,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<CrmContractApi.Contract>();
|
const data = modalApi.getData<CrmContractApi.Contract>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
|
// 设置到 values
|
||||||
|
await formApi.setValues(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
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 { getAreaTree } from '#/api/system/area';
|
import { getAreaTree } from '#/api/system/area';
|
||||||
import { getSimpleUserList } from '#/api/system/user';
|
import { getSimpleUserList } from '#/api/system/user';
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -47,6 +50,7 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { useUserStore } from '@vben/stores';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ import { $t } from '#/locales';
|
||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
@ -39,6 +42,7 @@ const [Form, formApi] = useVbenForm({
|
||||||
value: 'id',
|
value: 'id',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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 { handleTree } from '@vben/utils';
|
import { handleTree } from '@vben/utils';
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
|
@ -10,6 +11,7 @@ import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
@ -31,9 +33,13 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
label: '负责人',
|
label: '负责人',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getSimpleUserList,
|
api: () => getSimpleUserList(),
|
||||||
fieldNames: { label: 'nickname', value: 'id' },
|
fieldNames: {
|
||||||
|
label: 'nickname',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
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 { 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 { getReceivablePlanSimpleList } from '#/api/crm/receivable/plan';
|
||||||
|
@ -9,6 +11,7 @@ import { DICT_TYPE, getDictOptions } from '#/utils';
|
||||||
|
|
||||||
/** 新增/修改的表单 */
|
/** 新增/修改的表单 */
|
||||||
export function useFormSchema(): VbenFormSchema[] {
|
export function useFormSchema(): VbenFormSchema[] {
|
||||||
|
const userStore = useUserStore();
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'id',
|
fieldName: 'id',
|
||||||
|
@ -34,11 +37,14 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getSimpleUserList,
|
api: () => getSimpleUserList(),
|
||||||
labelField: 'nickname',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'nickname',
|
||||||
placeholder: '请选择客户',
|
value: 'id',
|
||||||
|
},
|
||||||
|
placeholder: '请选择负责人',
|
||||||
},
|
},
|
||||||
|
defaultValue: userStore.userInfo?.id,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'customerId',
|
fieldName: 'customerId',
|
||||||
|
@ -46,9 +52,11 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -159,9 +167,11 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
label: '客户',
|
label: '客户',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,7 +33,12 @@ function onRefresh() {
|
||||||
|
|
||||||
/** 创建回款 */
|
/** 创建回款 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi
|
||||||
|
.setData({
|
||||||
|
contractId: props.contractId,
|
||||||
|
customerId: props.customerId,
|
||||||
|
})
|
||||||
|
.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 编辑回款 */
|
/** 编辑回款 */
|
||||||
|
|
|
@ -66,6 +66,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData();
|
const data = modalApi.getData();
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
// 设置到 values
|
||||||
|
await formApi.setValues(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { receivable, plan } = data;
|
const { receivable, plan } = data;
|
||||||
|
|
|
@ -16,9 +16,11 @@ export function useFormSchema(): VbenFormSchema[] {
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -121,9 +123,11 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
||||||
label: '客户',
|
label: '客户',
|
||||||
component: 'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
api: getCustomerSimpleList,
|
api: () => getCustomerSimpleList(),
|
||||||
labelField: 'name',
|
fieldNames: {
|
||||||
valueField: 'id',
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
},
|
||||||
placeholder: '请选择客户',
|
placeholder: '请选择客户',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -40,7 +40,12 @@ function onRefresh() {
|
||||||
|
|
||||||
/** 创建回款计划 */
|
/** 创建回款计划 */
|
||||||
function handleCreate() {
|
function handleCreate() {
|
||||||
formModalApi.setData(null).open();
|
formModalApi
|
||||||
|
.setData({
|
||||||
|
contractId: props.contractId,
|
||||||
|
customerId: props.customerId,
|
||||||
|
})
|
||||||
|
.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建回款 */
|
/** 创建回款 */
|
||||||
|
|
|
@ -66,6 +66,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<CrmReceivablePlanApi.Plan>();
|
const data = modalApi.getData<CrmReceivablePlanApi.Plan>();
|
||||||
if (!data || !data.id) {
|
if (!data || !data.id) {
|
||||||
|
// 设置到 values
|
||||||
|
await formApi.setValues(data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
|
|
|
@ -120,7 +120,7 @@ export function useBindFormSchema(): VbenFormSchema[] {
|
||||||
label: '门店名称',
|
label: '门店名称',
|
||||||
dependencies: {
|
dependencies: {
|
||||||
triggerFields: ['id'],
|
triggerFields: ['id'],
|
||||||
disabled: () => true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ export function useBindFormSchema(): VbenFormSchema[] {
|
||||||
trigger(values, form) {
|
trigger(values, form) {
|
||||||
form.setFieldValue('verifyUsers', values.verifyUserIds);
|
form.setFieldValue('verifyUsers', values.verifyUserIds);
|
||||||
},
|
},
|
||||||
disabled: () => true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in New Issue