wangting
2024-10-22 b861ab233cf03a240fc5b5608d68a409175cbc9b
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
<template>
  <!--文仓管理页面-->
  <basic-container>
    <avue-crud
      ref="logCrud"
      :data="tableData"
      :option="option"
      :page.sync="page"
      :table-loading="tableLoading"
      @on-load="getTableList"
      @refresh-change="handleRefresh"
      @search-change="handleSearch"
      @search-reset="handleReset"
      @size-change="sizeChange"
      @current-change="currentChange"
    >
      <template slot="menuLeft" slot-scope="scope">
        <el-button icon="el-icon-download" plain size="small" type="primary" @click="exportClickHandler">导出</el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
 
<script>
import {exportLog, getLogListByContion} from "@/api/system/log/logBasic";
import func from "@/util/func";
import basicOption from "@/util/basic-option";
 
export default {
  name: "index",
  data: function () {
    return {
      tableLoading: false,
      tableData: [],
      option: {
        ...basicOption,
        addBtn:false,
        editBtn: false,
        delBtn: false,
        calcHeight: -60,
        align:'left',
        headerAlign:'center',
        menu:false,
        searchMenuSpan: 6,
        searchIcon:false,
        column: [
          {
            label: '卷名',
            prop: 'truename',
            width: 300
          }, {
            label: '机器类型',
            prop: 'username',
            width: 150
          },{
            label: '路径名称',
            prop: 'userIp'
          },{
            label: '首选路径',
            prop: 'moduleName',
          },{
            label: '服务器',
            prop: 'type',
            width: 150
          },{
            label: '卷服务',
            prop: 'date',
          }]
      },
      page: {
        currentPage: 1,
        pageSize: 50,
        total: 0,
        pageSizes: [10, 30, 50, 100],
      },
      searchParams: {}
    }
  },
  methods: {
    // 表格请求
    getTableList() {
      this.tableLoading = true;
      getLogListByContion(this.page.currentPage, this.page.pageSize, {'logType':this.$route.query.logType,...this.searchParams}).then(res => {
        this.tableData = res.data.data;
        this.page.total = res.data.total;
        this.tableLoading = false;
      })
    },
 
    // 搜索查询
    handleSearch(params, done) {
      this.searchParams = {
        userName:params.truename,
        ipText:params.userIp,
        startDate:params.date[0],
        endDate:params.date[1]
      };
 
      this.getTableList();
      done();
    },
 
    // 重置搜索条件
    handleReset() {
      this.searchParams = {};
      this.getTableList();
    },
 
    // 条数
    sizeChange(val) {
      this.page.pageSize = val;
    },
 
    // 页码
    currentChange(val) {
      this.page.currentPage = val;
    },
 
    handleRefresh(){
      this.getTableList();
    },
    // 导出
    exportClickHandler() {
      const loading = this.$loading({});
      exportLog().then(res => {
        func.downloadFileByBlobHandler(res);
        this.createdLoading = false
        this.$message.success('导出成功');
        loading.close();
      })
    },
  }
}
</script>
 
<style scoped>
 
</style>