Commit 73211b15 by 胡悦

合并

2 parents 377b7b15 398e987f
...@@ -7,9 +7,11 @@ import GlsxVueCommon from 'glsx-vue-common' ...@@ -7,9 +7,11 @@ import GlsxVueCommon from 'glsx-vue-common'
import { common } from '@/config' import { common } from '@/config'
import './styles/role-user-common.scss' import './styles/role-user-common.scss'
import './styles/index.scss' import './styles/index.scss'
import './date.js'
// import _ from 'lodash' // import _ from 'lodash'
import { Tree } from '@/components' import { MenuManager, Tree } from '@/components'
Vue.use(GlsxVueComponents) Vue.use(GlsxVueComponents)
Vue.component('menuManager', MenuManager)
Vue.component('tree', Tree) Vue.component('tree', Tree)
Vue.use(GlsxVueCommon, common) Vue.use(GlsxVueCommon, common)
......
const roleCreateStructure = { const roleCreateStructure = {
// id: Number, roleId: Number,
roleName: '', roleName: '',
description: '', description: '',
departName: '', departName: '',
right: Array, right: Array,
state: 1, state: Number,
createTime: '' createTime: ''
} }
const userRoleDetailColumn = [{ const userRoleDetailColumn = [{
label: '序号', label: '序号',
prop: 'id' prop: 'userId'
}, { }, {
label: '账号', label: '账号',
prop: 'username' prop: 'username'
......
import MenuManager from './src/main'
MenuManager.install = Vue => Vue.components(MenuManager.name, MenuManager)
export default MenuManager
<template>
<gl-row :gutter="150">
<gl-col :span='8'>
<div class="menu-box box">
<div class="title" v-html="title"></div>
<div class="console-btn">
<div><gl-button @click="openAll(openOrClose)">{{openOrClose ? '全部展开' : '全部收起'}}</gl-button></div>
<div><gl-button @click="pushSublings" type='primary' :disabled="push">添加同级菜单</gl-button></div>
<div><gl-button @click="pushChildren" type='primary' :disabled="push">添加子菜单</gl-button></div>
</div>
<tree
ref='tree'
@node-click='nodeClick'
></tree>
</div>
</gl-col>
<gl-col :span='16' v-show="showDetails">
<div class="details box">
<div class="title">详情</div>
<gl-form :model='form' class="content" label-width="150px">
<gl-form-item label="名称" >
<gl-input v-model="form.name" ref="name"></gl-input>
</gl-form-item>
<gl-form-item label="主机自定义名称">
<gl-input v-model="form.newName"></gl-input>
</gl-form-item>
<gl-form-item label="打开模式">
<gl-select v-model="form.open" style="width:100%">
<gl-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</gl-form-item>
<gl-form-item label="功能类型">
<gl-select v-model="form.type" style="width:100%" placeholder="请选择功能类型">
<gl-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</gl-form-item>
<gl-form-item label="上级菜单">
<gl-input v-model="form.upMenu" disabled></gl-input>
</gl-form-item>
<gl-form-item label="菜单路径">
<gl-input v-model="form.url" disabled></gl-input>
</gl-form-item>
<gl-form-item label="路由">
<gl-input v-model="form.router"></gl-input>
</gl-form-item>
<gl-form-item label="基础路径">
<gl-input v-model="form.defaultUrl"></gl-input>
</gl-form-item>
<gl-form-item label="排序">
<gl-input v-model="form.index"></gl-input>
</gl-form-item>
<gl-form-item label="是否隐藏">
<gl-switch v-model="form.Show"></gl-switch>
</gl-form-item>
<gl-form-item label="创建时间">
<gl-input v-model="form.createTime" disabled></gl-input>
</gl-form-item>
<gl-form-item label="修改时间">
<gl-input v-model="form.changeTime" disabled></gl-input>
</gl-form-item>
<gl-form-item>
<gl-button type="primary" @click="submit">{{btnTxt}}</gl-button>
<gl-button type="danger" v-show='del' @click="delData">删除</gl-button>
<gl-button @click="showDetails = false" style="float:right">取消</gl-button>
</gl-form-item>
</gl-form>
</div>
</gl-col>
</gl-row>
</template>
<script>
var timeTip = '系统自动生成(格式yyyy-MM-dd HH:mm:ss)'
export default {
name: 'MenuManager',
data() {
return {
data: [],
props: null,
openOrClose: true,
node: null,
btnTxt: '修改',
allNode: null,
push: true,
del: true,
showDetails: false,
_children: false,
_sublings: false,
form: {
name: '',
newName: '',
open: '新系统',
type: '',
upMenu: '',
url: '',
router: '',
defaultUrl: '',
index: '',
Show: true,
createTime: null,
changeTime: null
},
options: [
{
value: '选项1',
label: '本系统'
},
{
value: '选项2',
label: '新系统'
}
],
options2: [
{
value: '选项1',
label: '菜单路由'
},
{
value: '选项2',
label: '菜单'
},
{
value: '选项3',
label: '按钮'
}
]
}
},
props: {
title: {
type: String,
default: '标题'
}
},
watch: {
'form.name'(val) {
if (val !== '') this.$refs.name.$el.classList.remove('err')
}
},
methods: {
nodeClick(data, node, that, props) {
if (node.level === 1) this.data = node.parent.data
this.btnTxt = '修改'
this.node = node
this.allNode = data
this.props = props
this._sublings = false
this._children = false
this.del = true
this.push = false
this.showDetails = true
this.form.name = data.label || data[props.label]
this.form.upMenu = node.level === 1 ? '顶级菜单' : node.parent.data.label || node.parent.data[props.label]
this.form.defaultUrl = data.path
this.form.index = node.data.id
this.form.createTime = data.createTime
this.form.changeTime = data.changeTime
},
// 展开与关闭
openAll(val) {
this.searchChildren(this.$refs.tree.$children[0].$children[0].store._getAllNodes(), val)
this.openOrClose = !this.openOrClose
},
searchChildren(data, val) {
data.forEach(el => {
el.expanded = val
if (el.childNodes) {
this.searchChildren(el.childNodes, val)
}
})
},
// 添加同级菜单
pushSublings() {
this.btnTxt = '保存'
this._sublings = true
this._children = false
this.del = false
this.showDetails = true
for (const key in this.form) {
this.form[key] = null
}
this.form.createTime = timeTip
this.form.changeTime = timeTip
},
// 添加子菜单
pushChildren() {
this.btnTxt = '保存'
this._children = true
this._sublings = false
this.del = false
this.showDetails = true
for (const key in this.form) {
this.form[key] = null
}
this.form.createTime = timeTip
this.form.changeTime = timeTip
},
// 删除
delData() {
for (let index = 0; index < this.node.parent.childNodes.length; index++) {
if (this.node.parent.childNodes[index] === this.node) this.node.level === 1 ? this.node.parent.data.splice(index, 1) : this.node.parent.data.children.splice(index, 1)
}
this.$notify({
title: '删除成功',
type: 'success'
})
this.$set_session_config(this.data)
this.showDetails = false
},
// 保存修改
submit() {
if (this.form.name !== '' && this.form.name !== null) {
let arr = {}
// 添加同级
if (this._sublings) {
arr = {
id: this.form.index,
level: this.node.level,
createTime: new Date().format('yyyy-MM-dd HH:mm:ss')
}
arr[this.props.label] = this.form.name
if (this.node.level === 1) {
this.data.push(arr)
} else {
if (this.node.parent.data.children === undefined) this.$set(this.node.parent.data, 'children', [])
this.node.parent.data.children.push(arr)
}
} else if (this._children) { // 添加子级
arr = {
id: this.form.index,
level: this.node.level + 1,
createTime: new Date().format('yyyy-MM-dd HH:mm:ss')
}
arr[this.props.label] = this.form.name
if (this.allNode.children === undefined) this.$set(this.allNode, 'children', [])
this.allNode.children.push(arr)
} else { // 修改
this.node.data.id = this.form.index
this.node.data[this.props.label] = this.form.name
if (this.node.data.changeTime === undefined) this.$set(this.node.data, 'changeTime', '')
this.node.data.changeTime = new Date().format('yyyy-MM-dd HH:mm:ss')
}
this.showDetails = false
this.$notify({
title: '操作成功',
type: 'success'
})
this.$set_session_config(this.data)
} else {
this.$refs.name.$el.classList.add('err')
}
}
}
}
</script>
<style scoped>
.content{
padding: 15px;
}
.box{
margin-bottom: 20px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
.title{
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.el-form-item{
margin-bottom: 15px;
}
.console-btn{
padding: 15px;
display: flex;
flex-wrap:wrap;
width: 100%;
box-sizing: border-box;
}
.console-btn div{
flex: 1;
height: 40px;
margin-bottom: 10px;
}
.err::after{
content: '请填写列表名称';
display: block;
color: red;
}
</style>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<script> <script>
import { roleCreateStructure } from '@/common/commonConst' import { roleCreateStructure } from '@/common/commonConst'
import { saveRoleList } from '@/api/api' import { saveRoleList, updateRole } from '@/api/api'
export default { export default {
name: 'RoleCreate', name: 'RoleCreate',
props: { props: {
...@@ -64,28 +64,39 @@ export default { ...@@ -64,28 +64,39 @@ export default {
} }
}, },
methods: { methods: {
// isRoleNameExit getParams() {
addRole(editData) { return this.$deep_clone(this.createRuleForm)
saveRoleList.req(editData).then((data) => { },
// 接口
addRole() {
saveRoleList.req(this.getParams()).then((data) => {
console.log(data) console.log(data)
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
}, },
updateRoleInfo() {
updateRole.req(this.getParams()).then((data) => {
console.log(data)
}).catch(err => {
console.log(err)
})
},
// 接口
handleCreateSubmit(formName) { handleCreateSubmit(formName) {
const editData = this.$deep_clone(this.createRuleForm) const editData = this.getParams()
// eidt:true;create:false // eidt:true;create:false
// const flagEOrC = role.id === Number const flagEOrC = editData.id === Number
// flagEOrC && console.log(flagEOrC)
// const editData = { roleName: 'fhkdsajfakjfa' } flagEOrC && this.addRole()
this.addRole(editData) !flagEOrC && this.updateRoleInfo()
// this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
// if (valid) { if (valid) {
// this.$emit('createClose', flagEOrC, editData) this.$emit('createClose', flagEOrC, editData)
// } else { } else {
// return false return false
// } }
// }) })
}, },
handleCreateCancel() { handleCreateCancel() {
this.$emit('createClose') this.$emit('createClose')
......
<template> <template>
<gl-row :gutter="150"> <div class="tree" :style="treeStyle">
<gl-col :span='8'> <gl-tree
<div class="menu-box box"> ref='tree'
<div class="title" v-html="title"></div> highlight-current
<gl-row v-if="consoleItem" class="console-btn"> :data='data'
<gl-col :span='8'><gl-button @click="openAll(openOrClose)">{{openOrClose ? '全部展开' : '全部收起'}}</gl-button></gl-col> :show-checkbox='showCheckbox'
<gl-col :span='16'> node-key='id'
<gl-button @click="pushSublings" type='primary' :disabled="push">添加同级菜单</gl-button> :props='props'
<gl-button @click="pushChildren" type='primary' :disabled="push">添加子菜单</gl-button> :default-expand-all='defaultExpandAll'
</gl-col> @check='check'
</gl-row> @node-click='nodeClick'
<div class="tree"> ></gl-tree>
<gl-tree </div>
ref='tree'
highlight-current
:data='data'
@node-click='nodeClick'
:show-checkbox='showCheckbox'
node-key='id'
:props='props'
></gl-tree>
</div>
</div>
</gl-col>
<gl-col :span='16' v-show="showDetails">
<div class="details box">
<div class="title">详情</div>
<gl-form :model='form' class="content" label-width="150px">
<gl-form-item label="名称" >
<gl-input v-model="form.name" ref="name"></gl-input>
</gl-form-item>
<gl-form-item label="主机自定义名称">
<gl-input v-model="form.newName"></gl-input>
</gl-form-item>
<gl-form-item label="打开模式">
<gl-select v-model="form.open" style="width:100%">
<gl-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</gl-form-item>
<gl-form-item label="功能类型">
<gl-select v-model="form.type" style="width:100%" placeholder="请选择功能类型">
<gl-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</gl-form-item>
<gl-form-item label="上级菜单">
<gl-input v-model="form.upMenu" disabled></gl-input>
</gl-form-item>
<gl-form-item label="菜单路径">
<gl-input v-model="form.url" disabled></gl-input>
</gl-form-item>
<gl-form-item label="路由">
<gl-input v-model="form.router"></gl-input>
</gl-form-item>
<gl-form-item label="基础路径">
<gl-input v-model="form.defaultUrl"></gl-input>
</gl-form-item>
<gl-form-item label="排序">
<gl-input v-model="form.index"></gl-input>
</gl-form-item>
<gl-form-item label="是否隐藏">
<gl-switch v-model="form.Show"></gl-switch>
</gl-form-item>
<gl-form-item label="创建时间">
<gl-input v-model="form.createTime" disabled></gl-input>
</gl-form-item>
<gl-form-item label="修改时间">
<gl-input v-model="form.changeTime" disabled></gl-input>
</gl-form-item>
<gl-form-item>
<gl-button type="primary" @click="submit">{{btnTxt}}</gl-button>
<gl-button type="danger" v-show='del' @click="delData">删除</gl-button>
<gl-button @click="showDetails = false" style="float:right">取消</gl-button>
</gl-form-item>
</gl-form>
</div>
</gl-col>
</gl-row>
</template> </template>
<script> <script>
var timeTip = '系统自动生成(格式yyyy-MM-dd HH:mm:ss)'
export default { export default {
name: 'Tree', name: 'Tree',
data() { data() {
return { return {
openOrClose: true, data: this.$get_session_config().resources || this.$get_session_config(),
node: null, props: {
btnTxt: '修改', label: 'title'
allNode: null,
push: true,
del: true,
showDetails: false,
_children: false,
_sublings: false,
form: {
name: '',
newName: '',
open: '新系统',
type: '',
upMenu: '',
url: '',
router: '',
defaultUrl: '',
index: '',
Show: true,
createTime: null,
changeTime: null
},
options: [
{
value: '选项1',
label: '本系统'
},
{
value: '选项2',
label: '新系统'
}
],
options2: [
{
value: '选项1',
label: '菜单路由'
},
{
value: '选项2',
label: '菜单'
},
{
value: '选项3',
label: '按钮'
}
]
}
},
props: {
title: {
type: String,
default: '标题'
},
consoleItem: {
type: Boolean
},
data: {
type: Array,
default: () => []
},
showCheckbox: {
type: Boolean,
default: false
},
props: {
type: Object,
default: () => {
return {
lebel: 'label',
children: 'children'
}
} }
} }
}, },
watch: { props: {
'form.name'(val) { showCheckbox: Boolean,
if (val !== '') this.$refs.name.$el.classList.remove('err') value: null,
} defaultExpandAll: Boolean,
treeStyle: null
}, },
methods: { methods: {
nodeClick(data, node, that) { nodeClick(data, treeData, vue) {
this.btnTxt = '修改' this.$emit('node-click', data, treeData, vue, this.props)
this.node = node
this.allNode = data
this._sublings = false
this._children = false
this.del = true
this.push = false
this.showDetails = true
this.form.name = data.label || data[this.props.label]
this.form.upMenu = node.level === 1 ? '顶级菜单' : node.parent.data.label || node.parent.data[this.props.label]
this.form.defaultUrl = data.path
this.form.index = node.data.id
this.form.createTime = data.createTime
this.form.changeTime = data.changeTime
}, },
// 展开与关闭 check(data, treeData) {
openAll(val) { this.$emit('input', { data, treeData })
this.searchChildren(this.$refs.tree.$children[0].store._getAllNodes(), val)
this.openOrClose = !this.openOrClose
},
searchChildren(data, val) {
data.forEach(el => {
el.expanded = val
if (el.childNodes) {
this.searchChildren(el.childNodes, val)
}
})
},
// 添加同级菜单
pushSublings() {
this.btnTxt = '保存'
this._sublings = true
this._children = false
this.del = false
this.showDetails = true
for (const key in this.form) {
this.form[key] = null
}
this.form.createTime = timeTip
this.form.changeTime = timeTip
},
// 添加子菜单
pushChildren() {
this.btnTxt = '保存'
this._children = true
this._sublings = false
this.del = false
this.showDetails = true
for (const key in this.form) {
this.form[key] = null
}
this.form.createTime = timeTip
this.form.changeTime = timeTip
},
// 删除
delData() {
for (let index = 0; index < this.node.parent.childNodes.length; index++) {
if (this.node.parent.childNodes[index] === this.node) this.node.level === 1 ? this.node.parent.data.splice(index, 1) : this.node.parent.data.children.splice(index, 1)
}
this.$notify({
title: '删除成功',
type: 'success'
})
this.$set_session_config(this.data)
this.showDetails = false
},
// 保存修改
submit() {
if (this.form.name !== '' && this.form.name !== null) {
let arr = {}
if (this._sublings) {
arr = {
id: this.form.index,
level: this.node.level,
createTime: new Date().format('yyyy-MM-dd HH:mm:ss')
}
arr[this.props.label] = this.form.name
if (this.node.level === 1) {
this.data.push(arr)
} else {
if (this.node.parent.data.children === undefined) this.$set(this.node.parent.data, 'children', [])
this.node.parent.data.children.push(arr)
}
} else if (this._children) {
arr = {
id: this.form.index,
level: this.node.level + 1,
createTime: new Date().format('yyyy-MM-dd HH:mm:ss')
}
arr[this.props.label] = this.form.name
if (this.allNode.children === undefined) this.$set(this.allNode, 'children', [])
this.allNode.children.push(arr)
} else {
this.node.data.id = this.form.index
this.node.data[this.props.label] = this.form.name
if (this.node.data.changeTime === undefined) this.$set(this.node.data, 'changeTime', '')
this.node.data.changeTime = new Date().format('yyyy-MM-dd HH:mm:ss')
}
this.showDetails = false
this.$notify({
title: '操作成功',
type: 'success'
})
this.$set_session_config(this.data)
} else {
this.$refs.name.$el.classList.add('err')
}
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.tree{ .tree{
height: 650px; height: 550px;
overflow-y: scroll; overflow-y: scroll;
} }
.content{
padding: 15px;
}
.box{
margin-bottom: 20px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
}
.title{
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.el-form-item{
margin-bottom: 15px;
}
.console-btn{
padding: 15px;
}
.err::after{
content: '请填写列表名称';
display: block;
color: red;
}
</style> </style>
...@@ -3,17 +3,20 @@ ...@@ -3,17 +3,20 @@
<div> <div>
<gl-dialog :title="userDetailTitle" :visible.sync="userDetailVisible" :before-close="handleClose"> <gl-dialog :title="userDetailTitle" :visible.sync="userDetailVisible" :before-close="handleClose">
<gl-table :table="tableParam"></gl-table> <gl-table :table="tableParam"></gl-table>
<gl-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[1,2,3,4]" :page-size="pageSize" layout="total, prev, pager, next" :total="total">
</gl-pagination>
</gl-dialog> </gl-dialog>
</div> </div>
</template> </template>
<script> <script>
import { selectUserRoleByRoleId } from '@/api/api'
export default { export default {
name: 'UserDetail', name: 'UserDetail',
props: { props: {
userDetailTitle: String, userDetailTitle: String,
userDetailVisible: Boolean, userDetailVisible: Boolean,
// dataParam: Array, resParam: [Array, Object],
columnParam: Array, columnParam: Array,
consoleParam: [Array, Object] consoleParam: [Array, Object]
}, },
...@@ -23,36 +26,72 @@ export default { ...@@ -23,36 +26,72 @@ export default {
}, },
consoleParam(val) { consoleParam(val) {
this.tableParam.console = val this.tableParam.console = val
},
apiParams(val) {
// this.tableParam.data = val.list
// this.total = val.total
this.id = val
console.log(this.id)
this.selectUser()
} }
}, },
data() { data() {
return { return {
pageNum: 1,
pageSize: 10,
total: 10,
id: Number,
tableParam: { tableParam: {
border: true, border: true,
// role-data // role-data
// data: [{ // data: [{
// id: '1006', // userId: '1006',
// username: 'text11', // username: 'text11',
// realname: '陈婉清', // realname: '陈婉清',
// state: '启动' // state: '启动'
// }], // }],
data: [{ data: [],
username: 'abc',
realname: '陈婉清',
isadmin: '否',
mobile: '13033333333',
email: 'abc@didihu.com',
roles: '好车主',
state: '开启'
}],
column: [], column: [],
console: [] console: []
} }
} }
}, },
methods: { methods: {
getParams() {
return {
pageSize: this.pageSize,
pageNum: this.pageNum,
roleId: this.id
}
},
// 获取角色的相关用户详细信息
selectUser() {
const params = this.getParams()
// const params = {
// pageSize: this.pageSize,
// pageNum: this.pageNum,
// roleName: this.roleName
// roleId: roleId
// }
// console.log(params)
selectUserRoleByRoleId.req(params).then(res => {
console.log(res)
this.total = res.total
this.resParam = res.list
}).catch(err => {
console.log(err)
})
},
handleClose() { handleClose() {
this.$emit('userDetailClose') this.$emit('userDetailClose')
},
handleSizeChange(val) {
this.pageSize = val
this.selectUser()
},
handleCurrentChange(val) {
this.pageNum = val
this.selectUser()
} }
} }
} }
......
...@@ -3,10 +3,12 @@ import UserDetail from './UserDetail' ...@@ -3,10 +3,12 @@ import UserDetail from './UserDetail'
import RoleCreate from './RoleCreate' import RoleCreate from './RoleCreate'
import RoleDetail from './RoleDetail' import RoleDetail from './RoleDetail'
import Tree from './Tree' import Tree from './Tree'
import MenuManager from './MenuManager'
export { export {
UserCreate, UserCreate,
UserDetail, UserDetail,
RoleCreate, RoleCreate,
RoleDetail, RoleDetail,
Tree Tree,
MenuManager
} }
...@@ -2,7 +2,7 @@ export default { ...@@ -2,7 +2,7 @@ export default {
axios: { axios: {
baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/', baseURL: 'http://cas.dev.glsx.net/admin-operating-auth/',
// baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/', // baseURL: 'http://192.168.3.171:7300/mock/5b91805391b67469b43e2921/subsystem/',
whiteList: ['role/deleteRoleById', 'role/deleteUserRoleById', 'role/getRoleDetail', 'role/getRoleDetail', 'role/getRoleList', 'role/isRoleNameExit', 'role/saveRoleList', 'role/selectMenuTreeRoleId', 'role/selectUserRoleByRoleId', 'role/updateRole', 'user/batcheDel', 'user/findAll', 'user/get', 'user/getWithRoles', 'user/operatUser', 'user/updateUser'], whiteList: ['role/deleteRoleById', 'role/deleteUserRoleById', 'role/getRoleDetail', 'role/getRoleDetail', 'role/getRoleList', 'role/isRoleNameExit', 'role/saveRoleList', 'role/selectMenuTreeRoleId', 'role/selectUserRoleByRoleId', 'role/updateRole', 'user/batcheDel', 'user/findAll', 'user/get', 'user/getWithRoles', 'user/operatUser', 'user/updateUser', 'department/del', 'department/findTree', 'department/getPName', 'department/getTreeNode', 'department/updateDepartment', 'menu/add', 'menu/del', 'menu/edit', 'menu/findById', 'menu/findTree', 'menu/getByUserId', 'menu/getPName'],
timeout: 15000, timeout: 15000,
result: { result: {
data_key: 'data', // 返回值数据实体存放对象 data_key: 'data', // 返回值数据实体存放对象
......
function format(formatStr) {
const date = this
var zeroize = function(value, length) {
if (!length) {
length = 2
}
for (var i = 0, zeros = ''; i < (length - value.length); i++) {
zeros += '0'
}
return zeros + value
}
return formatStr.replace(/"[^"]*"|'[^']*'|\b(?:d{1,4}|M{1,4}|yy(?:yy)?|([hHmstT])\1?|[lLZ])\b/g, function($0) {
switch ($0) {
case 'd': return date.getDate()
case 'dd': return zeroize(date.getDate())
case 'ddd': return ['Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat'][date.getDay()]
case 'dddd': return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][date.getDay()]
case 'M': return date.getMonth() + 1
case 'MM': return zeroize(date.getMonth() + 1)
case 'MMM': return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][date.getMonth()]
case 'MMMM': return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][date.getMonth()]
case 'yy': return date.getFullYear().substr(2)
case 'yyyy': return date.getFullYear()
case 'h': return date.getHours() % 12 || 12
case 'hh': return zeroize(date.getHours() % 12 || 12)
case 'H': return date.getHours()
case 'HH': return zeroize(date.getHours())
case 'm': return date.getMinutes()
case 'mm': return zeroize(date.getMinutes())
case 's': return date.getSeconds()
case 'ss': return zeroize(date.getSeconds())
case 'l': return date.getMilliseconds()
case 'll': return zeroize(date.getMilliseconds())
case 'tt': return date.getHours() < 12 ? 'am' : 'pm'
case 'TT': return date.getHours() < 12 ? 'AM' : 'PM'
}
})
}
const time = Date
time.prototype.format = format
<template> <template>
<div> <div>
<tree :data='res' :title="'菜单列表'" :props='props' consoleItem></tree> <menu-manager :title="'菜单列表'"></menu-manager>
</div> </div>
</template> </template>
...@@ -9,10 +9,6 @@ export default { ...@@ -9,10 +9,6 @@ export default {
name: 'menuMG', name: 'menuMG',
data() { data() {
return { return {
res: this.$get_session_config().resources,
props: {
label: 'title'
}
} }
} }
} }
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
<gl-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10,20,30,40]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> <gl-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10,20,30,40]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
</gl-pagination> </gl-pagination>
<role-detail :detailVisible="detailVisible" :roleParam="roleParam" @detailClose="handleDetailClose"></role-detail> <role-detail :detailVisible="detailVisible" :roleParam="roleParam" @detailClose="handleDetailClose"></role-detail>
<user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="handleUserDetailClose" :dataParam="[]" :columnParam="columnParam" :consoleParam="consoleParam"></user-detail> <!-- <user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="handleUserDetailClose" :resParam="resParam" :columnParam="columnParam" :consoleParam="consoleParam"></user-detail> -->
<user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="handleUserDetailClose" :apiParams="apiParams" :columnParam="columnParam" :consoleParam="consoleParam"></user-detail>
</div> </div>
</div> </div>
</div> </div>
...@@ -37,12 +38,14 @@ export default { ...@@ -37,12 +38,14 @@ export default {
data() { data() {
return { return {
roleName: '', roleName: '',
roleId: Number,
createVisible: false, createVisible: false,
detailVisible: false, detailVisible: false,
userDetailVisible: false, userDetailVisible: false,
roleParam: roleCreateStructure, roleParam: roleCreateStructure,
columnParam: [], columnParam: [],
consoleParam: [], consoleParam: [],
apiParams: Number,
createOrEditTitle: '新增角色', createOrEditTitle: '新增角色',
userDetailTitle: '用户列表', userDetailTitle: '用户列表',
// 分页所需参数-start // 分页所需参数-start
...@@ -95,7 +98,7 @@ export default { ...@@ -95,7 +98,7 @@ export default {
label: '用户', label: '用户',
type: 'text', type: 'text',
callback: (index, rows) => { callback: (index, rows) => {
this.handleGetUserDetail() this.handleGetUserDetail(index, rows)
} }
}] }]
} }
...@@ -104,6 +107,7 @@ export default { ...@@ -104,6 +107,7 @@ export default {
}, },
mounted() { mounted() {
this.getList() this.getList()
// this.selectUser()
}, },
// search-------------------- // search--------------------
// watch: { // watch: {
...@@ -138,29 +142,50 @@ export default { ...@@ -138,29 +142,50 @@ export default {
// 获取页面参数 // 获取页面参数
getParams() { getParams() {
return { return {
// pageSize: this.pageSize, pageSize: this.pageSize,
// pageNum: this.pageNum, pageNum: this.pageNum,
roleName: this.roleName roleName: this.roleName
} }
}, },
reqList() {
// const params = this.getParams()
},
// 接口请求-start--------------------------------------- // 接口请求-start---------------------------------------
// 获取展示数据,请求表格数据 // 获取展示数据,请求表格数据
getList() { getList() {
// 接口
const params = this.getParams() const params = this.getParams()
getRoleList.req(params).then(res => { getRoleList.req(params).then(res => {
console.log(res) // console.log(res)
this.total = res.total this.total = res.total
this.roleData.data = res.list this.roleData.data = res.list
// console.log(this.roleData.data)
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
}) })
}, },
// 获取角色的相关用户详细信息
// selectUser(roleId) {
// // const params = this.getParams()
// const params = {
// pageSize: this.pageSize,
// pageNum: this.pageNum,
// roleName: this.roleName
// // roleId: roleId
// }
// // console.log(params)
// selectUserRoleByRoleId.req(params).then(res => {
// console.log(res)
// // this.total = res.total
// this.resParam = res
// }).catch(err => {
// console.log(err)
// })
// },
// 接口请求-end--------------------------------------- // 接口请求-end---------------------------------------
// 新增用户到页面 // 新增用户到页面
aaaddRole(data) { aaaddRole(data) {
// 后台获取---------------------- // 后台获取----------------------
data.id = '1038' // data.id = '1038'
data.createTime = new Date().toLocaleString().split('/').join('-') data.createTime = new Date().toLocaleString().split('/').join('-')
// 后台获取---------------------- // 后台获取----------------------
const newData = data const newData = data
...@@ -197,13 +222,18 @@ export default { ...@@ -197,13 +222,18 @@ export default {
this.deleteDialogVisible() this.deleteDialogVisible()
this.roleParam = roleCreateStructure this.roleParam = roleCreateStructure
}, },
handleGetUserDetail() { handleGetUserDetail(index, rows) {
this.columnParam = userRoleDetailColumn this.columnParam = userRoleDetailColumn
this.consoleParam = userRoleDetailConsole this.consoleParam = userRoleDetailConsole
this.apiParams = rows[index].id
// console.log(rows[index].id)
// this.selectUser({ roleId: rows[index].id })
// this.selectUser(rows[index].id)
this.userDetailDialogVisible() this.userDetailDialogVisible()
}, },
handleUserDetailClose() { handleUserDetailClose() {
this.userDetailDialogVisible() this.userDetailDialogVisible()
this.apiParams = Number
}, },
handleCreateOrEdit(params, title) { handleCreateOrEdit(params, title) {
this.createDialogVisible() this.createDialogVisible()
...@@ -216,8 +246,8 @@ export default { ...@@ -216,8 +246,8 @@ export default {
this.roleParam = roleCreateStructure this.roleParam = roleCreateStructure
!data && this.message('取消创建角色') !data && this.message('取消创建角色')
// 将数据提交给后台,根据返回结果做判断 // 将数据提交给后台,根据返回结果做判断
data && !flagEOrC && this.aaaddRole(data) // data && !flagEOrC && this.aaaddRole(data)
data && flagEOrC && this.message('已经成功修改数据!', 'success') // data && flagEOrC && this.message('已经成功修改数据!', 'success')
} }
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<gl-table :table="userData" ref="multipleTable"></gl-table> <gl-table :table="userData" ref="multipleTable"></gl-table>
<gl-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10,20,30,40]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> <gl-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum" :page-sizes="[10,20,30,40]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
</gl-pagination> </gl-pagination>
<user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="handleUserDetailClose" :dataParam="[]" :columnParam="columnParam" :consoleParam="consoleParam"></user-detail> <user-detail :userDetailVisible="userDetailVisible" :userDetailTitle="userDetailTitle" @userDetailClose="handleUserDetailClose" :resParam="[]" :columnParam="columnParam" :consoleParam="consoleParam"></user-detail>
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!