|
|
|
@ -107,14 +107,15 @@
|
|
|
|
|
</table-list>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
<el-tab-pane label="角色" name="role">
|
|
|
|
|
<template v-if="state.condition2.departmentId">
|
|
|
|
|
<div class="role-list">
|
|
|
|
|
<div v-for="(item, index) in roleList" :key="index" class="system">
|
|
|
|
|
<div v-for="(item, index) in opts.system" :key="index" class="system">
|
|
|
|
|
<h3 class="system-header">
|
|
|
|
|
{{ item.systemVO.systemName }}
|
|
|
|
|
{{ item.systemName }}
|
|
|
|
|
</h3>
|
|
|
|
|
<div class="flex">
|
|
|
|
|
<el-tag
|
|
|
|
|
v-for="(role, j) in item.roleListVO"
|
|
|
|
|
v-for="(role, j) in store.getters['deptRole/roleList'](item.id)"
|
|
|
|
|
:key="index + '' + j"
|
|
|
|
|
closable
|
|
|
|
|
size="large"
|
|
|
|
@ -122,25 +123,35 @@
|
|
|
|
|
>
|
|
|
|
|
{{ role.roleName }}
|
|
|
|
|
</el-tag>
|
|
|
|
|
<el-popover v-model:visible="roleVisible" placement="top" :width="160">
|
|
|
|
|
<!-- <el-select
|
|
|
|
|
:config="{ label: 'roleName', value: 'id' }"
|
|
|
|
|
:opts="opts.role"
|
|
|
|
|
style="margin-bottom: 10px"
|
|
|
|
|
/> -->
|
|
|
|
|
<p>还没做</p>
|
|
|
|
|
<div style="text-align: right; margin: 0">
|
|
|
|
|
<el-button size="small" text @click="roleVisible = false">取消</el-button>
|
|
|
|
|
<el-button size="small" type="primary" @click="handleAddRole">确定</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<template #reference>
|
|
|
|
|
<el-button>添加角色</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-popover>
|
|
|
|
|
<el-button @click="handleAddRole(item.id)">添加角色</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="!roleList.length" class="empty">暂无数据</div>
|
|
|
|
|
</template>
|
|
|
|
|
<div v-else class="empty">请选择组织架构</div>
|
|
|
|
|
<el-dialog v-model="roleVisible" title="添加角色">
|
|
|
|
|
<el-form v-loading="loading3">
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-select
|
|
|
|
|
v-model="checkedRole"
|
|
|
|
|
:config="{
|
|
|
|
|
label: 'roleName',
|
|
|
|
|
value: 'id',
|
|
|
|
|
disabled: (item) =>
|
|
|
|
|
store.getters['deptRole/roleList'](currentSystemId).findIndex(
|
|
|
|
|
(role) => role.id === item.id
|
|
|
|
|
) !== -1,
|
|
|
|
|
}"
|
|
|
|
|
multiple
|
|
|
|
|
:opts="systemRoleList"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="roleVisible = false">取消</el-button>
|
|
|
|
|
<el-button :loading="loading3" type="primary" @click="handleSaveRole">确定</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
</el-tabs>
|
|
|
|
|
</div>
|
|
|
|
@ -282,7 +293,9 @@
|
|
|
|
|
/* 角色 */
|
|
|
|
|
const loading3 = ref(false);
|
|
|
|
|
const roleVisible = ref(false);
|
|
|
|
|
const roleList = computed(() => _.cloneDeep(store.state.deptRole.list));
|
|
|
|
|
const systemRoleList = ref([]);
|
|
|
|
|
const currentSystemId = ref(null);
|
|
|
|
|
const checkedRole = ref([]);
|
|
|
|
|
const handleSearchRole = async () => {
|
|
|
|
|
if (state.condition3.departmentId) {
|
|
|
|
|
loading3.value = true;
|
|
|
|
@ -304,9 +317,34 @@
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
);
|
|
|
|
|
const handleDelRole = async (id) => {
|
|
|
|
|
store.dispatch('deptRole/remove', { id });
|
|
|
|
|
store.dispatch('deptRole/remove', {
|
|
|
|
|
departmentId: state.condition3.departmentId,
|
|
|
|
|
isDeleteDepartmentOfEmployeeRole: true,
|
|
|
|
|
roleId: id,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const handleAddRole = async (id) => {
|
|
|
|
|
loading3.value = true;
|
|
|
|
|
roleVisible.value = true;
|
|
|
|
|
currentSystemId.value = id;
|
|
|
|
|
systemRoleList.value = await store.dispatch('deptRole/role', id);
|
|
|
|
|
loading3.value = false;
|
|
|
|
|
};
|
|
|
|
|
const handleSaveRole = async () => {
|
|
|
|
|
loading3.value = true;
|
|
|
|
|
let res =
|
|
|
|
|
!unref(checkedRole).length ||
|
|
|
|
|
(await store.dispatch('deptRole/save', {
|
|
|
|
|
departmentId: state.condition3.departmentId,
|
|
|
|
|
isDistributionCurrentDepartmentEmployee: true,
|
|
|
|
|
roleIds: unref(checkedRole),
|
|
|
|
|
}));
|
|
|
|
|
if (res) {
|
|
|
|
|
roleVisible.value = false;
|
|
|
|
|
handleSearchRole();
|
|
|
|
|
}
|
|
|
|
|
loading3.value = false;
|
|
|
|
|
};
|
|
|
|
|
const handleAddRole = async () => {};
|
|
|
|
|
|
|
|
|
|
/* 表单 */
|
|
|
|
|
const refsForm = ref(null);
|
|
|
|
|