fei.wang
2025-04-18 11f6acee504c77a8919a4e0ddfe3e70a746e3522
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
<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input v-model="listQuery.keyword" size="small" placeholder="请输入发送人/报警类型" clearable class="filter-item w-200" />
      <el-button-group class="filter-item">
        <el-button size="small" type="primary" icon="el-icon-search" @click="search">
          搜索
        </el-button>
        <el-button size="small" type="primary" icon="el-icon-refresh" @click="refresh">
          刷新
        </el-button>
      </el-button-group>
    </div>
 
    <el-table v-loading="listLoading" :data="list" element-loading-text="Loading" border fit height="100%"
      class="table-container" highlight-current-row>
      <el-table-column fixed label="ID" width="70" >
        <template slot-scope="scope">
          {{ scope.row.id }}
        </template>
      </el-table-column>
      <el-table-column label="报警类型" >
        <template slot-scope="scope">
          {{ scope.row.type }}
        </template>
      </el-table-column>
      <el-table-column label="发送人" width="100">
        <template slot-scope="scope">
          {{ scope.row.name }}
        </template>
      </el-table-column>
      <el-table-column label="发送电话" width="110">
        <template slot-scope="scope">
          {{ scope.row.phone }}
        </template>
      </el-table-column>
      <el-table-column label="发送部门" >
        <template slot-scope="scope">
          {{ scope.row.bumen}}
        </template>
      </el-table-column>
      <el-table-column label="发送内容"  width="980">
        <template slot-scope="scope">
          {{ scope.row.msg}}
        </template>
      </el-table-column>
      <el-table-column label="发送时间"  width="180">
        <template slot-scope="scope">
          {{ scope.row.addtime}}
        </template>
      </el-table-column>
    </el-table>
 
    <pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
      @pagination="fetchData" />
  </div>
</template>
 
<script>
import Pagination from '@/components/Pagination'
import { getDuanxinlogPage, searchDuanxinlog } from '@/api/duanxinlog'
import { deepClone } from '@/utils'
 
export default {
  components: {
    Pagination
  },
  data() {
    return {
      total: 0,
      list: [],
      menus: [],
      listLoading: true,
      listQuery: {
        current: 1,
        size: 20,
        keyword: undefined,
        username:localStorage.getItem('username')
      },
      dialogVisible: false,
      dialogType: 'create',
      loading: false
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    // 搜索
    search() {
      this.listLoading = true
      searchDuanxinlog(this.listQuery).then(response => {
        if (response.data!=null) {
          this.list = response.data.records
          this.total = response.data.total
        }else{
          this.$message({
            message: '未搜索到数据',
            type: 'error'
          })
        }
      
        this.listLoading = false
      })
    },
    refresh() {
      this.listQuery = {
        current: 1,
        size: 20,
        keyword: undefined,
        username:localStorage.getItem('username')
      }
      this.fetchData()
    },
    // 分页数据
    fetchData() {
      this.listLoading = true
      getDuanxinlogPage(this.listQuery).then(response => {
        this.list = response.data.records
        this.total = response.data.total
        this.listLoading = false
      })
    },
  }
}
</script>
 
<style lang="scss" scoped>
.el-upload {
  border: 1px dashed #d9d9d9 !important;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
 
  .el-icon-plus.avatar-uploader-icon {
    border: 1px dashed #d9d9d9 !important;
    border-radius: 6px;
    font-size: 28px;
    color: #8c939d;
    width: 128px;
    height: 128px;
    line-height: 128px;
    text-align: center;
  }
}
 
.avatar-uploader {
  height: 128px;
 
  img {
    width: 128px;
    height: 128px;
  }
}
</style>