commit
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
v-model="filterText">
|
||||
</el-input>
|
||||
<el-tree
|
||||
class="filter-tree"
|
||||
:data="treeData"
|
||||
:props="defaultProps"
|
||||
default-expand-all
|
||||
@@ -65,7 +64,7 @@
|
||||
label="所属部门">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="positionName"
|
||||
prop="NameList"
|
||||
label="所属岗位">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -83,6 +82,7 @@
|
||||
<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 === '0'" :command="[scope.row, '禁用']">禁用</el-dropdown-item>
|
||||
<el-dropdown-item :command="[scope.row, '配置岗位']">配置岗位</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
@@ -94,6 +94,36 @@
|
||||
<pagination :page="page" :total="total" @pageChange="pageChange" @pageSizeChange="pageSizeChange"></pagination>
|
||||
</div>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
@@ -102,6 +132,14 @@ export default {
|
||||
name: 'MechanismManage',
|
||||
data () {
|
||||
return {
|
||||
userId: '',
|
||||
postList: [],
|
||||
props: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
nodeList: [],
|
||||
modalPost: false,
|
||||
filterText: '', // 树结构检索条件
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
@@ -119,6 +157,21 @@ export default {
|
||||
}
|
||||
},
|
||||
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) {
|
||||
switch (command[1]) {
|
||||
case '启用':
|
||||
@@ -127,8 +180,27 @@ export default {
|
||||
case '禁用':
|
||||
this.disableFlagEdit(command[0], 1)
|
||||
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) {
|
||||
let json = {}
|
||||
json.userId = row.userId
|
||||
@@ -173,6 +245,16 @@ export default {
|
||||
_this: this,
|
||||
loading: 'Loading'
|
||||
}, 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
|
||||
})
|
||||
},
|
||||
@@ -194,6 +276,7 @@ export default {
|
||||
mounted () {
|
||||
// 获取组织结构树
|
||||
this.getTree()
|
||||
this.getTree2()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -263,6 +346,9 @@ export default {
|
||||
/deep/.width-all{
|
||||
width: 100%;
|
||||
}
|
||||
.filter-tree {
|
||||
height: calc(~'100% - 50px')
|
||||
}
|
||||
.laws-tree{
|
||||
/deep/.clearable {
|
||||
top: 20px;
|
||||
|
||||
@@ -47,11 +47,26 @@
|
||||
label="操作时间"
|
||||
width="170px">
|
||||
</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"></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>
|
||||
</div>
|
||||
<loading :loading="Loading">加载中...</loading>
|
||||
<el-dialog
|
||||
title="新增岗位"
|
||||
:title="dialogTitle"
|
||||
:visible.sync="modalshowflag"
|
||||
:wrapperClosable="false"
|
||||
size="800px"
|
||||
@@ -113,6 +128,9 @@
|
||||
name: 'PostManage',
|
||||
data () {
|
||||
return {
|
||||
editId: '',
|
||||
type: '', // 1为新增 2为编辑
|
||||
dialogTitle: '',
|
||||
nodeList: [],
|
||||
submitLoading: false,
|
||||
selectList: [],
|
||||
@@ -136,6 +154,33 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCommand (command) {
|
||||
switch (command[1]) {
|
||||
case '删除':
|
||||
this.deleteData(command[0])
|
||||
break
|
||||
case '编辑':
|
||||
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', {
|
||||
@@ -164,9 +209,9 @@
|
||||
this.selectList = val
|
||||
},
|
||||
addRole () { // 点击配置角色按钮
|
||||
this.nodeList = this.selectList[0].idList
|
||||
if (this.selectList.length === 1) {
|
||||
this.modalRole = true
|
||||
this.nodeList = this.selectList[0].idList
|
||||
} else if (this.selectList.length === 0) {
|
||||
this.$message.warning('请选择要配置角色的岗位')
|
||||
} else {
|
||||
@@ -195,6 +240,8 @@
|
||||
})
|
||||
},
|
||||
addModal () { // 点击新增按钮
|
||||
this.type = 1
|
||||
this.dialogTitle = '新增岗位'
|
||||
this.modalshowflag = true
|
||||
},
|
||||
resetForm () { // 新增岗位关闭事件
|
||||
@@ -204,22 +251,40 @@
|
||||
submit () { // 新增角色确认
|
||||
this.$refs['sarStandardsInfoForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.$http.post('sarPosition/position', {
|
||||
createById: this.$store.getters.userInfo.userId,
|
||||
operator: this.$store.getters.userInfo.account,
|
||||
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)
|
||||
}
|
||||
})
|
||||
if (this.type === 1) {
|
||||
this.$http.post('sarPosition/position', {
|
||||
createById: this.$store.getters.userInfo.userId,
|
||||
operator: this.$store.getters.userInfo.account,
|
||||
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 {
|
||||
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 {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user