unknown
2023-10-23 5672f352d0ba114e2ae96c8cefad6c74ae6d2934
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
<template>
    <!-- 安全管理 ==> 智能安全帽 => 照片管理 -->
    <div class="main">
        <!-- main_left -->
        <div class="main_left">
            <div class="main_left_search">
                <div class="search_item">
                    <span>姓名:</span>
                    <el-input size="mini" v-model="queryInfo.userName" placeholder="请输入姓名" clearable></el-input>
                </div>
                <div class="search_item">
                    <span>设备编号:</span>
                    <el-input size="mini" v-model="queryInfo.deviceNum" placeholder="请输入设备编号" clearable></el-input>
                    <el-button icon="el-icon-search" @click="queryTable">查询</el-button>
                </div>
            </div>
            <div class="main_left_table">
                <cpnTable :table-loading="loading" :table-data="dataList" :table-columns="tableColumns"
                    :row-click="rowClick">
                </cpnTable>
            </div>
        </div>
        <!-- main_right -->
        <div class="main_right">
            <div class="search_item">
                <span>日期:</span>
                <el-date-picker type="daterange" v-model="pics.date" value-format="yyyy-MM-dd" start-placeholder="开始日期"
                    end-placeholder="结束日期" clearable></el-date-picker>
                <!-- <el-select v-model="pics.type">
                    <el-option :value="1">所有照片</el-option>
                    <el-option :value="2">安全带取证</el-option>
                </el-select> -->
                <el-button icon="el-icon-search" @click="queryPic">查询</el-button>
            </div>
            <div class="pic_wrap">
                <div class="pic_item" v-for="item in pics.data" :key="item.iid">
                    <el-image :src="item.imageUrl" :preview-src-list="[item.imageUrl]" lazy></el-image>
                    <div class="pic_item_info">
                        <div class="pic_item_info_time">{{ item.smTime }}</div>
                        <div class="pic_item_info_des"></div>
                        <div class="pic_item_info_btn">
                        </div>
                    </div>
                </div>
                <div class="nopic" v-if="!pics.data.length">暂无图片</div>
            </div>
        </div>
    </div>
</template>
  
<script>
import cpnTable from '@/components/element/Table'
export default {
    data() {
        return {
            loading: false,
            queryInfo: {
                pageNum: 1,
                pageSize: 9999,
                userName: '',
                deviceNum: '',
            },
            dataList: [],
            tableColumns: [],
            userId: '', // 用户id
            pics: {
                date: [],
                type: '',
                data: [],
            },
            $http: '', // 接口api路径
        }
    },
    components: {
        cpnTable
    },
    created() {
        this.$http = this.$api.Safety.SmartHelmet.pic
        this.setTableColumn()
        this.getLists()
    },
    methods: {
        setTableColumn() {
            this.tableColumns = [
                {selection: true},
                {name: "用户ID", key: "userId"},
                {name: "姓名", key: "userName"},
                {name: "设备编号", key: "deviceNum"},
            ]
        },
        getLists() {
            this.loading = true
            this.$api.Safety.SmartHelmet.getLists(this.queryInfo).then(res => {
                if (res.statusMsg === 'ok') {
                    this.dataList = res.data.list
                }
            }).finally(() => this.loading = false)
        },
        getPics() {
            const params = {
                userId: this.userId,
                pageNum: 1,
                pageSize: 9999,
                strTime: this.pics.date?.[0],
                endTime: this.pics.date?.[1],
            }
            this.$http.getPics(params).then(res => {
                if (res.statusMsg === 'ok') {
                    this.pics.data = res.data.list
                }
            })
        },
        rowClick(row) {
            this.userId = row.userId
            this.getPics()
        },
        queryTable() {
            this.getLists()
        },
        queryPic() {
            this.getPics()
        },
    }
}
</script>
  
<style lang="scss" scoped>
@import '@/style/layout-main.scss';
 
.main {
    display: flex;
    flex-direction: row;
    color: #EBEBEB;
 
    .main_left {
        display: flex;
        flex-direction: column;
        width: 380px;
        padding: 14px;
        margin-right: 18px;
        border: 1px solid #39B5FE;
        border-radius: 10px;
        box-shadow: rgba(0, 145, 255, 0.7) 0 0 18px inset;
        box-sizing: content-box;
 
        .search_item {
            span {
                display: inline-block;
                min-width: 54px;
                margin-right: 6px;
                text-align: right;
            }
 
            .el-input {
                width: 220px;
                margin: 0 28px 16px 0;
            }
        }
 
        ::v-deep.main_left_table {
            overflow: hidden;
 
            .el-table__row {
                cursor: pointer
            }
 
            .el-table {
                display: flex;
                flex-direction: column;
 
                .el-table__body-wrapper {
                    overflow-y: auto;
                    flex: 1;
                }
            }
        }
    }
 
    .main_right {
        overflow: hidden;
        display: flex;
        flex-direction: column;
        flex: 1;
        padding: 20px;
        border: 1px solid #39B5FE;
        background-color: rgba(0, 52, 121, 0.3);
        border-radius: 10px;
        box-shadow: rgba(0, 145, 255, 0.7) 0 0 18px inset;
        box-sizing: content-box;
 
        .search_item {
 
            .el-button,
            .el-input,
            .el-select {
                margin: 0 12px 14px 6px;
            }
        }
 
        .pic_wrap {
            flex: 1;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            overflow-y: auto;
 
            .nopic {
                width: 100%;
                text-align: center;
                font-size: 28px;
            }
 
            .pic_item {
                display: flex;
                flex-direction: column;
                width: 380px;
                height: 300px;
                border: 1px solid green;
                margin: 10px;
 
                .el-image {
                    border: 1px solid #4EA7DD;
                }
 
                .pic_item_info {
                    position: relative;
                    flex: 1;
                    margin-top: 3px;
                    border: 1px solid #3DC8FF;
                    background: rgba(21, 66, 107, .6);
 
                    .pic_item_info_time {
                        position: absolute;
                        top: 40%;
                        font-size: 13px;
                        text-indent: 20px;
                    }
 
                    .pic_item_info_btn {
                        position: absolute;
                        top: 34px;
                        right: 20px;
                    }
                }
            }
        }
    }
}
</style>