add:菜单国际化

This commit is contained in:
zhangzq
2024-12-21 17:07:41 +08:00
parent c63404b718
commit 2d3fb1730e
40 changed files with 126 additions and 72 deletions

View File

@@ -1,48 +0,0 @@
2024-12-21 08:26:11.869 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'passRCL' defined in file [D:\workspace\hengseng\wms1.0\wms_pro\hd\nladmin-system\target\classes\org\nl\wms\decision_manage\handler\decisioner\impl\diy\PassRCLHandler.class]: Invocation of init method failed; nested exception is org.nl.common.domain.exception.BadRequestException: 启动失败当前策略passRCL没有实例信息
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
at org.nl.AppRun.main(AppRun.java:39)
Caused by: org.nl.common.domain.exception.BadRequestException: 启动失败当前策略passRCL没有实例信息
at org.nl.wms.decision_manage.handler.decisioner.Decisioner.afterPropertiesSet(Decisioner.java:36)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 16 common frames omitted
2024-12-21 08:37:26.771 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'passRCL' defined in file [D:\workspace\hengseng\wms1.0\wms_pro\hd\nladmin-system\target\classes\org\nl\wms\decision_manage\handler\decisioner\impl\diy\PassRCLHandler.class]: Invocation of init method failed; nested exception is org.nl.common.domain.exception.BadRequestException: 启动失败当前策略passRCL没有实例信息
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
at org.nl.AppRun.main(AppRun.java:39)
Caused by: org.nl.common.domain.exception.BadRequestException: 启动失败当前策略passRCL没有实例信息
at org.nl.wms.decision_manage.handler.decisioner.Decisioner.afterPropertiesSet(Decisioner.java:36)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
... 16 common frames omitted

View File

