新增license管理页面对接

This commit is contained in:
aoshiguchen
2022-09-01 17:17:08 +08:00
parent 02867d5b12
commit 767066f70a
16 changed files with 352 additions and 242 deletions
+46
View File
@@ -0,0 +1,46 @@
import request from '@/utils/request'
export function fetchList(query) {
return request({
url: '/license/page',
method: 'get',
params: query
})
}
export function createLicense(data) {
return request({
url: '/license/create',
method: 'post',
data
})
}
export function updateLicense(data) {
return request({
url: '/license/update',
method: 'post',
data
})
}
export function updateEnableStatus(id, enable) {
return request({
url: '/license/update/enable-status',
method: 'post',
data: {
id: id,
enable: enable
}
})
}
export function deleteLicense(id) {
return request({
url: '/license/delete',
method: 'post',
params: {
id: id
}
})
}
@@ -0,0 +1,9 @@
import request from '@/utils/request'
export function fetchList(query) {
return request({
url: '/port-mapping/page',
method: 'get',
params: query
})
}
+7 -1
View File
@@ -117,7 +117,13 @@ export default {
disable: '禁用',
enable: '启用',
loginName: '登录名',
port: '端口'
port: '端口',
licenseName: 'License名称',
licenseKey: 'License Key',
isOnline: '在线状态',
enableStatus: '启用状态',
serverPort: '服务端口',
proxyClient: '代理客户端'
},
errorLog: {
tips: '请点击右上角bug小图标',
+188 -186
View File
@@ -39,17 +39,19 @@ export const constantRouterMap = [
name: 'dashboard',
meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
}]
}, {
path: '/documentation',
component: Layout,
redirect: '/documentation/index',
children: [{
path: 'index',
component: _import('documentation/index'),
name: 'documentation',
meta: { title: 'documentation', icon: 'documentation', noCache: true }
}]
}
// , {
// path: '/documentation',
// component: Layout,
// redirect: '/documentation/index',
// children: [{
// path: 'index',
// component: _import('documentation/index'),
// name: 'documentation',
// meta: { title: 'documentation', icon: 'documentation', noCache: true }
// }]
// }
]
export default new Router({
@@ -59,183 +61,183 @@ export default new Router({
})
export const asyncRouterMap = [
{
path: '/permission',
component: Layout,
redirect: '/permission/index',
meta: { roles: ['admin'] }, // you can set roles in root nav
children: [{
path: 'index',
component: _import('permission/index'),
name: 'permission',
meta: {
title: 'permission',
icon: 'lock',
roles: ['admin'] // or you can only set roles in sub nav
}
}]
},
// {
// path: '/permission',
// component: Layout,
// redirect: '/permission/index',
// meta: { roles: ['admin'] }, // you can set roles in root nav
// children: [{
// path: 'index',
// component: _import('permission/index'),
// name: 'permission',
// meta: {
// title: 'permission',
// icon: 'lock',
// roles: ['admin'] // or you can only set roles in sub nav
// }
// }]
// },
//
// {
// path: '/icon',
// component: Layout,
// children: [{
// path: 'index',
// component: _import('svg-icons/index'),
// name: 'icons',
// meta: { title: 'icons', icon: 'icon', noCache: true }
// }]
// },
//
// {
// path: '/components',
// component: Layout,
// redirect: 'noredirect',
// name: 'component-demo',
// meta: {
// title: 'components',
// icon: 'component'
// },
// children: [
// { path: 'tinymce', component: _import('components-demo/tinymce'), name: 'tinymce-demo', meta: { title: 'tinymce' }},
// { path: 'markdown', component: _import('components-demo/markdown'), name: 'markdown-demo', meta: { title: 'markdown' }},
// { path: 'json-editor', component: _import('components-demo/jsonEditor'), name: 'jsonEditor-demo', meta: { title: 'jsonEditor' }},
// { path: 'dnd-list', component: _import('components-demo/dndList'), name: 'dndList-demo', meta: { title: 'dndList' }},
// { path: 'splitpane', component: _import('components-demo/splitpane'), name: 'splitpane-demo', meta: { title: 'splitPane' }},
// { path: 'avatar-upload', component: _import('components-demo/avatarUpload'), name: 'avatarUpload-demo', meta: { title: 'avatarUpload' }},
// { path: 'dropzone', component: _import('components-demo/dropzone'), name: 'dropzone-demo', meta: { title: 'dropzone' }},
// { path: 'sticky', component: _import('components-demo/sticky'), name: 'sticky-demo', meta: { title: 'sticky' }},
// { path: 'count-to', component: _import('components-demo/countTo'), name: 'countTo-demo', meta: { title: 'countTo' }},
// { path: 'mixin', component: _import('components-demo/mixin'), name: 'componentMixin-demo', meta: { title: 'componentMixin' }},
// { path: 'back-to-top', component: _import('components-demo/backToTop'), name: 'backToTop-demo', meta: { title: 'backToTop' }}
// ]
// },
//
// {
// path: '/charts',
// component: Layout,
// redirect: 'noredirect',
// name: 'charts',
// meta: {
// title: 'charts',
// icon: 'chart'
// },
// children: [
// { path: 'keyboard', component: _import('charts/keyboard'), name: 'keyboardChart', meta: { title: 'keyboardChart', noCache: true }},
// { path: 'line', component: _import('charts/line'), name: 'lineChart', meta: { title: 'lineChart', noCache: true }},
// { path: 'mixchart', component: _import('charts/mixChart'), name: 'mixChart', meta: { title: 'mixChart', noCache: true }}
// ]
// },
//
// {
// path: '/example',
// component: Layout,
// redirect: '/example/table/complex-table',
// name: 'example',
// meta: {
// title: 'example',
// icon: 'example'
// },
// children: [
// {
// path: '/example/table',
// component: _import('example/table/index'),
// redirect: '/example/table/complex-table',
// name: 'Table',
// meta: {
// title: 'Table',
// icon: 'table'
// },
// children: [
// { path: 'dynamic-table', component: _import('example/table/dynamicTable/index'), name: 'dynamicTable', meta: { title: 'dynamicTable' }},
// { path: 'drag-table', component: _import('example/table/dragTable'), name: 'dragTable', meta: { title: 'dragTable' }},
// { path: 'inline-edit-table', component: _import('example/table/inlineEditTable'), name: 'inlineEditTable', meta: { title: 'inlineEditTable' }},
// { path: 'complex-table', component: _import('example/table/complexTable'), name: 'complexTable', meta: { title: 'complexTable' }}
// ]
// },
// { path: 'tab/index', icon: 'tab', component: _import('example/tab/index'), name: 'tab', meta: { title: 'tab' }}
// ]
// },
{
path: '/icon',
component: Layout,
children: [{
path: 'index',
component: _import('svg-icons/index'),
name: 'icons',
meta: { title: 'icons', icon: 'icon', noCache: true }
}]
},
{
path: '/components',
component: Layout,
redirect: 'noredirect',
name: 'component-demo',
meta: {
title: 'components',
icon: 'component'
},
children: [
{ path: 'tinymce', component: _import('components-demo/tinymce'), name: 'tinymce-demo', meta: { title: 'tinymce' }},
{ path: 'markdown', component: _import('components-demo/markdown'), name: 'markdown-demo', meta: { title: 'markdown' }},
{ path: 'json-editor', component: _import('components-demo/jsonEditor'), name: 'jsonEditor-demo', meta: { title: 'jsonEditor' }},
{ path: 'dnd-list', component: _import('components-demo/dndList'), name: 'dndList-demo', meta: { title: 'dndList' }},
{ path: 'splitpane', component: _import('components-demo/splitpane'), name: 'splitpane-demo', meta: { title: 'splitPane' }},
{ path: 'avatar-upload', component: _import('components-demo/avatarUpload'), name: 'avatarUpload-demo', meta: { title: 'avatarUpload' }},
{ path: 'dropzone', component: _import('components-demo/dropzone'), name: 'dropzone-demo', meta: { title: 'dropzone' }},
{ path: 'sticky', component: _import('components-demo/sticky'), name: 'sticky-demo', meta: { title: 'sticky' }},
{ path: 'count-to', component: _import('components-demo/countTo'), name: 'countTo-demo', meta: { title: 'countTo' }},
{ path: 'mixin', component: _import('components-demo/mixin'), name: 'componentMixin-demo', meta: { title: 'componentMixin' }},
{ path: 'back-to-top', component: _import('components-demo/backToTop'), name: 'backToTop-demo', meta: { title: 'backToTop' }}
]
},
{
path: '/charts',
component: Layout,
redirect: 'noredirect',
name: 'charts',
meta: {
title: 'charts',
icon: 'chart'
},
children: [
{ path: 'keyboard', component: _import('charts/keyboard'), name: 'keyboardChart', meta: { title: 'keyboardChart', noCache: true }},
{ path: 'line', component: _import('charts/line'), name: 'lineChart', meta: { title: 'lineChart', noCache: true }},
{ path: 'mixchart', component: _import('charts/mixChart'), name: 'mixChart', meta: { title: 'mixChart', noCache: true }}
]
},
{
path: '/example',
component: Layout,
redirect: '/example/table/complex-table',
name: 'example',
meta: {
title: 'example',
icon: 'example'
},
children: [
{
path: '/example/table',
component: _import('example/table/index'),
redirect: '/example/table/complex-table',
name: 'Table',
meta: {
title: 'Table',
icon: 'table'
},
children: [
{ path: 'dynamic-table', component: _import('example/table/dynamicTable/index'), name: 'dynamicTable', meta: { title: 'dynamicTable' }},
{ path: 'drag-table', component: _import('example/table/dragTable'), name: 'dragTable', meta: { title: 'dragTable' }},
{ path: 'inline-edit-table', component: _import('example/table/inlineEditTable'), name: 'inlineEditTable', meta: { title: 'inlineEditTable' }},
{ path: 'complex-table', component: _import('example/table/complexTable'), name: 'complexTable', meta: { title: 'complexTable' }}
]
},
{ path: 'tab/index', icon: 'tab', component: _import('example/tab/index'), name: 'tab', meta: { title: 'tab' }}
]
},
{
path: '/form',
component: Layout,
redirect: 'noredirect',
name: 'form',
meta: {
title: 'form',
icon: 'form'
},
children: [
{ path: 'create-form', component: _import('form/create'), name: 'createForm', meta: { title: 'createForm', icon: 'table' }},
{ path: 'edit-form', component: _import('form/edit'), name: 'editForm', meta: { title: 'editForm', icon: 'table' }}
]
},
{
path: '/error',
component: Layout,
redirect: 'noredirect',
name: 'errorPages',
meta: {
title: 'errorPages',
icon: '404'
},
children: [
{ path: '401', component: _import('errorPage/401'), name: 'page401', meta: { title: 'page401', noCache: true }},
{ path: '404', component: _import('errorPage/404'), name: 'page404', meta: { title: 'page404', noCache: true }}
]
},
{
path: '/error-log',
component: Layout,
redirect: 'noredirect',
children: [{ path: 'log', component: _import('errorLog/index'), name: 'errorLog', meta: { title: 'errorLog', icon: 'bug' }}]
},
{
path: '/excel',
component: Layout,
redirect: '/excel/export-excel',
name: 'excel',
meta: {
title: 'excel',
icon: 'excel'
},
children: [
{ path: 'export-excel', component: _import('excel/exportExcel'), name: 'exportExcel', meta: { title: 'exportExcel' }},
{ path: 'export-selected-excel', component: _import('excel/selectExcel'), name: 'selectExcel', meta: { title: 'selectExcel' }},
{ path: 'upload-excel', component: _import('excel/uploadExcel'), name: 'uploadExcel', meta: { title: 'uploadExcel' }}
]
},
{
path: '/zip',
component: Layout,
redirect: '/zip/download',
children: [{ path: 'download', component: _import('zip/index'), name: 'exportZip', meta: { title: 'exportZip', icon: 'zip' }}]
},
{
path: '/theme',
component: Layout,
redirect: 'noredirect',
children: [{ path: 'index', component: _import('theme/index'), name: 'theme', meta: { title: 'theme', icon: 'theme' }}]
},
{
path: '/clipboard',
component: Layout,
redirect: 'noredirect',
children: [{ path: 'index', component: _import('clipboard/index'), name: 'clipboardDemo', meta: { title: 'clipboardDemo', icon: 'clipboard' }}]
},
{
path: '/i18n',
component: Layout,
children: [{ path: 'index', component: _import('i18n-demo/index'), name: 'i18n', meta: { title: 'i18n', icon: 'international' }}]
},
// {
// path: '/form',
// component: Layout,
// redirect: 'noredirect',
// name: 'form',
// meta: {
// title: 'form',
// icon: 'form'
// },
// children: [
// { path: 'create-form', component: _import('form/create'), name: 'createForm', meta: { title: 'createForm', icon: 'table' }},
// { path: 'edit-form', component: _import('form/edit'), name: 'editForm', meta: { title: 'editForm', icon: 'table' }}
// ]
// },
//
// {
// path: '/error',
// component: Layout,
// redirect: 'noredirect',
// name: 'errorPages',
// meta: {
// title: 'errorPages',
// icon: '404'
// },
// children: [
// { path: '401', component: _import('errorPage/401'), name: 'page401', meta: { title: 'page401', noCache: true }},
// { path: '404', component: _import('errorPage/404'), name: 'page404', meta: { title: 'page404', noCache: true }}
// ]
// },
//
// {
// path: '/error-log',
// component: Layout,
// redirect: 'noredirect',
// children: [{ path: 'log', component: _import('errorLog/index'), name: 'errorLog', meta: { title: 'errorLog', icon: 'bug' }}]
// },
//
// {
// path: '/excel',
// component: Layout,
// redirect: '/excel/export-excel',
// name: 'excel',
// meta: {
// title: 'excel',
// icon: 'excel'
// },
// children: [
// { path: 'export-excel', component: _import('excel/exportExcel'), name: 'exportExcel', meta: { title: 'exportExcel' }},
// { path: 'export-selected-excel', component: _import('excel/selectExcel'), name: 'selectExcel', meta: { title: 'selectExcel' }},
// { path: 'upload-excel', component: _import('excel/uploadExcel'), name: 'uploadExcel', meta: { title: 'uploadExcel' }}
// ]
// },
//
// {
// path: '/zip',
// component: Layout,
// redirect: '/zip/download',
// children: [{ path: 'download', component: _import('zip/index'), name: 'exportZip', meta: { title: 'exportZip', icon: 'zip' }}]
// },
//
// {
// path: '/theme',
// component: Layout,
// redirect: 'noredirect',
// children: [{ path: 'index', component: _import('theme/index'), name: 'theme', meta: { title: 'theme', icon: 'theme' }}]
// },
//
// {
// path: '/clipboard',
// component: Layout,
// redirect: 'noredirect',
// children: [{ path: 'index', component: _import('clipboard/index'), name: 'clipboardDemo', meta: { title: 'clipboardDemo', icon: 'clipboard' }}]
// },
//
// {
// path: '/i18n',
// component: Layout,
// children: [{ path: 'index', component: _import('i18n-demo/index'), name: 'i18n', meta: { title: 'i18n', icon: 'international' }}]
// },
{ path: '*', redirect: '/404', hidden: true },
{
@@ -2,7 +2,8 @@
<div class="login-container">
<el-form class="login-form" autoComplete="on" :model="loginForm" :rules="loginRules" ref="loginForm" label-position="left">
<div class="title-container">
<h3 class="title">{{$t('login.title')}}</h3>
<!-- <h3 class="title">{{$t('login.title')}}</h3>-->
<h3 class="title">中微子代理</h3>
</div>
<el-form-item prop="username">
<span class="svg-container svg-container_login">
@@ -6,19 +6,24 @@
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
<el-table-column align="center" :label="$t('table.id')" width="100">
<el-table-column align="center" :label="$t('table.id')" width="50">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.userName')" width="200">
<el-table-column align="center" :label="$t('table.userName')" width="150">
<template slot-scope="scope">
<span>{{scope.row.userName}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.licenseName')" width="150">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.loginName')" width="200">
<el-table-column align="center" :label="$t('table.licenseKey')" width="300">
<template slot-scope="scope">
<span>{{scope.row.loginName}}</span>
<span>{{scope.row.key}}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
@@ -31,11 +36,16 @@
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.status')" width="100">
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.isOnline')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.isOnline | statusFilter">{{scope.row.isOnline | isOnlineName}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
@@ -55,12 +65,15 @@
</div>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
<el-form-item :label="$t('用户')" prop="name">
<el-input v-model="temp.name"></el-input>
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px" style='width: 400px; margin-left:50px;'>
<el-form-item :label="$t('用户')" prop="userId">
<el-select class="filter-item" v-model="temp.userId" placeholder="Please select" :disabled="dialogStatus=='update'">
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('登录名')" prop="loginName">
<el-input v-model="temp.loginName"></el-input>
<el-form-item :label="$t('License名称')" prop="name">
<el-input v-model="temp.name"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -84,7 +97,7 @@
</template>
<script>
import { fetchList, createUser, updateUser, updateEnableStatus, deleteUser } from '@/api/user'
import { fetchList, createLicense, updateLicense, updateEnableStatus, deleteLicense } from '@/api/license'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import ButtonPopover from '../../components/Button/buttonPopover'
@@ -125,6 +138,10 @@
},
importanceOptions: [1, 2, 3],
calendarTypeOptions,
userList: [
{id: 1, name: '管理员'},
{id: 2, name: '游客'}
],
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
statusOptions: ['published', 'draft', 'deleted'],
showReviewer: false,
@@ -146,8 +163,8 @@
dialogPvVisible: false,
pvData: [],
rules: {
name: [{ required: true, message: '用户名必填', trigger: 'blur' }],
loginName: [{ required: true, message: '登录名必填', trigger: 'blur' }]
userId: [{ required: true, message: '请选择用户', trigger: 'blur' }],
name: [{ required: true, message: 'License名称不能为空', trigger: 'blur' }]
},
downloadLoading: false
}
@@ -160,6 +177,13 @@
}
return statusMap[status]
},
isOnlineName(isOnline) {
const isOnlineMap = {
1: '在线',
2: '离线'
}
return isOnlineMap[isOnline]
},
statusFilter(status) {
const statusMap = {
1: 'success',
@@ -175,6 +199,9 @@
this.getList()
},
methods: {
getUserList() {
console.log('获取用户列表')
},
getList() {
this.listLoading = true
fetchList(this.listQuery).then(response => {
@@ -210,12 +237,8 @@
resetTemp() {
this.temp = {
id: undefined,
importance: 1,
remark: '',
timestamp: new Date(),
title: '',
status: 'published',
type: ''
name: undefined,
userId: undefined
}
},
handleCreate() {
@@ -229,7 +252,7 @@
createData() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
createUser(this.temp).then(response => {
createLicense(this.temp).then(response => {
if (response.data.code === 0) {
this.dialogFormVisible = false
this.$notify({
@@ -246,7 +269,6 @@
},
handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj
this.temp.timestamp = new Date(this.temp.timestamp)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
@@ -257,12 +279,8 @@
this.$refs['dataForm'].validate((valid) => {
if (valid) {
const tempData = Object.assign({}, this.temp)
updateUser(tempData).then(response => {
updateLicense(tempData).then(response => {
if (response.data.code === 0) {
// this.$message({
// message: '操作成功',
// type: 'success'
// })
this.$notify({
title: '成功',
message: '更新成功',
@@ -296,7 +314,7 @@
}).catch(() => {})
},
handleDelete2(row) {
deleteUser(row.id).then(response => {
deleteLicense(row.id).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
@@ -6,19 +6,29 @@
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
<el-table-column align="center" :label="$t('table.id')" width="100">
<el-table-column align="center" :label="$t('table.id')" width="50">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.userName')" width="200">
<el-table-column align="center" :label="$t('table.userName')" width="100">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
<span>{{scope.row.userName}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.loginName')" width="200">
<el-table-column align="center" :label="$t('table.licenseName')" width="150">
<template slot-scope="scope">
<span>{{scope.row.loginName}}</span>
<span>{{scope.row.licenseName}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.serverPort')" width="200">
<template slot-scope="scope">
<span>{{scope.row.serverPort}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.proxyClient')" width="200">
<template slot-scope="scope">
<span>{{scope.row.clientIp}}:{{scope.row.clientPort}}</span>
</template>
</el-table-column>
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
@@ -31,11 +41,16 @@
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.status')" width="100">
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.isOnline')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.isOnline | statusFilter">{{scope.row.isOnline | isOnlineName}}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
@@ -84,7 +99,7 @@
</template>
<script>
import { fetchList, createUser, updateUser, updateEnableStatus, deleteUser } from '@/api/user'
import { fetchList, createUser, updateUser, updateEnableStatus, deleteUser } from '@/api/portMapping'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
import ButtonPopover from '../../components/Button/buttonPopover'
@@ -160,6 +175,13 @@
}
return statusMap[status]
},
isOnlineName(isOnline) {
const isOnlineMap = {
1: '在线',
2: '离线'
}
return isOnlineMap[isOnline]
},
statusFilter(status) {
const statusMap = {
1: 'success',
@@ -26,7 +26,7 @@
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.status')" width="100">
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
</template>
@@ -49,7 +49,7 @@
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
<el-form-item :label="$t('table.port')" prop="userName">
<el-form-item :label="$t('table.port')" prop="port">
<el-input v-model="temp.port"></el-input>
</el-form-item>
</el-form>
@@ -31,7 +31,7 @@
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" :label="$t('table.status')" width="100">
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
</template>
@@ -58,6 +58,10 @@ public class PortMappingListRes {
* 客户端ip
*/
private String clientIp;
/**
* 客户端端口
*/
private Integer clientPort;
/**
* 客户端端口
*/
@@ -63,8 +63,8 @@ public interface LicenseMapper extends SqlMapper {
*/
int add(LicenseDO license);
@Update("update `license` set enable = :enable where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable);
@Update("update `license` set enable = :enable, update_time = :updateTime where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable, @Param("updateTime") Date updateTime);
@Update("update `license` set key = :key,update_time = :updateTime where id = :id")
void reset(@Param("id") Integer id, @Param("key") String key, @Param("updateTime") Date updateTime);
@@ -75,11 +75,11 @@ public interface LicenseMapper extends SqlMapper {
@Select("select * from `license` where id = ?")
LicenseDO findById(Integer id);
@Update("update `license` set name = :name where id = :id")
void update(@Param("id") Integer id, @Param("name") String name);
@Update("update `license` set name = :name, update_time = :updateTime where id = :id")
void update(@Param("id") Integer id, @Param("name") String name, @Param("updateTime") Date updateTime);
@ResultType(LicenseDO.class)
@Select("select * from `license` where in in (:ids)")
@Select("select * from `license` where id in (:ids)")
List<LicenseDO> findByIds(@Param("ids")Set<Integer> ids);
@ResultType(LicenseDO.class)
@@ -30,6 +30,7 @@ import fun.asgc.neutrino.proxy.server.controller.req.PortPoolListReq;
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolListRes;
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
import java.util.Date;
import java.util.List;
/**
@@ -51,8 +52,8 @@ public interface PortPoolMapper extends SqlMapper {
@Insert("insert into port_pool(`port`,`enable`,`create_time`,`update_time`) values(:port,:enable,:createTime,:updateTime)")
void add(PortPoolDO portPool);
@Update("update `port_pool` set enable = :enable where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable);
@Update("update `port_pool` set enable = :enable, update_time = :updateTime where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable, @Param("updateTime") Date updateTime);
@Delete("delete from `port_pool` where id = ?")
void delete(Integer id);
@@ -31,6 +31,7 @@ import fun.asgc.neutrino.proxy.server.controller.res.UserListRes;
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
import java.util.Date;
import java.util.List;
import java.util.Set;
@@ -70,17 +71,17 @@ public interface UserMapper extends SqlMapper {
@Select("select * from user where enable = 1")
List<UserListRes> list();
@Update("update `user` set enable = :enable where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable);
@Update("update `user` set enable = :enable,update_time = :updateTime where id = :id")
void updateEnableStatus(@Param("id") Integer id, @Param("enable") Integer enable, @Param("updateTime")Date updateTime);
@Delete("delete from `user` where id = ?")
void delete(Integer id);
@Update("update `user` set name = :name,login_name = :loginName where id = :id")
@Update("update `user` set name = :name,login_name = :loginName,update_time = :updateTime where id = :id")
void update(UserDO userDO);
@Update("update `user` set login_password = :loginPassword where id = :id")
void updateLoginPassword(@Param("id") Integer id, @Param("loginPassword") String loginPassword);
@Update("update `user` set login_password = :loginPassword,update_time = :updateTime where id = :id")
void updateLoginPassword(@Param("id") Integer id, @Param("loginPassword") String loginPassword, @Param("updateTime")Date updateTime);
@Insert("insert into user(`name`,`login_name`,`login_password`,`enable`,`create_time`,`update_time`) values(:name,:loginName,:loginPassword,:enable,:createTime,:updateTime)")
void add(UserDO user);
@@ -125,7 +125,7 @@ public class LicenseService {
LicenseDO licenseCheck = licenseMapper.checkRepeat(oldLicenseDO.getUserId(), req.getName(), Sets.newHashSet(oldLicenseDO.getId()));
ParamCheckUtil.checkExpression(null == licenseCheck, ExceptionConstant.LICENSE_NAME_CANNOT_REPEAT);
licenseMapper.update(req.getId(), req.getName());
licenseMapper.update(req.getId(), req.getName(), new Date());
return new LicenseUpdateRes();
}
@@ -158,7 +158,7 @@ public class LicenseService {
* @return
*/
public LicenseUpdateEnableStatusRes updateEnableStatus(LicenseUpdateEnableStatusReq req) {
licenseMapper.updateEnableStatus(req.getId(), req.getEnable());
licenseMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
return new LicenseUpdateEnableStatusRes();
}
@@ -79,7 +79,7 @@ public class PortPoolService {
public PortPoolUpdateEnableStatusRes updateEnableStatus(PortPoolUpdateEnableStatusReq req) {
portPoolMapper.updateEnableStatus(req.getId(), req.getEnable());
portPoolMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
return new PortPoolUpdateEnableStatusRes();
}
@@ -158,7 +158,7 @@ public class UserService {
}
public UserUpdateEnableStatusRes updateEnableStatus(UserUpdateEnableStatusReq req) {
userMapper.updateEnableStatus(req.getId(), req.getEnable());
userMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
return new UserUpdateEnableStatusRes();
}
@@ -191,7 +191,7 @@ public class UserService {
public UserUpdatePasswordRes updatePassword(UserUpdatePasswordReq req) {
String loginPassword = Md5Util.encode(req.getLoginPassword());
userMapper.updateLoginPassword(req.getId(), loginPassword);
userMapper.updateLoginPassword(req.getId(), loginPassword, new Date());
return new UserUpdatePasswordRes();
}