123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <template>
- <div class="page">
- <el-form size="small" :inline="true" class="query-form" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
- <!-- 搜索框-->
- <el-form-item prop="createBy">
- <el-input size="small" v-model="searchForm.createBy" placeholder="操作人" clearable></el-input>
- </el-form-item>
- <el-form-item prop="operationType">
- <el-input size="small" v-model="searchForm.operationType" placeholder="操作类型" clearable></el-input>
- </el-form-item>
- <el-form-item prop="operationContent">
- <el-input size="small" v-model="searchForm.operationContent" placeholder="操作内容" clearable></el-input>
- </el-form-item>
- <el-form-item prop="remoteAddr">
- <el-input size="small" v-model="searchForm.remoteAddr" placeholder="访问IP" clearable></el-input>
- </el-form-item>
- <el-form-item prop="operationResult">
- <el-select v-model="searchForm.operationResult" @change="change" placeholder="请选择">
- <el-option label="成功" value="成功"></el-option>
- <el-option label="失败" value="失败"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item prop="createDates">
- <el-date-picker
- v-model="searchForm.createDates"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="refreshList()" size="small" icon="el-icon-search">查询</el-button>
- <el-button @click="resetSearch()" size="small" icon="el-icon-refresh-right">重置</el-button>
- </el-form-item>
- </el-form>
- <div class="bg-white top">
- <!--<vxe-toolbar :refresh="{query: refreshList}" import export print custom>
- <template #buttons>
- <el-button v-if="hasPermission('sys:project:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
- <!– <el-button v-if="hasPermission('sys:post:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length !== 1" plain>修改</el-button>–>
- <el-button v-if="hasPermission('sys:project:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.projectTable && $refs.projectTable.getCheckboxRecords().length === 0" plain>删除</el-button>
- <el-button v-if="hasPermission('sys:project:import')" type="default" @click="downloadTpl()" size="small">下载模板</el-button>
- </template>
- </vxe-toolbar>-->
- <div style="height: calc(100% - 80px);">
- <vxe-table
- border="inner"
- auto-resize
- resizable
- height="auto"
- :loading="loading"
- size="small"
- ref="projectTable"
- show-header-overflow
- show-overflow
- highlight-hover-row
- :menu-config="{}"
- :print-config="{}"
- @sort-change="sortChangeHandle"
- :sort-config="{remote:true}"
- :data="dataList"
- :checkbox-config="{}">
- <vxe-column type="seq" width="60" title="序号"></vxe-column>
- <!-- <vxe-column type="checkbox" width="40px"></vxe-column>-->
- <vxe-column width="160" title="操作时间" field="createDate"></vxe-column>
- <vxe-column width="100px" title="操作人" field="createBy" > </vxe-column>
- <vxe-column width="100px" title="操作模块" field="type" > </vxe-column>
- <vxe-column width="100px" title="操作类型" field="operationType" > </vxe-column>
- <vxe-column width="" title="操作内容" field="operationContent" > </vxe-column>
- <vxe-column width="100px" title="操作结果" field="operationResult" ></vxe-column>
- <vxe-column width="80px" title="访问IP" field="remoteAddr" ></vxe-column>
- <!-- <vxe-column width="100px" title="访问位置" field="accessLocation" ></vxe-column>-->
- <!--<vxe-column title="操作" width="200px" fixed="right" align="center">
- <template slot-scope="scope">
- <el-button v-if="hasPermission('sys:project:view')" type="text" icon="el-icon-view" size="small" @click="view(scope.row.id)">查看</el-button>
- <el-button v-if="hasPermission('sys:project:edit') && scope.row.permissionFlag" type="text" icon="el-icon-edit" size="small" @click="edit(scope.row.id)">修改</el-button>
- <el-button v-if="hasPermission('sys:project:del') && scope.row.permissionFlag" type="text" icon="el-icon-delete" size="small" @click="del(scope.row.id)">删除</el-button>
- </template>
- </vxe-column>-->
- </vxe-table>
- <vxe-pager
- background
- size="small"
- :current-page="tablePage.currentPage"
- :page-size="tablePage.pageSize"
- :total="tablePage.total"
- :page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
- :layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
- @page-change="currentChangeHandle">
- </vxe-pager>
- </div>
- </div>
- </div>
- </template>
- <script>
- import PositionLogService from '@/api/position/PositionLogService'
- import moment from 'moment'
- export default {
- data () {
- return {
- searchForm: {
- createDates: [],
- createBy: '',
- operationType: '',
- operationResult: '',
- operationContent: '',
- remoteAddr: ''
- },
- dataList: [],
- tablePage: {
- total: 0,
- currentPage: 1,
- pageSize: 10,
- orders: []
- },
- loading: false
- }
- },
- projectLogService: null,
- created () {
- this.projectLogService = new PositionLogService()
- },
- components: {
- },
- activated () {
- this.refreshList()
- },
- methods: {
- change () {
- this.$forceUpdate()
- },
- // 获取数据列表
- refreshList () {
- this.loading = true
- if (this.searchForm.createDates !== undefined && this.searchForm.createDates !== null && this.searchForm.createDates !== '' && this.searchForm.createDates !== [] && this.searchForm.createDates.length !== 0) {
- this.searchForm.createDateStart = moment(this.searchForm.createDates[0]).format('YYYY-MM-DD HH:mm:ss')
- this.searchForm.createDateEnd = moment(this.searchForm.createDates[1]).format('YYYY-MM-DD HH:mm:ss')
- }
- this.projectLogService.list({
- 'current': this.tablePage.currentPage,
- 'size': this.tablePage.pageSize,
- 'orders': this.tablePage.orders,
- 'type': this.$route.query.type,
- ...this.searchForm
- }).then(({data}) => {
- this.dataList = data.records
- this.tablePage.total = data.total
- this.loading = false
- })
- },
- // 当前页
- currentChangeHandle ({ currentPage, pageSize }) {
- this.tablePage.currentPage = currentPage
- this.tablePage.pageSize = pageSize
- this.refreshList()
- },
- // 排序
- sortChangeHandle (column) {
- this.tablePage.orders = []
- if (column.order != null) {
- this.tablePage.orders.push({column: this.$utils.toLine(column.property), asc: column.order === 'asc'})
- }
- this.refreshList()
- },
- // 删除
- // del (id) {
- // let ids = id || this.$refs.projectTable.getCheckboxRecords().map(item => {
- // return item.id
- // }).join(',')
- // this.$confirm(`确定删除所选项吗?`, '提示', {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning'
- // }).then(() => {
- // this.loading = true
- // this.projectService.delete(ids).then(({data}) => {
- // this.$message.success(data)
- // this.refreshList()
- // this.loading = false
- // })
- // })
- // },
- resetSearch () {
- this.searchForm.createDateStart = null
- this.searchForm.createDateEnd = null
- this.$refs.searchForm.resetFields()
- this.refreshList()
- }
- }
- }
- </script>
|