Blame view

antis-ncc-admin/src/views/systemData/dataInterface/Log.vue 3.1 KB
03207d5d   wwk   1
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
  <template>
    <transition name="el-zoom-in-center">
      <div class="NCC-preview-main">
        <div class="NCC-common-page-header">
          <el-page-header @back="goBack" :content="title" />
          <div class="options">
            <el-button @click="goBack()">{{$t('common.cancelButton')}}</el-button>
          </div>
        </div>
        <div class="main">
          <el-row class="NCC-common-search-box" :gutter="16">
            <el-form @submit.native.prevent>
              <el-col :span="6">
                <el-form-item label="关键词">
                  <el-input v-model="listQuery.keyword" placeholder="请输入关键词查询" clearable
                    @keyup.enter.native="search()" />
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item>
                  <el-button type="primary" icon="el-icon-search" @click="search()">
                    {{$t('common.search')}}</el-button>
                  <el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
                  </el-button>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
          <NCC-table v-loading="listLoading" :data="list">
            <el-table-column prop="invokTime" label="请求时间" :formatter="ncc.tableDateFormat"
              width="130" />
            <el-table-column prop="userId" label="请求用户" />
            <el-table-column prop="invokIp" label="请求IP" />
            <el-table-column prop="invokDevice" label="请求设备" show-overflow-tooltip />
            <el-table-column prop="invokType" label="请求类型" />
            <el-table-column prop="invokWasteTime" label="请求耗时" />
          </NCC-table>
          <pagination :total="total" :page.sync="listQuery.currentPage"
            :limit.sync="listQuery.pageSize" @pagination="initData" />
        </div>
      </div>
    </transition>
  </template>
  
  <script>
  import { getDataInterfaceLog } from '@/api/systemData/dataInterface'
  import { deepClone } from '@/utils'
  const listQuery = {
    keyword: '',
    currentPage: 1,
    pageSize: 20,
    sort: 'desc',
    sidx: ''
  }
  export default {
    data() {
      return {
        id: '',
        title: '',
        list: [],
        total: 0,
        listLoading: true,
        listQuery: {}
      }
    },
    methods: {
      goBack() {
        this.$emit('close')
      },
      init(id, title) {
        if (!id) return this.$emit('close')
        this.id = id
        this.title = title
        this.reset()
      },
      initData() {
        this.listLoading = true
        getDataInterfaceLog(this.id, this.listQuery).then(res => {
          this.list = res.data.list
          this.total = res.data.pagination.total
          this.listLoading = false
        })
      },
      reset() {
        this.listQuery = deepClone(listQuery)
        this.initData()
      },
      search() {
        const keyword = this.listQuery.keyword
        this.listQuery = deepClone(listQuery)
        this.listQuery.keyword = keyword
        this.initData()
      }
    }
  }
  </script>
  <style lang="scss" scoped>
  .main {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 0 10px;
    >>> .el-table {
      flex: 1;
      border-top: none;
    }
  }
  </style>