index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <!--校院巡查组-->
  2. <template>
  3. <div class="app-container inspectionGroup">
  4. <div class="title-box">
  5. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true" label-width="80px">
  6. <el-form-item label="关键字" prop="searchValue">
  7. <el-input
  8. maxLength="30"
  9. v-model="queryParams.searchValue"
  10. placeholder="巡查组名称"
  11. clearable
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. <el-form-item label="巡查层级" prop="checkLevel">
  16. <el-select v-model="queryParams.checkLevel" clearable placeholder="请选择层级" style="width: 150px">
  17. <el-option
  18. v-for="item in optionsOne"
  19. :key="item.key"
  20. :label="item.label"
  21. :value="item.key">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="状态" prop="enable" label-width="60px">
  26. <el-select v-model="queryParams.enable" clearable placeholder="请选择状态" style="width: 150px">
  27. <el-option
  28. v-for="item in optionsTwo"
  29. :key="item.key"
  30. :label="item.label"
  31. :value="item.key">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  37. <p class="reset-button-one" @click="resetQuery">重置</p>
  38. </el-form-item>
  39. <el-form-item style="float: right;" v-hasPermi="['security:checkGroup:add']">
  40. <el-col :span="1.5">
  41. <p class="inquire-button-one"
  42. style="width:130px;"
  43. @click="addDialogOpen(1)"
  44. ><i class="el-icon-plus"></i>添加巡察组</p>
  45. </el-col>
  46. </el-form-item>
  47. </el-form>
  48. </div>
  49. <div class="content-box">
  50. <el-table border :data="tableList" ref="multipleTable">
  51. <el-table-column label="序号" width="60" align="center" type="index"/>
  52. <el-table-column label="巡查组名称" align="center" prop="groupName" show-overflow-tooltip/>
  53. <el-table-column label="巡查层级" align="center" prop="checkLevel" show-overflow-tooltip width="200">
  54. <template slot-scope="scope">{{scope.row.checkLevel==1?'校级':(scope.row.checkLevel==2?'院级':'')}}</template>
  55. </el-table-column>
  56. <el-table-column label="成员人数" align="center" prop="peopleNum" show-overflow-tooltip width="150"/>
  57. <el-table-column label="是否启用" align="center" prop="enable" show-overflow-tooltip width="185">
  58. <template slot-scope="scope">
  59. <div style="width:70px;margin-left:50px;">
  60. <el-switch
  61. @click.native="switchClick(scope.row)"
  62. class="switch"
  63. v-model="scope.row.enable"
  64. :active-value="1"
  65. :inactive-value="0"
  66. active-color="#0183FA"
  67. inactive-color="#E0E0E0"
  68. active-text="启用"
  69. inactive-text="停用"
  70. disabled
  71. ></el-switch>
  72. </div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="操作人" align="center" prop="deptName" show-overflow-tooltip width="150">
  76. <template slot-scope="scope">{{scope.row.updateName?scope.row.updateName:scope.row.createName}}</template>
  77. </el-table-column>
  78. <el-table-column label="操作时间" align="center" prop="updateTime" show-overflow-tooltip width="250">
  79. <template slot-scope="scope">{{scope.row.updateTime?scope.row.updateTime:scope.row.createTime}}</template>
  80. </el-table-column>
  81. <el-table-column label="操作" align="center" prop="deptName" width="200" v-if="tableButtonType">
  82. <template slot-scope="scope">
  83. <div class="table-button-box">
  84. <p class="table-button-null"></p>
  85. <p class="table-button-p" @click="addDialogOpen(3,scope.row)" v-hasPermi="['security:checkGroup:query']">详情</p>
  86. <p class="table-button-p" @click="addDialogOpen(2,scope.row)" v-hasPermiAnd="['security:checkGroup:query','security:checkGroup:edit']">编辑</p>
  87. <p class="table-button-p" @click="deleteObj(scope.row)" v-hasPermi="['security:checkGroup:remove']">删除</p>
  88. <p class="table-button-null"></p>
  89. </div>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination :page-sizes="[20, 30, 40, 50]"
  94. v-show="total>0"
  95. :total="total"
  96. :page.sync="queryParams.pageNum"
  97. :limit.sync="queryParams.pageSize"
  98. @pagination="getList"
  99. />
  100. </div>
  101. <addDialog v-if="addDialogType" :addDialogData="addDialogData"></addDialog>
  102. </div>
  103. </template>
  104. <script>
  105. import addDialog from './addDialog.vue'
  106. import { checkGroupList,checkGroupDelete,checkGroupEnable } from '@/api/safetyCheck/index'
  107. export default {
  108. name: 'index',
  109. components: {
  110. addDialog,
  111. },
  112. data(){
  113. return{
  114. tableButtonType:this.hasPermiDom(['security:checkGroup:query','security:checkGroup:edit','security:checkGroup:remove']),
  115. addDialogType:false,
  116. addDialogData:{},
  117. queryParams:{
  118. pageNum:1,
  119. pageSize:20,
  120. searchValue:"",
  121. checkLevel:"",
  122. enable:"",
  123. },
  124. tableList:[],
  125. total:0,
  126. optionsOne:[{key:1,label:"校级"},{key:2,label:"院级"}],
  127. optionsTwo:[{key:1,label:"启用"},{key:0,label:"停用"}],
  128. }
  129. },
  130. created(){
  131. },
  132. mounted(){
  133. this.getList();
  134. },
  135. methods:{
  136. //弹窗开启
  137. addDialogOpen(type,data){
  138. if(type==1){
  139. this.$set(this,'addDialogData',{
  140. title:"新增巡察组",
  141. addType:true,
  142. lookInfoType:false,
  143. })
  144. this.$set(this,'addDialogType',true)
  145. }else if(type == 2){
  146. this.$set(this,'addDialogData',{
  147. title:"编辑巡察组",
  148. addType:false,
  149. lookInfoType:false,
  150. id:data.id
  151. })
  152. this.$set(this,'addDialogType',true)
  153. }else if(type == 3){
  154. this.$set(this,'addDialogData',{
  155. title:"巡察组详情",
  156. addType:false,
  157. lookInfoType:true,
  158. id:data.id
  159. })
  160. this.$set(this,'addDialogType',true)
  161. }else if(type == 5){
  162. this.getList();
  163. this.$set(this,'addDialogType',false)
  164. }else{
  165. this.$set(this,'addDialogType',false)
  166. }
  167. },
  168. // 开关
  169. switchClick(data){
  170. console.log('data',data);
  171. let self = this;
  172. this.$confirm('是否确认'+(data.enable==1?'停用':'启用')+'?', "警告", {
  173. confirmButtonText: "确定",
  174. cancelButtonText: "取消",
  175. type: "warning"
  176. }).then(function() {
  177. let obj = {
  178. checkGroupId:data.id,
  179. enable:data.enable==1?0:1
  180. };
  181. checkGroupEnable(obj).then(response => {
  182. self.msgSuccess(response.msg)
  183. self.getList();
  184. });
  185. }).then(() => {
  186. }).catch(() => {});
  187. },
  188. //获取数据列表
  189. getList(){
  190. checkGroupList(this.queryParams).then(response => {
  191. this.total = response.data.total;
  192. this.tableList = response.data.records;
  193. });
  194. },
  195. /** 搜索按钮操作 */
  196. handleQuery() {
  197. this.$set(this.queryParams,'pageNum',1);
  198. this.getList();
  199. },
  200. /** 重置按钮操作 */
  201. resetQuery() {
  202. this.$set(this,'queryParams',{
  203. pageNum:1,
  204. pageSize:20,
  205. searchValue:"",
  206. checkLevel:"",
  207. enable:"",
  208. });
  209. this.handleQuery();
  210. },
  211. //删除
  212. deleteObj(data){
  213. let self = this;
  214. this.$confirm('是否确认删除?', "警告", {
  215. confirmButtonText: "确定",
  216. cancelButtonText: "取消",
  217. type: "warning"
  218. }).then(function() {
  219. checkGroupDelete({id:data.id}).then(response => {
  220. self.msgSuccess(response.msg)
  221. self.getList();
  222. });
  223. }).then(() => {
  224. }).catch(() => {});
  225. },
  226. }
  227. }
  228. </script>
  229. <style scoped lang="scss">
  230. .inspectionGroup {
  231. flex: 1;
  232. display: flex !important;
  233. flex-direction: column;
  234. overflow: hidden;
  235. .title-box{
  236. padding-top:20px;
  237. border-bottom:1px solid #dedede;
  238. }
  239. .content-box{
  240. flex: 1;
  241. display: flex;
  242. flex-direction: column;
  243. padding:20px;
  244. overflow: hidden;
  245. }
  246. }
  247. </style>