mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-05 18:15:28 +08:00
【v3.8.3】我的租户大改造
This commit is contained in:
@ -4,10 +4,20 @@
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate"> 新增</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleCreate">新增</a-button>
|
||||
<a-button
|
||||
preIcon="ant-design:user-add-outlined"
|
||||
type="primary"
|
||||
@click="handleInvitation"
|
||||
style="margin-right: 5px">
|
||||
邀请用户加入
|
||||
</a-button>
|
||||
<JThirdAppButton biz-type="user" :selected-row-keys="selectedRowKeys" syncToApp syncToLocal @sync-finally="onSyncFinally" />
|
||||
<a-button type="primary" @click="openQuitModal(true, {})" preIcon="ant-design:user-delete-outlined">离职信息</a-button>
|
||||
<a-button type="primary" @click="openQuitModal(true, {})" preIcon="ant-design:user-delete-outlined">离职人员</a-button>
|
||||
<div style="margin-left: 10px;margin-top: 5px"> 当前登录租户: <span class="tenant-name">{{loginTenantName}}</span> </div>
|
||||
<a-tooltip title="租户用户更多操作说明">
|
||||
<a-icon type="question-circle" style="margin-left: 8px; cursor: pointer " @click="tipShow = true"/>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
@ -16,12 +26,23 @@
|
||||
</BasicTable>
|
||||
<!--用户抽屉-->
|
||||
<TenantUserDrawer @register="registerDrawer" @success="handleSuccess" />
|
||||
<!-- 离职受理人弹窗 -->
|
||||
<UserQuitAgentModal @register="registerQuitAgentModal" @success="handleQuitSuccess" />
|
||||
<!-- 离职人员列弹窗 -->
|
||||
<UserQuitModal @register="registerQuitModal" @success="reload" />
|
||||
<!-- 变更拥有者弹窗 -->
|
||||
<UserSelectModal @register="registerUserModal" :excludeUserIdList="excludeUserIdList" :maxSelectCount="1" @getSelectResult="selectResult" />
|
||||
<!-- 套餐分配弹窗 -->
|
||||
<TenantPackAllotModal @register="registerPackAllotModal"></TenantPackAllotModal>
|
||||
<!-- 邀请人弹窗 -->
|
||||
<TenantInviteUserModal @register="registerSelUserModal" @inviteOk="handleInviteUserOk" />
|
||||
<a-modal v-model:open="tipShow" :footer="null" title="租户用户更多操作说明" :width="800">
|
||||
<ul class="user-tenant-tip">
|
||||
<li>移除:将用户从当前租户中移除</li>
|
||||
<li>删除:仅可删除当天创建的用户,删除后可在系统用户回收站恢复</li>
|
||||
<li>离职:非租户创建者可进行离职操作,离职员工可在离职人员列表查看</li>
|
||||
<li>交接:租户创建者可进行租户交接,交接后员工信息可在离职人员列表查看</li>
|
||||
</ul>
|
||||
<div style="height: 10px"></div>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -31,14 +52,13 @@
|
||||
import { BasicTable, TableAction, ActionItem } from '/@/components/Table';
|
||||
import UserDrawer from '../user/UserDrawer.vue';
|
||||
import JThirdAppButton from '/@/components/jeecg/thirdApp/JThirdAppButton.vue';
|
||||
import UserQuitAgentModal from '../user/UserQuitAgentModal.vue';
|
||||
import UserQuitModal from '../user/UserQuitModal.vue';
|
||||
import { useDrawer } from '/@/components/Drawer';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { columns, searchFormSchema } from '../user/user.data';
|
||||
import { list , deleteUser, batchDeleteUser, getImportUrl, getExportUrl, frozenBatch , getUserTenantPageList, updateUserTenantStatus } from '../user/user.api';
|
||||
import { list , deleteUser, batchDeleteUser, getImportUrl, getExportUrl, frozenBatch, getUserTenantPageList, updateUserTenantStatus } from '../user/user.api';
|
||||
// import { usePermission } from '/@/hooks/web/usePermission'
|
||||
// const { hasPermission } = usePermission();
|
||||
import { userTenantColumns, userTenantFormSchema } from '../user/user.data';
|
||||
@ -46,9 +66,11 @@
|
||||
import UserSelectModal from '/@/components/Form/src/jeecg/components/modal/UserSelectModal.vue';
|
||||
import { getTenantId } from "/@/utils/auth";
|
||||
import { changeOwenUserTenant } from "/@/views/system/usersetting/UserSetting.api";
|
||||
import { getLoginTenantName } from "/@/views/system/tenant/tenant.api";
|
||||
import {getLoginTenantName, invitationUserJoin, leaveTenant} from "/@/views/system/tenant/tenant.api";
|
||||
import TenantUserDrawer from './components/TenantUserDrawer.vue';
|
||||
import { tenantSaasMessage } from "@/utils/common/compUtils";
|
||||
import { sameDay, tenantSaasMessage } from "@/utils/common/compUtils";
|
||||
import TenantPackAllotModal from './components/TenantPackAllotModal.vue'
|
||||
import TenantInviteUserModal from "@/views/system/tenant/components/TenantInviteUserModal.vue";
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
@ -58,8 +80,12 @@
|
||||
const [registerQuitAgentModal, { openModal: openQuitAgentModal }] = useModal();
|
||||
//离职用户列表model
|
||||
const [registerQuitModal, { openModal: openQuitModal }] = useModal();
|
||||
//分配套餐弹窗
|
||||
const [registerPackAllotModal, { openModal: openPackAllotModal }] = useModal();
|
||||
const userStore = useUserStore();
|
||||
const createBy = userStore.getUserInfo.username;
|
||||
//弹窗提示显示
|
||||
const tipShow = ref<boolean>(false);
|
||||
|
||||
// 列表页面公共参数、方法
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
@ -153,22 +179,23 @@
|
||||
function getDropDownAction(record): ActionItem[] {
|
||||
return [
|
||||
{
|
||||
label: '详情',
|
||||
label: '查看详情',
|
||||
onClick: handleDetail.bind(null, record),
|
||||
},
|
||||
{
|
||||
label: '离职',
|
||||
//update-begin---author:wangshuai---date:2023-10-25---for:【QQYUN-6822】9.离职交接人选的是自己,完成之后数据没了---
|
||||
onClick: handleQuit.bind(null,record.username, record.id),
|
||||
//update-end---author:wangshuai---date:2023-10-25---for:【QQYUN-6822】9.离职交接人选的是自己,完成之后数据没了---
|
||||
//update-begin---author:wangshuai ---date:20230130 for:[QQYUN-3974]租户的创建人 不应该有离职按钮------------
|
||||
ifShow: () =>{
|
||||
return record.status === '1' && record.username!== record.createBy;
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20230130 for:[QQYUN-3974]租户的创建人 不应该有离职按钮------------
|
||||
label: '移除用户',
|
||||
onClick: handleLeave.bind(null, record.id),
|
||||
},
|
||||
{
|
||||
label: '交接',
|
||||
label: '删除用户',
|
||||
popConfirm: {
|
||||
title: '是否确认删除该用户',
|
||||
confirm: handleDeleteUser.bind(null, record),
|
||||
},
|
||||
ifShow: () => record.username!== userStore.getUserInfo?.username && sameDay(record.createTime),
|
||||
},
|
||||
{
|
||||
label: '变更拥有者',
|
||||
onClick: handleHandover.bind(null, record),
|
||||
ifShow: () =>{
|
||||
return record.username === record.createBy;
|
||||
@ -191,19 +218,13 @@
|
||||
return record.status === '3' && record.createBy === createBy;
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '用户套餐',
|
||||
onClick: handleAllotPack.bind(null, record),
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 离职
|
||||
* @param userName
|
||||
* @param userId
|
||||
*/
|
||||
function handleQuit(userName, userId) {
|
||||
//打开离职代理人弹窗
|
||||
openQuitAgentModal(true, { userName, userId });
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户租户状态
|
||||
* @param id
|
||||
@ -228,6 +249,8 @@
|
||||
const excludeUserIdList = ref<any>([]);
|
||||
//离职代理人model
|
||||
const [registerUserModal, { openModal: openUserModal }] = useModal();
|
||||
//邀请用户加入弹窗
|
||||
const [registerSelUserModal, { openModal: userOpenModal }] = useModal();
|
||||
const handOverUserName = ref<string>('');
|
||||
|
||||
/**
|
||||
@ -277,21 +300,59 @@
|
||||
loginTenantName.value = await getLoginTenantName();
|
||||
}
|
||||
//update-end---author:wangshuai ---date:20230710 for:【QQYUN-5723】4、显示当前登录租户------------
|
||||
|
||||
|
||||
/**
|
||||
* 离职成功之后需要判断一下是否为当前用户,当前用户需要刷新浏览器
|
||||
* @param userName
|
||||
* 分配套餐
|
||||
*
|
||||
* @param record
|
||||
*/
|
||||
function handleQuitSuccess(userName) {
|
||||
//判断如果当前离职的是当前登录用户,需要刷新页面,便将租户id设置成null
|
||||
let username = userStore.getUserInfo.username;
|
||||
if (username && userName === username) {
|
||||
userStore.setTenant(null);
|
||||
window.location.reload();
|
||||
}else{
|
||||
function handleAllotPack(record) {
|
||||
openPackAllotModal(true,{
|
||||
record
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
function handleDeleteUser(record) {
|
||||
deleteUser({ id: record.id }, reload);
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请用户加入租户
|
||||
*/
|
||||
function handleInvitation() {
|
||||
userOpenModal(true, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户选择回调事件
|
||||
* @param username
|
||||
* @param phone
|
||||
* @param userSelectId
|
||||
*/
|
||||
async function handleInviteUserOk(phone, username) {
|
||||
let tId = getTenantId();
|
||||
if (phone) {
|
||||
await invitationUserJoin({ ids: tId, phone: phone });
|
||||
reload();
|
||||
}
|
||||
if (username) {
|
||||
await invitationUserJoin({ ids: tId, username: username });
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请离
|
||||
* @param id
|
||||
*/
|
||||
async function handleLeave(id) {
|
||||
await leaveTenant({ userIds: id, tenantId: getTenantId() }, reload)
|
||||
}
|
||||
|
||||
|
||||
onMounted(()=>{
|
||||
tenantSaasMessage('租户用户')
|
||||
@ -304,4 +365,11 @@
|
||||
margin: 5px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.user-tenant-tip{
|
||||
margin: 20px;
|
||||
background-color: #f8f9fb;
|
||||
color: #99a1a9;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user