马宇豪
2023-02-13 cbaa21c32c9899e135bc22f51f02fbbed0635164
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
    <div class="table">
        <div class="table_content">
<!--            <div></div>-->
            <el-table
                v-loading="listLoading"
                :key="tableKey"
                :data="checkData"
                border
                fit
                id="areaSheet"
                highlight-current-row
                style="width: 100%;"
            >
 
                <el-table-column type="index" label="序号" align="center" width="80"/>
                <el-table-column label="单位名称" prop="enterpriseName" align="center" width="180"></el-table-column>
                <el-table-column label="联系电话" prop="enterpriseOfficephone" align="center"></el-table-column>
                <el-table-column label="库存数量/箱" prop="stockNum" align="center"></el-table-column>
                <el-table-column label="库容量/箱" prop="storageCapacity" align="center"></el-table-column>
                <el-table-column label="是否查出隐患" prop="hiddendangerStatus" align="center">
                    <template slot-scope="scope">
                        <span>{{ scope.row.hiddendangerStatus == 1 ? '是' : '否' }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="是否自查" prop="selfcheckStatus" align="center">
                    <template slot-scope="scope">
                        <span>{{ scope.row.selfcheckStatus == 1 ? '已自查' : '未自查' }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="被检查次数" prop="checkedTimes" align="center"></el-table-column>
                <el-table-column label="隐患数量" prop="hiddendangerSum" align="center"></el-table-column>
                <el-table-column label="整改数量" prop="rectifyHiddendangerSum" align="center"></el-table-column>
                <el-table-column label="重大整改数量" prop="rectifyMajorHiddendangerNum" align="center"></el-table-column>
                <el-table-column label="操作" align="center" class-name="small-padding">
                    <template slot-scope="scope">
                        <el-button type="text" @click="toEnterprises(scope.row.selfAndcheckInfos)">查看</el-button>
                    </template>
                </el-table-column>
            </el-table>
 
            <el-pagination
                v-show="recordTotal>0"
                :current-page="currentPage"
                :page-sizes="[10, 15]"
                :page-size="pageSize"
                :total="recordTotal"
                layout="total, sizes, prev, pager, next, jumper"
                background
                style="float:right;margin:3px"
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
            />
        </div>
        <area-enterprises ref="enterPrises"></area-enterprises>
    </div>
</template>
 
<script>
import {mapGetters} from "vuex";
import Cookies from "js-cookie";
import {paramList} from "../../../api/contract";
import {computePageCount} from "../../../utils";
import {parseError} from "../../../utils/messageDialog";
import { getCheckUnitType, getEnterpriseCompleteInfoList, getDataStatistics, getSpecialCheckTask } from "@/api/specialCheck"
import AreaEnterprises from "./areaEnterprises";
 
export default {
name: "areaForm",
    components: {AreaEnterprises},
    data(){
        return{
            recordTotal: 0,
            pageSize: 10,
            currentPage: 1,
            unitType: null,
            taskId: null,
            enterpriseType: null,
            enterpriseCity: '',
            enterpriseArea: '',
            listLoading: false,
            tableKey: 0,
            checkData: []
        }
    },
    created() {
        const t = this
        t.getCheckUnitType()
        if(t.taskId){t.getAreaStatistics()}
    },
    computed: {
        ...mapGetters([
            'userType',
            'name'
        ])
    },
    methods:{
        async getCheckUnitType(){
            const t = this
            t.listLoading = true
            let res = await getCheckUnitType()
            if(res.data.code === "200"){
                t.unitType = res.data.result.checkUnitType
            }else{
                t.$message({
                    type:'warning',
                    message:res.data.message
                })
            }
            t.listLoading = false
        },
        async getAreaStatistics(){
            const t = this
            const data = {id: t.taskId,enterpriseType: t.enterpriseType,enterpriseCity: t.enterpriseCity,enterpriseArea: t.enterpriseArea,pageIndex: t.currentPage,pageSize: t.pageSize}
            const res = await getDataStatistics(data)
            if(res.data.code === "200"){
                t.checkData = res.data.result.records
                t.recordTotal = res.data.result.total
            }else{
                t.$message({
                    type:'warning',
                    message:res.data.message
                })
            }
        },
 
        handleSizeChange: function (val) {
            this.pageSize = val
            this.currentPage = 1
            this.getAreaStatistics()
        },
        handleCurrentChange: function (val) {
            this.currentPage = val
            this.getAreaStatistics()
        },
 
        toEnterprises(infos){
            this.$refs.enterPrises.checkList = infos
            this.$refs.enterPrises.enterpriseType = this.enterpriseType
            this.$refs.enterPrises.dialogVisible = true
        }
    }
}
</script>
 
<style lang="scss" scoped>
    .table{
        width: 100%;
        height: 100%;
    }
</style>