流程设计-审批人-添加角色:增加根据租户选择角色的功能
This commit is contained in:
@ -19,6 +19,8 @@
|
||||
keyword.value = '';
|
||||
emits('search', keyword.value);
|
||||
}
|
||||
|
||||
defineExpose({ search });
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -11,7 +11,11 @@
|
||||
>
|
||||
<!-- 已选 -->
|
||||
<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">
|
||||
<RoleCard
|
||||
:class="data.selectedIds && data.selectedIds.includes(item.id) ? 'picked' : 'not-picked'"
|
||||
@ -34,9 +38,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { ref,reactive } from 'vue';
|
||||
import RoleCard from './card/RoleCard.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 { 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() {
|
||||
if (props.selectedIds && Array.isArray(props.selectedIds)) data.selectedIds = props.selectedIds;
|
||||
await getList();
|
||||
@ -123,6 +137,7 @@
|
||||
data.list = [];
|
||||
let params = {
|
||||
keyword: data.searchConfig.keyword,
|
||||
tenantId:tenantId.value
|
||||
};
|
||||
let list = await getRoleList(params);
|
||||
if (list.length > 0) {
|
||||
@ -132,6 +147,7 @@
|
||||
id: ele.id,
|
||||
code: ele.code,
|
||||
count: ele.count, //角色人数
|
||||
tenantName:ele.tenantName
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -149,6 +165,7 @@
|
||||
id: ele.id,
|
||||
code: ele.code,
|
||||
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"
|
||||
:key="index"
|
||||
:item="item"
|
||||
:showTenant="true"
|
||||
@click="abolish(item.id)"
|
||||
:disabled="props.disabledIds && props.disabledIds.includes(item.id) ? true : false"
|
||||
>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</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 v-if="column.key === 'memberType'">
|
||||
{{ getMemberType(record.memberType) }}
|
||||
@ -36,6 +36,7 @@
|
||||
import Posts from '/@bpmn/components/member/Posts.vue';
|
||||
import Roles from '/@bpmn/components/member/Roles.vue';
|
||||
// import Users from '/@bpmn/components/member/Users.vue';
|
||||
import { getAppEnvConfig } from '/@/utils/env';
|
||||
|
||||
import SelectUserV2 from './SelectUserV2.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(() => {
|
||||
return [
|
||||
{ name: t('添加岗位'), component: Posts, show: true },
|
||||
|
||||
@ -59,6 +59,7 @@
|
||||
name: ele.name,
|
||||
id: ele.id,
|
||||
memberType: MemberType.ROLE,
|
||||
tenantName: ele.tenantName
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user