-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
235 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
<template> | ||
<a-card :bordered="false"> | ||
<div class="table-page-search-wrapper"> | ||
<a-form layout="inline"> | ||
<a-row :gutter="48"> | ||
<a-col :md="5" :sm="15"> | ||
<a-form-item label="操作人员"> | ||
<a-input placeholder="请输入" v-model="queryParam.operName"/> | ||
</a-form-item> | ||
</a-col> | ||
<a-col :md="4" :sm="12"> | ||
<a-form-item label="操作类型"> | ||
<a-select placeholder="请选择" v-model="queryParam.businessType" default-value="0"> | ||
<a-select-option :value="''">全部</a-select-option> | ||
<a-select-option v-for="(d, index) in commonStatus" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option> | ||
</a-select> | ||
</a-form-item> | ||
</a-col> | ||
<a-col :md="4" :sm="12"> | ||
<a-form-item label="操作状态"> | ||
<a-select placeholder="请选择" v-model="queryParam.status" default-value="0"> | ||
<a-select-option :value="''">全部</a-select-option> | ||
<a-select-option :value="0">成功</a-select-option> | ||
<a-select-option :value="1">失败</a-select-option> | ||
</a-select> | ||
</a-form-item> | ||
</a-col> | ||
<a-col :md="6" :sm="18"> | ||
<a-form-item label="操作时间"> | ||
<a-range-picker v-model="range"/> | ||
</a-form-item> | ||
</a-col> | ||
<a-col :md="5" :sm="15"> | ||
<span class="table-page-search-submitButtons"> | ||
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button> | ||
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button> | ||
</span> | ||
</a-col> | ||
</a-row> | ||
</a-form> | ||
</div> | ||
<div class="table-operator"> | ||
<a-popconfirm title="确认清空吗?" @confirm="clean"> | ||
<a-icon slot="icon" type="question-circle-o" style="color: red" /> | ||
<a-button type="danger" ghost icon="close">清空</a-button> | ||
</a-popconfirm> | ||
<a-dropdown v-has="'role:del'" v-if="selectedRowKeys.length > 0"> | ||
<a-button type="danger" icon="delete" @click="delByIds(selectedRowKeys)">删除</a-button> | ||
</a-dropdown> | ||
</div> | ||
<s-table | ||
size="default" | ||
ref="table" | ||
rowKey="infoId" | ||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | ||
:columns="columns" | ||
:data="loadData" | ||
:rangPicker="range" | ||
> | ||
<span slot="status" slot-scope="text"> | ||
{{ text | statusFilter }} | ||
</span> | ||
</s-table> | ||
</a-card> | ||
</template> | ||
|
||
<script> | ||
import { STable } from '@/components' | ||
import { getLoginLogList, delLoginLog, cleanLoginLog } from '@/api/monitor' | ||
import { getDictArray } from '../../utils/dict' | ||
const commonStatusMap = {} | ||
export default { | ||
name: 'TableList', | ||
components: { | ||
STable | ||
}, | ||
data () { | ||
return { | ||
visible: false, | ||
labelCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 5 } | ||
}, | ||
wrapperCol: { | ||
xs: { span: 24 }, | ||
sm: { span: 16 } | ||
}, | ||
form: this.$form.createForm(this), | ||
mdl: {}, | ||
permissions: [], | ||
// 高级搜索 展开/关闭 | ||
advanced: false, | ||
// 查询参数 | ||
queryParam: {}, | ||
// 表头 | ||
columns: [ | ||
{ | ||
title: '访问编号', | ||
dataIndex: 'infoId' | ||
}, | ||
{ | ||
title: '登录名称', | ||
dataIndex: 'loginName' | ||
}, | ||
{ | ||
title: '登录地址', | ||
dataIndex: 'ipaddr' | ||
}, | ||
{ | ||
title: '登录地点', | ||
dataIndex: 'loginLocation' | ||
}, | ||
{ | ||
title: '浏览器', | ||
dataIndex: 'browser' | ||
}, | ||
{ | ||
title: '操作系统', | ||
dataIndex: 'os' | ||
}, | ||
{ | ||
title: '状态', | ||
dataIndex: 'status', | ||
scopedSlots: { customRender: 'status' } | ||
}, | ||
{ | ||
title: '操作信息', | ||
dataIndex: 'msg' | ||
}, | ||
{ | ||
title: '操作时间', | ||
dataIndex: 'loginTime', | ||
sorter: true | ||
} | ||
], | ||
range: null, | ||
// 加载数据方法 必须为 Promise 对象 | ||
loadData: parameter => { | ||
return getLoginLogList(Object.assign(parameter, this.queryParam)) | ||
}, | ||
commonStatus: [], | ||
selectedRowKeys: [], | ||
selectedRows: [] | ||
} | ||
}, | ||
filters: { | ||
operTypeFilter (type) { | ||
return commonStatusMap[type].text | ||
}, | ||
statusFilter (status) { | ||
const statusMap = { | ||
'1': '失败', | ||
'0': '成功' | ||
} | ||
return statusMap[status] | ||
} | ||
}, | ||
beforeCreate () { | ||
}, | ||
async created () { | ||
this.commonStatus = await getDictArray('sys_common_status') | ||
this.commonStatus.map(d => { | ||
commonStatusMap[d.dictValue] = { text: d.dictLabel } | ||
}) | ||
}, | ||
methods: { | ||
onSelectChange (selectedRowKeys, selectedRows) { | ||
this.selectedRowKeys = selectedRowKeys | ||
this.selectedRows = selectedRows | ||
}, | ||
handleOk () { | ||
this.$refs.table.refresh(true) | ||
}, | ||
delByIds (ids) { | ||
delLoginLog({ ids: ids.join(',') }).then(res => { | ||
if (res.code === 0) { | ||
this.$message.success(`删除成功`) | ||
this.handleOk() | ||
} else { | ||
this.$message.error(res.msg) | ||
} | ||
this.selectedRowKeys = [] | ||
}) | ||
}, | ||
clean () { | ||
cleanLoginLog().then(res => { | ||
this.handleOk() | ||
}) | ||
} | ||
}, | ||
watch: { | ||
/* | ||
'selectedRows': function (selectedRows) { | ||
this.needTotalList = this.needTotalList.map(item => { | ||
return { | ||
...item, | ||
total: selectedRows.reduce( (sum, val) => { | ||
return sum + val[item.dataIndex] | ||
}, 0) | ||
} | ||
}) | ||
} | ||
*/ | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters