This commit is contained in:
宋伟佳
2021-06-29 17:52:51 +08:00
5 changed files with 585 additions and 1856 deletions
+4 -4
View File
@@ -299,10 +299,10 @@ export default {
// path: '/convertDocView', // path: '/convertDocView',
// menuId: '3F52K25546' // menuId: '3F52K25546'
// }, // },
// // { {
// // title: '菜单管理', title: '菜单管理',
// // path: '/menuManage' path: '/menuManage'
// // }, },
// // { // // {
// // title: '保密管理', // // title: '保密管理',
// // path: '/convertDocView' // // path: '/convertDocView'
@@ -9,7 +9,6 @@
v-model="filterText"> v-model="filterText">
</el-input> </el-input>
<el-tree <el-tree
class="filter-tree"
:data="treeData" :data="treeData"
:props="defaultProps" :props="defaultProps"
default-expand-all default-expand-all
@@ -65,7 +64,7 @@
label="所属部门"> label="所属部门">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="positionName" prop="NameList"
label="所属岗位"> label="所属岗位">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -83,6 +82,7 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item v-if="scope.row.disableFlag === '1'" :command="[scope.row, '启用']">启用</el-dropdown-item> <el-dropdown-item v-if="scope.row.disableFlag === '1'" :command="[scope.row, '启用']">启用</el-dropdown-item>
<el-dropdown-item v-if="scope.row.disableFlag === '0'" :command="[scope.row, '禁用']">禁用</el-dropdown-item> <el-dropdown-item v-if="scope.row.disableFlag === '0'" :command="[scope.row, '禁用']">禁用</el-dropdown-item>
<el-dropdown-item :command="[scope.row, '配置岗位']">配置岗位</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@@ -94,6 +94,36 @@
<pagination :page="page" :total="total" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination> <pagination :page="page" :total="total" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination>
</div> </div>
<loading style="z-index: 2099;" :loading="treeLoading">导入中...</loading> <loading style="z-index: 2099;" :loading="treeLoading">导入中...</loading>
<el-drawer
title="配置岗位"
:visible.sync="modalPost"
:wrapperClosable="false"
size="800px"
@close="resetFormPost"
>
<el-tree
ref="tree2"
node-key="id"
class="filter-tree"
v-if="modalPost"
:props="props"
:data="postList"
:default-checked-keys="nodeList"
check-strictly
default-expand-all
show-checkbox>
</el-tree>
<div id="roleFormButton" class="demo-drawer-footer">
<el-button
size="mini"
class="common-button-primary"
icon="el-icon-check"
type="primary"
@click="PostSubmit"
>确定</el-button>
<el-button size="mini" class="common-button-default" icon="el-icon-close" @click="resetFormPost">取消</el-button>
</div>
</el-drawer>
</div> </div>
</template> </template>
@@ -102,6 +132,14 @@ export default {
name: 'MechanismManage', name: 'MechanismManage',
data () { data () {
return { return {
userId: '',
postList: [],
props: {
children: 'children',
label: 'name'
},
nodeList: [],
modalPost: false,
filterText: '', // 树结构检索条件 filterText: '', // 树结构检索条件
defaultProps: { defaultProps: {
children: 'children', children: 'children',
@@ -119,6 +157,21 @@ export default {
} }
}, },
methods: { methods: {
resetFormPost () {
this.modalPost= false
},
PostSubmit () {
this.$http.postData('sarUser/user/position', {
positionIds: this.$refs.tree2.getCheckedKeys(),
userId: this.userId
}, {}, res => {
if (res.ok) {
this.$message.success('配置岗位成功')
this.modalPost = false
this.getData()
}
})
},
handleCommand (command) { handleCommand (command) {
switch (command[1]) { switch (command[1]) {
case '启用': case '启用':
@@ -127,8 +180,27 @@ export default {
case '禁用': case '禁用':
this.disableFlagEdit(command[0], 1) this.disableFlagEdit(command[0], 1)
break break
case '配置岗位':
this.postsConfigure(command[0])
break
} }
}, },
getTree2 () {
this.$http.get('sarPosition/position', {}, {
_this: this,
}, res=> {
this.postList = res.data
})
},
postsConfigure (row) {
var arr = []
this.userId = row.userId
row.positions.forEach((item) => {
arr.push(item.id)
})
this.nodeList = arr
this.modalPost= true
},
disableFlagEdit (row, type) { disableFlagEdit (row, type) {
let json = {} let json = {}
json.userId = row.userId json.userId = row.userId
@@ -173,6 +245,16 @@ export default {
_this: this, _this: this,
loading: 'Loading' loading: 'Loading'
}, res => { }, res => {
res.data.forEach((item) => {
var NameList = ''
item.positions.forEach((items) => {
if (NameList.length > 0) {
NameList += ','
}
NameList += items.name
})
item.NameList = NameList
})
this.data = res.data this.data = res.data
}) })
}, },
@@ -188,13 +270,13 @@ export default {
computed: {}, computed: {},
watch: { watch: {
filterText(val) { filterText(val) {
console.log(val);
this.$refs.tree.filter(val); this.$refs.tree.filter(val);
} }
}, },
mounted () { mounted () {
// 获取组织结构树 // 获取组织结构树
this.getTree() this.getTree()
this.getTree2()
} }
} }
</script> </script>
@@ -264,6 +346,9 @@ export default {
/deep/.width-all{ /deep/.width-all{
width: 100%; width: 100%;
} }
.filter-tree {
height: calc(~'100% - 50px')
}
.laws-tree{ .laws-tree{
/deep/.clearable { /deep/.clearable {
top: 20px; top: 20px;
+107 -427
View File
@@ -2,89 +2,67 @@
<template> <template>
<div id="permission-menu-manage"> <div id="permission-menu-manage">
<div class="permission-menu-manage-left"> <div class="permission-menu-manage-left">
<laws-tree <el-tree
ref="permissionManage" class="filter-tree"
treeDivId="permissionManage" :data="treeData"
:zNodes="zNodes" :props="defaultProps"
autoSelect default-expand-all
deptSelect ref="tree"
showRMenu @node-contextmenu="rightHandleNodeClick"
@treeClick="(treeId, treeNode) => handleClick(treeId, treeNode)" @node-click="handleNodeClick">
@treeAdd="(treeId, treeNode) => handleAdd(treeId, treeNode)" </el-tree>
@treeEdit="(treeId, treeNode) => handleEdit(treeId, treeNode)"
@treeRightClick="(treeId, treeNode) => treeRightClick(treeId, treeNode)"
@treeRemove="(treeId, treeNode) => handleRemove(treeId, treeNode)"
></laws-tree>
</div> </div>
<div class="permission-menu-manage-right" v-if="showSarMenuInfoFlag"> <div class="permission-menu-manage-right" v-if="showSarMenuInfoFlag">
<div class="permission-content"> <el-row>
<el-form ref="sarMenuForm" :model="sarMenuEO" :rules="sarMenuRules" class="label-input-form"> <el-col :span="12">
<el-row> <el-button type="primary"
<el-col :span="6"> class="common-button-primary add-button"
<span style="color: #fff">1</span> @click="Add"
</el-col> size="mini">新增</el-button>
<el-col :span="18"> </el-col>
<el-form-item label="ID" prop="id" label-width="130px" class="standards-info-item"> </el-row>
<el-input v-model="sarMenuEO.id" :disabled="formdisableflag" class="permission-input"></el-input> <el-row>
</el-form-item> <el-col :span="12">
</el-col> <el-form
</el-row> ref="sarStandardsInfoForm"
<el-row> :model="form"
<el-col :span="6"> label-width="100px"
<span style="color: #fff">1</span> class="label-input-form"
</el-col> >
<el-col :span="18"> <el-form-item label="Id" class="search-item">
<el-form-item label="名称" prop="name" label-width="130px" class="standards-info-item"> <el-input v-model="form.id" clearable disabled/>
<el-input v-model="sarMenuEO.name" class="permission-input"></el-input> </el-form-item>
</el-form-item> <el-form-item label="名称" class="search-item">
</el-col> <el-input v-model="form.menuName" clearable disabled/>
</el-row> </el-form-item>
<Row> <el-form-item label="父节点Id" class="search-item">
<el-col :span="6"> <el-input v-model="form.parentId" clearable disabled/>
<span style="color: #fff">1</span> </el-form-item>
</el-col> </el-form>
<el-col :span="18"> </el-col>
<el-form-item label="父节点ID" prop="pId" label-width="130px" class="standards-info-item"> </el-row>
<el-input v-model="sarMenuEO.pId" :disabled="formdisableflag" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="前台页面地址" prop="href" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.href" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="排序号" prop="isShow" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.isShow" maxlength="2" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="后台接口权限" prop="permission" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.permission" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
</el-form>
</div>
<div class="permission-btn" v-if="submitBtnFlag">
<el-button type="primary" :loading="isSubmit" @click="saveMenuInfo">提交</el-button>
</div>
</div> </div>
<el-dialog
title="新增"
:visible.sync="modalshowflag"
:wrapperClosable="false"
:before-close="closeDialog"
size="800px">
<el-form
ref="sarStandardsInfoForm"
:model="NewForm"
label-width="100px"
class="label-input-form"
>
<el-form-item label="名称" class="search-item">
<el-input v-model="NewForm.menuName" clearable/>
</el-form-item>
</el-form>
<div slot="footer">
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="closeDialog">取消</el-button>
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="confirmDialog">提交</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@@ -96,212 +74,62 @@ export default {
name: 'permission-menu-manage', name: 'permission-menu-manage',
data () { data () {
return { return {
formdisableflag: true, modalshowflag: false,
zNodes: [], showSarMenuInfoFlag: false,
sarMenuEO: { treeData: [],
defaultProps: {
children: 'children',
label: 'menuName'
},
form: {
id: '', id: '',
name: '', menuName: '',
pId: '',
href: '',
isShow: '',
permission: '',
parentId: '' parentId: ''
}, },
sarMenuRules: { NewForm: {
name: [ menuName: '',
{ required: true, message: '不能为空', trigger: 'blur' } }
]
// isShow: [
// { type: 'string', required: true, message: '不能为空', trigger: 'blur' }
// ]
},
isSubmit: false,
showSarMenuInfoFlag: false,
submitBtnFlag: false,
saveClickNodeInfo: '',
clickType: '' // 1为新增,2为修改
} }
}, },
methods: { methods: {
getTree () { confirmDialog () {
return new Promise((resolve, reject) => { var form = {}
this.$http.get('sys/menu/listAllMenu', {}, { form.parentId = this.form.id
_this: this form.menuName = this.NewForm.menuName
}, res => { this.$http.postData('lawss/sarMenu/add', form, {}, res=> {
if (res.ok) { if (res.ok) {
let zNodes = [] this.getTree()
for (let i = 0; i < res.data.length; i++) { this.modalshowflag = false
let zObj = {} this.$message.success('成功')
zObj.id = res.data[i].id
zObj.pId = res.data[i].parentId
zObj.name = res.data[i].name
zObj.href = res.data[i].href
zObj.isShow = res.data[i].isShow
zObj.permission = res.data[i].permission
zObj.remarks = res.data[i].remarks
zNodes[i] = zObj
if (res.data[i].parentIds !== null) {}
}
this.zNodes = zNodes
}
resolve()
}, e => {
reject(e)
})
})
},
/**
* @description: 树节点点击
* @author: chenxiaoxi
* @date: 2018-09-25 16:13:25
*/
handleClick (treeId, treeNode) {
this.submitBtnFlag = false
this.showSarMenuInfoFlag = true
this.sarMenuEO = treeNode
if (treeNode.href == null || treeNode.href === '' || treeNode.href === 'null') {
this.sarMenuEO.href = ''
}
if (treeNode.permission == null || treeNode.permission === '' || treeNode.permission === 'null') {
this.sarMenuEO.permission = ''
}
},
/**
* @description: 树节点添加
* @author: chenxiaoxi
* @date: 2018/12/26 15:39:22
*/
handleAdd (treeId, treeNode) {
this.resetForm()
this.submitBtnFlag = true
this.clickType = '1'
this.showSarMenuInfoFlag = true
this.sarMenuEO.pId = treeNode.id
},
/**
* @description: 树节点删除
* @author: chenxiaoxi
* @date: 2018-09-25 14:05:25
*/
handleRemove (treeId, treeNode) {
if (treeNode.pId == null || treeNode.pId === '') {
this.$Message.error('不能删除根级节点')
} else {
this.$http.get('sys/menu/judgeContentChild', {
id: treeNode.id
}, {
_this: this
}, res => {
if (res.data != null && res.data.length > 0) {
this.$message.error('该节点包含子节点,不能删除')
} else {
this.sureDeleteMenu(treeNode)
}
}, e => {})
}
},
sureDeleteMenu (treeNode) {
this.$confirm('确认删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
if (treeNode.id != null && treeNode.id !== '') {
this.$http.put('sys/menu/deleteMenuById', {
id: treeNode.id
}, {
_this: this
}, res => {
if (res.data != null) {
this.getTree()
this.showSarMenuInfoFlag = false
this.resetForm()
}
}, e => {
})
} else { } else {
this.$message.warning('没有获取到所选节点id') this.$message.warning(res.message)
} }
}) })
}, },
/** Add () {
* @description: 节点编辑 this.NewForm.menuName = ''
* @author: chenxiaoxi this.modalshowflag = true
* @date: 2018/12/26 15:29:46 },
*/ closeDialog () {
handleEdit (treeId, treeNode) { this.modalshowflag = false
this.submitBtnFlag = true this.NewForm.menuName = ''
this.clickType = '2' },
rightHandleNodeClick (e, data) {},
handleNodeClick (data) {
this.form.id = data.id
this.form.menuName = data.menuName
this.form.parentId = data.parentId
this.showSarMenuInfoFlag = true this.showSarMenuInfoFlag = true
this.saveClickNodeInfo = treeNode
this.sarMenuEO = treeNode
if (treeNode.href == null || treeNode.href === '' || treeNode.href === 'null') {
this.sarMenuEO.href = ''
}
if (treeNode.permission == null || treeNode.permission === '' || treeNode.permission === 'null') {
this.sarMenuEO.permission = ''
}
}, },
treeRightClick (treeId, treeNode) { getTree () {
}, this.$http.get('lawss/sarMenu', {}, {}, res=> {
resetForm () { if (res.ok) {
this.sarMenuEO.id = '' this.treeData = res.data
this.sarMenuEO.pId = '' }
this.sarMenuEO.name = '' })
this.sarMenuEO.href = ''
this.sarMenuEO.isShow = ''
this.sarMenuEO.permission = ''
},
saveMenuInfo () {
if (this.sarMenuEO.isShow != null && this.sarMenuEO.isShow !== '') {
this.isSubmit = true
this.$refs['sarMenuForm'].validate((valid) => {
if (valid) {
this.sarMenuEO.parentId = this.sarMenuEO.pId
let menuEO = JSON.parse(JSON.stringify(this.sarMenuEO))
if (this.clickType === '1') {
this.$http.post('sys/menu/addMenu', menuEO, {
_this: this,
loading: 'isSubmit'
}, res => {
if (res.ok) {
this.isSubmit = false
this.submitBtnFlag = false
this.getTree()
}
}, e => {
this.isSubmit = false
})
} else {
this.$http.put('sys/menu/updateMenu', this.sarMenuEO, {
_this: this,
loading: 'isSubmit'
}, res => {
this.isSubmit = false
this.submitBtnFlag = false
this.getTree()
}, e => {
this.isSubmit = false
})
}
} else {
this.isSubmit = false
this.$message.error('请检查表单是否填写正确!')
}
})
} else {
this.$message.warning('排序号不能为空!')
}
}
},
props: {
sideClose: {
type: Boolean
} }
}, },
props: {},
computed: {}, computed: {},
watch: {}, watch: {},
mounted () { mounted () {
@@ -312,177 +140,29 @@ export default {
<style lang="less"> <style lang="less">
//@import '~styles/mixins'; //@import '~styles/mixins';
#permission-menu-manage{ #permission-menu-manage {
display: flex; display: flex;
//.flex();
background: #FFF; background: #FFF;
.permission-menu-manage-left{ height: 100%;
.permission-menu-manage-left {
width: 240px; width: 240px;
height: 100%; height: 100%;
border-right: 1px solid #DDD; border-right: 1px solid #DDD;
position: relative; position: relative;
overflow-x: auto; overflow-x: auto;
padding: 5px; padding: 5px;
.node_name{
display: inline-block;
max-width: 200px;
//.ellipsis();
}
} }
.permission-menu-manage-right{
.permission-menu-manage-right {
width: calc(~'100% - 240px'); width: calc(~'100% - 240px');
display: inline-block; display: inline-block;
height: 100%; height: 100%;
padding: 10px; padding: 10px;
position: relative; position: relative;
.content{
.content {
height: calc(~'100% - 150px'); height: calc(~'100% - 150px');
background: #CCC; background: #CCC;
.hasNoData{
background: #FFF;
width: 100%;
height: 100%;
.no-data-icon{
width: 150px;
}
}
}
.ivu-table-overflowX{
overflow-x: auto;
}
.pagination{
.ivu-divider{
margin-bottom: 0;
}
}
.syncInfo{
padding-bottom: 0.2rem;
//.flex();
flex: 1;
align-items: center;
}
.permission-content{
padding-top: 30px;
.permission-input{
width: 300px;
}
}
.permission-btn{
text-align: center;
}
}
.ivu-tree-children{
.ivu-tree-arrow{
margin-right: 5px;
}
}
.content .btn-group{
margin-bottom: 0.5rem;
}
.permission-menu-manage-right-search{
.ivu-form-item-label{
padding: 0;
}
.ivu-form-item-content{
width: calc(~'100% - 60px');
.ivu-select{
width: 100%;
}
}
.ivu-form-item{
margin: 0;
}
.ivu-btn{
position: relative;
top: 1px;
}
}
.ivu-divider-horizontal{
margin: 8px 0;
}
.ivu-table-body{
overflow-x: auto;
}
.ivu-table-tip{
width: 100%;
height: calc(~'100% - 41px');
table{
display: block;
tbody,tr,td{
display: block;
width: 100% !important;
height: 100%;
}
td{
//.flex();
justify-content: center;
align-items: center;
}
}
}
.hasNoData{
background: #FFF;
.no-data-icon{
width: 85px;
}
}
.ivu-table-fixed,
.ivu-table-fixed-right{
height: 100%;
.ivu-table-fixed-body{
height: calc(~'100% - 41px');
}
}
.ivu-select-item{
max-width: 200px;
//.ellipsis();
}
.demo-drawer-footer{
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
.btn-show{
display: inline-block !important;
}
.btn-hide{
display: none !important;
}
.ivu-tag{
cursor: default;
}
}
.role-setting-form{
.ivu-modal-body{
overflow-y: inherit;
}
}
.demo-drawer-profile{
font-size: 14px;
}
.demo-drawer-profile .ivu-col{
margin-bottom: 12px;
}
.user-info-text{
color: #A59D9D;
}
.mechanism-tree-modal{
.ivu-modal{
width: 350px !important;
.form-content{
width: 300px;
margin: 0 auto;
.ivu-form-item{
//.flex();
.ivu-form-item-content{
flex: 1;
}
}
} }
} }
} }
+138 -32
View File
@@ -34,7 +34,7 @@
width="170px"> width="170px">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="" prop="NameList"
label="绑定角色"> label="绑定角色">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@@ -47,11 +47,26 @@
label="操作时间" label="操作时间"
width="170px"> width="170px">
</el-table-column> </el-table-column>
<el-table-column
label="操作"
width="50px">
<template slot-scope="scope">
<div @click.stop style="display: inline-block">
<el-dropdown trigger="click" @command="handleCommand">
<i class="iconfont">&#xe61e;</i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="[scope.row, '删除']">删除</el-dropdown-item>
<el-dropdown-item :command="[scope.row, '编辑']">编辑</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
<loading :loading="Loading">加载中...</loading> <loading :loading="Loading">加载中...</loading>
<el-dialog <el-dialog
title="新增岗位" :title="dialogTitle"
:visible.sync="modalshowflag" :visible.sync="modalshowflag"
:wrapperClosable="false" :wrapperClosable="false"
size="800px" size="800px"
@@ -88,10 +103,22 @@
v-if="modalRole" v-if="modalRole"
:props="props" :props="props"
:data="roleList" :data="roleList"
show-checkbox :default-checked-keys="nodeList"
@check="handleCheckChange"> check-strictly
default-expand-all
show-checkbox>
</el-tree> </el-tree>
<el-button @click="add"></el-button> <div id="roleFormButton" class="demo-drawer-footer">
<el-button
size="mini"
class="common-button-primary"
icon="el-icon-check"
type="primary"
@click="RoleSubmit"
:loading="submitLoading"
>确定</el-button>
<el-button size="mini" class="common-button-default" icon="el-icon-close" @click="resetFormRole">取消</el-button>
</div>
</el-drawer> </el-drawer>
</div> </div>
</template> </template>
@@ -101,6 +128,11 @@
name: 'PostManage', name: 'PostManage',
data () { data () {
return { return {
editId: '',
type: '', // 1为新增 2为编辑
dialogTitle: '',
nodeList: [],
submitLoading: false,
selectList: [], selectList: [],
data: [], data: [],
Loading: false, Loading: false,
@@ -122,15 +154,52 @@
} }
}, },
methods: { methods: {
add () { handleCommand (command) {
console.log(this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys())); switch (command[1]) {
}, case '删除':
handleCheckChange (checkedNodes, checkedKeys) { this.deleteData(command[0])
var list = [] break
for (var a = 0; a < checkedKeys.checkedNodes.length; a++) { case '编辑':
list.push(checkedKeys.checkedNodes[a].id) this.editData(command[0])
break
} }
}, },
deleteData (row) {
this.$http.delete('sarPosition/position', {
positionId: row.id
}, {}, res => {
if (res.ok) {
this.$message.success('删除成功')
this.getData()
}
})
},
editData (row) {
this.type = 2
this.editId = row.id
this.sarStandardsInfoEO.name = row.name
this.dialogTitle = '修改岗位信息'
this.modalshowflag = true
},
RoleSubmit () { // 配置角色提交
this.submitLoading = true
this.$http.postData('sarPosition/position/role', {
positionId: this.selectList[0].id,
roleIds: this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys())
}, {}, res=> {
if (res.ok) {
this.$message.success('配置成功')
this.modalRole = false
this.getData()
} else {
this.$message.warning(res.message)
}
this.submitLoading = false
})
},
resetFormRole () { // 配置角色关闭事件
this.modalRole = false
},
getRole () { getRole () {
this.$http.get('sarRole/role', {}, {}, res=> { this.$http.get('sarRole/role', {}, {}, res=> {
this.roleList = res.data this.roleList = res.data
@@ -140,10 +209,13 @@
this.selectList = val this.selectList = val
}, },
addRole () { // 点击配置角色按钮 addRole () { // 点击配置角色按钮
if (this.selectList.length > 0) { if (this.selectList.length === 1) {
this.modalRole = true this.modalRole = true
} else { this.nodeList = this.selectList[0].idList
} else if (this.selectList.length === 0) {
this.$message.warning('请选择要配置角色的岗位') this.$message.warning('请选择要配置角色的岗位')
} else {
this.$message.warning('请选择一条岗位')
} }
}, },
getData () { // 获取岗位数据 getData () { // 获取岗位数据
@@ -151,37 +223,68 @@
_this: this, _this: this,
loading: 'Loading' loading: 'Loading'
}, res=> { }, res=> {
res.data.forEach((item)=>{
var idList = []
var NameList = ''
item.roles.forEach((items)=>{
if (NameList.length > 0) {
NameList += ','
}
idList.push(items.id)
NameList += items.name
})
item.idList = idList
item.NameList = NameList
})
this.data = res.data this.data = res.data
}) })
}, },
addModal () { // 点击新增按钮 addModal () { // 点击新增按钮
this.type = 1
this.dialogTitle = '新增岗位'
this.modalshowflag = true this.modalshowflag = true
}, },
resetForm () { // 新增岗位关闭事件 resetForm () { // 新增岗位关闭事件
this.$refs['sarStandardsInfoForm'].resetFields(); this.$refs['sarStandardsInfoForm'].resetFields();
this.modalshowflag = false this.modalshowflag = false
}, },
resetFormRole () { // 配置角色关闭事件
},
submit () { // 新增角色确认 submit () { // 新增角色确认
this.$refs['sarStandardsInfoForm'].validate((valid) => { this.$refs['sarStandardsInfoForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http.post('sarPosition/position', { if (this.type === 1) {
createById: this.$store.getters.userInfo.userId, this.$http.post('sarPosition/position', {
operator: this.$store.getters.userInfo.account, createById: this.$store.getters.userInfo.userId,
name: this.sarStandardsInfoEO.name operator: this.$store.getters.userInfo.account,
}, { name: this.sarStandardsInfoEO.name
_this: this, }, {
loading: 'Loading' _this: this,
}, res=> { loading: 'Loading'
if (res.ok) { }, res=> {
this.$message.success('新增成功') if (res.ok) {
this.modalshowflag = false this.$message.success('新增成功')
this.getData() this.modalshowflag = false
} else { this.getData()
this.$message.warning('新增失败') } else {
} this.$message.warning(res.message)
}) }
})
} else {
this.$http.put('sarPosition/position', {
id: this.editId,
name: this.sarStandardsInfoEO.name
}, {
_this: this,
loading: 'Loading'
}, res=> {
if (res.ok) {
this.$message.success('修改成功')
this.modalshowflag = false
this.getData()
} else {
this.$message.warning(res.message)
}
})
}
} else { } else {
return false; return false;
} }
@@ -204,5 +307,8 @@
.content { .content {
height: calc(~'100% - 53px') height: calc(~'100% - 53px')
} }
.filter-tree {
height: calc(~'100% - 50px')
}
} }
</style> </style>
File diff suppressed because it is too large Load Diff