feat: 客户管理国际化翻译
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -228,5 +228,6 @@
|
|||||||
"vue.server.hybridMode": true,
|
"vue.server.hybridMode": true,
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"oxc.enable": false,
|
"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 { useAccess } from '@vben/access';
|
||||||
|
|
||||||
import { getAreaTree } from '#/api/system/area';
|
import { getAreaTree } from '#/api/system/area';
|
||||||
|
import { $t } from '#/locales';
|
||||||
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils';
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
const { hasAccessByCodes } = useAccess();
|
||||||
@@ -22,44 +23,34 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '客户名称',
|
label: $t('customer.customerName'),
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入客户名称',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '客户编号',
|
label: $t('customer.customerSn'),
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入客户编号',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'type',
|
fieldName: 'type',
|
||||||
label: '客户类型',
|
label: $t('customer.customerType'),
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
|
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
|
||||||
placeholder: '请选择客户类型',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'contacts',
|
fieldName: 'contacts',
|
||||||
label: '联系人',
|
label: $t('customer.contacts'),
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入联系人',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'areaIds',
|
fieldName: 'areaIds',
|
||||||
label: '地区',
|
label: $t('customer.area'),
|
||||||
rules: 'required',
|
rules: 'required',
|
||||||
component: 'ApiCascader',
|
component: 'ApiCascader',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
@@ -72,40 +63,27 @@ export function useFormSchema(): VbenFormSchema[] {
|
|||||||
children: 'children',
|
children: 'children',
|
||||||
},
|
},
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
placeholder: '请输入地区',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'role',
|
fieldName: 'role',
|
||||||
label: '角色',
|
label: $t('customer.role'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入角色',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'phone',
|
fieldName: 'phone',
|
||||||
label: '联系电话',
|
label: $t('customer.phone'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入联系电话',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'email',
|
fieldName: 'email',
|
||||||
label: '邮箱',
|
label: $t('customer.email'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入邮箱',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'remark',
|
fieldName: 'remark',
|
||||||
label: '备注',
|
label: $t('customer.remarks'),
|
||||||
component: 'Textarea',
|
component: 'Textarea',
|
||||||
componentProps: {
|
|
||||||
placeholder: '请输入备注',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -115,44 +93,40 @@ export function useGridFormSchema(): VbenFormSchema[] {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
fieldName: 'name',
|
fieldName: 'name',
|
||||||
label: '客户名称',
|
label: $t('customer.customerName'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: '请输入客户名称',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'code',
|
fieldName: 'code',
|
||||||
label: '客户编号',
|
label: $t('customer.customerSn'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: '请输入客户编号',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'type',
|
fieldName: 'type',
|
||||||
label: '客户类型',
|
label: $t('customer.customerType'),
|
||||||
component: 'Select',
|
component: 'Select',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
|
options: getDictOptions(DICT_TYPE.LIC_CUSTOMER_TYPE, 'number'),
|
||||||
placeholder: '请选择客户类型',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'contacts',
|
fieldName: 'contacts',
|
||||||
label: '联系人',
|
label: $t('customer.contacts'),
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
placeholder: '请输入联系人',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fieldName: 'createTime',
|
fieldName: 'createTime',
|
||||||
label: '创建时间',
|
label: $t('customer.creationTime'),
|
||||||
component: 'RangePicker',
|
component: 'RangePicker',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
...getRangePickerDefaultProps(),
|
...getRangePickerDefaultProps(),
|
||||||
@@ -169,17 +143,17 @@ export function useGridColumns(
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '客户名称',
|
title: $t('customer.customerName'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'code',
|
field: 'code',
|
||||||
title: '客户编号',
|
title: $t('customer.customerSn'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'type',
|
field: 'type',
|
||||||
title: '客户类型',
|
title: $t('customer.customerType'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
cellRender: {
|
cellRender: {
|
||||||
name: 'CellDict',
|
name: 'CellDict',
|
||||||
@@ -188,43 +162,43 @@ export function useGridColumns(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'contacts',
|
field: 'contacts',
|
||||||
title: '联系人',
|
title: $t('customer.contacts'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'areaNames',
|
field: 'areaNames',
|
||||||
title: '地区',
|
title: $t('customer.area'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'role',
|
field: 'role',
|
||||||
title: '角色',
|
title: $t('customer.role'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'phone',
|
field: 'phone',
|
||||||
title: '联系电话',
|
title: $t('customer.phone'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'email',
|
field: 'email',
|
||||||
title: '邮箱',
|
title: $t('customer.email'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'remark',
|
field: 'remark',
|
||||||
title: '备注',
|
title: $t('customer.remarks'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '创建时间',
|
title: $t('customer.creationTime'),
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
formatter: 'formatDateTime',
|
formatter: 'formatDateTime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'operation',
|
field: 'operation',
|
||||||
title: '操作',
|
title: $t('customer.operation'),
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
@@ -233,7 +207,7 @@ export function useGridColumns(
|
|||||||
cellRender: {
|
cellRender: {
|
||||||
attrs: {
|
attrs: {
|
||||||
nameField: 'id',
|
nameField: 'id',
|
||||||
nameTitle: '客户',
|
nameTitle: $t('customer.customer'),
|
||||||
onClick: onActionClick,
|
onClick: onActionClick,
|
||||||
},
|
},
|
||||||
name: 'CellOperation',
|
name: 'CellOperation',
|
||||||
|
|||||||
@@ -63,7 +63,10 @@ async function onDelete(row: CustomerApi.Customer) {
|
|||||||
/** 导出表格 */
|
/** 导出表格 */
|
||||||
async function onExport() {
|
async function onExport() {
|
||||||
const data = await exportCustomer(await gridApi.formApi.getValues());
|
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>
|
<Page auto-content-height>
|
||||||
<FormModal @success="onRefresh" />
|
<FormModal @success="onRefresh" />
|
||||||
|
|
||||||
<Grid table-title="客户列表">
|
<Grid :table-title="$t('customer.customerList')">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Button
|
<Button
|
||||||
:icon="h(Plus)"
|
:icon="h(Plus)"
|
||||||
@@ -128,7 +131,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
|||||||
@click="onCreate"
|
@click="onCreate"
|
||||||
v-access:code="['license:customer:create']"
|
v-access:code="['license:customer:create']"
|
||||||
>
|
>
|
||||||
{{ $t('ui.actionTitle.create', ['客户']) }}
|
{{ $t('ui.actionTitle.create', [$t('customer.customer')]) }}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
:icon="h(Download)"
|
:icon="h(Download)"
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ const emit = defineEmits(['success']);
|
|||||||
const formData = ref<CustomerApi.Customer>();
|
const formData = ref<CustomerApi.Customer>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id
|
||||||
? $t('ui.actionTitle.edit', ['客户'])
|
? $t('ui.actionTitle.edit', [$t('customer.customer')])
|
||||||
: $t('ui.actionTitle.create', ['客户']);
|
: $t('ui.actionTitle.create', [$t('customer.customer')]);
|
||||||
});
|
});
|
||||||
|
|
||||||
const [Form, formApi] = useVbenForm({
|
const [Form, formApi] = useVbenForm({
|
||||||
|
|||||||
Reference in New Issue
Block a user