| | |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-userLogin'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | |
| | | |
| | | const columns = [ |
| | | { |
| | | title: 'ID', |
| | | name: 'id', |
| | | dataIndex: 'id', |
| | | key: 'id', |
| | | }, |
| | | { |
| | | title: '用户', |
| | | name: 'userId$', |
| | | title: formatMessage('db.sys_user_login.user_id', '用户'), |
| | | dataIndex: 'userId$', |
| | | key: 'userId$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '密钥', |
| | | name: 'token', |
| | | title: formatMessage('db.sys_user_login.token', '密钥'), |
| | | dataIndex: 'token', |
| | | key: 'token', |
| | | width: 140, |
| | | ellipsis: true, |
| | | }, |
| | | { |
| | | title: '登录ip', |
| | | name: 'ip', |
| | | title: formatMessage('db.sys_user_login.ip', '登录ip'), |
| | | dataIndex: 'ip', |
| | | key: 'ip', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '类型', |
| | | name: 'type', |
| | | dataIndex: 'type', |
| | | key: 'type', |
| | | customRender: (column) => { |
| | | let typeMap = { |
| | | 0: { |
| | | text: formatMessage('login.success', '登录成功'), |
| | | }, |
| | | 1: { |
| | | text: formatMessage('login.fail', '登录失败'), |
| | | }, |
| | | 2: { |
| | | text: formatMessage('login.logout', '退出登录'), |
| | | }, |
| | | 3: { |
| | | text: formatMessage('login.retoken', '续签token'), |
| | | }, |
| | | }; |
| | | return typeMap[column.value].text; |
| | | } |
| | | title: formatMessage('db.sys_user_login.type', '类型'), |
| | | dataIndex: 'type$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '添加时间', |
| | | name: 'createTime$', |
| | | title: formatMessage('db.sys_user_login.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | key: 'createTime$', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: '备注', |
| | | name: 'memo', |
| | | title: formatMessage('db.sys_user_login.system', '登录系统'), |
| | | dataIndex: 'system', |
| | | width: 140, |
| | | }, |
| | | { |
| | | title: formatMessage('db.sys_user_login.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | key: 'memo', |
| | | width: 140, |
| | | }, |
| | | |
| | | { |
| | | title: '操作', |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | | try { |
| | | post('/api/userLogin/remove/' + rows.map((row) => row.id).join(','), {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.code === 200) { |
| | |
| | | message.error(result.msg); |
| | | } |
| | | getPage() |
| | | hide() |
| | | }) |
| | | } catch (error) { |
| | | message.error(formatMessage('common.fail', '请求失败')); |
| | | } |
| | | }, |
| | | }); |
| | | } |