index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!--白名单列表-->
  2. <template>
  3. <div class="app-container whitelist">
  4. <div class="whitelist-page" v-if="pageType == 1">
  5. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px">
  6. <el-form-item label="关键字" prop="userName">
  7. <el-input
  8. v-model="queryParams.searchValue"
  9. placeholder="姓名/工号/联系方式"
  10. clearable
  11. maxLength="30"
  12. size="small"
  13. />
  14. </el-form-item>
  15. <el-form-item>
  16. <p class="inquire-button-one" @click="handleQuery">查询</p>
  17. <p class="reset-button-one" @click="resetQuery">重置</p>
  18. </el-form-item>
  19. <el-form-item style="float: right;">
  20. <el-button
  21. style="margin-left: 20px"
  22. type="primary"
  23. plain
  24. icon="el-icon-plus"
  25. size="mini"
  26. @click="pageClick(2)"
  27. v-hasPermi="['laboratory:whitelist:add']"
  28. >新增</el-button>
  29. </el-form-item>
  30. </el-form>
  31. <el-table v-loading="loading" border :data="safe_bookList" >
  32. <el-table-column label="姓名" align="left" prop="userName"/>
  33. <el-table-column label="工号" align="left" prop="userNumber"/>
  34. <el-table-column label="联系方式" align="left" prop="userTelephone"/>
  35. <el-table-column label="学院" align="left" prop="deptName"/>
  36. <el-table-column label="操作" align="center" width="160" v-if="tableButtonType">
  37. <template slot-scope="scope">
  38. <div class="table-button-box">
  39. <p class="table-button-null"></p>
  40. <p class="table-button-p"
  41. @click="pageEditClick(2,scope.row)"
  42. v-hasPermiAnd="['laboratory:whitelist:query','laboratory:whitelist:edit']"
  43. >编辑</p>
  44. <p class="table-button-p"
  45. @click="delButton(scope.row)"
  46. v-hasPermi="['laboratory:whitelist:remove']"
  47. >移除</p>
  48. <p class="table-button-null"></p>
  49. </div>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. <pagination :page-sizes="[20, 30, 40, 50]"
  54. v-show="total>0"
  55. :total="total"
  56. :page.sync="queryParams.pageNum"
  57. :limit.sync="queryParams.pageSize"
  58. @pagination="getList"
  59. />
  60. </div>
  61. <add-page v-if="pageType == 2" :pageData="pageData"></add-page>
  62. </div>
  63. </template>
  64. <script>
  65. import { whitelistList,whitelistDel } from "@/api/laboratory/whitelist";
  66. import addPage from './addPage.vue'
  67. export default {
  68. components:{
  69. addPage
  70. },
  71. name: "whitelist",
  72. data() {
  73. return {
  74. tableButtonType:this.hasPermiDom(['laboratory:whitelist:query','laboratory:whitelist:edit','laboratory:whitelist:remove']),
  75. pageType:1,
  76. // 遮罩层
  77. loading: false,
  78. // 显示搜索条件
  79. showSearch: true,
  80. // 总条数
  81. total: 0,
  82. // 实验室安全制度表格数据
  83. safe_bookList: [],
  84. // 查询参数
  85. queryParams: {
  86. pageNum: 1,
  87. pageSize:20,
  88. searchValue: null,
  89. },
  90. pageData:{},
  91. };
  92. },
  93. created() {
  94. this.getList();
  95. },
  96. methods: {
  97. delButton(item){
  98. let self = this;
  99. this.$confirm('确定移除当前准入信息,移除后将无法进入实验室?', "警告", {
  100. confirmButtonText: "确定",
  101. cancelButtonText: "取消",
  102. type: "warning"
  103. }).then(function() {
  104. self.whitelistDel(item);
  105. }).then(() => {}).catch(() => {});
  106. },
  107. whitelistDel(item){
  108. whitelistDel(item.id).then(response => {
  109. this.msgSuccess("删除成功");
  110. this.getList();
  111. });
  112. },
  113. getList(){
  114. this.loading = true;
  115. whitelistList(this.queryParams).then(response => {
  116. this.safe_bookList = response.rows;
  117. this.total = response.total;
  118. this.loading = false;
  119. });
  120. },
  121. //新增
  122. pageClick(type){
  123. if(this.pageType != type){
  124. this.pageType = type;
  125. this.pageData= {};
  126. if(type == 1){
  127. this.getList();
  128. }
  129. }
  130. },
  131. //编辑
  132. pageEditClick(type,item){
  133. if(this.pageType != type){
  134. this.pageType = type;
  135. this.pageData=item;
  136. if(type == 1){
  137. this.getList();
  138. }
  139. }
  140. },
  141. /** 搜索按钮操作 */
  142. handleQuery() {
  143. this.queryParams.pageNum = 1;
  144. this.getList();
  145. },
  146. /** 重置按钮操作 */
  147. resetQuery() {
  148. this.queryParams.searchValue='';
  149. this.handleQuery();
  150. },
  151. handleDelete(){
  152. },
  153. }
  154. };
  155. </script>
  156. <style scoped lang="scss">
  157. .whitelist {
  158. flex:1;
  159. display: flex !important;
  160. flex-direction: column;
  161. overflow: hidden;
  162. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  163. .whitelist-page{
  164. flex:1;
  165. display: flex;
  166. flex-direction: column;
  167. overflow: hidden;
  168. padding:11px 20px 20px!important;
  169. .button-box{
  170. margin:0 auto;
  171. width:190px;
  172. display: flex;
  173. }
  174. }
  175. }
  176. </style>