|
@@ -1,79 +1,82 @@
|
|
<template>
|
|
<template>
|
|
- <el-dialog
|
|
|
|
|
|
+ <!-- <el-dialog
|
|
:title="!dataForm.id ? '新增' : '修改'"
|
|
:title="!dataForm.id ? '新增' : '修改'"
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
- :visible.sync="visible">
|
|
|
|
- <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
|
|
|
- <el-form-item label="类型" prop="type">
|
|
|
|
- <el-radio-group v-model="dataForm.type">
|
|
|
|
- <el-radio v-for="(type, index) in dataForm.typeList" :label="index" :key="index">{{ type }}</el-radio>
|
|
|
|
- </el-radio-group>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item :label="dataForm.typeList[dataForm.type] + '名称'" prop="name">
|
|
|
|
- <el-input v-model="dataForm.name" :placeholder="dataForm.typeList[dataForm.type] + '名称'"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item v-if="dataForm.type !== 0" label="上级菜单" prop="parentName">
|
|
|
|
- <el-popover
|
|
|
|
- ref="menuListPopover"
|
|
|
|
- placement="bottom-start"
|
|
|
|
- trigger="click">
|
|
|
|
- <el-tree
|
|
|
|
- :data="menuList"
|
|
|
|
- :props="menuListTreeProps"
|
|
|
|
- node-key="menuId"
|
|
|
|
- ref="menuListTree"
|
|
|
|
- @current-change="menuListTreeCurrentChangeHandle"
|
|
|
|
- :highlight-current="true"
|
|
|
|
- :expand-on-click-node="false">
|
|
|
|
- </el-tree>
|
|
|
|
- </el-popover>
|
|
|
|
- <el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" placeholder="点击选择上级菜单" class="menu-list__input"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item v-if="dataForm.type === 1" label="菜单路由" prop="url">
|
|
|
|
- <el-input v-model="dataForm.url" placeholder="菜单路由"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item v-if="dataForm.type !== 0" label="授权标识" prop="perms">
|
|
|
|
- <el-input v-model="dataForm.perms" placeholder="多个用逗号分隔, 如: user:list,user:create"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
|
|
|
|
- <el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">
|
|
|
|
- <el-row>
|
|
|
|
- <el-col :span="22">
|
|
|
|
- <el-popover
|
|
|
|
- ref="iconListPopover"
|
|
|
|
- placement="bottom-start"
|
|
|
|
- trigger="click"
|
|
|
|
- popper-class="mod-menu__icon-popover">
|
|
|
|
- <div class="mod-menu__icon-inner">
|
|
|
|
- <div class="mod-menu__icon-list">
|
|
|
|
- <el-button
|
|
|
|
- v-for="(item, index) in iconList"
|
|
|
|
- :key="index"
|
|
|
|
- @click="iconActiveHandle(item)"
|
|
|
|
- :class="{ 'is-active': item === dataForm.icon }">
|
|
|
|
- <icon-svg :name="item"></icon-svg>
|
|
|
|
- </el-button>
|
|
|
|
|
|
+ :visible.sync="visible"> -->
|
|
|
|
+ <div>
|
|
|
|
+ <div class="my-title">{{ !dataForm.id ? '新增' : '修改' }}</div>
|
|
|
|
+ <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
|
|
|
|
+ <el-form-item label="类型" prop="type">
|
|
|
|
+ <el-radio-group v-model="dataForm.type">
|
|
|
|
+ <el-radio v-for="(type, index) in dataForm.typeList" :label="index" :key="index">{{ type }}</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item :label="dataForm.typeList[dataForm.type] + '名称'" prop="name">
|
|
|
|
+ <el-input v-model="dataForm.name" :placeholder="dataForm.typeList[dataForm.type] + '名称'"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.type !== 0" label="上级菜单" prop="parentName">
|
|
|
|
+ <el-popover
|
|
|
|
+ ref="menuListPopover"
|
|
|
|
+ placement="bottom-start"
|
|
|
|
+ trigger="click">
|
|
|
|
+ <el-tree
|
|
|
|
+ :data="menuList"
|
|
|
|
+ :props="menuListTreeProps"
|
|
|
|
+ node-key="menuId"
|
|
|
|
+ ref="menuListTree"
|
|
|
|
+ @current-change="menuListTreeCurrentChangeHandle"
|
|
|
|
+ :highlight-current="true"
|
|
|
|
+ :expand-on-click-node="false">
|
|
|
|
+ </el-tree>
|
|
|
|
+ </el-popover>
|
|
|
|
+ <el-input v-model="dataForm.parentName" v-popover:menuListPopover :readonly="true" placeholder="点击选择上级菜单" class="menu-list__input"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.type === 1" label="菜单路由" prop="url">
|
|
|
|
+ <el-input v-model="dataForm.url" placeholder="菜单路由"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.type !== 0" label="授权标识" prop="perms">
|
|
|
|
+ <el-input v-model="dataForm.perms" placeholder="多个用逗号分隔, 如: user:list,user:create"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.type !== 2" label="排序号" prop="orderNum">
|
|
|
|
+ <el-input-number v-model="dataForm.orderNum" controls-position="right" :min="0" label="排序号"></el-input-number>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item v-if="dataForm.type !== 2" label="菜单图标" prop="icon">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="22">
|
|
|
|
+ <el-popover
|
|
|
|
+ ref="iconListPopover"
|
|
|
|
+ placement="bottom-start"
|
|
|
|
+ trigger="click"
|
|
|
|
+ popper-class="mod-menu__icon-popover">
|
|
|
|
+ <div class="mod-menu__icon-inner">
|
|
|
|
+ <div class="mod-menu__icon-list">
|
|
|
|
+ <el-button
|
|
|
|
+ v-for="(item, index) in iconList"
|
|
|
|
+ :key="index"
|
|
|
|
+ @click="iconActiveHandle(item)"
|
|
|
|
+ :class="{ 'is-active': item === dataForm.icon }">
|
|
|
|
+ <icon-svg :name="item"></icon-svg>
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
- </el-popover>
|
|
|
|
- <el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" placeholder="菜单图标名称" class="icon-list__input"></el-input>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col :span="2" class="icon-list__tips">
|
|
|
|
- <el-tooltip placement="top" effect="light">
|
|
|
|
- <div slot="content">全站推荐使用SVG Sprite, 详细请参考:<a href="//github.com/daxiongYang/renren-fast-vue/blob/master/src/icons/index.js" target="_blank">icons/index.js</a>描述</div>
|
|
|
|
- <i class="el-icon-warning"></i>
|
|
|
|
- </el-tooltip>
|
|
|
|
- </el-col>
|
|
|
|
- </el-row>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <span slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="visible = false">取消</el-button>
|
|
|
|
- <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
|
- </span>
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
+ </el-popover>
|
|
|
|
+ <el-input v-model="dataForm.icon" v-popover:iconListPopover :readonly="true" placeholder="菜单图标名称" class="icon-list__input"></el-input>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="2" class="icon-list__tips">
|
|
|
|
+ <el-tooltip placement="top" effect="light">
|
|
|
|
+ <div slot="content">全站推荐使用SVG Sprite, 详细请参考:<a href="//github.com/daxiongYang/renren-fast-vue/blob/master/src/icons/index.js" target="_blank">icons/index.js</a>描述</div>
|
|
|
|
+ <i class="el-icon-warning"></i>
|
|
|
|
+ </el-tooltip>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="onChose">取消</el-button>
|
|
|
|
+ <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- </el-dialog> -->
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
@@ -187,6 +190,9 @@
|
|
iconActiveHandle (iconName) {
|
|
iconActiveHandle (iconName) {
|
|
this.dataForm.icon = iconName
|
|
this.dataForm.icon = iconName
|
|
},
|
|
},
|
|
|
|
+ onChose () {
|
|
|
|
+ this.$emit('onChose')
|
|
|
|
+ },
|
|
// 表单提交
|
|
// 表单提交
|
|
dataFormSubmit () {
|
|
dataFormSubmit () {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
@@ -212,7 +218,7 @@
|
|
type: 'success',
|
|
type: 'success',
|
|
duration: 1500,
|
|
duration: 1500,
|
|
onClose: () => {
|
|
onClose: () => {
|
|
- this.visible = false
|
|
|
|
|
|
+ this.onChose()
|
|
this.$emit('refreshDataList')
|
|
this.$emit('refreshDataList')
|
|
}
|
|
}
|
|
})
|
|
})
|