@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.entity.PageQuery;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.RedissonUtils;
import org.nl.wms.base_manage.material.service.IMdMeMaterialbaseService;
import org.nl.wms.base_manage.material.service.dao.MdMeMaterialbase;
@@ -46,6 +47,7 @@ public class BmMaterialController {
@PostMapping
public ResponseEntity<Object> create(@Validated @RequestBody MdMeMaterialbase dto) {
dto.setMaterial_id(IdUtil.getStringId());
materialService.save(dto);
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.entity.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
@@ -43,7 +44,7 @@ public class BmSupplierController {
@PostMapping
public ResponseEntity<Object> create(@Validated @RequestBody BmSupplier dto) {
dto.setSupp_id(IdUtil.getLongId());
dto.setSupp_id(IdUtil.getStringId());
dto.setCreate_id(SecurityUtils.getCurrentUserId());
dto.setCreate_name(SecurityUtils.getCurrentNickName());
dto.setCreate_time(DateUtil.now());
@@ -53,6 +54,7 @@ public class BmSupplierController {
@PutMapping
@Log("修改供应商")
public ResponseEntity<Object> update(@Validated @RequestBody BmSupplier dto) {
dto.setUpdate_id(SecurityUtils.getCurrentUserId());
dto.setUpdate_name(SecurityUtils.getCurrentNickName());
@@ -63,9 +65,12 @@ public class BmSupplierController {
@DeleteMapping
@Log("删除")
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
if (ids.length > 0) {
supplierService.removeByIds(Arrays.asList(ids));
for (Long id : ids) {
supplierService.removeById(id);
}
}
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@@ -23,8 +23,8 @@ public class BmSupplier implements Serializable {
/**
* 供应商标识
*/
@TableId
private Long supp_id;
@TableId("supp_id")
private String supp_id;
/**
* 供应商编码

View File

@@ -61,6 +61,19 @@ public class SysMenu implements Serializable {
*/
private String title;
/**
* 菜单标题
*/
private String zh_title;
/**
* 菜单标题
*/
private String en_title;
/**
* 菜单标题
*/
private String es_title;
/**
* 组件名称
*/

View File

@@ -40,6 +40,10 @@ public class MenuDto implements Serializable {
private String title;
private String zh_title;
private String en_title;
private String es_title;
private Integer menu_sort;
private String path;
@@ -106,4 +110,17 @@ public class MenuDto implements Serializable {
public int hashCode() {
return Objects.hash(menu_id);
}
public String getLocalTitle(String local){
if ("es".equals(local)){
return es_title;
}
if ("en".equals(local)){
return en_title;
}
if ("zh".equals(local)){
return zh_title;
}
return title;
}
}

View File

@@ -26,6 +26,7 @@ import org.nl.wms.system_manage.service.menu.dto.MenuDto;
import org.nl.wms.system_manage.service.menu.dto.MenuMetaVo;
import org.nl.wms.system_manage.service.menu.dto.MenuQuery;
import org.nl.wms.system_manage.service.menu.dto.MenuVo;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@@ -265,11 +266,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
@Override
public List<MenuVo> buildMenus(List<MenuDto> menuDtos) {
List<MenuVo> list = new LinkedList<>();
String lang = LocaleContextHolder.getLocale().getLanguage();
menuDtos.forEach(menuDTO -> {
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
// 一级目录需要加斜杠,不然会报警告
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
@@ -284,7 +286,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
menuVo.setComponent(menuDTO.getComponent());
}
}
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");
@@ -351,9 +353,22 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
queryWrapper = new QueryWrapper<SysMenu>().isNull("pid");
}
queryWrapper.orderByAsc("menu_sort");
return baseMapper.selectList(queryWrapper);
List<SysMenu> sysMenus = baseMapper.selectList(queryWrapper);
String lang = LocaleContextHolder.getLocale().getLanguage();
for (SysMenu sysMenu : sysMenus) {
sysMenu.setTitle(getLocal(lang, sysMenu));
}
return sysMenus;
}
private String getLocal(String lang,SysMenu sysMenu){
if ("es".equals(lang)){
return sysMenu.getEs_title();
}
if ("en".equals(lang)){
return sysMenu.getEn_title();
}
return sysMenu.getTitle();
};
@Override
public MenuDto doToDto(SysMenu entity) {
@@ -365,6 +380,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
menuDto.setType(entity.getType());
menuDto.setPermission(entity.getPermission());
menuDto.setTitle(entity.getTitle());
menuDto.setEs_title(entity.getEs_title());
menuDto.setEn_title(entity.getEn_title());
menuDto.setZh_title(entity.getZh_title());
menuDto.setMenu_sort(entity.getMenu_sort());
menuDto.setPath(entity.getPath());
menuDto.setComponent(entity.getComponent());
@@ -408,11 +426,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
public List<MenuVo> buildMenus(List<MenuDto> menuDtos, String pid) {
List<MenuVo> list = new LinkedList<>();
//剔除系统级菜单
String lang = LocaleContextHolder.getLocale().getLanguage();
menuDtos.forEach(menuDTO -> {
if (menuDTO != null) {
List<MenuDto> menuDtoList = menuDTO.getChildren();
MenuVo menuVo = new MenuVo();
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
// 一级目录需要加斜杠,不然会报警告
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
menuVo.setHidden(menuDTO.getHidden());
@@ -420,15 +439,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (!menuDTO.getIframe()) {
if (pid.equals(menuDTO.getPid())) {
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
//"2".equals(menuDTO.getType() 判断是不是目录
} else if (!pid.equals(menuDTO.getPid()) && "2".equals(menuDTO.getType())) {
} else if (!pid.equals(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
menuVo.setComponent(menuDTO.getComponent());
}
}
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
if (menuDtoList != null && menuDtoList.size() != 0) {
menuVo.setAlwaysShow(true);
menuVo.setRedirect("noredirect");

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -37,7 +37,7 @@ export default {
const first = matched[0]
if (!this.isDashboard(first)) {
matched = [{ path: '/dashboard', meta: { title: '首页' }}].concat(matched)
matched = [{ path: '/dashboard', meta: { title: this.$t('auto.common.home') }}].concat(matched)
}
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)

View File

@@ -59,9 +59,14 @@ import customer2 from './basedata/customer/zh'
import supplier2 from './basedata/supplier/zh'
import measure2 from './basedata/measure/zh'
import classification2 from './basedata/classification/zh'
import ivtChange from './ivtChange/zh'
import eslog from './eslog/zh'
import elpage from './elpage/zh'
export default {
...elpage,
...eslog,
...ivtChange,
...vehicle2,
...material2,
...customer2,

View File

@@ -0,0 +1,8 @@
export default {
'el': {
'pagination': {
'total': 'total',
'pagesize': 'size',
}
}
}

View File

@@ -0,0 +1,8 @@
export default {
'el': {
'pagination': {
'total': 'total',
'pagesize': 'size',
}
}
}

View File

@@ -0,0 +1,8 @@
export default {
'el': {
'pagination': {
'total': 'total',
'pagesize': 'size',
}
}
}

View File

@@ -59,8 +59,14 @@ import customer2 from './basedata/customer/en'
import supplier2 from './basedata/supplier/en'
import measure2 from './basedata/measure/en'
import classification2 from './basedata/classification/en'
import ivtChange from './ivtChange/en'
import eslog from './eslog/en'
import elpage from './elpage/en'
export default {
...elpage,
...eslog,
...ivtChange,
...vehicle2,
...material2,
...customer2,

View File

@@ -16,7 +16,7 @@ import operation_log from './operationLog/vi'
import record from './record/vi'
import online from './online/vi'
import error_log from './errorLog/vi'
import menu from './menu/vi'
import menu from './menu/es'
import param from './param/vi'
import instruction from './instruction/in'
import task from './task/in'
@@ -33,8 +33,8 @@ import timing from './timing/vi'
import config from './config/in'
import customPolicy from './customPolicy/in'
import deviceErrorInfo from './deviceErrorInfo/in'
import user from './user/vi'
import role from './role/vi'
import user from './user/es'
import role from './role/es'
import department from './department/vi'
import dict from './dict/vi'
import angle from './angle/in'
@@ -54,8 +54,15 @@ import customer from './basedata/customer/es'
import supplier from './basedata/supplier/es'
import measure from './basedata/measure/es'
import classification from './basedata/classification/es'
import ivtChange from './ivtChange/en'
import eslog from './eslog/es'
import elpage from './elpage/es'
export default {
...elpage,
...eslog,
...ivtChange,
...vehicle,
...material,
...customer,

View File

@@ -69,7 +69,11 @@ Element.TableColumn.props.align = { type: String, default: 'center' }
Vue.use(Element, {
size: Cookies.get('size') || 'mini' // set element-ui default size
})
Vue.prototype.$langPre = {
computedProp(suffix) {
return localStorage.getItem('lang') + '_' + suffix
}
}
Vue.config.productionTip = false
// 全局方法挂载
Vue.prototype.parseTime = parseTime

View File

@@ -1,6 +1,7 @@
import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'
import i18n from '@/i18n'
Vue.use(Router)
@@ -41,7 +42,7 @@ export const constantRouterMap = [
path: 'dashboard',
component: (resolve) => require(['@/views/monitor/server/index'], resolve),
name: 'Dashboard',
meta: { title: '首页', icon: 'index', affix: true, noCache: true }
meta: { title: i18n.t('auto.common.home'), icon: 'index', affix: true, noCache: true }
}
]
},

View File

@@ -1,7 +1,7 @@
<template>
<div style="height:1000px">
<iframe
src="./src/assets/daping/index.html"
src="/static/daping/index.html"
width="100%"
height="100%"
frameborder="0"

View File

@@ -171,7 +171,7 @@
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="selection" width="55" />
<el-table-column :label="$t('menu.table_title.menu_title')" prop="title" :min-width="100" />
<el-table-column :label="$t('menu.table_title.menu_title')" :prop="$langPre.computedProp('title')" :min-width="flexWidth($langPre.computedProp('title'),crud.data,$t('menu.table_title.menu_title'))" />
<el-table-column :label="$t('menu.table_title.system')" prop="systemType" :min-width="flexWidth('systemType',crud.data,$t('menu.table_title.system'))">
<template slot-scope="scope">
{{ dict.label.system_type[scope.row.systemType] }} : {{ scope.row.systemType }}