马宇豪
2025-04-23 34ec919649adfefeecd0418284dd7b02e9ed49b8
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
<template>
    <div class="app-container">
        <div class="filter-container">
            <div style="display: block;">
                <div class="basic_search" style="padding-top: 10px;">
                    <span>按时间查询:</span>
                    <el-date-picker
                        value-format="yyyy-MM-dd HH:mm:ss"
                        v-model="validTime"
                        type="daterange"
                        :default-time="['00:00:00','23:59:59']"
                        range-separator="-"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                    >
                    </el-date-picker>
                </div>
                <div class="basic_search" style="margin-right: 10px;padding-top: 10px">
                    <span>状态:</span>
                    <el-select v-model="listQuery.filter.alarmStatus" clearable filterable>
                        <el-option key="0" label="全部" value=""></el-option>
                        <el-option key="1" label="未销警" :value="0"></el-option>
                        <el-option key="2" label="已销警" :value="1"></el-option>
                    </el-select>
                </div>
                <div class="basic_search" style="margin-right: 10px;padding-top: 10px">
                    <span>报警类型:</span>
                    <el-select v-model="listQuery.filter.alarmType" clearable filterable>
                        <el-option key="1" label="超员作业" :value="1"></el-option>
                        <el-option key="2" label="堵塞通道" :value="2"></el-option>
                        <el-option key="3" label="超高超量" :value="3"></el-option>
                        <el-option key="4" label="非法入侵" :value="4"></el-option>
                        <el-option key="5" label="摄像头遮挡偏移" :value="5"></el-option>
                        <el-option key="6" label="温度" :value="6"></el-option>
                        <el-option key="7" label="湿度" :value="7"></el-option>
                    </el-select>
                </div>
                <div class="basic_search">
                    <span>企业名称:</span>
                    <el-input v-model.trim="listQuery.filter.companyName" style="width: 300px"/>
                </div>
                <div class="basic_search" style="margin-right: 10px">
                    <el-button style="margin-left: 10px;" type="primary" @click="reset()">重置</el-button>
                    <el-button style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="search()">查询</el-button>
                </div>
            </div>
        </div>
        <div class="table_content">
            <el-table
                :key="tableKey"
                :data="dataList"
                border
                fit
                highlight-current-row
                style="width: 100%;"
            >
                <el-table-column label="序号" type="index" align="center"></el-table-column>
                <el-table-column label="企业" prop="companyName" align="center"></el-table-column>
                <el-table-column label="仓库" prop="storeName" align="center"></el-table-column>
                <el-table-column label="库房" prop="storeroomName" align="center"></el-table-column>
                <el-table-column label="报警类型" prop="alarmType" align="center">
                    <template slot-scope="scope">
                        {{getTypeName(scope.row.alarmType)}}
                    </template>
                </el-table-column>
                <el-table-column label="报警状态" prop="alarmStatus" align="center">
                    <template slot-scope="scope">
                        {{ scope.row.alarmStatus == 1?'已销警':'未销警' }}
                    </template>
                </el-table-column>
                <el-table-column label="报警图片" prop="alarmFile" align="center">
                    <template slot-scope="scope">
                        <el-image style="width: 100px; height: 100px" :preview-src-list="[scope.row.alarmFile]" :src="scope.row.alarmFile" fit="cover"></el-image>
                    </template>
                </el-table-column>
                <el-table-column label="报警时间" prop="warningDate" align="center"></el-table-column>
                <el-table-column label="销警时间" prop="clearDate" align="center"></el-table-column>
<!--                <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width" fixed="right">-->
<!--                    <template slot-scope="scope">-->
<!--                        <el-button type="text" @click="clearWarning(scope.row.id)">销警</el-button>-->
<!--                    </template>-->
<!--                </el-table-column>-->
            </el-table>
            <br>
            <div style="display: flex;justify-content: right">
                <el-pagination
                    v-show="recordTotal>0"
                    :current-page="currentPage"
                    :page-sizes="[10, 20, 30, 50]"
                    :page-size="listQuery.pageSize"
                    :total="recordTotal"
                    layout="total, sizes, prev, pager, next, jumper"
                    background
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
            </div>
            <warning-info-dialog ref="warningInfoRef"></warning-info-dialog>
        </div>
    </div>
</template>
 
<script>
import {computePageCount} from "../../../utils";
import {regionPifaBox} from "../../../api/stock"
import warningInfoDialog from "./components/warningInfoDialog"
import {editAlarmInfo, getOriginalAlarm, getOriginalPerson} from "../../../api/monitorAlert";
 
export default {
    name: "warningInfo",
    components: { warningInfoDialog },
    data() {
        return {
            tableKey: '',
            recordTotal: 0,
            currentPage: 1,
            validTime: [],
            dataList: [],
            listQuery: {
                filter:{
                    alarmStartTime: '',
                    alarmEndTime: '',
                    alarmStatus: null,
                    companyCode: '',
                    companyName: '',
                    alarmType: null
                },
                pageIndex:1,
                pageSize:10
            },
            typeList: [
                {
                    name: '超员作业',
                    value: 1
                },
                {
                    name: '堵塞通道',
                    value: 2
                },
                {
                    name: '超高超量',
                    value: 3
                },
                {
                    name: '非法入侵',
                    value: 4
                },
                {
                    name: '摄像头遮挡偏移',
                    value: 5
                },
                {
                    name: '温度',
                    value: 6
                },
                {
                    name: '湿度',
                    value: 7
                }
            ]
        }
    },
    created() {
        this.getDataList()
    },
    mounted() {
    },
    watch: {},
    methods: {
        openDialog(type,data){
            this.$refs.warningInfoRef.open(type,data)
        },
        clearWarning(id){
            this.$confirm('确定执行销警操作?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(async() => {
                let res = await editAlarmInfo({id: id})
                if (res.data.code === "200") {
                    this.$message({
                        type: 'success',
                        message: res.data.message
                    })
                } else {
                    this.$message({
                        type: 'warning',
                        message: res.data.message
                    })
                }
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消'
                });
            });
        },
        getTypeName(type){
            return this.typeList.find(i=>i.value == type).name
        },
        async getDataList() {
            if(this.validTime.length>0){
                this.listQuery.filter.alarmStartTime = this.validTime[0]
                this.listQuery.filter.alarmEndTime = this.validTime[1]
            }
            let res = await getOriginalAlarm(this.listQuery)
            if (res.data.code === "200") {
                const data = res.data.result
                if(Array.isArray(data.records)){
                    this.dataList = data.records.map(item => {
                      return {
                        ...item,
                        alarmFile: process.env.IMG_API + item.alarmFile
                      }
                    })
                    this.recordTotal = data.total
                    this.currentPage = data.current
                }else{
                    this.dataList = []
                }
            } else {
                this.$message({
                    type: 'warning',
                    message: res.data.message
                })
            }
        },
        handleSizeChange: function(val) {
            this.listQuery.pageSize = val
            this.getDataList()
        },
        handleCurrentChange: function(val) {
            this.listQuery.pageIndex = val
            this.getDataList()
        },
        reset(){
            this.listQuery = {
                filter:{
                    alarmStartTime: '',
                    alarmEndTime: '',
                    alarmStatus: null,
                    companyCode: '',
                    companyName: '',
                    alarmType: null
                },
                pageIndex:1,
                pageSize:10
            }
            this.validTime = []
            this.getDataList()
        },
        search(){
            this.listQuery.pageIndex = 1
            this.getDataList()
        }
    },
}
</script>
 
<style scoped>
.basic_search {
    display: inline-block;
}
</style>