hejianhao
2025-04-16 dab2d210ca06c1faa514c6388fbd5de1ab355360
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
<template>
  <div class='sys_log'>
    <v-header title="操作日志信息"></v-header>
    <div class="tab">
      <v-tool-table
        :trs="trs"
        :tds="tds"
      >
        <template v-slot:type="item">
          <b>{{is_type(+item.scope.operatorType)}}</b>
        </template>
      </v-tool-table>
    </div>
    <v-tool-page
      :item="paged"
      @on-page="onPage"
    ></v-tool-page>
  </div>
</template>
 
<script>
import { mapState } from "vuex";
export default {
  props: {},
  components: {},
  data() {
    return {
      trs: [
        { text: "序号", val: "operId", width: "50px" },
        { text: "操作类型", val: "btn", slot: "type" },
        { text: "操作表名", val: "title" },
        // { text: "操作主键", val: "id" },
        { text: "操作用户账号", val: "account" },
        { text: "操作用户名称", val: "operName" },
        { text: "操作时间", val: "operTime" },
      ],
      tds: [],
      paged: { page: 0, total: 0, r: 0, limit: 10 },
      os: {},
      search: {},
    };
  },
  computed: {
    ...mapState({ vuex_page: "pageReset" }),
  },
  watch: {
    vuex_page: {
      handler(n) {
        if (n.page === this.$route.path) {
          this.paged.page = 1;
          this.init();
        }
      },
      deep: true,
    },
  },
  methods: {
    is_type(v) {
      return ["其他", "后台用户", "移动端用户"][v];
    },
    // 分页点击
    onPage(v) {
      if (v.page === this.paged.page && v.page && !v.reset) {
        return 0;
      }
      this.paged.page = v.page;
      this.paged.limit = v.limit;
      this.init();
    },
    // 获取数据
    init() {
      let v = demo.copy(
        Object.assign(this.os, this.search, {
          pageNum: this.paged.page,
          pageSize: this.paged.limit,
        })
      );
      this.$api.post("systemmanagement/pageoperlog", v, (e) => {
        this.paged.total = e.total;
        this.paged.r++;
        this.tds = e.records || [];
      });
    },
  },
  mounted() {},
};
</script>
<style lang='less' scoped>
.sys_log {
  overflow-y: auto;
  .tab {
    margin: 10px 0;
  }
}
</style>