123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>app菜单管理-列表</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css & js 资源 -->
- <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- </head>
- <body>
- <div class="vue-box" style="display: none;" :style="'display: block;'">
- <div class="c-panel">
- <!-- ------------- 检索参数 ------------- -->
- <el-form ref="form" :model='p' @submit.native.prevent>
- <!-- <sa-item type="text" name="菜单名称" v-model="p.menuName"></sa-item>
- <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
- <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button> -->
- <el-button v-if="sa.isAuth('app-menu-add')" size="mini" type="primary" @click="add()">分配权限</el-button>
- </el-form>
- <!-- ------------- 数据列表 ------------- -->
- <el-table class="data-table" ref="data-table" :data="dataList" >
- <sa-td type="selection"></sa-td>
- <sa-td type="index" name="序号"></sa-td>
- <sa-td name="菜单名称" prop="menuName" ></sa-td>
- <sa-td name="前端路径" prop="path"></sa-td>
- <sa-td name="图标" prop="icon" type="img"></sa-td>
- <sa-td name="排序" prop="sort" ></sa-td>
- <!-- <sa-td name="状态" prop="enable" type="switch" :jv="{0: '禁用[red]', 1: '启用[green]'}" @change="s => updateEnable(s.row)"></sa-td>
- <sa-td name="是否认证后访问" prop="auth" type="switch" :jv="{0: '否', 1: '是'}" @change="s => updateAuth(s.row)"></sa-td> -->
- </el-table>
- <!-- ------------- 分页 ------------- -->
- <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
- "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
- },
- el: '.vue-box',
- data: {
- p: { // 查询参数
- path: '', // 前端路径
- menuName: '', // 菜单名称
- icon: '', // 图标
- sort: '', // 排序
- enable: 1, // 状态(0=禁用,1=启用)
- auth: '', // 是否认证后访问(0=否,1=是)
- pageNo: 1, // 当前页
- pageSize: 10, // 页大小
- sortType: 0 // 排序方式
- },
- dataCount: 0,
- dataList: [], // 数据集合
- appRoleId: sa.p('appRoleId',0),
- authList: []
- },
- methods: {
- // 刷新
- f5: function() {
- sa.ajax('/sp-admin/AppMenu/getList', sa.removeNull(this.p), function(res) {
- this.dataList = res.data; // 数据
- this.dataCount = res.dataCount; // 数据总数
-
- sa.ajax('/sp-admin/ReRoleMenu/getList', {appRoleId : this.appRoleId}, function(res) {
- this.authList = res.data; // 数据
-
- this.dataList.forEach((item,index) => {
- if(this.authList.find((key) => key.appMenuId == item.id)){
- this.$nextTick(()=>{
- this.$refs['data-table'].toggleRowSelection(
- this.$refs['data-table'].data[index],
- true
- );
- });
- }
- })
- sa.f5TableHeight(); // 刷新表格高度
- }.bind(this));
-
- }.bind(this));
- },
- // 分配权限
- add() {
- let selectDatas = this.$refs['data-table'].selection;
-
- let list = '';
- selectDatas.forEach(item => {
- list += item.id + ',';
- })
- let item={list: list,roleId: this.appRoleId};
- sa.ajax('/sp-admin/ReRoleMenu/assignPermissions',item, function(res) {
- sa.msg('权限分配成功');
- }.bind(this));
- }
- },
- created: function() {
- this.f5();
- sa.onInputEnter();
- }
- })
- </script>
- </body>
- </html>
|