流程设计-审批人-添加角色:增加根据租户选择角色的功能
This commit is contained in:
@ -19,6 +19,8 @@
|
|||||||
keyword.value = '';
|
keyword.value = '';
|
||||||
emits('search', keyword.value);
|
emits('search', keyword.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineExpose({ search });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -11,7 +11,11 @@
|
|||||||
>
|
>
|
||||||
<!-- 已选 -->
|
<!-- 已选 -->
|
||||||
<Selected type="role" :list="data.selectedList" @abolish="abolishChecked" />
|
<Selected type="role" :list="data.selectedList" @abolish="abolishChecked" />
|
||||||
<SearchBox @search="search" />
|
|
||||||
|
<!-- 搜索栏 -->
|
||||||
|
<SearchBox @search="search" ref="searchBox" style="display: inline-block"/>
|
||||||
|
<SelectTenant @change="handleTenantChange" v-if="getAppEnvConfig().VITE_GLOB_TENANT_ENABLED" style="display:inline-block"/>
|
||||||
|
|
||||||
<div class="list-page-box" v-if="data.list.length > 0">
|
<div class="list-page-box" v-if="data.list.length > 0">
|
||||||
<RoleCard
|
<RoleCard
|
||||||
:class="data.selectedIds && data.selectedIds.includes(item.id) ? 'picked' : 'not-picked'"
|
:class="data.selectedIds && data.selectedIds.includes(item.id) ? 'picked' : 'not-picked'"
|
||||||
@ -34,9 +38,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { reactive } from 'vue';
|
import { ref,reactive } from 'vue';
|
||||||
import RoleCard from './card/RoleCard.vue';
|
import RoleCard from './card/RoleCard.vue';
|
||||||
import Selected from './Selected.vue';
|
import Selected from './Selected.vue';
|
||||||
|
import SelectTenant from './SelectTenant.vue';
|
||||||
|
import { getAppEnvConfig } from '/@/utils/env';
|
||||||
import { ModalPanel, EmptyBox, SearchBox } from '/@/components/ModalPanel/index';
|
import { ModalPanel, EmptyBox, SearchBox } from '/@/components/ModalPanel/index';
|
||||||
|
|
||||||
import { getRoleList, getRoleMulti } from '/@/api/system/role';
|
import { getRoleList, getRoleMulti } from '/@/api/system/role';
|
||||||
@ -78,6 +84,14 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const searchBox = ref();
|
||||||
|
const tenantId=ref();
|
||||||
|
|
||||||
|
function handleTenantChange(value:Number){
|
||||||
|
tenantId.value=value;
|
||||||
|
searchBox.value.search();
|
||||||
|
}
|
||||||
|
|
||||||
async function show() {
|
async function show() {
|
||||||
if (props.selectedIds && Array.isArray(props.selectedIds)) data.selectedIds = props.selectedIds;
|
if (props.selectedIds && Array.isArray(props.selectedIds)) data.selectedIds = props.selectedIds;
|
||||||
await getList();
|
await getList();
|
||||||
@ -123,6 +137,7 @@
|
|||||||
data.list = [];
|
data.list = [];
|
||||||
let params = {
|
let params = {
|
||||||
keyword: data.searchConfig.keyword,
|
keyword: data.searchConfig.keyword,
|
||||||
|
tenantId:tenantId.value
|
||||||
};
|
};
|
||||||
let list = await getRoleList(params);
|
let list = await getRoleList(params);
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
@ -132,6 +147,7 @@
|
|||||||
id: ele.id,
|
id: ele.id,
|
||||||
code: ele.code,
|
code: ele.code,
|
||||||
count: ele.count, //角色人数
|
count: ele.count, //角色人数
|
||||||
|
tenantName:ele.tenantName
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -149,6 +165,7 @@
|
|||||||
id: ele.id,
|
id: ele.id,
|
||||||
code: ele.code,
|
code: ele.code,
|
||||||
count: ele.count, //角色人数
|
count: ele.count, //角色人数
|
||||||
|
tenantName:ele.tenantName
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/components/SelectOrganizational/src/SelectTenant.vue
Normal file
47
src/components/SelectOrganizational/src/SelectTenant.vue
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<label>租户:</label>
|
||||||
|
<a-select
|
||||||
|
v-model:value="selectedId"
|
||||||
|
style="width:300px;heiht:32px;padding: 10px 0px;margin-left: 10px"
|
||||||
|
:options="tenantOptions"
|
||||||
|
@change="changeTenant"/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref,reactive,unref,onMounted} from 'vue';
|
||||||
|
import { getTenantAllList} from '/@/api/system/tenant';
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const { userInfo } = storeToRefs(userStore);
|
||||||
|
|
||||||
|
const emits = defineEmits(['change']);
|
||||||
|
|
||||||
|
let selectedId=userInfo.value.tenantId;
|
||||||
|
|
||||||
|
const tenantOptions = reactive([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
/* let list=await getTenantAllList();
|
||||||
|
userInfo.te
|
||||||
|
if(list.length>0){
|
||||||
|
list.forEach((item)=>{
|
||||||
|
tenantOptions.push({
|
||||||
|
value:item.id,
|
||||||
|
label:item.name
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}*/
|
||||||
|
userInfo.value.tenants.forEach((o) => {
|
||||||
|
tenantOptions.push({
|
||||||
|
value:o.id,
|
||||||
|
label:o.name
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
function changeTenant(value:Number) {
|
||||||
|
emits('change', value);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@ -22,6 +22,7 @@
|
|||||||
class="picked"
|
class="picked"
|
||||||
:key="index"
|
:key="index"
|
||||||
:item="item"
|
:item="item"
|
||||||
|
:showTenant="true"
|
||||||
@click="abolish(item.id)"
|
@click="abolish(item.id)"
|
||||||
:disabled="props.disabledIds && props.disabledIds.includes(item.id) ? true : false"
|
:disabled="props.disabledIds && props.disabledIds.includes(item.id) ? true : false"
|
||||||
>
|
>
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a-table :dataSource="props.memberList" :columns="configColumns" :pagination="false">
|
<a-table :dataSource="props.memberList" :columns="getConfigColumns()" :pagination="false">
|
||||||
<template #bodyCell="{ column, record, index }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.key === 'memberType'">
|
<template v-if="column.key === 'memberType'">
|
||||||
{{ getMemberType(record.memberType) }}
|
{{ getMemberType(record.memberType) }}
|
||||||
@ -36,6 +36,7 @@
|
|||||||
import Posts from '/@bpmn/components/member/Posts.vue';
|
import Posts from '/@bpmn/components/member/Posts.vue';
|
||||||
import Roles from '/@bpmn/components/member/Roles.vue';
|
import Roles from '/@bpmn/components/member/Roles.vue';
|
||||||
// import Users from '/@bpmn/components/member/Users.vue';
|
// import Users from '/@bpmn/components/member/Users.vue';
|
||||||
|
import { getAppEnvConfig } from '/@/utils/env';
|
||||||
|
|
||||||
import SelectUserV2 from './SelectUserV2.vue';
|
import SelectUserV2 from './SelectUserV2.vue';
|
||||||
import NodeApprover from '/@bpmn/components/member/NodeApprover.vue';
|
import NodeApprover from '/@bpmn/components/member/NodeApprover.vue';
|
||||||
@ -86,6 +87,21 @@
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function getConfigColumns(){
|
||||||
|
const arr=configColumns;
|
||||||
|
if(getAppEnvConfig().VITE_GLOB_TENANT_ENABLED){
|
||||||
|
arr.splice(2, 0,
|
||||||
|
{
|
||||||
|
title: t('租户'),
|
||||||
|
dataIndex: 'tenantName',
|
||||||
|
key: 'tenantName',
|
||||||
|
align: 'center',
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
const allComponentList = computed(() => {
|
const allComponentList = computed(() => {
|
||||||
return [
|
return [
|
||||||
{ name: t('添加岗位'), component: Posts, show: true },
|
{ name: t('添加岗位'), component: Posts, show: true },
|
||||||
|
|||||||
@ -59,6 +59,7 @@
|
|||||||
name: ele.name,
|
name: ele.name,
|
||||||
id: ele.id,
|
id: ele.id,
|
||||||
memberType: MemberType.ROLE,
|
memberType: MemberType.ROLE,
|
||||||
|
tenantName: ele.tenantName
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user