From 2c657ac274800dc17e29a1844fbe2123dacf5f2c Mon Sep 17 00:00:00 2001 From: zhutianqi Date: Tue, 29 Jun 2021 17:14:26 +0800 Subject: [PATCH] commit --- .../config/pages/mechanismManage/index.vue | 90 +++++++++++++++- src/pages/config/pages/postManage/index.vue | 101 ++++++++++++++---- 2 files changed, 171 insertions(+), 20 deletions(-) diff --git a/src/pages/config/pages/mechanismManage/index.vue b/src/pages/config/pages/mechanismManage/index.vue index b5e1f5053..4c35ec569 100644 --- a/src/pages/config/pages/mechanismManage/index.vue +++ b/src/pages/config/pages/mechanismManage/index.vue @@ -9,7 +9,6 @@ v-model="filterText"> 启用 禁用 + 配置岗位 @@ -94,6 +94,36 @@ 导入中... + + + + + @@ -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() } } @@ -263,6 +346,9 @@ export default { /deep/.width-all{ width: 100%; } +.filter-tree { + height: calc(~'100% - 50px') +} .laws-tree{ /deep/.clearable { top: 20px; diff --git a/src/pages/config/pages/postManage/index.vue b/src/pages/config/pages/postManage/index.vue index fa0f14c26..ec98b27eb 100644 --- a/src/pages/config/pages/postManage/index.vue +++ b/src/pages/config/pages/postManage/index.vue @@ -47,11 +47,26 @@ label="操作时间" width="170px"> + + + 加载中... { + 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; }