♻️ Refactoring code. 增加菜单的i18n

This commit is contained in:
aeizzz 2023-02-15 10:12:32 +08:00
parent 23f7e58876
commit 229ce1f60b
3 changed files with 46 additions and 8 deletions

View File

@ -17,7 +17,7 @@
<el-tree-select v-model="state.ruleForm.parentId" :data="state.parentData"
default-expand-all
:props="{ value: 'id', label: 'name', children: 'children' }" class="w100" clearable check-strictly
placeholder="请选择上级菜单">
:placeholder="$t('sysmenu.inputParentIdTip')">
</el-tree-select>
</el-form-item>
</el-col>
@ -28,12 +28,12 @@
</el-col>
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType === '0'">
<el-form-item :label="$t('sysmenu.path')" prop="path">
<el-input v-model="state.ruleForm.path" placeholder="请输入路由地址" />
<el-input v-model="state.ruleForm.path" :placeholder="$t('sysmenu.inputPathTip')" />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType === '1'">
<el-form-item :label="$t('sysmenu.permission')" prop="permission">
<el-input v-model="state.ruleForm.permission" maxlength="50" placeholder="请权限标识" />
<el-input v-model="state.ruleForm.permission" maxlength="50" :placeholder="$t('sysmenu.inputPermissionTip')" />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20">
@ -43,10 +43,10 @@
</el-col>
<el-col :span="12" class="mb20">
<el-form-item :label="$t('sysmenu.icon')" prop="icon">
<IconSelector placeholder="请输入菜单图标" v-model="state.ruleForm.icon" />
<IconSelector :placeholder="$t('sysmenu.inputIconTip')" v-model="state.ruleForm.icon" />
</el-form-item>
</el-col>
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType === '0'">
<el-col :span="12" class="mb20" v-if="state.ruleForm.menuType === '0' && showembedded">
<el-form-item :label="$t('sysmenu.embedded')" prop="embedded">
<el-radio-group v-model="state.ruleForm.embedded">
<el-radio-button label="0"></el-radio-button>
@ -136,9 +136,21 @@ const getMenuData = () => {
menu.children = res.data;
state.parentData.push(menu)
})
};
const showembedded = ref(false)
watch(() => state.ruleForm.path,(val) => {
if(val.startsWith('http')){
showembedded.value = true
}else{
showembedded.value = false
}
})
const dataRules = reactive({
menType: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
parentId: [{ required: true, message: "姓名不能为空", trigger: "blur" }],

View File

@ -11,6 +11,22 @@ export default {
parentId: 'parent menu',
embedded: 'embedded',
visible: 'visible',
icon: 'icon'
icon: 'icon',
inputMenuIdTip: 'input menuId',
inputPermissionTip: 'input permission',
inputPathTip: 'input path',
inputParentIdTip: 'input parentId',
inputIconTip: 'input icon',
inputVisibleTip: 'input visible',
inputSortOrderTip: 'input sortOrder',
inputKeepAliveTip: 'input keepAlive',
inputMenuTypeTip: 'input menuType',
inputCreateByTip: 'input createBy',
inputCreateTimeTip: 'input createTime',
inputUpdateByTip: 'input updateBy',
inputUpdateTimeTip: 'input updateTime',
inputDelFlagTip: 'input delFlag',
inputTenantIdTip: 'input tenantId',
inputEmbeddedTip: 'input embedded',
}
}

View File

@ -11,7 +11,17 @@ export default {
parentId: '上级菜单',
embedded: '是否内嵌',
visible: '是否显示',
icon: '图标'
icon: '图标',
inputMenuIdTip: '',
inputPermissionTip: '请输入权限标识',
inputPathTip: '请输入路由路径',
inputParentIdTip: '请选择上级菜单',
inputIconTip: '请选择图标',
inputVisibleTip: '请选择是否显示',
inputSortOrderTip: '请输入排序',
inputKeepAliveTip: '请选择是否缓冲',
inputMenuTypeTip: '请选择菜单类型',
inputEmbeddedTip: '请选择是否内嵌',
},
}