Commit 748a4b95 by 胡悦

添加回车事件、修改样式、添加必填等

1 parent fd62a72f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"glsx-vue-common": "^1.1.17", "glsx-vue-common": "^1.1.19",
"glsx-vue-components": "^1.0.15", "glsx-vue-components": "^1.0.15",
"node-sass": "^4.9.3", "node-sass": "^4.9.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
......
...@@ -23,7 +23,7 @@ const userDetailColumn = [{ ...@@ -23,7 +23,7 @@ const userDetailColumn = [{
label: '管理员', label: '管理员',
prop: 'isadmin', prop: 'isadmin',
formatter: (cellValue) => { formatter: (cellValue) => {
return cellValue < 1 ? '否' : '是' return cellValue.isadmin < 1 ? '否' : '是'
} }
}, { }, {
label: '手机号码', label: '手机号码',
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<div><gl-button @click="pushSublings" type='primary' :disabled="value.push">添加同级菜单</gl-button></div> <div><gl-button @click="pushSublings" type='primary' :disabled="value.push">添加同级菜单</gl-button></div>
<div><gl-button @click="pushChildren" type='primary' :disabled="value.push">添加子菜单</gl-button></div> <div><gl-button @click="pushChildren" type='primary' :disabled="value.push">添加子菜单</gl-button></div>
</div> </div>
<gl-scroll :height='parseInt(this.$client_height() - this.height - 60)'> <gl-scroll :height='parseInt(this.$client_height() - this.height - 108)'>
<tree <tree
ref='tree' ref='tree'
@node-click='nodeClick' @node-click='nodeClick'
...@@ -43,6 +43,7 @@ export default { ...@@ -43,6 +43,7 @@ export default {
eventBus: Object eventBus: Object
}, },
mounted() { mounted() {
console.log()
this.height = this.$refs.topInfo.offsetHeight this.height = this.$refs.topInfo.offsetHeight
}, },
methods: { methods: {
......
...@@ -158,21 +158,21 @@ export default { ...@@ -158,21 +158,21 @@ export default {
}) })
: delMenu.req({ menuId: obj.id }).then(res => { : delMenu.req({ menuId: obj.id }).then(res => {
this.delLoading = false this.delLoading = false
this.delTip(true) this.delTip(true, '删除成功,首页查看需重新登录')
}).catch(err => { }).catch(err => {
this.delLoading = false this.delLoading = false
console.log(err) console.log(err)
this.delErrTip() this.delErrTip()
}) })
}, },
delTip(val) { delTip(val, tips) {
if (val) { if (val) {
const parent = this.value.node.parent const parent = this.value.node.parent
const children = parent.data.children || parent.data const children = parent.data.children || parent.data
const index = children.findIndex(d => d.id === this.value.data.id) const index = children.findIndex(d => d.id === this.value.data.id)
children.splice(index, 1) children.splice(index, 1)
this.$notify({ this.$notify({
title: '删除成功', title: tips || '删除成功',
type: 'success' type: 'success'
}) })
this.value.showDetails = false this.value.showDetails = false
...@@ -199,8 +199,10 @@ export default { ...@@ -199,8 +199,10 @@ export default {
if (this.value.sublings) { if (this.value.sublings) {
if (treeData.parent === '#') { if (treeData.parent === '#') {
obj.parentId = 0 obj.parentId = 0
obj.grade = 0
} else { } else {
obj.parentId = treeData.parent obj.parentId = treeData.parent
obj.grade = this.menu.grade
} }
this.addData(obj) this.addData(obj)
// 添加子级 // 添加子级
...@@ -213,7 +215,7 @@ export default { ...@@ -213,7 +215,7 @@ export default {
if (!this.isDepart) { if (!this.isDepart) {
editMenu.req(obj).then(res => { editMenu.req(obj).then(res => {
this.subLoading = false this.subLoading = false
this.Tip(true) this.Tip(true, '操作成功,首页查看需重新登录')
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
this.subLoading = false this.subLoading = false
...@@ -241,7 +243,7 @@ export default { ...@@ -241,7 +243,7 @@ export default {
if (!this.isDepart) { if (!this.isDepart) {
addMenu.req(obj).then(res => { addMenu.req(obj).then(res => {
this.subLoading = false this.subLoading = false
this.Tip(true) this.Tip(true, '操作成功,首页查看需重新登录')
}).catch(err => { }).catch(err => {
this.subLoading = false this.subLoading = false
console.log(err) console.log(err)
...@@ -256,10 +258,10 @@ export default { ...@@ -256,10 +258,10 @@ export default {
this.addOrEditDepart(obj) this.addOrEditDepart(obj)
} }
}, },
Tip(val) { Tip(val, tips) {
if (val) { if (val) {
this.$notify({ this.$notify({
title: '操作成功', title: tips || '操作成功',
type: 'success' type: 'success'
}) })
this.value.showDetails = false this.value.showDetails = false
......
...@@ -3,13 +3,17 @@ ...@@ -3,13 +3,17 @@
<gl-dialog title="角色列表" :visible.sync="detailVisible" :before-close="handleDetailCancel"> <gl-dialog title="角色列表" :visible.sync="detailVisible" :before-close="handleDetailCancel">
<gl-form label-width="105px"> <gl-form label-width="105px">
<gl-form-item label="角色名称:"> <gl-form-item label="角色名称:">
<span>{{roleParam.roleName}}</span> <span style="line-height:40px;">{{roleParam.roleName}}</span>
</gl-form-item> </gl-form-item>
<gl-form-item label="角色描述:"> <gl-form-item label="角色描述:">
<div style="padding-top:10px;">
<span style="word-wrap: break-word;">{{roleParam.description}}</span> <span style="word-wrap: break-word;">{{roleParam.description}}</span>
</div>
</gl-form-item> </gl-form-item>
<gl-form-item label="菜单选项:"> <gl-form-item label="菜单选项:">
<div style="padding-top:10px;">
<tree ref='tree' :propsData="roleMenuTree" :defaultExpandAll="defaultExpandAll" style="height:160px;overflow-y: auto;"></tree> <tree ref='tree' :propsData="roleMenuTree" :defaultExpandAll="defaultExpandAll" style="height:160px;overflow-y: auto;"></tree>
</div>
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
</gl-dialog> </gl-dialog>
......
...@@ -75,18 +75,20 @@ ...@@ -75,18 +75,20 @@
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label="状态" prop="state"> <gl-form-item label="状态" prop="state">
<gl-select v-model="userManageForm.state" placeholder="启用"> <gl-select v-model="userManageForm.state" data-vv-as="状态" name="state" v-validate="'required'">
<gl-option label="禁用" value='0'></gl-option> <gl-option label="禁用" value='0'></gl-option>
<gl-option label="启用" value='1'></gl-option> <gl-option label="启用" value='1'></gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has('state')" class="error">{{ errorBags.first('state') }}</span>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col :span="12"> <gl-col :span="12">
<gl-form-item label="管理员"> <gl-form-item label="管理员" prop="isadmin">
<gl-select v-model="userManageForm.isadmin" placeholder="否"> <gl-select v-model="userManageForm.isadmin" data-vv-as="管理员" name="isadmin" v-validate="'required'">
<gl-option label="否" value='0'></gl-option> <gl-option label="否" value='0'></gl-option>
<gl-option label="是" value='1'></gl-option> <gl-option label="是" value='1'></gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has('isadmin')" class="error">{{ errorBags.first('isadmin') }}</span>
</gl-form-item> </gl-form-item>
</gl-col> </gl-col>
<gl-col :span="24"> <gl-col :span="24">
...@@ -182,6 +184,12 @@ export default { ...@@ -182,6 +184,12 @@ export default {
email: [ email: [
{ required: true } { required: true }
], ],
state: [
{ required: true }
],
isadmin: [
{ required: true }
],
departName: [ departName: [
{ required: true } { required: true }
], ],
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<template> <template>
<div> <div>
<div class="default m-b20"> <div class="default m-b20">
<gl-input class="search-w250" placeholder="请输入角色名称" v-model="roleName" clearable></gl-input> <gl-input class="search-w250" placeholder="请输入角色名称" @keyup.enter.native="handleSearchRoleName" v-model="roleName" clearable></gl-input>
<gl-button type="primary" @click="handleSearchRoleName">搜索</gl-button> <gl-button type="primary" @keyup.enter="handleSearchRoleName" @click="handleSearchRoleName">搜索</gl-button>
</div> </div>
<div class="default p-t15"> <div class="default p-t15">
<gl-button class="control-tabledata-button" size="small" @click="handleCreateOrEdit(flagCOrE = true)">创建</gl-button> <gl-button class="control-tabledata-button" size="small" @click="handleCreateOrEdit(flagCOrE = true)">创建</gl-button>
...@@ -88,6 +88,7 @@ export default { ...@@ -88,6 +88,7 @@ export default {
roleData: { roleData: {
border: true, border: true,
height: parseInt(this.$client_height() - 140), height: parseInt(this.$client_height() - 140),
align: 'center',
data: [], data: [],
column: roleDataColumn, column: roleDataColumn,
console: { console: {
...@@ -125,6 +126,13 @@ export default { ...@@ -125,6 +126,13 @@ export default {
} }
} }
}, },
created() {
document.onkeydown = e => {
if (e.keyCode === 13) {
this.handleSearchRoleName()
}
}
},
mounted() { mounted() {
this.getList() this.getList()
this.getdepartData() this.getdepartData()
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<template> <template>
<div> <div>
<div class="default m-b20"> <div class="default m-b20">
<gl-input class="search-w250" placeholder="请输入用户名或姓名" v-model="userName" clearable></gl-input> <gl-input class="search-w250" @keyup.enter.native="finduserName" placeholder="请输入用户名或姓名" v-model="userName" clearable></gl-input>
<gl-button type="primary" @click="finduserName">搜索</gl-button> <gl-button type="primary" @keyup.enter="finduserName" @click="finduserName">搜索</gl-button>
</div> </div>
<div class="default p-t15"> <div class="default p-t15">
<div class="control-tabledata-button"> <div class="control-tabledata-button">
...@@ -173,6 +173,13 @@ export default { ...@@ -173,6 +173,13 @@ export default {
} }
} }
}, },
created() {
document.onkeydown = e => {
if (e.keyCode === 13) {
this.finduserName()
}
}
},
mounted() { mounted() {
this.findUserList() this.findUserList()
this.getRoleOptions() this.getRoleOptions()
...@@ -369,6 +376,7 @@ export default { ...@@ -369,6 +376,7 @@ export default {
}) })
}, },
findRolesName(params) { findRolesName(params) {
if (!params) return null
var nameArray = [] var nameArray = []
const userRoles = params.split(',') const userRoles = params.split(',')
userRoles.forEach(userItem => { userRoles.forEach(userItem => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!