派生自 wuyushui/SewerAndRainNetwork

XingChuan
2021-05-30 2d5e75bbc04d8c4c5c7dc6bb141ad16ffa2d9936
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
<template>
    <div class="report-incident" v-drag v-show="eventsReported">
        <div class="report-box map-background">
            <div class="public-bounced-title panel-title">
                <span>事件上报</span>
                <i class="el-icon-close" @click="circlePopup"></i>
            </div>
            <div class="form-popup">
                <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="90px" class="search-form">
                    <!--            事件名称-->
                    <el-form-item class="input-event-name" label="事件名称" prop="nameOfEvent">
                        <el-input
                                v-model="ruleForm.nameOfEvent"
                                placeholder="将事件命名"
                        ></el-input>
                    </el-form-item>
                    <!--            事件类型-->
                    <el-form-item label="事件类型" prop="eventOfType">
                        <el-radio-group v-model="ruleForm.eventOfType">
                            <el-col :span="8" v-for="(item,index) in ruleForm.eventOfTypeList" :key="index"
                                    :style="{margin:'5px 0'}">
                                <el-radio :label="item.value">
                                    <span>{{ item.name }}</span>
                                </el-radio>
                            </el-col>
                        </el-radio-group>
                    </el-form-item>
                    <!--            事件等级-->
                    <el-form-item label="事件分级" prop="eventOfLevel">
                        <el-radio-group v-model="ruleForm.eventOfLevel">
                            <el-col :span="8" v-for="(item,index) in ruleForm.eventOfLevelList" :key="index"
                                    :style="{margin:'5px 0'}">
                                <el-radio :label="item.value">
                                    <span>{{ item.name }}</span>
                                </el-radio>
                            </el-col>
                        </el-radio-group>
                    </el-form-item>
                    <el-row>
                        <!--                事发单位-->
                        <el-col :span="12">
                            <el-form-item label="事发单位" prop="unit">
                                <el-select v-model="ruleForm.unit" placeholder="单位,装置选择">
                                    <el-option
                                            v-for="item in ruleForm.unitList"
                                            :key="item.value"
                                            :label="item.label"
                                            :value="item.value">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <!--                事发时间-->
                        <el-col :span="12">
                            <el-form-item class="search-panel-item" label="事发时间" prop="atTime">
                                <el-date-picker
                                        v-model="ruleForm.atTime"
                                        type="datetime"
                                        placeholder="年/月/日">
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--                事发位置-->
                        <el-col :span="12">
                            <el-form-item label="事发位置" prop="positionOf">
                                <el-input v-model="ruleForm.positionOf">
                                    <!--                            <el-button slot="suffix" type="text" class="el-icon-location-information"-->
                                    <!--                                       @click="locationInfo"></el-button>-->
                                    <el-button style="padding-right:10px;" slot="suffix" type="text"
                                               @click="locationInfo">
                                        <img src="../../../../../public/assets/images/map/loc.png" alt="">
                                    </el-button>
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <!--                位置描述-->
                        <el-col :span="12">
                            <el-form-item label="位置描述" prop="positionDescription">
                                <el-input v-model="ruleForm.positionDescription"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!--                管线名称-->
                        <el-col :span="12">
                            <el-form-item label="管线名称" prop="lineName" class="search-panel-item">
                                <el-input disabled v-model="ruleForm.lineName" placeholder="自动带出不可修改"
                                          class="report-input"></el-input>
                            </el-form-item>
                        </el-col>
                        <!--                管线类型-->
                        <el-col :span="12">
                            <el-form-item label="管线类型" prop="lineType">
                                <label>{{ ruleForm.lineTypeText }}</label>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!--             点击上传-->
                    <el-form-item label="附件上传" prop="upload">
                        <el-upload
                                class="upload-demo"
                                action="uploadAction"
                                multiple
                                :limit="3"
                                :file-list="fileList">
                            <el-button size="small" type="primary">点击上传</el-button>
                        </el-upload>
                    </el-form-item>
                    <!--            消息推送-->
                    <el-form-item label="消息推送" prop="beingPush">
                        <el-checkbox-group v-model="ruleForm.beingPushed" @change="infoChange">
                            <el-checkbox v-for="item in ruleForm.beingPushList"
                                         :key="item.name"
                                         :label="item.name"
                            >
                            </el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                    <!--            // 描述 接收 展示、隐藏-->
                    <div v-show="wayTo" class="way-to">
                        <el-form-item label="事件描述" prop="desc">
                            <el-input type="textarea" resize="none" v-model="ruleForm.desc"
                                      placeholder="带出事件类型,事件位置,事件单位,事件时间等字段自动生产一部分描述">
                            </el-input>
                            <el-button type="primary">一键<br/>生成</el-button>
                        </el-form-item>
                        <el-form-item label="接收人员" prop="receiveOne">
                            <el-input type="textarea" resize="none" v-model="ruleForm.receiveOne"
                                      placeholder="张三;李四,"></el-input>
                            <el-button type="primary">+</el-button>
                        </el-form-item>
                    </div>
                    <el-form-item class="confirmCancel">
                        <el-button type="primary" @click="submitForm('ruleForm')">确认</el-button>
                        <el-button @click="resetForm('ruleForm')">取消</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
        <div class="local-box">
            <PositionChange :location="location" @localCation="getLocalCation"></PositionChange>
        </div>
        <div class="file-box">
            <PipelineFile></PipelineFile>
        </div>
    </div>
