safetyHazardStatistics.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <!--安全隐患统计列表-->
  2. <template>
  3. <div class="safetyHazardStatistics">
  4. <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
  5. <el-form-item label="" prop="deptId" label-width="50px">
  6. <el-select v-model="queryParams.deptId" clearable placeholder="全部">
  7. <el-option
  8. v-for="item in deptSelectList"
  9. :key="item.deptId"
  10. :label="item.deptName"
  11. :value="item.deptId">
  12. </el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="" prop="rectifyStatus">
  16. <el-select v-model="queryParams.rectifyStatus" clearable placeholder="全部状态" style="width: 120px">
  17. <el-option
  18. v-for="item in typeList"
  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="hdLevel">
  26. <el-select v-model="queryParams.hdLevel" clearable placeholder="全部隐患等级" style="width: 140px">
  27. <el-option
  28. v-for="item in levelList"
  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 label="" prop="searchValue" label-width="80px">
  36. <el-input
  37. maxLength="30"
  38. v-model="queryParams.searchValue"
  39. placeholder="计划任务/实验室/房间号"
  40. clearable
  41. style="width: 200px"/>
  42. </el-form-item>
  43. <el-form-item label="" prop="dateRange" label-width="70px">
  44. <el-date-picker
  45. :clearable="false"
  46. v-model="dateRange"
  47. size="small"
  48. style="width: 240px"
  49. value-format="yyyy-MM-dd"
  50. type="daterange"
  51. range-separator="-"
  52. start-placeholder="开始日期"
  53. end-placeholder="结束日期"
  54. ></el-date-picker>
  55. </el-form-item>
  56. <el-form-item>
  57. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  58. <p class="reset-button-one" @click="resetQuery">重置</p>
  59. </el-form-item>
  60. <el-form-item style="float: right;" v-hasPermi="['safety:dataSub:export']">
  61. <el-dropdown @command="exportButton">
  62. <div class="form-dropdown-box">
  63. <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
  64. <p>导出</p>
  65. <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
  66. </div>
  67. <el-dropdown-menu slot="dropdown">
  68. <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
  69. <el-dropdown-item style="margin:0 10px;color:#333;" :command="{command:2}">导出选中数据</el-dropdown-item>
  70. </el-dropdown-menu>
  71. </el-dropdown>
  72. </el-form-item>
  73. </el-form>
  74. <div class="num-data-box">
  75. 共搜索到隐患总数 {{numData.sumTotal}},重大隐患数 {{numData.zdHazardTotal}},一般隐患数 {{numData.ybHazardTotal}},管理问题数 {{numData.glHazardTotal}} ,待整改总数 {{numData.rectifiedTotal}},复核总数 {{numData.resultTotal}},复核通过率 {{numData.rate}}
  76. </div>
  77. <el-table border :data="tableList" ref="multipleTable"
  78. :row-key="getRowKeys"
  79. @select="select" @select-all="selectAll">
  80. <el-table-column type="selection" width="50" align="center" fixed/>
  81. <el-table-column label="序号" align="center" type="index" width="60" fixed/>
  82. <el-table-column label="计划任务" align="center" prop="title" show-overflow-tooltip width="200" fixed/>
  83. <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="200" fixed/>
  84. <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="180"/>
  85. <el-table-column label="房间号" align="center" prop="subRoom" show-overflow-tooltip width="100"/>
  86. <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="180"/>
  87. <el-table-column label="隐患等级" align="center" prop="hazardLevel" show-overflow-tooltip width="100">
  88. <template slot-scope="scope">
  89. {{scope.row.hazardLevel==1?'重大隐患':(scope.row.hazardLevel==2?'一般隐患':(scope.row.hazardLevel==3?'管理问题':''))}}
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="不符合项" align="center" prop="hazardCheckPoint" show-overflow-tooltip width="260">
  93. <template slot-scope="scope">
  94. {{scope.row.hazardCheckCode}} {{scope.row.hazardCheckPoint}}
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="历史出现次数" align="center" prop="sumTotal" show-overflow-tooltip width="120"/>
  98. <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="180"/>
  99. <el-table-column label="检查者" align="center" prop="checkUser" show-overflow-tooltip width="100"/>
  100. <el-table-column label="检查时间" align="center" prop="checkTime2" show-overflow-tooltip width="180"/>
  101. <el-table-column label="状态" align="center" prop="rectifyStatus" show-overflow-tooltip width="100">
  102. <template slot-scope="scope">
  103. {{scope.row.rectifyStatus==1?'复核完毕':(scope.row.rectifyStatus==2?'未整改':(scope.row.rectifyStatus==3?'已整改':(scope.row.rectifyStatus==4?'暂无法整改':'')))}}
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <pagination :page-sizes="[20, 30, 40, 50]"
  108. v-show="total>0"
  109. :total="total"
  110. :page.sync="queryParams.pageNum"
  111. :limit.sync="queryParams.pageSize"
  112. @pagination="getList"
  113. />
  114. </div>
  115. </template>
  116. <script>
  117. import { listDepartments } from "@/api/system/dept";
  118. import { dataStatisticsHazardList,dataStatisticsHazardListTop } from "@/api/safetyCheck/index";
  119. export default {
  120. name: 'safetyHazardStatistics',
  121. data(){
  122. return{
  123. deptSelectList:[],
  124. typeList:[{label:"未整改",key:"2"},{label:"已整改",key:"3"},{label:"暂无法整改",key:"4"},{label:"复核完毕",key:"1"}],
  125. levelList:[{label:"一般隐患",key:"2"},{label:"重大隐患",key:"1"},{label:"管理问题",key:"3"}],
  126. dateRange:[],
  127. queryParams:{
  128. pageNum:1,
  129. pageSize:20,
  130. searchValue:"",
  131. deptId:"",
  132. rectifyStatus:"",
  133. hdLevel:"",
  134. },
  135. setChildren:"",
  136. numData:{},
  137. tableList:[],
  138. total:0,
  139. }
  140. },
  141. created(){
  142. },
  143. mounted(){
  144. this.initializationInterface();
  145. this.getList();
  146. },
  147. methods:{
  148. initializationInterface(){
  149. //获取学院列表
  150. listDepartments().then(response => {
  151. this.deptSelectList = response.data;
  152. });
  153. },
  154. //获取数据列表
  155. getList(){
  156. let obj = JSON.parse(JSON.stringify(this.queryParams))
  157. if(this.dateRange[0]){
  158. obj.beginTime = this.dateRange[0];
  159. }else{
  160. obj.beginTime = "";
  161. }
  162. if(this.dateRange[1]){
  163. obj.endTime = this.dateRange[1];
  164. }else{
  165. obj.endTime = "";
  166. }
  167. dataStatisticsHazardList(obj).then(response => {
  168. this.total = response.total;
  169. this.tableList = response.rows;
  170. });
  171. dataStatisticsHazardListTop(obj).then(response => {
  172. this.$set(this,'numData',response.data);
  173. });
  174. },
  175. /** 搜索按钮操作 */
  176. handleQuery() {
  177. this.$set(this.queryParams,'pageNum',1);
  178. this.getList();
  179. },
  180. /** 重置按钮操作 */
  181. resetQuery() {
  182. this.$set(this,'dateRange',[]);
  183. this.$set(this,'queryParams',{
  184. pageNum:1,
  185. pageSize:20,
  186. searchValue:"",
  187. deptId:"",
  188. rectifyStatus:"",
  189. hdLevel:"",
  190. });
  191. this.handleQuery();
  192. },
  193. /** 导出按钮操作 */
  194. exportButton(item) {
  195. let self = this;
  196. if(item.command == 1){
  197. self.$confirm(`确认导出全部数据?`, "提示", {
  198. confirmButtonText: "确定",
  199. cancelButtonText: "取消",
  200. type: "warning"
  201. }).then(async () => {
  202. self.download('/zd-security/DataStatistics/hazardExport/', {}, '安全隐患统计.xlsx')
  203. }).catch(() => {})
  204. }else if(item.command == 2){
  205. let list = self.$refs.multipleTable.selection;
  206. let ids = [];
  207. for(let i=0;i<list.length;i++){
  208. ids.push(list[i].id)
  209. }
  210. if(ids.length>0) {
  211. self.$confirm(`确认导出选中数据?`, "提示", {
  212. confirmButtonText: "确定",
  213. cancelButtonText: "取消",
  214. type: "warning"
  215. }).then(async () => {
  216. self.download(`/zd-security/DataStatistics/hazardExport/?ids=`+ids,{}, '安全隐患统计.xlsx')
  217. this.$refs.multipleTable.clearSelection();
  218. }).catch(() => {})
  219. }else {
  220. this.msgError('请选择要导出的数据')
  221. }
  222. }
  223. },
  224. /*===记录勾选数据===
  225. 需要再el-table 添加 :row-key="getRowKeys"
  226. 需要在selection 添加 :reserve-selection="true"
  227. */
  228. getRowKeys(row) {
  229. return row.id
  230. },
  231. // 单选
  232. select (selection, row) {
  233. if (selection.some(el => { return row.id === el.id })) {
  234. if (row.children) {
  235. this.setChildren(row.children, true)
  236. }
  237. } else {
  238. if (row.children) {
  239. this.setChildren(row.children, false)
  240. }
  241. }
  242. },
  243. // 全选
  244. selectAll (selection) {
  245. const isSelect = selection.some(el => {
  246. const tableDataIds = this.tableData.map(j => j.id)
  247. return tableDataIds.includes(el.id)
  248. })
  249. const isCancel = !this.tableData.every(el => {
  250. const selectIds = selection.map(j => j.id)
  251. return selectIds.includes(el.id)
  252. })
  253. if (isSelect) {
  254. selection.map(el => {
  255. if (el.children) {
  256. this.setChildren(el.children, true)
  257. }
  258. })
  259. }
  260. if (isCancel) {
  261. this.tableData.map(el => {
  262. if (el.children) {
  263. this.setChildren(el.children, false)
  264. }
  265. })
  266. }
  267. },
  268. }
  269. }
  270. </script>
  271. <style scoped lang="scss">
  272. ::v-deep .el-table__fixed{
  273. margin-top:-1px;
  274. margin-left:-1px;
  275. height:100%!important;
  276. }
  277. ::v-deep .el-table__fixed-body-wrapper{
  278. height: calc(100% - 48px);
  279. overflow-y: auto;
  280. pointer-events: none;
  281. cursor: default;
  282. }
  283. .safetyHazardStatistics{
  284. flex:1;
  285. display: flex;
  286. flex-direction: column;
  287. overflow: hidden;
  288. padding:20px;
  289. .form-box{
  290. .form-dropdown-box{
  291. display: flex;
  292. margin:0;
  293. padding:0 10px;
  294. cursor: pointer;
  295. height:40px;
  296. img:nth-child(1){
  297. width:16px;
  298. height:16px;
  299. margin-top:12px;
  300. }
  301. p{
  302. width:47px;
  303. text-align: center;
  304. font-size:14px;
  305. margin:0;
  306. line-height:40px;
  307. }
  308. img:nth-child(3){
  309. width:10px;
  310. height:6px;
  311. margin-top:17px;
  312. }
  313. }
  314. }
  315. .num-data-box{
  316. background: rgba(1,131,250,0.2);
  317. color:#0183FA;
  318. font-size:14px;
  319. line-height:40px;
  320. padding:0 20px;
  321. border-radius:4px;
  322. margin-bottom:20px;
  323. }
  324. }
  325. </style>