| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div class="white-box">
- <div class="filter-box">
- <filter-user
- :filter-types.sync="filterTypes"
- :filter-btn-name="$t('common.screen')"
- @select-value="handleFilterUser"
- />
- </div>
- <el-table ref="multipleTable" :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight()">
- <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''" :prop="tableHeader.other.prop ? tableHeader.other.prop : null">
- <template slot-scope="scope">
- <template v-if="scope.row[tableHeader.index].other.tag">
- <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null">{{ scope.row[tableHeader.index].value }}</el-tag>
- </template>
- <template v-else>
- <div v-html="scope.row[tableHeader.index].value" />
- </template>
- </template>
- </el-table-column>
- </el-table>
- <div class="white-box-footer">
- <pagination
- :total="totalCount"
- :page_size="pageSize"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- </div>
- </template>
- <script>
- import tool from '@/utils/tool'
- import permission from '@/utils/permission'
- import { fetchAdminHandle } from '@/api/log'
- import filterHelper from '@/utils/filterHelper'
- import FilterUser from '@/components/FilterUser'
- import Pagination from '@/components/Pagination'
- export default {
- name: 'LogAdminLogin',
- components: { FilterUser, Pagination },
- data() {
- return {
- tableHeaders: null,
- allData: null,
- tableData: null,
- loading: true,
- currentPage: 1,
- totalPages: 1,
- totalCount: 1,
- pageSize: 20,
- tool: tool,
- permission: permission,
- filterTypes: null,
- filterModel: {},
- filterData: null
- }
- },
- mounted() {
- this.getData()
- },
- methods: {
- handleCurrentChange(page) {
- this.getData(page, this.pageSize)
- },
- handleSizeChange(pageSize) {
- this.getData(this.currentPage, pageSize)
- },
- handleFilterUser(filterData) {
- filterHelper.handleFilterUser(this, filterData)
- },
- getData(page, pageSize) {
- const filterData = this.filterModel
- console.log(filterData)
- const vueObj = this
- const paramsData = Object.assign({
- page: (page === null || page === undefined) ? 1 : page,
- pageSize: (pageSize === null || pageSize === undefined) ? vueObj.pageSize : pageSize
- }, filterData)
- fetchAdminHandle(paramsData).then(response => {
- vueObj.filterTypes = response.data.filterTypes
- vueObj.tableData = response.data.list
- vueObj.tableHeaders = response.data.columnsShow
- vueObj.currentPage = page
- vueObj.totalPages = parseInt(response.data.totalPages)
- vueObj.totalCount = parseInt(response.data.totalCount)
- vueObj.pageSize = pageSize
- this.loading = false
- })
- },
- handleFilter() {
- this.getData()
- }
- }
- }
- </script>
- <style scoped>
- </style>
|