</template>
<script>
import '../../../../utils/dragBoxes'
import eventBus from '../../../../eventBus'
// 引入组件
import PositionChange from './PositionChange'
import PipelineFile from './PipelineFile'
 
export default {
  name: 'ReportIncident',
  components: {
    PositionChange,
    PipelineFile
  },
  data () {
    return {
      // 判断弹框是否能展示 temp=>临时true 开发
      eventsReported: false,
      // 表单绑定数据
      ruleForm: {
        // 事件名称 绑定数据
        nameOfEvent: '',
        // 事件类型 绑定数据值
        eventOfType: '',
        // 事件类型可选择数据radio 绑定数据
        eventOfTypeList: [
          {
            name: '海(水)上溢油污染',
            value: 1
          },
          {
            name: '油气管道泄漏污染',
            value: 2
          },
          {
            name: '辐射污染',
            value: 3
          },
          {
            name: '生态环境破坏',
            value: 4
          },
          {
            name: '其他',
            value: 5
          }
        ],
        // 事件等级
        eventOfLevel: '',
        // 事件等级可选择数据radio 绑定数据
        eventOfLevelList: [
          {
            name: '特别重大环境事件',
            value: 1
          },
          {
            name: '重大环境事件',
            value: 2
          },
          {
            name: '较大环境事件',
            value: 3
          },
          {
            name: '一般A级',
            value: 4
          },
          {
            name: '一般B级',
            value: 5
          },
          {
            name: '一般C级',
            value: 6
          }
        ],
        // 事发单位 绑定数据值
        unit: '',
        unitList: [
          {
            label: '扬子',
            value: '1'
          },
          {
            label: '南京',
            value: '2'
          }
        ],
        // 事发时间 绑定数据
        atTime: '',
        // 事发位置
        positionOf: '',
        // 位置描述
        positionDescription: '',
        // 管线名称
        lineName: '',
        // 管线类型
        lineType: '',
        lineTypeText: '自动带出不可修改',
        // 消息推送
        beingPushed: [],
        beingPushList: [
          {
            name: '短信推送',
            value: false
          },
          {
            name: '手机应用推送',
            value: false
          }
        ],
        // 事件描述
        desc: '',
        // 接收人员
        receiveOne: ''
      },
      // 上传列表
      fileList: [],
      // 上传地址
      uploadAction: '',
      // 表单验证
      rules: {
        // 事件名称校验
        nameOfEvent: [
          {
            required: true,
            message: '请输入活动名称',
            trigger: 'blur'
          }
        ],
        // 事件类型校验
        eventOfType: [
          {
            required: true,
            message: '请选择事件类型',
            trigger: 'blur'
          }
        ],
        // 事件等级校验
        eventOfLevel: [
          {
            required: true,
            message: '请选择事件等级',
            trigger: 'blur'
          }
        ],
        // 事发单位 绑定数据值
        unit: [
          {
            required: true,
            message: '请选择活动区域',
            trigger: 'change'
          }
        ],
        // 事发时间
        atTime: [
          {
            required: true,
            message: '请选择活动资源',
            trigger: 'change'
          }
        ],
        // 事件位置校验
        positionOf: [
          {
            required: true,
            message: '请输入活动位置',
            trigger: 'blur'
          }
        ],
        // 位置描述校验
        positionDescription: [
          {
            required: true,
            message: '请输入位置描述',
            trigger: 'blur'
          }
        ],
        // 管线名称
        lineName: [],
        // 管线类型
        lineType: []
      },
      // 描述 接收 => 展示/隐藏
      wayTo: false,
      // 控制显示定位二级页面展示/隐藏
      location: false
    }
  },
  mounted () {
    // 点击确认
    eventBus.$on('local-cation', (obj) => {
      this.location = obj
    })
    eventBus.$on('start-analysis', (obj) => {
      this.eventsReported = obj
    })
  },
  methods: {
    // 消息推送 选择推送的对象
    infoChange () {
      if (this.ruleForm.beingPushed.indexOf('短信推送') > -1 || this.ruleForm.beingPushed.indexOf('手机应用推送') > -1) {
        this.wayTo = true
      } else {
        this.wayTo = false
      }
    },
    // 点击定位 进行位置选择
    locationInfo () {
      // 父组件 传递数据控制二级附属框的显示隐藏
      this.location = !this.location
      // 传递 数据 控制 三级附属框的隐藏
      eventBus.$emit('pipelineFile-choose', false)
      // 通过 bus 控制tab 栏 显示 哪一个 传递数据规定 每次重新选择定位 都指定 选择第一个开始
      eventBus.$emit('tab-change', 'first')
    },
    // 接收子组件 传递 数据 进行 二级 附属框的显示/隐藏
    getLocalCation (value) {
      // console.log(value)
      this.location = value
    },
    // 表单的确认按钮点击事件
    submitForm (formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          // alert('submit!')
          this.$message({
            message: '事件上报提交成功',
            type: 'success'
          })
        } else {
          this.$message('事件上报提交失败')
          return false
        }
      })
      this.circlePopup()
      this.$refs[formName].resetFields()
    },
    // 点击关闭 事件上报
    circlePopup () {
      this.eventsReported = false
    },
    // form表单的取消按钮点击事件 重置信息
    resetForm (formName) {
      this.$refs[formName].resetFields()
      this.circlePopup()
    }
  }
}
</script>
 
