|
@@ -65,6 +65,29 @@
|
|
|
<!-- >解绑-->
|
|
|
<!-- </el-button>-->
|
|
|
</div>
|
|
|
+ <el-dialog append-to-body :close-on-click-modal="false" :show-close="false" :visible.sync="updateRole" title="修改角色" width="570px">
|
|
|
+ <el-form ref="updateRoleForm" :inline="true" :rules="rules" size="small" label-width="66px">
|
|
|
+ <el-form-item style="margin-bottom: 0;" label="角色">
|
|
|
+ <el-select
|
|
|
+ v-model="updateRoles"
|
|
|
+ style="width: 437px"
|
|
|
+ multiple
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in roles"
|
|
|
+ :key="item.name"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="text" @click="cancelUpdateRole">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitUpdateRole">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
<!--表单渲染-->
|
|
|
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="570px">
|
|
|
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="66px">
|
|
@@ -238,13 +261,15 @@
|
|
|
align="center"
|
|
|
fixed="right"
|
|
|
>
|
|
|
- <template slot-scope="scope" v-if="scope.row.dmUser.type === '01'">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button v-if="scope.row.dmUser.type === '00'" size="mini" type="primary" @click="toEditUserRole(scope.row)">修改角色</el-button>
|
|
|
<udOperation
|
|
|
:data="scope.row"
|
|
|
:permission="permission"
|
|
|
:disabled-dle="scope.row.id === user.id"
|
|
|
+ v-if="scope.row.dmUser.type === '01'"
|
|
|
/>
|
|
|
- <el-button type="success" size="mini" @click="dimissionUser(scope.row)">离职</el-button>
|
|
|
+ <el-button v-if="scope.row.dmUser.type === '01'" type="success" size="mini" @click="dimissionUser(scope.row)">离职</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -381,7 +406,10 @@ export default {
|
|
|
errLimit: [
|
|
|
{ required: true, trigger: 'blur', validator: validErrLimit }
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ updateRole: false,
|
|
|
+ updateRoles: [],
|
|
|
+ updateRoleUserId: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -649,6 +677,36 @@ export default {
|
|
|
}).catch((e) => {
|
|
|
this.$message.error('离职失败')
|
|
|
})
|
|
|
+ },
|
|
|
+ cancelUpdateRole() {
|
|
|
+ this.updateRoles = []
|
|
|
+ this.updateRole = false
|
|
|
+ },
|
|
|
+ submitUpdateRole() {
|
|
|
+ if (this.updateRoles.length === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '角色不能为空',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ crudUser.editRole(this.updateRoleUserId, this.updateRoles).then((res) => {
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ this.updateRole = false
|
|
|
+ this.updateRoles = []
|
|
|
+ this.crud.refresh()
|
|
|
+ }).catch((e) => {
|
|
|
+ this.$message.error('修改失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toEditUserRole(data) {
|
|
|
+ const _this = this
|
|
|
+ data.roles.forEach(function(role, index) {
|
|
|
+ _this.updateRoles.push(role.id)
|
|
|
+ })
|
|
|
+ this.updateRoleUserId = data.id
|
|
|
+ this.getRoles()
|
|
|
+ this.updateRole = true
|
|
|
}
|
|
|
}
|
|
|
}
|