feat: 客户管理国际化翻译

This commit is contained in:
caiyuchao
2025-05-24 11:45:25 +08:00
parent ee36fe339d
commit 7206389717
6 changed files with 67 additions and 59 deletions

View File

@@ -5,6 +5,7 @@ import type { CustomerApi } from '#/api/license/customer';
import { useAccess } from '@vben/access';
import { getAreaTree } from '#/api/system/area';
import { $t } from '#/locales';
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
const { hasAccessByCodes } = useAccess();
@@ -22,44 +23,34 @@ export function useFormSchema(): VbenFormSchema[] {
},
{
fieldName: 'name',
label: '客户名称',
label: $t('customer.customerName'),
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入客户名称',
},
},
{
fieldName: 'code',
label: '客户编号',
label: $t('customer.customerSn'),
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入客户编号',
},
},
{
fieldName: 'type',
label: '客户类型',
label: $t('customer.customerType'),
rules: 'required',
component: 'Select',
componentProps: {
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
placeholder: '请选择客户类型',
},
},
{
fieldName: 'contacts',
label: '联系人',
label: $t('customer.contacts'),
rules: 'required',
component: 'Input',
componentProps: {
placeholder: '请输入联系人',
},
},
{
fieldName: 'areaIds',
label: '地区',
label: $t('customer.area'),
rules: 'required',
component: 'ApiCascader',
componentProps: {
@@ -72,40 +63,27 @@ export function useFormSchema(): VbenFormSchema[] {
children: 'children',
},
showSearch: true,
placeholder: '请输入地区',
},
},
{
fieldName: 'role',
label: '角色',
label: $t('customer.role'),
component: 'Input',
componentProps: {
placeholder: '请输入角色',
},
},
{
fieldName: 'phone',
label: '联系电话',
label: $t('customer.phone'),
component: 'Input',
componentProps: {
placeholder: '请输入联系电话',
},
},
{
fieldName: 'email',
label: '邮箱',
label: $t('customer.email'),
component: 'Input',
componentProps: {
placeholder: '请输入邮箱',
},
},
{
fieldName: 'remark',
label: '备注',
label: $t('customer.remarks'),
component: 'Textarea',
componentProps: {
placeholder: '请输入备注',
},
},
];
}
@@ -115,44 +93,40 @@ export function useGridFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'name',
label: '客户名称',
label: $t('customer.customerName'),
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入客户名称',
},
},
{
fieldName: 'code',
label: '客户编号',
label: $t('customer.customerSn'),
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入客户编号',
},
},
{
fieldName: 'type',
label: '客户类型',
label: $t('customer.customerType'),
component: 'Select',
componentProps: {
allowClear: true,
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
placeholder: '请选择客户类型',
},
},
{
fieldName: 'contacts',
label: '联系人',
label: $t('customer.contacts'),
component: 'Input',
componentProps: {
allowClear: true,
placeholder: '请输入联系人',
},
},
{
fieldName: 'createTime',
label: '创建时间',
label: $t('customer.creationTime'),
component: 'RangePicker',
componentProps: {
...getRangePickerDefaultProps(),
@@ -169,17 +143,17 @@ export function useGridColumns(
return [
{
field: 'name',
title: '客户名称',
title: $t('customer.customerName'),
minWidth: 120,
},
{
field: 'code',
title: '客户编号',
title: $t('customer.customerSn'),
minWidth: 120,
},
{
field: 'type',
title: '客户类型',
title: $t('customer.customerType'),
minWidth: 120,
cellRender: {
name: 'CellDict',
@@ -188,43 +162,43 @@ export function useGridColumns(
},
{
field: 'contacts',
title: '联系人',
title: $t('customer.contacts'),
minWidth: 120,
},
{
field: 'areaNames',
title: '地区',
title: $t('customer.area'),
minWidth: 120,
},
{
field: 'role',
title: '角色',
title: $t('customer.role'),
minWidth: 120,
},
{
field: 'phone',
title: '联系电话',
title: $t('customer.phone'),
minWidth: 120,
},
{
field: 'email',
title: '邮箱',
title: $t('customer.email'),
minWidth: 120,
},
{
field: 'remark',
title: '备注',
title: $t('customer.remarks'),
minWidth: 120,
},
{
field: 'createTime',
title: '创建时间',
title: $t('customer.creationTime'),
minWidth: 120,
formatter: 'formatDateTime',
},
{
field: 'operation',
title: '操作',
title: $t('customer.operation'),
minWidth: 200,
align: 'center',
fixed: 'right',
@@ -233,7 +207,7 @@ export function useGridColumns(
cellRender: {
attrs: {
nameField: 'id',
nameTitle: '客户',
nameTitle: $t('customer.customer'),
onClick: onActionClick,
},
name: 'CellOperation',