zhanghua
2023-11-13 2b6f255b97dba15d22b86319e2f38f6efac417cc
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
<template>
  <div class="mainContent">
    <!-- 数据展示 -->
    <el-table
        border
        stripe
        ref="multipleTable"
      :header-cell-style="{  'background':'#F5F5F5','font-weight': '650', 'line-height': '45px' }"
      :data="tableData" style="width: 100%" :row-class-name="tableRowClassName" @selection-change="tableChange">
      <el-table-column type="selection" min-width="5">
      </el-table-column>
      <el-table-column prop="code" label="事件编号" min-width="18">
        <template slot-scope="scope">
          <el-link @click="JumpView(scope.row)">{{ scope.row.code }}</el-link>
        </template>
      </el-table-column>
      <el-table-column prop="eventSource" label="问题来源" min-width="8">
        <template slot-scope="scope">
          <span>{{ scope.row.eventSource === 2 ? '网格巡查' : '视频巡查' }}</span>
        </template>
      </el-table-column>
      <el-table-column :prop="mystatus === 1 ? 'category' : 'category'" :label="mystatus === 1 ? '大类名称' : '违建类别'"
        :min-width="mystatus === 1 ? '10' : '15'">
      </el-table-column>
      <el-table-column :prop="mystatus === 1 ? 'type' : 'site'" :label="mystatus === 1 ? '小类名称' : '违建地点'" min-width="10">
      </el-table-column>
      <el-table-column :prop="mystatus === 1 ? 'site' : ''" :label="mystatus === 1 ? '报警点位' : '违法建筑长、宽、高'"
        :min-width="mystatus === 1 ? '10' : '20'">
        <template slot-scope="scope">
          <div v-if="mystatus === 2"><span>{{
              scope.row.buildingLength + '米' + '、' +
              scope.row.buildingWidth + '米' + '、' + scope.row.buildingHigh + '米'
          }}</span></div>
          <div v-else>{{ scope.row.site }}</div>
        </template>
      </el-table-column>
      <el-table-column :prop="mystatus === 1 ? 'street' : 'buildingArea'" :label="mystatus === 1 ? '所属区域' : '违法建筑面积'"
        min-width="12">
      </el-table-column>
      <el-table-column prop="alarmTime" label="报警时间" min-width="15" v-if="mystatus === 1">
        <template slot-scope="scope">
          <span>{{ filterTime(scope.row.alarmTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column :prop="mystatus === 1 ? 'continueTime' : 'materials'" :label="mystatus === 1 ? '持续时间' : '违法建筑材料'"
        min-width="12">
      </el-table-column>
      <el-table-column prop="operation" label="操作" min-width="20">
        <template slot-scope="scope">
          <div class="operation">
            <span @click="handleLearn(scope.row)">在学习</span>
            <span class="line">|</span>
            <span @click="handleNotDeal(scope.row)">暂不处理</span>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- tools -->
    <div class="tools">
      <div class="funs">
        <div class="funsItem funs-sp">
          <el-checkbox v-model="all" @change="selectAll()">全选
          </el-checkbox>
        </div>
        <div class="funsItem funs-sp">
          <el-checkbox v-model="unsame" @change="disSame(tableData)">反选
          </el-checkbox>
        </div>
        <div class="funsItem">
          <el-select v-model="myIdx" placeholder="批量操作" @change="selectChange">
            <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"
              :disabled="item.disabled">
            </el-option>
          </el-select>
        </div>
      </div>
      <div class="pagination">
        <el-pagination background :current-page="currentPage" layout="prev, pager, next" :total="totalNum"
          :page-size="pageSize" @current-change="changeCurrentPage" @prev-click="handlePrev" @next-click="handleNext">
        </el-pagination>
      </div>
    </div>
  </div>
</template>
 
<script>
import basecase from "@/api/operate/basecase";
import helper from '@/utils/mydate'
 
export default {
  created() {
    this.getInspectionData()
  },
  data() {
    return {
      preMyIdx: 0,
      mystatus: 1,
      tableData: [],
      myIdx: 0,
      options: [
        {
          value: 0,
          label: "批量操作",
          disabled: true,
        },
        {
          value: 3,
          label: "批量在学习",
        },
        {
          value: 4,
          label: "批量暂不处理",
        },
      ],
      totalNum: 0,
      pageSize: 10,
      currentPage: 1,
      all: false,
      unsame: false,
      tempList: []
    }
  },
  methods: {
    tableChange(list) {
      this.tempList = [];
      list.forEach((item) => {
        this.tempList.push(item.id);
      });
      if (list.length === this.tableData.length) {
        this.all = true;
      } else {
        this.all = false;
      }
    },
    selectChange(list) {
      if (this.tempList.length !== 0) {
        if (list === 3) {
          this.preMyIdx = list;
          this.mulHandler(this.tempList, list);
        }
        if (list === 4) {
          this.preMyIdx = list;
          this.mulHandler(this.tempList, list);
        }
      } else {
        this.myIdx = this.preMyIdx;
        this.$message({
          type: "warning",
          message: "您还没选中任何数据",
        });
      }
    },
    mulHandler(ids, option) {
      // console.log("whj", ids, option)
      // console.log(this.options.filter(x => x.value === option))
      const tag = this.options.filter(x => x.value === option)[0].label
      if (option === 3) {
        this.$confirm(`您确定要${tag}吗?`)
          .then((_) => {
            this.$axios({
              method: 'put',
              url: `/sccg/base_case/batch_case_study?ids=${ids}`,
            })
              .then(res => {
                this.$message({
                  type: res.code === 200 ? 'success' : 'warning',
                  message: res.message+",事件已经批量处理,请进入案件池在学习"
                })
                this.getInspectionData();
              })
          })
          .catch((err) => {
            console.log(err);
          });
      } else if (option === 4) {
        this.$confirm(`您确定要${tag}吗?`)
          .then((_) => {
            this.$axios({
              method: 'put',
              url: `/sccg/base_case/batch_case_Ignore?ids=${ids}`,
            })
              .then(res => {
                this.$message({
                  type: res.code === 200 ? 'success' : 'warning',
                  message: res.message+",事件已经批量处理,请进入案件池在学习"
                })
                this.getInspectionData();
              })
          })
          .catch((err) => {
            console.log(err);
          });
      }
    },
    handlePrev(page) {
      this.currentPage = page;
      this.getInspectionData();
    },
    handleNext(page) {
      this.currentPage = page;
      this.getInspectionData();
    },
    changeCurrentPage(page) {
      this.currentPage = page;
      this.getInspectionData();
    },
    selectAll() {
      this.$refs.multipleTable.toggleAllSelection();
    },
    disSame(list) {
      list.forEach((row) => {
        this.$refs.multipleTable.toggleRowSelection(row);
      });
    },
    tableRowClassName({ row, rowIndex }) {
      if ((rowIndex + 1) % 2 === 0) {
        return 'warning-row';
      } else {
        return 'success-row';
      }
    },
    getInspectionData() {
      const params = {
        current: this.currentPage,
        size: this.pageSize,
        state: 1,
        resource: 1,
        type: 1
      }
      basecase
        .baseCasePoolList(params)
        .then(({ records, total }) => {
          this.tableData = records;
          this.totalNum = total;
        })
        .catch(err => this.$message.error(err))
    },
    async JumpView(data) {
      await this.getEventInfo(data.code);
    },
    // 获取案件信息
    getEventInfo(code) {
      this.$axios({
        method: 'get',
        url: `sccg/base_case/baseCaseDetail/${code}`
      })
        .then(res => {
          this.info = res.data;
          this.dialogView = true;
        })
    },
    filterTime(time) {
      return helper(time);
    },
    handleLearn({ id }) {
      this.$axios({
        method: 'put',
        url: 'sccg/base_case/case_status_update?caseId=' + id + '&state=' + 3
      })
        .then(res => {
          if (res.code === 200) {
            this.$notify({
              title: '温馨提示',
              message: '此事件已忽略,返回系统在学习',
              type: 'success',
              position: 'bottom-right'
            })
            this.getInspectionData();
          } else {
            this.$message({
              type: 'error',
              message: '操作失败'
            })
          }
        })
    },
    // 暂不处理
    handleNotDeal({ id }) {
      this.$axios({
        method: 'put',
        url: 'sccg/base_case/case_status_update?caseId=' + id + '&state=' + 4
      })
        .then(res => {
          if (res.code === 200) {
            this.$notify({
              title: '温馨提示',
              message: '此事件暂不处理,请前往暂不处理界面查看详情',
              type: 'success',
              position: 'bottom-right'
            })
            this.getInspectionData();
          } else {
            this.$message({
              type: 'error',
              message: '操作失败'
            })
          }
        })
    },
  }
}
</script>
 
<style scoped lang="scss">
.tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
 
  .funs-sp {
    //border: 1px solid #DCDFE6;
  }
 
  .funs {
    display: flex;
 
    .funsItem {
      border: 1px solid #DCDFE6;
      line-height: 28px;
      display: flex;
      align-items: center;
      border-radius: 4px;
      font-size: 12px;
      margin-left: 10px;
 
      .el-checkbox {
        width: 80px;
        padding: 0 10px;
      }
 
      .el-select {
        width: 120px;
      }
 
      &::v-deep .el-input__inner {
        border: none;
        // background-color: #09152f;
      }
 
      &:hover {
        border: 1px solid #4b9bb7;
      }
 
      &:hover .el-checkbox {
        color: #4b9bb7;
      }
    }
  }
 
  .pagination {
    margin-top: 50px;
    display: flex;
    line-height: 50px;
    justify-content: center;
 
    .el-pagination {
 
      &::v-deep li,
      &::v-deep .btn-prev,
      &::v-deep .btn-next {
        // background-color: #071f39;
        color: #4b9bb7;
      }
 
      &::v-deep .active {
        background-color: #409eff;
        color: #fff;
      }
    }
  }
}
 
.el-table {
  // color: #4b9bb7;
  // font-size: 10px;
 
  .operation {
    display: flex;
    color: var(--operation-color);
    .line {
      padding: 0 5px;
    }
 
    span:hover {
      cursor: pointer;
    }
  }
}
</style>