feat:【antd】【crm】客户公海配置优化
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
|
|
||||||
export const CustomerDetailsInfo = defineAsyncComponent(
|
|
||||||
() => import('./detail/modules/info.vue'),
|
|
||||||
);
|
|
||||||
|
|
||||||
export const DistributeForm = defineAsyncComponent(
|
export const DistributeForm = defineAsyncComponent(
|
||||||
() => import('./poolConfig/distribute-form.vue'),
|
() => import('./poolConfig/distribute-form.vue'),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
},
|
},
|
||||||
rowConfig: {
|
rowConfig: {
|
||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
|
isHover: true,
|
||||||
},
|
},
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
refresh: true,
|
refresh: true,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { CrmCustomerPoolConfigApi } from '#/api/crm/customer/poolConfig';
|
import type { CrmCustomerPoolConfigApi } from '#/api/crm/customer/poolConfig';
|
||||||
|
|
||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
@@ -16,95 +17,96 @@ import { $t } from '#/locales';
|
|||||||
|
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
|
|
||||||
|
const schema: VbenFormSchema[] = [
|
||||||
|
{
|
||||||
|
component: 'RadioGroup',
|
||||||
|
fieldName: 'enabled',
|
||||||
|
label: '客户公海规则设置',
|
||||||
|
componentProps: {
|
||||||
|
options: [
|
||||||
|
{ label: '开启', value: true },
|
||||||
|
{ label: '关闭', value: false },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'InputNumber',
|
||||||
|
fieldName: 'contactExpireDays',
|
||||||
|
componentProps: {
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
|
renderComponentContent: () => ({
|
||||||
|
addonAfter: () => '天不跟进或',
|
||||||
|
}),
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['enabled'],
|
||||||
|
show: (value) => value.enabled,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'InputNumber',
|
||||||
|
fieldName: 'dealExpireDays',
|
||||||
|
renderComponentContent: () => ({
|
||||||
|
addonBefore: () => '或',
|
||||||
|
addonAfter: () => '天未成交',
|
||||||
|
}),
|
||||||
|
componentProps: {
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['enabled'],
|
||||||
|
show: (value) => value.enabled,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'RadioGroup',
|
||||||
|
fieldName: 'notifyEnabled',
|
||||||
|
label: '提前提醒设置',
|
||||||
|
componentProps: {
|
||||||
|
options: [
|
||||||
|
{ label: '开启', value: true },
|
||||||
|
{ label: '关闭', value: false },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['enabled'],
|
||||||
|
show: (value) => value.enabled,
|
||||||
|
},
|
||||||
|
defaultValue: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'InputNumber',
|
||||||
|
fieldName: 'notifyDays',
|
||||||
|
componentProps: {
|
||||||
|
min: 0,
|
||||||
|
precision: 0,
|
||||||
|
},
|
||||||
|
renderComponentContent: () => ({
|
||||||
|
addonBefore: () => '提前',
|
||||||
|
addonAfter: () => '天提醒',
|
||||||
|
}),
|
||||||
|
dependencies: {
|
||||||
|
triggerFields: ['notifyEnabled'],
|
||||||
|
show: (value) => value.enabled && value.notifyEnabled,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
commonConfig: {
|
commonConfig: {
|
||||||
// 所有表单项
|
|
||||||
labelClass: 'w-2/6',
|
labelClass: 'w-2/6',
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
wrapperClass: 'grid-cols-1',
|
wrapperClass: 'grid-cols-1',
|
||||||
actionWrapperClass: 'text-center',
|
actionWrapperClass: 'text-center',
|
||||||
schema: [
|
schema,
|
||||||
{
|
handleSubmit,
|
||||||
component: 'RadioGroup',
|
|
||||||
fieldName: 'enabled',
|
|
||||||
label: '客户公海规则设置',
|
|
||||||
componentProps: {
|
|
||||||
options: [
|
|
||||||
{ label: '开启', value: true },
|
|
||||||
{ label: '关闭', value: false },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'InputNumber',
|
|
||||||
fieldName: 'contactExpireDays',
|
|
||||||
componentProps: {
|
|
||||||
min: 0,
|
|
||||||
precision: 0,
|
|
||||||
},
|
|
||||||
renderComponentContent: () => ({
|
|
||||||
addonAfter: () => '天不跟进或',
|
|
||||||
}),
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: ['enabled'],
|
|
||||||
show: (value) => value.enabled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'InputNumber',
|
|
||||||
fieldName: 'dealExpireDays',
|
|
||||||
renderComponentContent: () => ({
|
|
||||||
addonBefore: () => '或',
|
|
||||||
addonAfter: () => '天未成交',
|
|
||||||
}),
|
|
||||||
componentProps: {
|
|
||||||
min: 0,
|
|
||||||
precision: 0,
|
|
||||||
},
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: ['enabled'],
|
|
||||||
show: (value) => value.enabled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'RadioGroup',
|
|
||||||
fieldName: 'notifyEnabled',
|
|
||||||
label: '提前提醒设置',
|
|
||||||
componentProps: {
|
|
||||||
options: [
|
|
||||||
{ label: '开启', value: true },
|
|
||||||
{ label: '关闭', value: false },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: ['enabled'],
|
|
||||||
show: (value) => value.enabled,
|
|
||||||
},
|
|
||||||
defaultValue: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
component: 'InputNumber',
|
|
||||||
fieldName: 'notifyDays',
|
|
||||||
componentProps: {
|
|
||||||
min: 0,
|
|
||||||
precision: 0,
|
|
||||||
},
|
|
||||||
renderComponentContent: () => ({
|
|
||||||
addonBefore: () => '提前',
|
|
||||||
addonAfter: () => '天提醒',
|
|
||||||
}),
|
|
||||||
dependencies: {
|
|
||||||
triggerFields: ['notifyEnabled'],
|
|
||||||
show: (value) => value.enabled && value.notifyEnabled,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
// 提交函数
|
|
||||||
handleSubmit: onSubmit,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
async function onSubmit() {
|
/** 提交表单 */
|
||||||
|
async function handleSubmit() {
|
||||||
const { valid } = await formApi.validate();
|
const { valid } = await formApi.validate();
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
@@ -120,26 +122,20 @@ async function onSubmit() {
|
|||||||
if (!data.notifyEnabled) {
|
if (!data.notifyEnabled) {
|
||||||
data.notifyDays = undefined;
|
data.notifyDays = undefined;
|
||||||
}
|
}
|
||||||
formApi.setValues(data);
|
await saveCustomerPoolConfig(data);
|
||||||
try {
|
// 关闭并提示
|
||||||
await saveCustomerPoolConfig(data);
|
await formApi.setValues(data);
|
||||||
// 关闭并提示
|
emit('success');
|
||||||
emit('success');
|
message.success($t('ui.actionMessage.operationSuccess'));
|
||||||
message.success($t('ui.actionMessage.operationSuccess'));
|
|
||||||
} finally {
|
|
||||||
formApi.setValues(data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取配置 */
|
||||||
async function getConfigInfo() {
|
async function getConfigInfo() {
|
||||||
try {
|
const res = await getCustomerPoolConfig();
|
||||||
const res = await getCustomerPoolConfig();
|
await formApi.setValues(res);
|
||||||
formApi.setValues(res);
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 初始化 */
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getConfigInfo();
|
getConfigInfo();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user