<style lang="less" scoped>
 
    .way-to {
        /deep/ .el-form-item__content {
            display: flex;
        }
    }
 
    /deep/ .form-popup {
        margin: 0 15px;
    }
 
    .report-incident {
        position: absolute;
        top: 0.42979rem;
        left: 3.14583rem;
        z-index: 999;
        display: flex;
 
        .report-box {
            min-width: 3.4674324rem;
            max-width: 3.4674324rem;
 
            .public-bounced-title {
                display: flex;
                align-items: center;
                justify-content: space-between;
 
                span {
                    color: #f4f7ff;
                    margin: 0 15px;
                    font-size: 14px;
                }
 
                i {
                    color: #C0C4CC;
                    margin: 0 15px;
                    font-size: 22px;
                    cursor: pointer;
                }
            }
        }
    }
 
    /deep/ .el-form-item {
        margin: 10px 0;
    }
 
    /deep/ .el-textarea__inner {
        width: 2rem;
        color: darkgrey;
        border: solid 1px #00fff6;
        background-color: rgba(0, 255, 246, 0.14);
        outline: none;
        font-size: 0.01rem;
    }
 
    /deep/ .el-checkbox__label {
        color: #00fff6 !important;
    }
 
    /deep/ .el-icon-time:before {
        content: " ";
    }
 
    /deep/ input {
        /*width: 145px;*/
        border-radius: 0;
        background-color: rgba(0, 255, 246, 0.14);
        border: solid 1px #00fff6;
        color: #C0C4CC;
        font-size: 0.01rem;
    }
 
    /deep/ .el-input.is-disabled .el-input__inner {
        color: #C0C4CC;
        font-size: 0.01rem;
        border-radius: 4px;
        background: @background-color;
        border-color: @color;
    }
 
    /deep/ .el-input__inner {
        /*width: 145px;*/
        border-radius: 5px;
        background: rgba(0, 16, 30, 0.5);
    }
 
    /deep/ .el-form-item__label {
        color: @color;
    }
 
    /deep/ .el-radio__label {
        color: @color;
    }
 
    .confirmCancel {
        text-align: right;
        margin: 15px;
        /*display: flex;*/
        /*justify-content: flex-end;*/
    }
</style>