feat: 客户管理国际化翻译
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -228,5 +228,6 @@
|
||||
"vue.server.hybridMode": true,
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"oxc.enable": false,
|
||||
"cSpell.words": ["Cascader"]
|
||||
"cSpell.words": ["Cascader"],
|
||||
"i18n-ally.extract.ignored": ["Input", "Select", "Textarea"]
|
||||
}
|
||||
|
||||
15
apps/web-antd/src/locales/langs/en-US/customer.json
Normal file
15
apps/web-antd/src/locales/langs/en-US/customer.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"creationTime": "Creation Time",
|
||||
"remarks": "Remarks",
|
||||
"email": "Email",
|
||||
"phone": "Phone Number",
|
||||
"role": "Role",
|
||||
"area": "Region",
|
||||
"contacts": "Contact Person",
|
||||
"customerType": "Customer Type",
|
||||
"customerSn": "Customer Sn",
|
||||
"customerName": "Customer Name",
|
||||
"operation": "Operation",
|
||||
"customer": "Customer",
|
||||
"customerList": "Customer List"
|
||||
}
|
||||
15
apps/web-antd/src/locales/langs/zh-CN/customer.json
Normal file
15
apps/web-antd/src/locales/langs/zh-CN/customer.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"creationTime": "创建时间",
|
||||
"remarks": "备注",
|
||||
"email": "邮箱",
|
||||
"phone": "联系电话",
|
||||
"role": "角色",
|
||||
"area": "地区",
|
||||
"contacts": "联系人",
|
||||
"customerType": "客户类型",
|
||||
"customerSn": "客户编号",
|
||||
"customerName": "客户名称",
|
||||
"operation": "操作",
|
||||
"customer": "客户",
|
||||
"customerList": "客户列表"
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
@@ -63,7 +63,10 @@ async function onDelete(row: CustomerApi.Customer) {
|
||||
/** 导出表格 */
|
||||
async function onExport() {
|
||||
const data = await exportCustomer(await gridApi.formApi.getValues());
|
||||
downloadFileFromBlobPart({ fileName: '客户.xls', source: data });
|
||||
downloadFileFromBlobPart({
|
||||
fileName: `${$t('customer.customer')}.xls`,
|
||||
source: data,
|
||||
});
|
||||
}
|
||||
|
||||
/** 表格操作按钮的回调函数 */
|
||||
@@ -120,7 +123,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
<Page auto-content-height>
|
||||
<FormModal @success="onRefresh" />
|
||||
|
||||
<Grid table-title="客户列表">
|
||||
<Grid :table-title="$t('customer.customerList')">
|
||||
<template #toolbar-tools>
|
||||
<Button
|
||||
:icon="h(Plus)"
|
||||
@@ -128,7 +131,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||
@click="onCreate"
|
||||
v-access:code="['license:customer:create']"
|
||||
>
|
||||
{{ $t('ui.actionTitle.create', ['客户']) }}
|
||||
{{ $t('ui.actionTitle.create', [$t('customer.customer')]) }}
|
||||
</Button>
|
||||
<Button
|
||||
:icon="h(Download)"
|
||||
|
||||
@@ -21,8 +21,8 @@ const emit = defineEmits(['success']);
|
||||
const formData = ref<CustomerApi.Customer>();
|
||||
const getTitle = computed(() => {
|
||||
return formData.value?.id
|
||||
? $t('ui.actionTitle.edit', ['客户'])
|
||||
: $t('ui.actionTitle.create', ['客户']);
|
||||
? $t('ui.actionTitle.edit', [$t('customer.customer')])
|
||||
: $t('ui.actionTitle.create', [$t('customer.customer')]);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
|
||||
Reference in New Issue
Block a user