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
| <!--
| * @Author: shuishen 1109946754@qq.com
| * @Date: 2023-04-04 16:24:42
| * @LastEditors: shuishen 1109946754@qq.com
| * @LastEditTime: 2023-07-13 15:24:08
| * @FilePath: \srs-police-affairs\src\components\warningSelect\index.vue
| * @Description:
| *
| * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
| -->
| <template>
| <div class="container" v-loading="loading" element-loading-background="rgba(0, 0, 0, 0.5)">
| <div v-for="(item, index) in imageUrls" :key="index" @click.stop="curImgClick(item)">
| <div class="content">
| <el-tooltip class="item" effect="dark" :content="item.title" placement="top">
| <img :src="item.url" alt />
| </el-tooltip>
| </div>
| </div>
| </div>
| </template>
|
| <script>
| import { getWarningsAll } from "@/api/icons/index"
|
|
| let warningImgData = [
| {
| title: '核心区1',
| url: 'hxq-one'
| },
| {
| title: '核心区2',
| url: 'hxq-two'
| },
| {
| title: '核心区3',
| url: 'hxq-three'
| },
| {
| title: '防范区1',
| url: 'ffq-one'
| },
| {
| title: '防范区2',
| url: 'ffq-two'
| },
| {
| title: '防范区3',
| url: 'ffq-three'
| },
| {
| title: '缓冲区1',
| url: 'hcq-one'
| },
| {
| title: '缓冲区2',
| url: 'hcq-two'
| },
| {
| title: '缓冲区3',
| url: 'hcq-three'
| },
| {
| title: '警戒线1',
| url: 'jjx-one'
| },
| {
| title: '警戒线2',
| url: 'jjx-two'
| },
| {
| title: '警戒线3',
| url: 'jjx-three'
| },
| ]
|
| export default {
| name: 'WarningSelect',
|
| data () {
| return {
| imageUrls: [],
| loading: false
| }
| },
|
| created () {
| this.requireImage()
| },
|
| methods: {
| requireImage () {
| getWarningsAll().then(res => {
| res.data.data.forEach(item => {
| let imgArr = item.split('/')
|
| let title = imgArr[imgArr.length - 1].split('.')[0]
|
| let cur = warningImgData.find(i => i.url == title)
|
| this.imageUrls.push({
| url: item,
| title: cur.title
| })
| })
| this.loading = false
| })
| },
|
| curImgClick (item) {
| this.$emit('curClick', item.url, 2)
| }
| },
| }
| </script>
|
| <style lang="scss" scoped>
| .container {
| position: absolute;
| left: 0;
| top: 100%;
| z-index: 999999;
| display: flex;
| flex-wrap: wrap;
|
| min-width: 420px;
| max-height: 360px;
| overflow-x: hidden;
| overflow-y: auto;
| background: $el-dialog-bg-color;
| border-radius: 10px;
|
| &>div {
| padding: 6px;
| margin: 10px;
| width: 400px;
| height: 80px;
| cursor: pointer;
| border: 1px solid #fff;
| border-radius: 8px;
| box-sizing: content-box;
|
| &:hover {
| color: #409eff;
| border-color: #409eff;
| }
|
| .content {
| position: relative;
| height: 80px;
|
| img {
| position: absolute;
| top: 0;
| left: 0;
| right: 0;
| bottom: 0;
| margin: auto;
| width: 400px;
| height: 80px;
| }
| }
| }
| }
| </style>
|
|