|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="sys-menu-container">
|
|
|
|
|
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="700px">
|
|
|
|
|
<el-dialog v-model="state.isShowDialog" draggable :close-on-click-modal="false" width="780px">
|
|
|
|
|
<template #header>
|
|
|
|
|
<div style="color: #fff">
|
|
|
|
|
<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit />
|
|
|
|
@ -11,10 +11,10 @@
|
|
|
|
|
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
|
|
|
|
|
<el-row :gutter="35">
|
|
|
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
|
|
|
|
<el-form-item label="上级菜单">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Upper_level_menu')">
|
|
|
|
|
<el-cascader :options="props.menuData"
|
|
|
|
|
:props="{ checkStrictly: true, emitPath: false, value: 'id', label: 'title' }"
|
|
|
|
|
placeholder="请选择上级菜单" clearable class="w100" v-model="state.ruleForm.pid">
|
|
|
|
|
:placeholder="$t('message.menu.Please_select_superior_menu')" clearable class="w100" v-model="state.ruleForm.pid">
|
|
|
|
|
<template #default="{ node, data }">
|
|
|
|
|
<span>{{ data.title }}</span>
|
|
|
|
|
<span v-if="!node.isLeaf"> ({{ data.children.length }}) </span>
|
|
|
|
@ -23,122 +23,122 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
|
|
|
|
<el-form-item label="菜单类型" prop="type"
|
|
|
|
|
:rules="[{ required: true, message: '菜单类型不能为空', trigger: 'blur' }]">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Menu_types')" prop="type"
|
|
|
|
|
:rules="[{ required: true, message: $t('message.menu.The_menu_type_cannot_empty'), trigger: 'blur' }]">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.type">
|
|
|
|
|
<el-radio :value="1">目录</el-radio>
|
|
|
|
|
<el-radio :value="2">菜单</el-radio>
|
|
|
|
|
<el-radio :value="3">按钮</el-radio>
|
|
|
|
|
<el-radio :value="1">{{$t('message.menu.Directory')}}</el-radio>
|
|
|
|
|
<el-radio :value="2">{{$t('message.menu.Menu')}}</el-radio>
|
|
|
|
|
<el-radio :value="3">{{$t('message.menu.Button')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="菜单名称" prop="title"
|
|
|
|
|
:rules="[{ required: true, message: '菜单名称不能为空', trigger: 'blur' }]">
|
|
|
|
|
<el-input v-model="state.ruleForm.title" placeholder="菜单名称" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Menu_name')" prop="title"
|
|
|
|
|
:rules="[{ required: true, message: $t('message.menu.Menu_names_cannot_empty'), trigger: 'blur' }]">
|
|
|
|
|
<el-input v-model="state.ruleForm.title" :placeholder="$t('message.menu.Menu_name')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<template v-if="state.ruleForm.type === 1 || state.ruleForm.type === 2">
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="路由名称">
|
|
|
|
|
<el-input v-model="state.ruleForm.name" placeholder="路由名称" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Route_name')">
|
|
|
|
|
<el-input v-model="state.ruleForm.name" :placeholder="$t('message.menu.Route_name')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="路由路径">
|
|
|
|
|
<el-input v-model="state.ruleForm.path" placeholder="路由路径" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Routing_path')">
|
|
|
|
|
<el-input v-model="state.ruleForm.path" :placeholder="$t('message.menu.Routing_path')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="组件路径">
|
|
|
|
|
<el-input v-model="state.ruleForm.component" placeholder="组件路径" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Component_paths')">
|
|
|
|
|
<el-input v-model="state.ruleForm.component" :placeholder="$t('message.menu.Component_paths')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="菜单图标">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Menu_ICONS')">
|
|
|
|
|
<IconSelector v-model="state.ruleForm.icon" :size="getGlobalComponentSize"
|
|
|
|
|
placeholder="菜单图标" type="all" />
|
|
|
|
|
:placeholder="$t('message.menu.Menu_ICONS')" type="all" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="重定向">
|
|
|
|
|
<el-input v-model="state.ruleForm.redirect" placeholder="重定向地址" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Redirection')">
|
|
|
|
|
<el-input v-model="state.ruleForm.redirect" :placeholder="$t('message.menu.Redirection')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="链接地址">
|
|
|
|
|
<el-input v-model="state.ruleForm.outLink" placeholder="外链/内嵌时链接地址" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Link_Address')">
|
|
|
|
|
<el-input v-model="state.ruleForm.outLink" :placeholder="$t('message.menu.External_link_embedded_link_address')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="菜单排序">
|
|
|
|
|
<el-input-number v-model="state.ruleForm.orderNo" placeholder="排序" class="w100" />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Sorting_menus')">
|
|
|
|
|
<el-input-number v-model="state.ruleForm.orderNo" :placeholder="$t('message.menu.Sorting_menus')" class="w100" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="是否隐藏">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Whether_hide')">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.isHide">
|
|
|
|
|
<el-radio :value="true">隐藏</el-radio>
|
|
|
|
|
<el-radio :value="false">不隐藏</el-radio>
|
|
|
|
|
<el-radio :value="true">{{$t('message.menu.Hide')}}</el-radio>
|
|
|
|
|
<el-radio :value="false">{{$t('message.menu.Don_hide')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="是否缓存">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Cache_not')">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.isKeepAlive">
|
|
|
|
|
<el-radio :value="true">缓存</el-radio>
|
|
|
|
|
<el-radio :value="false">不缓存</el-radio>
|
|
|
|
|
<el-radio :value="true">{{$t('message.menu.caching')}}</el-radio>
|
|
|
|
|
<el-radio :value="false">{{$t('message.menu.Not_caching')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="是否固定">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Fixed_not')">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.isAffix">
|
|
|
|
|
<el-radio :value="true">固定</el-radio>
|
|
|
|
|
<el-radio :value="false">不固定</el-radio>
|
|
|
|
|
<el-radio :value="true">{{$t('message.menu.fixed')}}</el-radio>
|
|
|
|
|
<el-radio :value="false">{{$t('message.menu.Not_fixed')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="是否内嵌">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Inline_not')">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.isIframe">
|
|
|
|
|
<el-radio :value="true">内嵌</el-radio>
|
|
|
|
|
<el-radio :value="false">不内嵌</el-radio>
|
|
|
|
|
<el-radio :value="true">{{$t('message.menu.inlay')}}</el-radio>
|
|
|
|
|
<el-radio :value="false">{{$t('message.menu.Not_inlined')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="state.ruleForm.type === 3">
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="权限标识">
|
|
|
|
|
<el-input v-model="state.ruleForm.permission" placeholder="权限标识" clearable />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Permission_identification')">
|
|
|
|
|
<el-input v-model="state.ruleForm.permission" :placeholder="$t('message.menu.Permission_identification')" clearable />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="菜单排序">
|
|
|
|
|
<el-input-number v-model="state.ruleForm.orderNo" placeholder="排序" class="w100" />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Sorting_menus')">
|
|
|
|
|
<el-input-number v-model="state.ruleForm.orderNo" :placeholder="$t('message.menu.Sorting_menus')" class="w100" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</template>
|
|
|
|
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
|
|
|
|
<el-form-item label="是否启用">
|
|
|
|
|
<el-form-item :label="$t('message.menu.Enabled_not')">
|
|
|
|
|
<el-radio-group v-model="state.ruleForm.status">
|
|
|
|
|
<el-radio :value="1">启用</el-radio>
|
|
|
|
|
<el-radio :value="2">不启用</el-radio>
|
|
|
|
|
<el-radio :value="1">{{$t('message.role.Enable')}}</el-radio>
|
|
|
|
|
<el-radio :value="2">{{$t('message.role.Disable')}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
|
|
|
|
<el-form-item label="备注">
|
|
|
|
|
<el-input v-model="state.ruleForm.remark" placeholder="请输入备注内容" clearable type="textarea" />
|
|
|
|
|
<el-form-item :label="$t('message.menu.Remarks')">
|
|
|
|
|
<el-input v-model="state.ruleForm.remark" :placeholder="$t('message.role.Please_enter_remarks')" clearable type="textarea" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="submit">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">{{$t('message.role.Cancel')}}</el-button>
|
|
|
|
|
<el-button type="primary" @click="submit">{{$t('message.role.Confirmation')}}</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
@ -154,7 +154,8 @@ import { getAPI } from '/@/utils/axios-utils';
|
|
|
|
|
import other from '/@/utils/other';
|
|
|
|
|
import { SysMenuApi } from '/@/api-services/api';
|
|
|
|
|
import { SysMenu, UpdateMenuInput } from '/@/api-services/models';
|
|
|
|
|
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
title: String,
|
|
|
|
|
menuData: Array<SysMenu>,
|
|
|
|
@ -196,16 +197,16 @@ const submit = () => {
|
|
|
|
|
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
|
|
|
|
const res = await getAPI(SysMenuApi).apiSysMenuUpdatePost(state.ruleForm);
|
|
|
|
|
if (res.data.data == 200) {
|
|
|
|
|
ElMessage.success('修改成功');
|
|
|
|
|
ElMessage.success(t('message.user_zz.Change_successful'));
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error('修改失败');
|
|
|
|
|
ElMessage.error(t('message.user_zz.Change_failed'));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const res = await getAPI(SysMenuApi).apiSysMenuAddPost(state.ruleForm);
|
|
|
|
|
if (res.data.data == 200) {
|
|
|
|
|
ElMessage.success('新增成功');
|
|
|
|
|
ElMessage.success(t('message.user_zz.Added_success'));
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error('新增失败');
|
|
|
|
|
ElMessage.error(t('message.user_zz.Add_failed'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closeDialog();
|
|
|
|
|