app-role-list.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>-列表</title>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <!-- 所有的 css & js 资源 -->
  8. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  9. <link rel="stylesheet" href="../../static/sa.css">
  10. <script src="../../static/kj/vue.min.js"></script>
  11. <script src="../../static/kj/element-ui/index.js"></script>
  12. <script src="../../static/kj/httpVueLoader.js"></script>
  13. <script src="../../static/kj/jquery.min.js"></script>
  14. <script src="../../static/kj/layer/layer.js"></script>
  15. <script src="../../static/sa.js"></script>
  16. </head>
  17. <body>
  18. <div class="vue-box" style="display: none;" :style="'display: block;'">
  19. <div class="c-panel">
  20. <!-- ------------- 检索参数 ------------- -->
  21. <!-- <div class="c-title">检索参数</div> -->
  22. <el-form ref="form" :model='p' @submit.native.prevent>
  23. <sa-item type="text" name="角色名称" v-model="p.roleName"></sa-item>
  24. <el-button type="primary" icon="el-icon-search" @click="p.pageNo = 1; f5()">查询</el-button>
  25. <el-button type="info" icon="el-icon-refresh" @click="sa.f5()">重置</el-button>
  26. </el-form>
  27. <!-- ------------- 数据列表 ------------- -->
  28. <el-table class="data-table" ref="data-table" :data="dataList" >
  29. <sa-td type="index" name="序号"></sa-td>
  30. <sa-td name="角色名称" prop="roleName" ></sa-td>
  31. <sa-td name="类型" prop="userType" type="enum" :jv="{1: '普通边民', 2: '边民组长', 3: '收购商', 4: '司机', 5: '外籍商户', 6: '合作社'}"></sa-td>
  32. <el-table-column label="操作" fixed="right" width="120px">
  33. <template slot-scope="s">
  34. <el-button class="c-btn" type="success" icon="el-icon-set-up" @click="AssignAuth(s.row)">菜单权限</el-button>
  35. <!-- <el-button class="c-btn" type="success" icon="el-icon-view" @click="get(s.row)">查看</el-button>
  36. <el-button v-if="sa.isAuth('app-role-edit')" class="c-btn" type="primary" icon="el-icon-edit" @click="update(s.row)">修改</el-button>
  37. <el-button v-if="sa.isAuth('app-role-del')" class="c-btn" type="danger" icon="el-icon-delete" @click="del(s.row)">删除</el-button> -->
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. <!-- ------------- 分页 ------------- -->
  42. <sa-item type="page" :curr.sync="p.pageNo" :size.sync="p.pageSize" :total="dataCount" @change="f5()"></sa-item>
  43. </div>
  44. </div>
  45. <script>
  46. var app = new Vue({
  47. components: {
  48. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  49. "sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue'),
  50. },
  51. el: '.vue-box',
  52. data: {
  53. p: { // 查询参数
  54. roleName: '', // 角色名称
  55. createTime: '', // 创建时间
  56. userType: '', // 类型(1=边民,2=组长,3=商户,4=收购商,5=司机)
  57. pageNo: 1, // 当前页
  58. pageSize: 10, // 页大小
  59. sortType: 0 // 排序方式
  60. },
  61. dataCount: 0,
  62. dataList: [], // 数据集合
  63. },
  64. methods: {
  65. // 刷新
  66. f5: function() {
  67. sa.ajax('/sp-admin/AppRole/getList', sa.removeNull(this.p), function(res) {
  68. this.dataList = res.data; // 数据
  69. this.dataCount = res.dataCount; // 数据总数
  70. sa.f5TableHeight(); // 刷新表格高度
  71. }.bind(this));
  72. },
  73. // 查看
  74. get: function(data) {
  75. sa.showIframe('数据详情', 'app-role-info.html?id=' + data.id, '1050px', '90%');
  76. },
  77. // 查看 - 根据选中的
  78. getBySelect: function(data) {
  79. var selection = this.$refs['data-table'].selection;
  80. if(selection.length == 0) {
  81. return sa.msg('请选择一条数据')
  82. }
  83. this.get(selection[0]);
  84. },
  85. // 修改
  86. update: function(data) {
  87. sa.showIframe('修改数据', 'app-role-add.html?id=' + data.id, '600px', '500px');
  88. },
  89. // 新增
  90. add: function(data) {
  91. sa.showIframe('新增数据', 'app-role-add.html?id=-1', '1000px', '90%');
  92. },
  93. // 删除
  94. del: function(data) {
  95. sa.confirm('是否删除,此操作不可撤销', function() {
  96. sa.ajax('/sp-admin/AppRole/delete?id=' + data.id, function(res) {
  97. sa.arrayDelete(this.dataList, data);
  98. sa.ok('删除成功');
  99. sa.f5TableHeight(); // 刷新表格高度
  100. }.bind(this))
  101. }.bind(this));
  102. },
  103. // 批量删除
  104. deleteByIds: function() {
  105. // 获取选中元素的id列表
  106. let selection = this.$refs['data-table'].selection;
  107. let ids = sa.getArrayField(selection, 'id');
  108. if(selection.length == 0) {
  109. return sa.msg('请至少选择一条数据')
  110. }
  111. // 提交删除
  112. sa.confirm('是否批量删除选中数据?此操作不可撤销', function() {
  113. sa.ajax('/sp-admin/AppRole/deleteByIds', {ids: ids.join(',')}, function(res) {
  114. sa.arrayDelete(this.dataList, selection);
  115. sa.ok('删除成功');
  116. sa.f5TableHeight(); // 刷新表格高度
  117. }.bind(this))
  118. }.bind(this));
  119. },
  120. AssignAuth: function(item) {
  121. sa.showIframe('角色菜单权限设置', 'app-role-menu-list.html?appRoleId=' + item.userType, '1000px', '90%');
  122. }
  123. },
  124. created: function() {
  125. this.f5();
  126. sa.onInputEnter();
  127. }
  128. })
  129. </script>
  130. </body>
  131. </html>