Skip to content

Commit

Permalink
Merge pull request #306 from Jzow/master
Browse files Browse the repository at this point in the history
Add English language support to the business
  • Loading branch information
Jzow authored Mar 22, 2024
2 parents c6ba957 + 00bbe07 commit 652e664
Show file tree
Hide file tree
Showing 32 changed files with 420 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public class SysMenu implements Serializable {
@TableField("title")
private String title;

/**
* 英文标题
*/
@TableField("title_english")
private String titleEnglish;

/**
* 父级菜单id
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ public class SysUser implements Serializable {
*/
private String phoneNumber;

/**
* 系统语言
*/
private String systemLanguage;

/**
* 是否为管理者 0==管理者 1==员工
*/
Expand Down
2 changes: 2 additions & 0 deletions core/domain/src/main/java/com/wansenai/vo/MenuVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class MenuVO {

private String title;

private String titleEnglish;

private String path;

private String component;
Expand Down
3 changes: 3 additions & 0 deletions core/domain/src/main/java/com/wansenai/vo/UserInfoVO.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class UserInfoVO {
/** 用户头像地址 */
private String avatar;

/** 用户语言 */
private String userLanguage;

/** 用户token */
private String token;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ public UserInfoVO getCurrentUser() {
.position(user.getPosition())
.description(user.getDescription())
.phoneNumber(user.getPhoneNumber())
.userLanguage(user.getSystemLanguage())
.userName(user.getUserName())
.avatar(user.getAvatar())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ open class SysMenuServiceImpl(
.id(menu.id)
.name(menu.name)
.title(menu.title)
.titleEnglish(menu.titleEnglish)
.menuType(menu.menuType)
.path(menu.path)
.component(menu.component)
Expand Down
2 changes: 2 additions & 0 deletions web/src/api/sys/model/userModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,6 @@ export interface GetUserInfoModel {
roleName: string;
// 头像
avatar: string;
// 用户语言
userLanguage: string;
}
8 changes: 4 additions & 4 deletions web/src/layouts/default/setting/SettingDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,12 +415,12 @@ export default defineComponent({
{/*{renderSiderTheme()}*/}
{/*<Divider>{() => t('layout.setting.interfaceFunction')}</Divider>*/}
{/*{renderFeatures()}*/}
<Divider>{() => t('layout.setting.interfaceDisplay')}</Divider>
{renderContent()}
{/*<Divider>{() => t('layout.setting.interfaceDisplay')}</Divider>*/}
{/*{renderContent()}*/}
{/*<Divider>{() => t('layout.setting.animation')}</Divider>*/}
{/*{renderTransition()}*/}
<Divider />
<SettingFooter />
{/*<Divider />*/}
{/*<SettingFooter />*/}
</BasicDrawer>
);
},
Expand Down
21 changes: 21 additions & 0 deletions web/src/locales/lang/en/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
today: 'Today',
yesterday: 'Yesterday',
thisMonth: 'This Month',
thisYear: 'This Year',
todayRetail: 'Today Retail',
yesterdayRetail: 'Yesterday Retail',
thisMonthRetail: 'This Month Retail',
thisYearRetail: 'This Year Retail',
todaySales: 'Today Sales',
yesterdaySales: 'Yesterday Sales',
thisMonthSales: 'This Month Sales',
thisYearSales: 'This Year Sales',
todayPurchase: 'Today Purchase',
yesterdayPurchase: 'Yesterday Purchase',
thisMonthPurchase: 'This Month Purchase',
thisYearPurchase: 'This Year Purchase',
retailStatistics: 'Retail Statistics',
salesStatistics: 'Sales Statistics',
purchaseStatistics: 'Purchase Statistics',
}
4 changes: 2 additions & 2 deletions web/src/locales/lang/en/retail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
shipments:{
title: 'Retail Shipments List',
table:{
customer: 'Customer',
member: 'Member',
receiptNumber: 'Receipt number',
productInformation: 'Product information',
productQuantity: 'Product quantity',
Expand All @@ -29,7 +29,7 @@ export default {
refund:{
title: 'Retail Return List',
table:{
customer: 'Customer',
member: 'Member',
receiptNumber: 'Receipt number',
productInformation: 'Product information',
totalAmount: 'Total amount',
Expand Down
82 changes: 82 additions & 0 deletions web/src/locales/lang/en/sales.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
export default {
selectData: 'Please select a piece of data',
modifyDataPrompt: 'Sorry, only unapproved documents can be edited!',
partialSales: 'Partial Sales',
completeSales: 'Complete Sales',
order:{
title: 'Sales Order List',
table:{
customer: 'Customer',
receiptNumber: 'Receipt number',
productInformation: 'Product information',
productQuantity: 'Product quantity',
totalAmount: 'Total amount',
totalIncludingTax: 'Total including tax',
collectDeposit: 'Collect Deposit',
receiptDate: 'Receipt date',
operator: 'operator',
status: 'status',
},
header:{
startDate: 'Start date',
endDate: 'End date',
receiptRemark: 'receipt remark',
},
export: {
exportData: 'Sales Order Data ',
noData: 'No data available',
}
},
shipments:{
title: 'Sales Shipments List',
table:{
customer: 'Customer',
receiptNumber: 'Receipt number',
productInformation: 'Product information',
productQuantity: 'Product quantity',
totalAmount: 'Total amount',
totalIncludingTax: 'Total including tax',
collectAmount: 'Collect amount',
thisTimeCollectAmount: 'This time collect amount',
thisTimeArrearsAmount: 'This time arrears amount',
receiptDate: 'Receipt date',
operator: 'operator',
status: 'status',
},
header:{
startDate: 'Start date',
endDate: 'End date',
receiptRemark: 'receipt remark',
},
export: {
exportData: 'Sales Shipments Data ',
noData: 'No data available',
}
},
refund:{
title: '销售退货列表',
table:{
customer: 'Customer',
receiptNumber: 'Receipt number',
productInformation: 'Product information',
productQuantity: 'Product quantity',
totalAmount: 'Total amount',
totalIncludingTax: 'Total including tax',
refundAmount: 'Refund Amount',
thisTimeRefundAmount: 'This time refund amount',
thisTimeArrearsAmount: 'This time arrears amount',
receiptDate: 'Receipt date',
operator: 'operator',
status: 'status',
},
header:{
startDate: 'Start date',
endDate: 'End date',
receiptRemark: 'receipt remark',
},
export: {
exportData: 'Sales Return Data',
noData: 'No data available',
}
}
};
21 changes: 21 additions & 0 deletions web/src/locales/lang/zh-CN/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default {
today: '今日',
yesterday: '昨日',
thisMonth: '本月',
thisYear: '今年',
todayRetail: '今日零售',
yesterdayRetail: '昨日零售',
thisMonthRetail: '本月累计零售',
thisYearRetail: '今年累计零售',
todaySales: '今日销售',
yesterdaySales: '昨日销售',
thisMonthSales: '本月累计销售',
thisYearSales: '今年累计销售',
todayPurchase: '今日采购',
yesterdayPurchase: '昨日采购',
thisMonthPurchase: '本月累计采购',
thisYearPurchase: '今年累计采购',
retailStatistics: '零售统计',
salesStatistics: '销售统计',
purchaseStatistics: '采购统计',
}
4 changes: 2 additions & 2 deletions web/src/locales/lang/zh-CN/retail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
shipments:{
title: '零售出库列表',
table:{
customer: '会员',
member: '会员',
receiptNumber: '单据编号',
productInformation: '商品信息',
productQuantity: '商品数量',
Expand All @@ -29,7 +29,7 @@ export default {
refund:{
title: '零售退货列表',
table:{
customer: '会员',
member: '会员',
receiptNumber: '单据编号',
productInformation: '商品信息',
totalAmount: '金额合计',
Expand Down
80 changes: 80 additions & 0 deletions web/src/locales/lang/zh-CN/sales.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
export default {
selectData: '请选择一条数据',
modifyDataPrompt: '抱歉,只有未审核的单据才能编辑!',
order:{
title: '销售订单列表',
table:{
customer: '客户',
receiptNumber: '单据编号',
productInformation: '商品信息',
productQuantity: '商品数量',
totalAmount: '金额合计',
totalIncludingTax: '含税合计',
collectDeposit: '收取定金',
receiptDate: '单据日期',
operator: '操作员',
status: '状态',
},
header:{
startDate: '开始日期',
endDate: '结束日期',
receiptRemark: '单据备注',
},
export: {
exportData: '销售订单数据 ',
noData: '无可用数据导出',
}
},
shipments:{
title: '销售出库列表',
table:{
customer: '客户',
receiptNumber: '单据编号',
productInformation: '商品信息',
productQuantity: '商品数量',
totalAmount: '金额合计',
totalIncludingTax: '含税合计',
collectAmount: '待收金额',
thisTimeCollectAmount: '本次收款',
thisTimeArrearsAmount: '本次欠款',
receiptDate: '单据日期',
operator: '操作员',
status: '状态',
},
header:{
startDate: '开始日期',
endDate: '结束日期',
receiptRemark: '单据备注',
},
export: {
exportData: '销售出库数据 ',
noData: '无可用数据导出',
}
},
refund:{
title: '销售退货列表',
table:{
customer: '客户',
receiptNumber: '单据编号',
productInformation: '商品信息',
productQuantity: '商品数量',
totalAmount: '金额合计',
totalIncludingTax: '含税合计',
refundAmount: '待退金额',
thisRefundAmount: '本次退款',
thisArrearsAmount: '本次欠款',
receiptDate: '单据日期',
operator: '操作员',
status: '状态',
},
header:{
startDate: '开始日期',
endDate: '结束日期',
receiptRemark: '单据备注',
},
export: {
exportData: '销售退货数据 ',
noData: '无可用数据导出',
}
}
};
4 changes: 2 additions & 2 deletions web/src/settings/projectSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const setting: ProjectConfig = {
// Menu mode
mode: MenuModeEnum.INLINE,
// Menu type
type: MenuTypeEnum.SIDEBAR,
type: MenuTypeEnum.MIX_SIDEBAR,
// Menu theme
theme: ThemeEnum.DARK,
// Split menu
Expand Down Expand Up @@ -161,7 +161,7 @@ const setting: ProjectConfig = {
showBreadCrumb: true,

// Whether to show the breadcrumb icon
showBreadCrumbIcon: false,
showBreadCrumbIcon: true,

// Use error-handler-plugin
useErrorHandle: false,
Expand Down
13 changes: 13 additions & 0 deletions web/src/store/modules/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ export const usePermissionStore = defineStore({
await this.changePermissionCode();
// routeList = (await getMenuList()) as AppRouteRecordRaw[];
const menus = await getMenuList();
// 从localStorage中获取用户信息userInfo,获取userLanguage的值 如果是en_US,这里菜单就需要显示英文 重写菜单的title
const { userInfo } = userStore;
const userLanguage = userInfo?.userLanguage;
if (userLanguage === 'en_US') {
menus.data.data.forEach((item: any) => {
item.meta.title = item.titleEnglish;
});
} else {
menus.data.data.forEach((item: any) => {
item.meta.title = item.title;
});
}
console.info(menus.data.data)
const menuTree = array2tree(menus.data.data);
routeList = menuTree as AppRouteRecordRaw[];
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/views/dashboard/analysis/components/GrowCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>

<div class="p-2 px-4 flex justify-between">
<span>{{ item.title }}</span>
<span>{{ item.title }}</span>
<CountTo prefix="" :startVal="1" :endVal="item.total" :decimals="2"/>
</div>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>

<div class="p-2 px-4 flex justify-between">
<span>{{ item.title }}</span>
<span>{{ item.title }}</span>
<CountTo prefix="" :startVal="1" :endVal="item.total" :decimals="2"/>
</div>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</div>

<div class="p-2 px-4 flex justify-between">
<span>{{ item.title }}</span>
<span>{{ item.title }}</span>
<CountTo prefix="" :startVal="1" :endVal="item.total" :decimals="2"/>
</div>
</Card>
Expand Down
Loading

0 comments on commit 652e664

Please sign in to comment.