safetyHazardStatistics.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. <span>{{scope.row.hazardCheckCode}}</span>
  95. <span v-if="scope.row.checkCategory==1">{{scope.row.hazardCheckPoint}}</span>
  96. <span v-if="scope.row.checkCategory!=1">{{scope.row.hazardCheckName}}</span>
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="历史出现次数" align="center" prop="sumTotal" show-overflow-tooltip width="120"/>
  100. <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="180"/>
  101. <el-table-column label="检查者" align="center" prop="checkUser" show-overflow-tooltip width="100"/>
  102. <el-table-column label="检查时间" align="center" prop="checkTime2" show-overflow-tooltip width="180"/>
  103. <el-table-column label="状态" align="center" prop="rectifyStatus" show-overflow-tooltip width="100">
  104. <template slot-scope="scope">
  105. {{scope.row.rectifyStatus==1?'复核完毕':(scope.row.rectifyStatus==2?'未整改':(scope.row.rectifyStatus==3?'已整改':(scope.row.rectifyStatus==4?'暂无法整改':'')))}}
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination :page-sizes="[20, 30, 40, 50]"
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. </div>
  117. </template>
  118. <script>
  119. import { listDepartments } from "@/api/system/dept";
  120. import { dataStatisticsHazardList,dataStatisticsHazardListTop } from "@/api/safetyCheck/index";
  121. export default {
  122. name: 'safetyHazardStatistics',
  123. data(){
  124. return{
  125. deptSelectList:[],
  126. typeList:[{label:"未整改",key:"2"},{label:"已整改",key:"3"},{label:"暂无法整改",key:"4"},{label:"复核完毕",key:"1"}],
  127. levelList:[{label:"一般隐患",key:"2"},{label:"重大隐患",key:"1"},{label:"管理问题",key:"3"}],
  128. dateRange:[],
  129. queryParams:{
  130. pageNum:1,
  131. pageSize:20,
  132. searchValue:"",
  133. deptId:"",
  134. rectifyStatus:"",
  135. hdLevel:"",
  136. },
  137. setChildren:"",
  138. numData:{},
  139. tableList:[],
  140. total:0,
  141. }
  142. },
  143. created(){
  144. },
  145. mounted(){
  146. this.initializationInterface();
  147. this.getList();
  148. },
  149. methods:{
  150. initializationInterface(){
  151. //获取学院列表
  152. listDepartments().then(response => {
  153. this.deptSelectList = response.data;
  154. });
  155. },
  156. //获取数据列表
  157. getList(){
  158. let obj = JSON.parse(JSON.stringify(this.queryParams))
  159. if(this.dateRange[0]){
  160. obj.beginTime = this.dateRange[0];
  161. }else{
  162. obj.beginTime = "";
  163. }
  164. if(this.dateRange[1]){
  165. obj.endTime = this.dateRange[1];
  166. }else{
  167. obj.endTime = "";
  168. }
  169. dataStatisticsHazardList(obj).then(response => {
  170. this.total = response.data.total;
  171. this.tableList = response.data.records;
  172. });
  173. dataStatisticsHazardListTop(obj).then(response => {
  174. this.$set(this,'numData',response.data);
  175. });
  176. },
  177. /** 搜索按钮操作 */
  178. handleQuery() {
  179. this.$set(this.queryParams,'pageNum',1);
  180. this.getList();
  181. },
  182. /** 重置按钮操作 */
  183. resetQuery() {
  184. this.$set(this,'dateRange',[]);
  185. this.$set(this,'queryParams',{
  186. pageNum:1,
  187. pageSize:20,
  188. searchValue:"",
  189. deptId:"",
  190. rectifyStatus:"",
  191. hdLevel:"",
  192. });
  193. this.handleQuery();
  194. },
  195. /** 导出按钮操作 */
  196. exportButton(item) {
  197. let self = this;
  198. if(item.command == 1){
  199. self.$confirm(`确认导出全部数据?`, "提示", {
  200. confirmButtonText: "确定",
  201. cancelButtonText: "取消",
  202. type: "warning"
  203. }).then(async () => {
  204. self.download('/zd-security/DataStatistics/hazardExport/', {}, '安全隐患统计.xlsx')
  205. }).catch(() => {})
  206. }else if(item.command == 2){
  207. let list = self.$refs.multipleTable.selection;
  208. let ids = [];
  209. for(let i=0;i<list.length;i++){
  210. ids.push(list[i].id)
  211. }
  212. if(ids.length>0) {
  213. self.$confirm(`确认导出选中数据?`, "提示", {
  214. confirmButtonText: "确定",
  215. cancelButtonText: "取消",
  216. type: "warning"
  217. }).then(async () => {
  218. self.download(`/zd-security/DataStatistics/hazardExport/?ids=`+ids,{}, '安全隐患统计.xlsx')
  219. this.$refs.multipleTable.clearSelection();
  220. }).catch(() => {})
  221. }else {
  222. this.msgError('请选择要导出的数据')
  223. }
  224. }
  225. },
  226. /*===记录勾选数据===
  227. 需要再el-table 添加 :row-key="getRowKeys"
  228. 需要在selection 添加 :reserve-selection="true"
  229. */
  230. getRowKeys(row) {
  231. return row.id
  232. },
  233. // 单选
  234. select (selection, row) {
  235. if (selection.some(el => { return row.id === el.id })) {
  236. if (row.children) {
  237. this.setChildren(row.children, true)
  238. }
  239. } else {
  240. if (row.children) {
  241. this.setChildren(row.children, false)
  242. }
  243. }
  244. },
  245. // 全选
  246. selectAll (selection) {
  247. const isSelect = selection.some(el => {
  248. const tableDataIds = this.tableData.map(j => j.id)
  249. return tableDataIds.includes(el.id)
  250. })
  251. const isCancel = !this.tableData.every(el => {
  252. const selectIds = selection.map(j => j.id)
  253. return selectIds.includes(el.id)
  254. })
  255. if (isSelect) {
  256. selection.map(el => {
  257. if (el.children) {
  258. this.setChildren(el.children, true)
  259. }
  260. })
  261. }
  262. if (isCancel) {
  263. this.tableData.map(el => {
  264. if (el.children) {
  265. this.setChildren(el.children, false)
  266. }
  267. })
  268. }
  269. },
  270. }
  271. }
  272. </script>
  273. <style scoped lang="scss">
  274. ::v-deep .el-table__body-wrapper{
  275. padding-bottom: 8px;
  276. }
  277. ::v-deep .el-table__fixed{
  278. margin-top:-1px;
  279. margin-left:-1px;
  280. height:calc(100% - 8px)!important;
  281. }
  282. ::v-deep .el-table__fixed-body-wrapper{
  283. height: calc(100% - 48px);
  284. overflow-y: auto;
  285. }
  286. .safetyHazardStatistics{
  287. flex:1;
  288. display: flex;
  289. flex-direction: column;
  290. overflow: hidden;
  291. padding:20px;
  292. .form-box{
  293. .form-dropdown-box{
  294. display: flex;
  295. margin:0;
  296. padding:0 10px;
  297. cursor: pointer;
  298. height:40px;
  299. img:nth-child(1){
  300. width:16px;
  301. height:16px;
  302. margin-top:12px;
  303. }
  304. p{
  305. width:47px;
  306. text-align: center;
  307. font-size:14px;
  308. margin:0;
  309. line-height:40px;
  310. }
  311. img:nth-child(3){
  312. width:10px;
  313. height:6px;
  314. margin-top:17px;
  315. }
  316. }
  317. }
  318. .num-data-box{
  319. background: rgba(1,131,250,0.2);
  320. color:#0183FA;
  321. font-size:14px;
  322. line-height:40px;
  323. padding:0 20px;
  324. border-radius:4px;
  325. margin-bottom:20px;
  326. }
  327. }
  328. </style>