Mr.Zhang
2023-09-14 e4b524d3150ee0f67cd60a07badf71e7bdc66e72
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
<template>
  <TableLayout :permissions="['system:loginLog:query']">
    
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="年月" prop="queryMonth">
        <el-date-picker
          v-model="searchForm.queryMonth"
          type="month"
          value-format="yyyy-MM"
          placeholder="选择年月"
          @change="handleSearchTimeChange"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="企业名称" prop="companyName">
        <el-input v-model="searchForm.companyName" placeholder="请输入企业名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="来源" prop="orgin">
        <el-select v-model="searchForm.orgin" placeholder="请选择登录来源" clearable @change="search">
          <el-option value="0" label="PC登陆"/>
          <el-option value="1" label="钉钉平台"/>
          <el-option value="2" label="羚羊平台"/>
          <el-option value="3" label="EDGP平台"/>
          <el-option value="4" label="微信小程序"/>
        </el-select>
      </el-form-item>
      
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar">
        <el-button :loading="isWorking.export" type="primary" @click="exportExcel">导出</el-button>
      </ul>
      <el-table
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        border
        @sort-change="handleSortChange"
      >
        <el-table-column prop="dataDate" label="登录时间" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="companyName" label="企业名称" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="orgin" label="渠道" align="center" min-width="100px">
           <template slot-scope="{row}">
            {{row.orgin | orginText}}
          </template>
        </el-table-column>
        <el-table-column prop="loginNum" label="登录次数" align="center" min-width="100px"></el-table-column>
      </el-table>
      <pagination
          @size-change="handleSizeChange"
          @current-change="handlePageChange"
          :pagination="tableData.pagination"
      ></pagination>
    </template>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
 
export default {
  name: 'SystemLoginLog',
  extends: BaseTable,
  components: { TableLayout, Pagination },
  data () {
    return {
      // 搜索时间范围
      searchDateRange: [],
      // 搜索
      searchForm: {
        companyName: '',
        queryMonth: '',
        orgin: ''
      }
    }
  },
  filters: {
    // 登录状态
    statusText (value) {
      if (value) {
        return '登录成功'
      }
      return '登录失败'
    },
    orginText (value) {
      if (value ==0) {
        return 'pc平台'
      }else  if (value == 1) {
        return '钉钉平台'
      }else  if (value == 2) {
       return '羚羊平台'
      }else  if (value == 3) {
       return 'EDGP平台'
      }else  if (value == 4) {
       return '微信小程序'
      }
      else{
        return 'pc-平台';
      }
    }
  },
  methods: {
    // 时间搜索范围变化
    
  },
  created () {
    this.config({
      module: '登录日志',
      api: '/business/companyLogin',
      'field.id': 'id',
      'field.main': 'id',
      sorts: [{
        property: 'LOGIN_TIME',
        direction: 'DESC'
      }]
    })
    this.search()
  },
  methods: {
    handleSearchTimeChange (value) {
      
      this.search()
    },
    // reset() {
    //   this.$refs.searchForm.resetFields()
    //   this.searchDateRange = []
    //   this.searchForm.startTime = ''
    //   this.searchForm.endTime = ''
    //   this.search()
    // }
  }
}
</script>