| | |
| | | > |
| | | <p class="tip" v-if="form.parent != null && form.id == null">为 <em>{{parentName}}</em> 新建子菜单</p> |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="上级菜单" prop="parentId"> |
| | | <el-form-item label="上级菜单" prop="parentId" v-if="form.type !== 1"> |
| | | <MenuSelect v-if="visible" v-model="form.parentId" placeholder="请选择上级菜单" :exclude-id="excludeMenuId" clearable :inline="false"/> |
| | | </el-form-item> |
| | | <el-form-item label="菜单名称" prop="name" required> |
| | |
| | | <el-form-item label="携带参数" prop="params"> |
| | | <el-input v-model="form.params" placeholder="请输入携带参数" v-trim maxlength="200"/> |
| | | </el-form-item> |
| | | <el-form-item label="图标" prop="icon" class="form-item-icon"> |
| | | <el-form-item label="图标" prop="icon" class="form-item-icon" v-if="form.type !== 1"> |
| | | <el-radio-group v-model="form.icon"> |
| | | <el-radio :label="icon" v-for="icon in icons" :key="icon"> |
| | | <i :class="{[icon]: true}"></i> |
| | |
| | | params:'', |
| | | path: '', |
| | | icon: '', |
| | | type: '', |
| | | remark: '' |
| | | }, |
| | | // 验证规则 |
| | |
| | | * @target: 编辑的菜单对象 |
| | | * @parent: 新建时的上级菜单 |
| | | */ |
| | | open (title, target, parent) { |
| | | open (title, target, parent,type) { |
| | | this.title = title |
| | | this.visible = true |
| | | this.form.type = type || 0 |
| | | // 新建,menu为空时表示新建菜单 |
| | | if (target == null) { |
| | | this.excludeMenuId = null |
| | |
| | | this.form.id = null |
| | | this.form.parentId = parent == null ? null : parent.id |
| | | this.parentName = parent == null ? null : parent.name |
| | | // this.form.type = parent == null ? 0 : parent.type |
| | | }) |
| | | return |
| | | } |
| | |
| | | for (const key in this.form) { |
| | | this.form[key] = target[key] |
| | | } |
| | | this.form.type = this.form.type || 0 |
| | | }) |
| | | } |
| | | }, |