safetyHazardStatistics.vue 12 KB

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