index.vue 7.9 KB

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