zxl
2026-03-23 b924e4fe906c3e1b4e804ed9d073e09db76fc710
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
<template>
  <a-card :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="12">
            <a-form-item>
              <j-select-depart v-model="departId" />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="12">
            <a-form-item>
              <j-select-multi-user placeholder="请点击选择用户" :multiple="false" v-model="userId" />
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="12">
            <a-form-item>
              <a-range-picker v-model="rangeDate" @change="onDateChange" />
            </a-form-item>
          </a-col>
 
          <a-col :md="6" :sm="12">
            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
            <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
          </a-col>
        </a-row>
      </a-form>
    </div>
 
    <a-table :loading="loading" :columns="columns" :data-source="data" :pagination="pagination" @change="onChange">
    </a-table>
  </a-card>
</template>
<script>
import { postAction } from '@tievd/cube-block/lib/api/manage'
 
export default {
  data() {
    return {
      data: [],
      loading: false,
      departId: '',
      userId: '',
      rangeDate: [],
      begin: '',
      end: '',
      pagination: {
        current: 1,
        total: 0,
        pageSize: 10, //每页中显示10条数据
        showSizeChanger: true,
        pageSizeOptions: ['10', '20', '50', '100'], //每页中显示的数据
        showTotal: total => `共有 ${total} 条数据` //分页中显示总的数据
      },
      columns: [
        {
          title: '时间',
          dataIndex: 'createTime'
        },
        {
          title: '菜单名称',
          dataIndex: 'permissionName'
        },
        {
          title: '访问次数',
          dataIndex: 'clickCount'
        }
      ],
      url: {
        list: '/sys/permission/history/clickCount'
      }
    }
  },
  created() {
    this.list(1, 10)
  },
  methods: {
    onChange(page) {
      this.list(page.current, page.pageSize)
    },
    onDateChange(date, dateString) {
      this.rangeDate = date
      this.begin = dateString[0]
      this.end = dateString[1]
    },
    list(idx, size) {
      this.loading = true
      let params = {
        pageNo: idx,
        pageSize: size,
        userId: this.userId,
        departId: this.departId,
        begin: this.begin,
        end: this.end
      }
      postAction(this.url.list, params).then(res => {
        if (res.success) {
          this.data = res.result.records.map((item, index) => {
            item.key = index
            return item
          })
          this.pagination.total = parseInt(res.result.total)
          this.pagination.current = parseInt(res.result.current)
          this.pagination.pageSize = parseInt(res.result.size)
          this.loading = false
        } else {
          console.error(res.message)
        }
      })
    },
    searchQuery() {
      this.list(1, 10)
    },
    searchReset() {
      this.userId = ''
      this.departId = ''
      this.rangeDate = []
    }
  }
}
</script>