feat: 项目管理字段添加和调整

This commit is contained in:
caiyuchao
2025-08-15 16:02:49 +08:00
parent ef6da4f3c6
commit 74e9b23f71
6 changed files with 143 additions and 31 deletions

View File

@@ -4,6 +4,8 @@ import type { CustomerApi } from '#/api/license/customer';
import { ref } from 'vue';
import { useAccess } from '@vben/access';
import { z } from '#/adapter/form';
import {
isCustomerCodeUnique,
@@ -13,6 +15,8 @@ import { getAreaTree } from '#/api/system/area';
import { $t } from '#/locales';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
const { hasAccessByRoles } = useAccess();
export const formData = ref<CustomerApi.Customer>();
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
@@ -97,6 +101,10 @@ export function useFormSchema(): VbenFormSchema[] {
label: $t('customer.contacts'),
rules: 'required',
component: 'Input',
dependencies: {
triggerFields: ['id'],
show: (values) => !values.id || hasAccessByRoles(['business']),
},
},
{
fieldName: 'areaIds',
@@ -119,11 +127,19 @@ export function useFormSchema(): VbenFormSchema[] {
fieldName: 'role',
label: $t('customer.role'),
component: 'Input',
dependencies: {
triggerFields: ['id'],
show: (values) => !values.id || hasAccessByRoles(['business']),
},
},
{
fieldName: 'phone',
label: $t('customer.phone'),
component: 'Input',
dependencies: {
triggerFields: ['id'],
show: (values) => !values.id || hasAccessByRoles(['business']),
},
},
{
fieldName: 'email',
@@ -214,6 +230,7 @@ export function useGridColumns(): VxeTableGridOptions<CustomerApi.Customer>['col
field: 'contacts',
title: $t('customer.contacts'),
minWidth: 120,
visible: hasAccessByRoles(['business']),
},
{
field: 'areaNames',
@@ -224,11 +241,13 @@ export function useGridColumns(): VxeTableGridOptions<CustomerApi.Customer>['col
field: 'role',
title: $t('customer.role'),
minWidth: 120,
visible: hasAccessByRoles(['business']),
},
{
field: 'phone',
title: $t('customer.phone'),
minWidth: 120,
visible: hasAccessByRoles(['business']),
},
{
field: 'email',