diff --git a/.vscode/settings.json b/.vscode/settings.json index ecb4763..dcd0b5e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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"] } diff --git a/apps/web-antd/src/locales/langs/en-US/customer.json b/apps/web-antd/src/locales/langs/en-US/customer.json new file mode 100644 index 0000000..50fe96a --- /dev/null +++ b/apps/web-antd/src/locales/langs/en-US/customer.json @@ -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" +} diff --git a/apps/web-antd/src/locales/langs/zh-CN/customer.json b/apps/web-antd/src/locales/langs/zh-CN/customer.json new file mode 100644 index 0000000..5001574 --- /dev/null +++ b/apps/web-antd/src/locales/langs/zh-CN/customer.json @@ -0,0 +1,15 @@ +{ + "creationTime": "创建时间", + "remarks": "备注", + "email": "邮箱", + "phone": "联系电话", + "role": "角色", + "area": "地区", + "contacts": "联系人", + "customerType": "客户类型", + "customerSn": "客户编号", + "customerName": "客户名称", + "operation": "操作", + "customer": "客户", + "customerList": "客户列表" +} diff --git a/apps/web-antd/src/views/license/customer/data.ts b/apps/web-antd/src/views/license/customer/data.ts index 3b6cf8e..93f1436 100644 --- a/apps/web-antd/src/views/license/customer/data.ts +++ b/apps/web-antd/src/views/license/customer/data.ts @@ -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', diff --git a/apps/web-antd/src/views/license/customer/index.vue b/apps/web-antd/src/views/license/customer/index.vue index 265b19c..f3af5dc 100644 --- a/apps/web-antd/src/views/license/customer/index.vue +++ b/apps/web-antd/src/views/license/customer/index.vue @@ -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({ - +