v1.6 版本发布 ,详情查看版本说明

This commit is contained in:
zhengjie
2019-02-28 16:27:08 +08:00
parent 685985ce59
commit 5d4f990368
27 changed files with 319 additions and 152 deletions

View File

@@ -16,7 +16,6 @@
</router-link>
</scroll-pane>
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
<li @click="refreshSelectedTag(selectedTag)">刷新</li>
<li @click="closeSelectedTag(selectedTag)">关闭</li>
<li @click="closeOthersTags">关闭其他</li>
<li @click="closeAllTags">关闭所有</li>
@@ -86,16 +85,6 @@ export default {
}
})
},
refreshSelectedTag(view) {
this.$store.dispatch('delCachedView', view).then(() => {
const { fullPath } = view
this.$nextTick(() => {
this.$router.replace({
path: '/redirect' + fullPath
})
})
})
},
closeSelectedTag(view) {
this.$store.dispatch('delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) {

View File

@@ -8,7 +8,7 @@
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon" style="height: 39px;width: 13px;margin-left: 2px;" />
</el-input>
</el-form-item>

View File

@@ -30,7 +30,7 @@ export default {
ico: 'unlock', unlock: true, content: '锁定滚动条',
height: document.documentElement.clientHeight - 94.5 + 'px;',
width: document.documentElement.clientWidth - 185 + 'px;',
data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output~' }],
data: [{ name: 'elAdmin-', timestamp: new Date(), threadName: 'system-prompt-message', level: 'INFO', className: 'me.zhengjie.AppRun' + ' :', body: 'Welcome, no log output' }],
// level
INFO: '#0000ff', WARN: '#FFFF00', ERROR: '#FF0000', DEBUG: '#DEA000'
}
@@ -129,5 +129,29 @@ export default {
</script>
<style scoped>
button,input,textarea{outline:0}.container .buttons .closes,.container .buttons .maximize,.container .buttons .minimize{padding:0;margin:0;margin-right:6px;width:12px;height:12px;border:1px solid transparent;border-radius:6px}.container{width:100%;margin:5px}.container .console{font-family:consolas;overflow-y:scroll;background:#494949;color:#f7f7f7;padding:10px;font-size:14px} .lock {position: fixed;right: 45px;bottom: 6.8%;z-index: 100000}
button,input,textarea {
outline: 0
}
.container {
width: 100%;
margin: 5px
}
.container .console {
font-family: "Interstate", "Hind", -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
overflow-y: scroll;
background: #494949;
color: #f7f7f7;
padding: 10px;
font-size: 14px;
border-radius: 3px 1px 3px 3px;
}
.lock {
position: fixed;
right: 45px;
bottom: 6.8%;
z-index: 100000
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<eHeader :roles="roles" :menus="menus" :query="query"/>
<eHeader :menus="menus" :query="query"/>
<!--表格渲染-->
<tree-table v-loading="loading" :data="data" :expand-all="true" :columns="columns" border size="small">
<el-table-column prop="icon" label="图标" align="center" width="80px">
@@ -28,7 +28,7 @@
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<edit v-if="checkPermission(['ADMIN','MENU_ALL','MENU_EDIT'])" :roles="roles" :menus="menus" :data="scope.row" :sup_this="sup_this"/>
<edit v-if="checkPermission(['ADMIN','MENU_ALL','MENU_EDIT'])" :menus="menus" :data="scope.row" :sup_this="sup_this"/>
<el-popover
v-if="checkPermission(['ADMIN','MENU_ALL','MENU_DELETE'])"
:ref="scope.row.id"
@@ -49,7 +49,6 @@
<script>
import checkPermission from '@/utils/permission' // 权限判断函数
import { getRoleTree } from '@/api/role'
import treeTable from '@/components/TreeTable'
import initData from '@/mixins/initData'
import { del, getMenusTree } from '@/api/menu'
@@ -67,11 +66,10 @@ export default {
value: 'name'
}
],
delLoading: false, sup_this: this, menus: [], roles: []
delLoading: false, sup_this: this, menus: []
}
},
created() {
this.getRoles()
this.getMenus()
this.$nextTick(() => {
this.init()
@@ -113,12 +111,6 @@ export default {
menu.children = res
this.menus.push(menu)
})
},
getRoles() {
this.roles = []
getRoleTree().then(res => {
this.roles = res
})
}
}
}

View File

@@ -1,7 +1,7 @@
<template>
<div>
<el-button size="mini" type="success" @click="to">编辑</el-button>
<eForm ref="form" :roles="roles" :menus="menus" :sup_this="sup_this" :is-add="false"/>
<eForm ref="form" :menus="menus" :sup_this="sup_this" :is-add="false"/>
</div>
</template>
<script>
@@ -20,20 +20,12 @@ export default {
menus: {
type: Array,
required: true
},
roles: {
type: Array,
required: true
}
},
methods: {
to() {
const _this = this.$refs.form
_this.roleIds = []
_this.form = { id: this.data.id, component: this.data.component, name: this.data.name, sort: this.data.sort, pid: this.data.pid, path: this.data.path, iframe: this.data.iframe.toString(), roles: [], icon: this.data.icon }
this.data.roles.forEach(function(data, index) {
_this.roleIds.push(data.id)
})
_this.dialog = true
}
}

View File

@@ -33,9 +33,6 @@
<el-form-item label="上级类目">
<treeselect v-model="form.pid" :options="menus" style="width: 460px;" placeholder="选择上级类目" />
</el-form-item>
<el-form-item style="margin-top: -10px;margin-bottom: 0px;" label="选择角色">
<treeselect v-model="roleIds" :multiple="true" :options="roles" style="width: 460px;" placeholder="请选择角色" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
@@ -56,10 +53,6 @@ export default {
type: Array,
required: true
},
roles: {
type: Array,
required: true
},
isAdd: {
type: Boolean,
required: true
@@ -72,7 +65,7 @@ export default {
data() {
return {
loading: false, dialog: false,
form: { name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }, roleIds: [],
form: { name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' },
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
@@ -94,12 +87,6 @@ export default {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.roles = []
const _this = this
this.roleIds.forEach(function(data, index) {
const role = { id: data }
_this.form.roles.push(role)
})
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
@@ -144,7 +131,6 @@ export default {
this.dialog = false
this.$refs['form'].resetFields()
this.form = { name: '', sort: 999, path: '', component: '', iframe: 'false', roles: [], pid: 0, icon: '' }
this.roleIds = []
},
selected(name) {
this.form.icon = name

View File

@@ -12,7 +12,7 @@
type="primary"
icon="el-icon-plus"
@click="$refs.form.dialog = true">新增</el-button>
<eForm ref="form" :roles="roles" :menus="menus" :is-add="true"/>
<eForm ref="form" :menus="menus" :is-add="true"/>
</div>
</div>
</template>
@@ -30,10 +30,6 @@ export default {
menus: {
type: Array,
required: true
},
roles: {
type: Array,
required: true
}
},
data() {
@@ -44,7 +40,6 @@ export default {
methods: {
checkPermission,
toQuery() {
console.log(this.query)
this.$parent.page = 0
this.$parent.init()
}

View File

@@ -21,7 +21,7 @@
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" :disabled="scope.row.id === 1" type="danger" size="mini">删除</el-button>
<el-button slot="reference" type="danger" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-button :disabled="data.id === 1" size="mini" type="success" @click="to">编辑</el-button>
<el-button size="mini" type="success" @click="to">编辑</el-button>
<eForm ref="form" :permissions="permissions" :sup_this="sup_this" :is-add="false"/>
</div>
</template>

View File

@@ -40,7 +40,6 @@ export default {
methods: {
checkPermission,
toQuery() {
console.log(this.query)
this.$parent.page = 0
this.$parent.init()
}

View File

@@ -1,33 +1,35 @@
<template>
<div class="app-container">
<eHeader :permissions="permissions" :query="query"/>
<eHeader :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
<el-table-column prop="name" label="名称"/>
<el-table-column prop="remark" label="描述"/>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<edit v-if="checkPermission(['ADMIN','ROLES_ALL','ROLES_EDIT'])" :permissions="permissions" :data="scope.row" :sup_this="sup_this"/>
<el-popover
v-if="checkPermission(['ADMIN','ROLES_ALL','ROLES_DELETE'])"
:ref="scope.row.id"
placement="top"
width="180">
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" :disabled="scope.row.id === 1" type="danger" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<div :style="'height: auto;max-height:' + height + 'overflow-y: auto;'">
<el-table v-loading="loading" :data="data" highlight-current-row size="small" border style="width: 100%;" @current-change="handleCurrentChange">
<el-table-column prop="name" label="名称"/>
<el-table-column prop="remark" label="描述"/>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
<template slot-scope="scope">
<edit v-if="checkPermission(['ADMIN','ROLES_ALL','ROLES_EDIT'])" :data="scope.row" :sup_this="sup_this"/>
<el-popover
v-if="checkPermission(['ADMIN','ROLES_ALL','ROLES_DELETE'])"
:ref="scope.row.id"
placement="top"
width="180">
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
</div>
<!--分页组件-->
<el-pagination
:total="total"
@@ -35,6 +37,59 @@
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
<!--这里是授权模块代码-->
<el-row :gutter="20" style="margin-top: 5px;">
<!--权限分配-->
<el-col :span="12">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">权限分配</span>
<el-button
v-if="showButton && checkPermission(['ADMIN','ROLES_ALL','ROLES_EDIT'])"
:loading="permissionLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 4px 10px"
type="info"
@click="savePermission">保存</el-button>
</div>
<div :style="'min-height: 200px;max-height:' + height + 'overflow-y: auto;'">
<el-tree
ref="permission"
:data="permissions"
:default-checked-keys="permissionIds"
:props="defaultProps"
show-checkbox
node-key="id"/>
</div>
</el-card>
</el-col>
<!--菜单分配-->
<el-col :span="12">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">菜单分配</span>
<el-button
v-if="showButton && checkPermission(['ADMIN','ROLES_ALL','ROLES_EDIT'])"
:loading="menuLoading"
icon="el-icon-check"
size="mini"
style="float: right; padding: 4px 10px"
type="info"
@click="saveMenu">保存</el-button>
</div>
<div :style="'min-height: 207px;max-height:' + height + 'overflow-y: auto;'">
<el-tree
ref="menu"
:data="menus"
:default-checked-keys="menuIds"
:props="defaultProps"
show-checkbox
node-key="id"/>
</div>
</el-card>
</el-col>
</el-row>
</div>
</template>
@@ -43,19 +98,28 @@ import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del } from '@/api/role'
import { getPermissionTree } from '@/api/permission'
import { getMenusTree } from '@/api/menu'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import edit from './module/edit'
import { editPermission, editMenu, get } from '@/api/role'
export default {
components: { eHeader, edit },
mixins: [initData],
data() {
return {
delLoading: false, sup_this: this, permissions: []
defaultProps: {
children: 'children',
label: 'label'
},
currentId: 0, permissionLoading: false, menuLoading: false, showButton: false,
delLoading: false, sup_this: this, permissions: [], permissionIds: [], menus: [], menuIds: [],
height: document.documentElement.clientHeight - 94.5 - 260 + 'px;'
}
},
created() {
this.getPermissions()
this.getMenus()
this.$nextTick(() => {
this.init()
})
@@ -64,6 +128,9 @@ export default {
parseTime,
checkPermission,
beforeInit() {
this.$refs.permission.setCheckedKeys([])
this.$refs.menu.setCheckedKeys([])
this.showButton = false
this.url = 'api/roles'
const sort = 'id,desc'
const query = this.query
@@ -93,11 +160,106 @@ export default {
getPermissionTree().then(res => {
this.permissions = res
})
},
getMenus() {
getMenusTree().then(res => {
this.menus = res
})
},
handleCurrentChange(val) {
const _this = this
// 清空权限与菜单的选中
this.$refs.permission.setCheckedKeys([])
this.$refs.menu.setCheckedKeys([])
// 保存当前的角色id
this.currentId = val.id
// 点击后显示按钮
this.showButton = true
// 初始化
this.menuIds = []
this.permissionIds = []
// 菜单数据需要特殊处理
val.menus.forEach(function(data, index) {
let add = true
for (let i = 0; i < val.menus.length; i++) {
if (data.id === val.menus[i].pid) {
add = false
break
}
}
if (add) {
_this.menuIds.push(data.id)
}
})
// 处理权限数据
val.permissions.forEach(function(data, index) {
_this.permissionIds.push(data.id)
})
},
savePermission() {
this.permissionLoading = true
const role = { id: this.currentId, permissions: [] }
this.$refs.permission.getCheckedKeys().forEach(function(data, index) {
const permission = { id: data }
role.permissions.push(permission)
})
editPermission(role).then(res => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.permissionLoading = false
this.update()
}).catch(err => {
this.permissionLoading = false
console.log(err.response.data.message)
})
},
saveMenu() {
this.menuLoading = true
const role = { id: this.currentId, menus: [] }
// 得到半选的父节点数据,保存起来
this.$refs.menu.getHalfCheckedNodes().forEach(function(data, index) {
const permission = { id: data.id }
role.menus.push(permission)
})
// 得到已选中的 key 值
this.$refs.menu.getCheckedKeys().forEach(function(data, index) {
const permission = { id: data }
role.menus.push(permission)
})
editMenu(role).then(res => {
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.menuLoading = false
this.update()
}).catch(err => {
this.menuLoading = false
console.log(err.response.data.message)
})
},
update() {
// 无刷新更新 表格数据
get(this.currentId).then(res => {
for (let i = 0; i < this.data.length; i++) {
if (res.id === this.data[i].id) {
this.data[i] = res
break
}
}
})
}
}
}
</script>
<style scoped>
.role-span {
font-weight: bold;color: #303133;
font-size: 15px;
}
</style>

View File

@@ -1,7 +1,7 @@
<template>
<div>
<el-button :disabled="data.id === 1" size="mini" type="success" @click="to">编辑</el-button>
<eForm ref="form" :permissions="permissions" :sup_this="sup_this" :is-add="false"/>
<el-button size="mini" type="success" @click="to">编辑</el-button>
<eForm ref="form" :sup_this="sup_this" :is-add="false"/>
</div>
</template>
<script>
@@ -16,20 +16,12 @@ export default {
sup_this: {
type: Object,
required: true
},
permissions: {
type: Array,
required: true
}
},
methods: {
to() {
const _this = this.$refs.form
_this.permissionIds = []
_this.form = { id: this.data.id, name: this.data.name, remark: this.data.remark, permissions: [] }
this.data.permissions.forEach(function(data, index) {
_this.permissionIds.push(data.id)
})
_this.dialog = true
}
}

View File

@@ -4,9 +4,6 @@
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" style="width: 370px;"/>
</el-form-item>
<el-form-item label="权限">
<treeselect v-model="permissionIds" :multiple="true" :options="permissions" style="width: 370px;" placeholder="请选择权限" />
</el-form-item>
<el-form-item style="margin-top: -10px;" label="描述">
<el-input v-model="form.remark" style="width: 370px;" rows="5" type="textarea"/>
</el-form-item>
@@ -20,15 +17,8 @@
<script>
import { add, edit } from '@/api/role'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
components: { Treeselect },
props: {
permissions: {
type: Array,
required: true
},
isAdd: {
type: Boolean,
required: true
@@ -41,7 +31,7 @@ export default {
data() {
return {
loading: false, dialog: false,
form: { name: '', permissions: [], remark: '' }, permissionIds: [],
form: { name: '', permissions: [], remark: '' },
rules: {
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
@@ -57,12 +47,6 @@ export default {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
this.form.permissions = []
const _this = this
this.permissionIds.forEach(function(data, index) {
const permission = { id: data }
_this.form.permissions.push(permission)
})
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
@@ -104,7 +88,6 @@ export default {
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.permissionIds = []
this.form = { name: '', permissions: [], remark: '' }
}
}

View File

@@ -12,7 +12,7 @@
type="primary"
icon="el-icon-plus"
@click="$refs.form.dialog = true">新增</el-button>
<eForm ref="form" :permissions="permissions" :is-add="true"/>
<eForm ref="form" :is-add="true"/>
</div>
<!-- 导出 -->
<el-button v-if="checkPermission(['ADMIN'])" :loading="downloadLoading" size="mini" class="filter-item" type="primary" icon="el-icon-download" @click="download">导出</el-button>
@@ -30,10 +30,6 @@ export default {
query: {
type: Object,
required: true
},
permissions: {
type: Array,
required: true
}
},
data() {

View File

@@ -11,11 +11,11 @@
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;margin-top: -10px;">
<el-table-column :show-overflow-tooltip="true" prop="jobName" width="90px" label="任务名称"/>
<el-table-column :show-overflow-tooltip="true" prop="beanName" width="90px" label="Bean名称"/>
<el-table-column :show-overflow-tooltip="true" prop="methodName" width="80px" label="执行方法"/>
<el-table-column :show-overflow-tooltip="true" prop="params" width="80px" label="参数"/>
<el-table-column :show-overflow-tooltip="true" prop="cronExpression" width="100px" label="cron表达式"/>
<el-table-column prop="createTime" label="异常详情" width="90px">
<el-table-column :show-overflow-tooltip="true" prop="beanName" width="110px" label="Bean名称"/>
<el-table-column :show-overflow-tooltip="true" prop="methodName" width="110px" label="执行方法"/>
<el-table-column :show-overflow-tooltip="true" prop="params" width="120px" label="参数"/>
<el-table-column :show-overflow-tooltip="true" prop="cronExpression" width="120px" label="cron表达式"/>
<el-table-column prop="createTime" label="异常详情" width="100px">
<template slot-scope="scope">
<el-button v-show="scope.row.exceptionDetail" size="mini" type="text" @click="info(scope.row.exceptionDetail)">查看详情</el-button>
</template>
@@ -26,7 +26,6 @@
<el-tag :type="scope.row.isSuccess ? 'success' : 'danger'">{{ scope.row.isSuccess ? '成功' : '失败' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" width="120px" label="描述"/>
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>

View File

@@ -33,7 +33,7 @@
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" :disabled="scope.row.id === 1" type="danger" size="mini">删除</el-button>
<el-button slot="reference" type="danger" size="mini">删除</el-button>
</el-popover>
</template>
</el-table-column>

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-button :disabled="data.id === 1" size="mini" type="success" @click="to">编辑</el-button>
<el-button size="mini" type="success" @click="to">编辑</el-button>
<eForm ref="form" :roles="roles" :sup_this="sup_this" :is-add="false"/>
</div>
</template>