| | |
| | | <!-- 表格和分页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-permissions="['system:menu:create', 'system:menu:delete', 'system:menu:sort']"> |
| | | <li><el-button type="primary" @click="$refs.operaMenuWindow.open(activeGroup==0?'新建一级菜单':'新建顶部导航菜单',null,null,activeGroup)" icon="el-icon-plus" v-permissions="['system:menu:create']">新建</el-button></li> |
| | | <li><el-button type="primary" @click="$refs.operaMenuWindow.open(activeType==0?'新建一级菜单':'新建顶部导航菜单',null,null,activeType)" icon="el-icon-plus" v-permissions="['system:menu:create']">新建</el-button></li> |
| | | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['system:menu:delete']">删除</el-button></li> |
| | | <li><el-button @click="sort('top')" :loading="isWorking.sort" icon="el-icon-sort-up" v-permissions="['system:menu:sort']">上移</el-button></li> |
| | | <li><el-button @click="sort('bottom')" :loading="isWorking.sort" icon="el-icon-sort-down" v-permissions="['system:menu:sort']">下移</el-button></li> |
| | |
| | | <template v-else>未设置</template> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="path" label="访问路径" show-tooltip-when-overflow min-width="220px"></el-table-column> |
| | | <el-table-column prop="path" label="访问路径" show-tooltip-when-overflow min-width="200px"></el-table-column> |
| | | <el-table-column prop="params" label="参数" min-width="120px"></el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="120px"></el-table-column> |
| | | <el-table-column prop="linkType" label="菜单类型" min-width="80px"> |
| | | <template slot-scope="{row}"> |
| | | {{row.linkType == 1 ? '外部系统' : '内部系统'}} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注" min-width="150px" show-tooltip-when-overflow></el-table-column> |
| | | <el-table-column prop="createUser" label="创建人" min-width="100px"> |
| | | <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template> |
| | | </el-table-column> |
| | |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaMenuWindow.open('编辑菜单', row,null,activeGroup)" v-permissions="['system:menu:update']">编辑</el-button> |
| | | <el-button v-if="activeGroup !== 1" type="text" icon="el-icon-plus" @click="$refs.operaMenuWindow.open('新建子菜单', null, row,activeGroup)" v-permissions="['system:menu:create']">新建子菜单</el-button> |
| | | <el-button type="text" icon="el-icon-edit" @click="$refs.operaMenuWindow.open('编辑菜单', row,null,activeType)" v-permissions="['system:menu:update']">编辑</el-button> |
| | | <el-button v-if="activeGroup !== 1" type="text" icon="el-icon-plus" @click="$refs.operaMenuWindow.open('新建子菜单', null, row,activeType)" v-permissions="['system:menu:create']">新建子菜单</el-button> |
| | | <el-button v-if="!row.fixed" type="text" icon="el-icon-delete" @click="deleteById(row)" v-permissions="['system:menu:delete']">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | data () { |
| | | return { |
| | | // 是否正在处理中 |
| | | activeGroup: 0, |
| | | groupList:[{id:0,name: "服务中心菜单"},{id:1,name: "顶部导航配置"}], |
| | | activeGroup: -1, |
| | | activeType: 1, |
| | | topMenuId:null, |
| | | groupList:[{id:-1,name: "顶部导航配置",type:1},{id:-2,name: "系统左侧菜单",type:0}], |
| | | isWorking: { |
| | | sort: false |
| | | } |
| | |
| | | methods: { |
| | | groupClick(item){ |
| | | this.activeGroup = item.id |
| | | this.activeType = item.type |
| | | this.handlePageChange(); |
| | | }, |
| | | // 查询数据 |
| | | handlePageChange () { |
| | | this.isWorking.search = true |
| | | fetchTree({type: this.activeGroup}) |
| | | fetchTree({type: this.activeType == 1?this.activeType:null}) |
| | | .then(records => { |
| | | this.tableData.list = records |
| | | if(this.activeType === 1){ |
| | | this.tableData.list = records |
| | | this.groupList = [{id:-1,name: "顶部导航配置",type:1}] |
| | | var tops = [] |
| | | this.tableData.list.forEach(item=>{ |
| | | if(item.linkType !== 1){ |
| | | tops.push({id:item.id,name: item.name,type:0}) |
| | | } |
| | | }) |
| | | if(tops.length){ |
| | | this.groupList.push(...tops) |
| | | }else { |
| | | this.groupList.push({id:0,name: "系统左侧菜单",type:0}) |
| | | } |
| | | }else{ |
| | | //如果是内部菜单 |
| | | records.forEach(item =>{ |
| | | if(item.id === this.activeGroup){ |
| | | this.tableData.list =item.children |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |