123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <!--安全隐患统计列表-->
- <template>
- <div class="safetyHazardStatistics">
- <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
- <el-form-item label="" prop="deptId" label-width="50px">
- <el-select v-model="queryParams.deptId" clearable placeholder="全部">
- <el-option
- v-for="item in deptSelectList"
- :key="item.deptId"
- :label="item.deptName"
- :value="item.deptId">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" prop="rectifyStatus">
- <el-select v-model="queryParams.rectifyStatus" clearable placeholder="全部状态" style="width: 120px">
- <el-option
- v-for="item in typeList"
- :key="item.key"
- :label="item.label"
- :value="item.key">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" prop="hdLevel">
- <el-select v-model="queryParams.hdLevel" clearable placeholder="全部隐患等级" style="width: 140px">
- <el-option
- v-for="item in levelList"
- :key="item.key"
- :label="item.label"
- :value="item.key">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="" prop="searchValue" label-width="80px">
- <el-input
- maxLength="30"
- v-model="queryParams.searchValue"
- placeholder="计划任务/实验室/房间号"
- clearable
- style="width: 200px"/>
- </el-form-item>
- <el-form-item label="" prop="dateRange" label-width="70px">
- <el-date-picker
- :clearable="false"
- v-model="dateRange"
- size="small"
- style="width: 240px"
- value-format="yyyy-MM-dd"
- type="daterange"
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- ></el-date-picker>
- </el-form-item>
- <el-form-item>
- <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
- <p class="reset-button-one" @click="resetQuery">重置</p>
- </el-form-item>
- <el-form-item style="float: right;" v-hasPermi="['safety:dataSub:export']">
- <export-component :exportConfig="exportConfig"></export-component>
- </el-form-item>
- </el-form>
- <div class="num-data-box">
- 共搜索到隐患总数 {{numData.sumTotal}},重大隐患数 {{numData.zdHazardTotal}},一般隐患数 {{numData.ybHazardTotal}},管理问题数 {{numData.glHazardTotal}} ,待整改总数 {{numData.rectifiedTotal}},复核总数 {{numData.resultTotal}},复核通过率 {{numData.rate}}
- </div>
- <el-table border :data="tableList" ref="multipleTable"
- :row-key="getRowKeys"
- @select="select" @select-all="selectAll">
- <el-table-column type="selection" width="50" align="center" fixed/>
- <el-table-column label="序号" align="center" type="index" width="60" fixed/>
- <el-table-column label="计划任务" align="center" prop="title" show-overflow-tooltip width="200" fixed/>
- <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="200" fixed/>
- <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="180"/>
- <el-table-column label="房间号" align="center" prop="subRoom" show-overflow-tooltip width="100"/>
- <el-table-column label="楼栋" align="center" prop="buildName" show-overflow-tooltip width="180"/>
- <el-table-column label="隐患等级" align="center" prop="hazardLevel" show-overflow-tooltip width="100">
- <template slot-scope="scope">
- {{scope.row.hazardLevel==1?'重大隐患':(scope.row.hazardLevel==2?'一般隐患':(scope.row.hazardLevel==3?'管理问题':''))}}
- </template>
- </el-table-column>
- <el-table-column label="不符合项" align="center" prop="hazardCheckPoint" show-overflow-tooltip width="260">
- <template slot-scope="scope">
- <span>{{scope.row.hazardCheckCode}}</span>
- <span v-if="scope.row.checkCategory==1">{{scope.row.hazardCheckPoint}}</span>
- <span v-if="scope.row.checkCategory!=1">{{scope.row.hazardCheckName}}</span>
- </template>
- </el-table-column>
- <el-table-column label="历史出现次数" align="center" prop="sumTotal" show-overflow-tooltip width="120"/>
- <el-table-column label="隐患描述" align="center" prop="hazardDescribe" show-overflow-tooltip width="180"/>
- <el-table-column label="检查者" align="center" prop="checkUser" show-overflow-tooltip width="100"/>
- <el-table-column label="检查时间" align="center" prop="checkTime2" show-overflow-tooltip width="180"/>
- <el-table-column label="状态" align="center" prop="rectifyStatus" show-overflow-tooltip width="100">
- <template slot-scope="scope">
- {{scope.row.rectifyStatus==1?'复核完毕':(scope.row.rectifyStatus==2?'未整改':(scope.row.rectifyStatus==3?'已整改':(scope.row.rectifyStatus==4?'暂无法整改':'')))}}
- </template>
- </el-table-column>
- </el-table>
- <pagination :page-sizes="[20, 30, 40, 50]"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </template>
- <script>
- import { listDepartments } from "@/apiDemo/system/dept";
- import { dataStatisticsHazardList,dataStatisticsHazardListTop } from "@/apiDemo/safetyCheck/index";
- // V3
- import exportComponent from "@/components/exportComponent/exportComponent.vue";
- export default {
- name: 'safetyHazardStatistics',
- components: {
- exportComponent,
- },
- data(){
- return{
- //导出
- exportConfig:{
- api:'/zd-security/DataStatistics/hazardExport/', //导出接口地址
- ids:'', //勾选导出,勾选的IDS
- fileName:'安全隐患统计', //导出文件的命名
- },
- deptSelectList:[],
- typeList:[{label:"未整改",key:"2"},{label:"已整改",key:"3"},{label:"暂无法整改",key:"4"},{label:"复核完毕",key:"1"}],
- levelList:[{label:"一般隐患",key:"2"},{label:"重大隐患",key:"1"},{label:"管理问题",key:"3"}],
- dateRange:[],
- queryParams:{
- pageNum:1,
- pageSize:20,
- searchValue:"",
- deptId:"",
- rectifyStatus:"",
- hdLevel:"",
- },
- setChildren:"",
- numData:{},
- tableList:[],
- total:0,
- }
- },
- created(){
- },
- mounted(){
- this.initializationInterface();
- this.getList();
- },
- methods:{
- initializationInterface(){
- //获取学院列表
- listDepartments().then(response => {
- this.deptSelectList = response.data;
- });
- },
- //获取数据列表
- getList(){
- let obj = JSON.parse(JSON.stringify(this.queryParams))
- if(this.dateRange[0]){
- obj.beginTime = this.dateRange[0];
- }else{
- obj.beginTime = "";
- }
- if(this.dateRange[1]){
- obj.endTime = this.dateRange[1];
- }else{
- obj.endTime = "";
- }
- dataStatisticsHazardList(obj).then(response => {
- this.total = response.data.total;
- this.tableList = response.data.records;
- });
- dataStatisticsHazardListTop(obj).then(response => {
- this.$set(this,'numData',response.data);
- });
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.$set(this.queryParams,'pageNum',1);
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.$set(this,'dateRange',[]);
- this.$set(this,'queryParams',{
- pageNum:1,
- pageSize:20,
- searchValue:"",
- deptId:"",
- rectifyStatus:"",
- hdLevel:"",
- });
- this.handleQuery();
- },
- /** 导出按钮操作 */
- exportButton(item) {
- let self = this;
- if(item.command == 1){
- self.$confirm(`确认导出全部数据?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(async () => {
- self.download('/zd-security/DataStatistics/hazardExport/', {}, '安全隐患统计.xlsx')
- }).catch(() => {})
- }else if(item.command == 2){
- let list = self.$refs.multipleTable.selection;
- let ids = [];
- for(let i=0;i<list.length;i++){
- ids.push(list[i].id)
- }
- if(ids.length>0) {
- self.$confirm(`确认导出选中数据?`, "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(async () => {
- self.download(`/zd-security/DataStatistics/hazardExport/?ids=`+ids,{}, '安全隐患统计.xlsx')
- this.$refs.multipleTable.clearSelection();
- }).catch(() => {})
- }else {
- this.msgError('请选择要导出的数据')
- }
- }
- },
- /*===记录勾选数据===
- 需要再el-table 添加 :row-key="getRowKeys"
- 需要在selection 添加 :reserve-selection="true"
- */
- getRowKeys(row) {
- return row.id
- },
- // 单选
- select (selection, row) {
- if (selection.some(el => { return row.id === el.id })) {
- if (row.children) {
- this.setChildren(row.children, true)
- }
- } else {
- if (row.children) {
- this.setChildren(row.children, false)
- }
- }
- },
- // 全选
- selectAll (selection) {
- const isSelect = selection.some(el => {
- const tableDataIds = this.tableData.map(j => j.id)
- return tableDataIds.includes(el.id)
- })
- const isCancel = !this.tableData.every(el => {
- const selectIds = selection.map(j => j.id)
- return selectIds.includes(el.id)
- })
- if (isSelect) {
- selection.map(el => {
- if (el.children) {
- this.setChildren(el.children, true)
- }
- })
- }
- if (isCancel) {
- this.tableData.map(el => {
- if (el.children) {
- this.setChildren(el.children, false)
- }
- })
- }
- },
- }
- }
- </script>
- <style scoped lang="scss">
- ::v-deep .el-table__body-wrapper{
- padding-bottom: 8px;
- }
- ::v-deep .el-table__fixed{
- margin-top:-1px;
- margin-left:-1px;
- height:calc(100% - 8px)!important;
- }
- ::v-deep .el-table__fixed-body-wrapper{
- height: calc(100% - 48px);
- overflow-y: auto;
- }
- .safetyHazardStatistics{
- flex:1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- padding:20px;
- .form-box{
- .form-dropdown-box{
- display: flex;
- margin:0;
- padding:0 10px;
- cursor: pointer;
- height:40px;
- img:nth-child(1){
- width:16px;
- height:16px;
- margin-top:12px;
- }
- p{
- width:47px;
- text-align: center;
- font-size:14px;
- margin:0;
- line-height:40px;
- }
- img:nth-child(3){
- width:10px;
- height:6px;
- margin-top:17px;
- }
- }
- }
- .num-data-box{
- background: rgba(1,131,250,0.2);
- color:#0183FA;
- font-size:14px;
- line-height:40px;
- padding:0 20px;
- border-radius:4px;
- margin-bottom:20px;
- }
- }
- </style>
|