index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!--权限管理-->
  2. <template>
  3. <div class="app-container managePermissionTemplates">
  4. <div class="managePermissionTemplates-list-page" v-if="pageType == 1">
  5. <div class="top-button-box">
  6. <p class="inquire-button-one add-button-box" @click="pageTypeClick(2)" v-hasPermi="['system:permit:add']"><i class="el-icon-plus"></i>新增</p>
  7. <p class="text-p">管理员在给人员分配权限时,可以直接复制模板中已经设置的权限。</p>
  8. </div>
  9. <el-table v-loading="loading" border :data="dataList" ref="multipleTable">
  10. <el-table-column label="序号" width="132" align="center" type="index"/>
  11. <el-table-column label="权限模板名称" align="left" prop="name" show-overflow-tooltip>
  12. <template slot-scope="scope">
  13. <span style="color:#0183FA;">{{scope.row.name}}</span>
  14. </template>
  15. </el-table-column>
  16. <el-table-column label="权限模板说明" align="left" prop="remark" show-overflow-tooltip width="595"/>
  17. <el-table-column label="创建日期" align="left" prop="createTime" show-overflow-tooltip width="157"/>
  18. <el-table-column label="操作" align="left" width="160" class-name="small-padding fixed-width" v-if="tableButtonType">
  19. <template slot-scope="scope">
  20. <div class="table-button-box">
  21. <p class="table-button-null"></p>
  22. <p class="table-button-p" @click="editButton(scope.row)" v-hasPermi="['system:permit:edit']">修改</p>
  23. <p class="table-button-p" @click="delButton(scope.row)" v-hasPermi="['system:permit:remove']">删除</p>
  24. <p class="table-button-null"></p>
  25. </div>
  26. </template>
  27. </el-table-column>
  28. </el-table>
  29. <pagination
  30. style="margin-top:20px!important;"
  31. v-show="total>0"
  32. :total="total"
  33. layout="total, sizes, prev, pager, next, jumper"
  34. :page.sync="queryParams.pageNum"
  35. :limit.sync="queryParams.pageSize"
  36. @pagination="getList"
  37. />
  38. </div>
  39. <add-page v-if="pageType == 2" :propsData="propsData"></add-page>
  40. </div>
  41. </template>
  42. <script>
  43. import addPage from "./addPage.vue"
  44. import { getPermitList, delSystemPermit, getPermitInfo } from "@/api/laboratory/managePermissionTemplates";
  45. export default {
  46. name: "managePermissionTemplates",
  47. components: {
  48. addPage
  49. },
  50. data() {
  51. return {
  52. tableButtonType:this.hasPermiDom(['system:permit:edit','system:permit:remove']),
  53. pageType:1,
  54. loading:false,
  55. // 查询参数
  56. queryParams: {
  57. pageNum: 1,
  58. pageSize:20,
  59. },
  60. total:0,
  61. //数据列表
  62. dataList:[],
  63. //组件传输数据
  64. propsData:{},
  65. }
  66. },
  67. created() {
  68. },
  69. mounted(){
  70. this.getPermitList();
  71. },
  72. methods:{
  73. //编辑按钮
  74. editButton(row){
  75. getPermitInfo(row.id).then(response => {
  76. this.propsData = response.data;
  77. this.pageType = 2;
  78. });
  79. },
  80. //删除按钮
  81. delButton(row){
  82. let self = this;
  83. this.$confirm('是否确认删除?', "警告", {
  84. confirmButtonText: "确定",
  85. cancelButtonText: "取消",
  86. type: "warning"
  87. }).then(function() {
  88. delSystemPermit(row.id).then(response => {
  89. self.msgSuccess(response.msg)
  90. self.getPermitList()
  91. });
  92. }).then(() => {}).catch(() => {});
  93. },
  94. //获取列表接口
  95. getPermitList(){
  96. this.loading = true;
  97. getPermitList(this.queryParams).then(response => {
  98. this.$set(this,'dataList',response.rows);
  99. this.loading = false;
  100. });
  101. },
  102. // 页面状态切换
  103. pageTypeClick(type){
  104. if(this.pageType != type){
  105. if(type == 1){
  106. this.pageType = 1;
  107. this.getPermitList();
  108. }else if(type == 2){
  109. this.propsData = {};
  110. this.pageType = 2;
  111. }
  112. }
  113. },
  114. //获取数据列表
  115. getList() {
  116. this.loading = true;
  117. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  118. this.$set(this,'dataList',response.rows);
  119. this.total = response.total;
  120. this.loading = false;
  121. }
  122. );
  123. },
  124. },
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .managePermissionTemplates{
  129. display: flex!important;
  130. flex-direction: column;
  131. overflow: hidden;
  132. *{
  133. margin:0;
  134. }
  135. .managePermissionTemplates-list-page{
  136. padding:20px!important;
  137. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  138. flex:1;
  139. display: flex;
  140. flex-direction: column;
  141. overflow: hidden;
  142. .top-button-box{
  143. display: flex;
  144. font-size:14px;
  145. margin-bottom:20px;
  146. .add-button-box{
  147. width:120px;
  148. }
  149. .text-p{
  150. margin-left:24px;
  151. flex:1;
  152. line-height:40px;
  153. color: #999999;
  154. }
  155. }
  156. .button-box{
  157. display: flex;
  158. }
  159. }
  160. }
  161. </style>