feat: 全局统一状态列替换为开关

This commit is contained in:
xinxin.wu 2024-07-29 10:51:52 +08:00 committed by 刘瑞斌
parent 467be9b526
commit 57f46a8815
12 changed files with 188 additions and 107 deletions

View File

@ -129,16 +129,12 @@
<div :class="{ 'flex w-full flex-row items-center': !item.isTag && !item.align }"> <div :class="{ 'flex w-full flex-row items-center': !item.isTag && !item.align }">
<template v-if="item.dataIndex === SpecialColumnEnum.ENABLE"> <template v-if="item.dataIndex === SpecialColumnEnum.ENABLE">
<slot name="enable" v-bind="{ record }"> <slot name="enable" v-bind="{ record }">
<div v-if="record.enable" class="flex flex-row flex-nowrap items-center gap-[2px]"> <a-switch
<icon-check-circle-fill class="text-[rgb(var(--success-6))]" /> v-model:model-value="record.enable"
<div>{{ item.enableTitle ? t(item.enableTitle) : t('msTable.enable') }}</div> size="small"
</div> :disabled="!hasAnyPermission(item.permission)"
<div v-else class="flex flex-row flex-nowrap items-center gap-[2px]"> :before-change="(val) => handleChangeEnable(val, record)"
<MsIcon type="icon-icon_disable" class="text-[var(--color-text-4)]" /> />
<div class="text-[var(--color-text-1)]">
{{ item.disableTitle ? t(item.disableTitle) : t('msTable.disable') }}
</div>
</div>
</slot> </slot>
</template> </template>
<template v-else-if="item.isTag || item.isStringTag"> <template v-else-if="item.isTag || item.isStringTag">
@ -312,6 +308,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore, useTableStore } from '@/store'; import { useAppStore, useTableStore } from '@/store';
import { hasAnyPermission } from '@/utils/permission';
import { DragSortParams } from '@/models/common'; import { DragSortParams } from '@/models/common';
import { ColumnEditTypeEnum, SelectAllEnum, SpecialColumnEnum, TableKeyEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, SelectAllEnum, SpecialColumnEnum, TableKeyEnum } from '@/enums/tableEnum';
@ -374,6 +371,7 @@
(e: 'expand', record: TableData): void | Promise<any>; (e: 'expand', record: TableData): void | Promise<any>;
(e: 'cell-click', record: TableData, column: TableColumnData, ev: Event): void | Promise<any>; (e: 'cell-click', record: TableData, column: TableColumnData, ev: Event): void | Promise<any>;
(e: 'clearSelector'): void; (e: 'clearSelector'): void;
(e: 'enableChange', record: any, newValue: string | number | boolean): void;
( (
e: 'filterChange', e: 'filterChange',
dataIndex: string, dataIndex: string,
@ -697,6 +695,11 @@
} }
}; };
function handleChangeEnable(newValue: string | number | boolean, record: TableData) {
emit('enableChange', record, newValue);
return false;
}
// //
const getBatchLeft = () => { const getBatchLeft = () => {
if (attrs.enableDrag) { if (attrs.enableDrag) {

View File

@ -1,4 +1,5 @@
import { TableQueryParams } from '@/models/common'; import { TableQueryParams } from '@/models/common';
import type { ResourcePoolItem } from '@/models/setting/resourcePool';
import { UserItem } from '../log'; import { UserItem } from '../log';
@ -59,4 +60,7 @@ export interface OrgProjectTableItem {
memberCount: number; memberCount: number;
userIds: string[]; userIds: string[];
resourcePoolIds: string[]; resourcePoolIds: string[];
orgAdmins: Record<string, any>;
moduleIds: string[];
resourcePoolList: ResourcePoolItem[];
} }

View File

@ -76,9 +76,43 @@
<span>{{ formatFileSize(record.size) }}</span> <span>{{ formatFileSize(record.size) }}</span>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<MsButton type="text" class="mr-[8px]" @click="handleDownload(record)"> <a-switch
v-if="record.fileType === 'jar' && hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+UPDATE'])"
v-model:model-value="record.enable"
size="small"
:before-change="(val) => handleChangeEnable(val, record)"
/>
<a-divider
v-if="record.fileType === 'jar' && hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+UPDATE'])"
direction="vertical"
:margin="8"
/>
<MsButton
v-if="record.fileType !== 'jar' && hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+UPDATE'])"
type="text"
class="!mr-0"
@click="handleMove(record)"
>
{{ t('project.fileManagement.move') }}
</MsButton>
<a-divider
v-if="record.fileType !== 'jar' && hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+UPDATE'])"
direction="vertical"
:margin="8"
/>
<MsButton
v-if="hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'])"
type="text"
class="!mr-0"
@click="handleDownload(record)"
>
{{ t('project.fileManagement.download') }} {{ t('project.fileManagement.download') }}
</MsButton> </MsButton>
<a-divider
v-if="hasAnyPermission(['PROJECT_FILE_MANAGEMENT:READ+DOWNLOAD'])"
direction="vertical"
:margin="8"
/>
<MsTableMoreAction <MsTableMoreAction
:list="record.fileType === 'jar' ? getJarFileActions(record) : normalFileActions" :list="record.fileType === 'jar' ? getJarFileActions(record) : normalFileActions"
@select="handleMoreActionSelect($event, record)" @select="handleMoreActionSelect($event, record)"
@ -462,7 +496,7 @@
}, },
]; ];
} }
const normalActions = [ const moveActions = [
{ {
label: 'project.fileManagement.move', label: 'project.fileManagement.move',
eventTag: 'move', eventTag: 'move',
@ -470,6 +504,9 @@
{ {
isDivider: true, isDivider: true,
}, },
];
const normalActions = [
{ {
label: 'project.fileManagement.delete', label: 'project.fileManagement.delete',
eventTag: 'delete', eventTag: 'delete',
@ -482,6 +519,7 @@
label: 'project.fileManagement.download', label: 'project.fileManagement.download',
eventTag: 'download', eventTag: 'download',
}, },
...moveActions,
...normalActions, ...normalActions,
]; ];
} }
@ -489,11 +527,7 @@
}); });
function getJarFileActions(record: FileItem) { function getJarFileActions(record: FileItem) {
let jarFileActions: ActionsItem[] = [ let enableActions: ActionsItem[] = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
},
{ {
label: 'common.enable', label: 'common.enable',
eventTag: 'toggle', eventTag: 'toggle',
@ -502,33 +536,49 @@
label: 'common.disable', label: 'common.disable',
eventTag: 'toggle', eventTag: 'toggle',
}, },
{ ];
isDivider: true,
}, if (record.enable) {
enableActions = enableActions.filter((e) => e.label !== 'common.enable');
} else if (record.enable === false) {
enableActions = enableActions.filter((e) => e.label !== 'common.disable');
}
const deleteActions = [
{ {
label: 'project.fileManagement.delete', label: 'project.fileManagement.delete',
eventTag: 'delete', eventTag: 'delete',
danger: true, danger: true,
}, },
]; ];
const jarFileActions: ActionsItem[] = [
{
label: 'project.fileManagement.move',
eventTag: 'move',
},
{
isDivider: true,
},
];
if (showType.value === 'card') { if (showType.value === 'card') {
jarFileActions = [ return [
{ {
label: 'project.fileManagement.download', label: 'project.fileManagement.download',
eventTag: 'download', eventTag: 'download',
}, },
...jarFileActions, ...jarFileActions,
...enableActions,
...deleteActions,
]; ];
} }
if (record.storage === 'GIT') { if (record.storage === 'GIT') {
jarFileActions = jarFileActions.filter((e) => e.eventTag !== 'move'); return jarFileActions.filter((e) => e.eventTag !== 'move');
} }
if (record.enable) {
jarFileActions = jarFileActions.filter((e) => e.label !== 'common.enable'); return [...jarFileActions, ...deleteActions];
} else if (record.enable === false) {
jarFileActions = jarFileActions.filter((e) => e.label !== 'common.disable');
}
return jarFileActions;
} }
const hasOperationPermission = computed(() => const hasOperationPermission = computed(() =>
hasAnyPermission([ hasAnyPermission([
@ -594,7 +644,7 @@
slotName: 'action', slotName: 'action',
dataIndex: 'operation', dataIndex: 'operation',
fixed: 'right', fixed: 'right',
width: hasOperationPermission.value ? 120 : 50, width: hasOperationPermission.value ? 180 : 50,
}, },
]; ];
const tableStore = useTableStore(); const tableStore = useTableStore();
@ -993,6 +1043,13 @@
} }
} }
//
function handleMove(record: FileItem) {
isBatchMove.value = false;
activeFile.value = record;
moveModalVisible.value = true;
}
/** /**
* 处理表格更多按钮事件 * 处理表格更多按钮事件
* @param item * @param item
@ -1000,9 +1057,7 @@
function handleMoreActionSelect(item: ActionsItem, record: FileItem) { function handleMoreActionSelect(item: ActionsItem, record: FileItem) {
switch (item.eventTag) { switch (item.eventTag) {
case 'move': case 'move':
isBatchMove.value = false; handleMove(record);
activeFile.value = record;
moveModalVisible.value = true;
break; break;
case 'delete': case 'delete':
delFile(record, false); delFile(record, false);
@ -1276,6 +1331,12 @@
}); });
} }
// |
function handleChangeEnable(newValue: string | number | boolean, record: FileItem) {
toggleJarFile(record);
return false;
}
await tableStore.initColumn(TableKeyEnum.FILE_MANAGEMENT_FILE, columns, 'drawer'); await tableStore.initColumn(TableKeyEnum.FILE_MANAGEMENT_FILE, columns, 'drawer');
</script> </script>

View File

@ -17,7 +17,7 @@
@clear="fetchData" @clear="fetchData"
></a-input-search> ></a-input-search>
</div> </div>
<MsBaseTable v-bind="propsRes" v-on="propsEvent"> <MsBaseTable v-bind="propsRes" v-on="propsEvent" @enable-change="enableChange">
<template #revokeDelete="{ record }"> <template #revokeDelete="{ record }">
<a-tooltip class="ms-tooltip-white"> <a-tooltip class="ms-tooltip-white">
<template #content> <template #content>
@ -57,9 +57,6 @@
</MsButton> </MsButton>
</template> </template>
<template v-else-if="!record.enable"> <template v-else-if="!record.enable">
<MsButton v-permission="['ORGANIZATION_PROJECT:READ+UPDATE']" @click="handleEnableOrDisableProject(record)">
{{ t('common.enable') }}
</MsButton>
<MsButton v-permission="['ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)"> <MsButton v-permission="['ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">
{{ t('common.delete') }} {{ t('common.delete') }}
</MsButton> </MsButton>
@ -185,6 +182,7 @@
dataIndex: 'enable', dataIndex: 'enable',
disableTitle: 'common.end', disableTitle: 'common.end',
showDrag: true, showDrag: true,
permission: ['ORGANIZATION_PROJECT:READ+UPDATE'],
}, },
{ {
title: 'common.desc', title: 'common.desc',
@ -261,11 +259,6 @@
}); });
const tableActions: ActionsItem[] = [ const tableActions: ActionsItem[] = [
{
label: 'common.end',
eventTag: 'end',
permission: ['ORGANIZATION_PROJECT:READ+UPDATE'],
},
{ {
label: 'system.user.delete', label: 'system.user.delete',
eventTag: 'delete', eventTag: 'delete',
@ -302,7 +295,11 @@
}); });
}; };
const showAddProjectModal = (record: any) => { function enableChange(record: OrgProjectTableItem, newValue: string | number | boolean) {
handleEnableOrDisableProject(record, newValue as boolean);
}
const showAddProjectModal = (record: OrgProjectTableItem) => {
const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record; const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record;
currentUpdateProject.value = { currentUpdateProject.value = {
id, id,
@ -317,7 +314,7 @@
addProjectVisible.value = true; addProjectVisible.value = true;
}; };
const showAddUserModal = (record: any) => { const showAddUserModal = (record: OrgProjectTableItem) => {
currentProjectId.value = record.id; currentProjectId.value = record.id;
userVisible.value = true; userVisible.value = true;
}; };
@ -406,9 +403,6 @@
const handleMoreAction = (tag: ActionsItem, record: TableData) => { const handleMoreAction = (tag: ActionsItem, record: TableData) => {
const { eventTag } = tag; const { eventTag } = tag;
switch (eventTag) { switch (eventTag) {
case 'end':
handleEnableOrDisableProject(record, false);
break;
case 'delete': case 'delete':
handleDelete(record); handleDelete(record);
break; break;

View File

@ -1,5 +1,5 @@
<template> <template>
<MsBaseTable v-bind="propsRes" v-on="propsEvent"> <MsBaseTable v-bind="propsRes" v-on="propsEvent" @enable-change="enableChange">
<template #revokeDelete="{ record }"> <template #revokeDelete="{ record }">
<a-tooltip class="ms-tooltip-white"> <a-tooltip class="ms-tooltip-white">
<template #content> <template #content>
@ -46,11 +46,6 @@
}}</MsButton> }}</MsButton>
</template> </template>
<template v-else-if="!record.enable"> <template v-else-if="!record.enable">
<MsButton
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
@click="handleEnableOrDisableOrg(record)"
>{{ t('common.enable') }}</MsButton
>
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{ <MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
t('common.delete') t('common.delete')
}}</MsButton> }}</MsButton>
@ -62,11 +57,10 @@
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER']" @click="showAddUserModal(record)">{{ <MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+ADD_MEMBER']" @click="showAddUserModal(record)">{{
t('system.organization.addMember') t('system.organization.addMember')
}}</MsButton> }}</MsButton>
<MsButton <!-- TODO 后台缺少字段控制 -->
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']" <MsButton v-xpack :disabled="appStore.currentOrgId === record.id" @click="enterOrganization(record.id)">{{
@click="handleEnableOrDisableOrg(record, false)" t('system.project.enterOrganization')
>{{ t('common.end') }}</MsButton }}</MsButton>
>
<MsTableMoreAction <MsTableMoreAction
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']"
:list="tableActions" :list="tableActions"
@ -118,12 +112,17 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import { useTableStore } from '@/store'; import { useTableStore } from '@/store';
import useAppStore from '@/store/modules/app';
import { characterLimit } from '@/utils'; import { characterLimit } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { CreateOrUpdateSystemOrgParams, OrgProjectTableItem } from '@/models/setting/system/orgAndProject'; import { CreateOrUpdateSystemOrgParams, OrgProjectTableItem } from '@/models/setting/system/orgAndProject';
import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, TableKeyEnum } from '@/enums/tableEnum';
import { enterOrganization } from '@/views/setting/utils';
const appStore = useAppStore();
export interface SystemOrganizationProps { export interface SystemOrganizationProps {
keyword: string; keyword: string;
} }
@ -173,6 +172,7 @@
title: 'system.organization.status', title: 'system.organization.status',
dataIndex: 'enable', dataIndex: 'enable',
disableTitle: 'common.end', disableTitle: 'common.end',
permission: ['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'],
}, },
{ {
title: 'common.desc', title: 'common.desc',
@ -200,7 +200,7 @@
slotName: 'operation', slotName: 'operation',
dataIndex: 'operation', dataIndex: 'operation',
fixed: 'right', fixed: 'right',
width: hasOperationPermission.value ? 230 : 50, width: hasOperationPermission.value ? 250 : 50,
}, },
]; ];
@ -252,7 +252,7 @@
}, },
]; ];
const handleEnableOrDisableOrg = async (record: any, isEnable = true) => { const handleEnableOrDisableOrg = async (record: OrgProjectTableItem, isEnable = true) => {
const title = isEnable ? t('system.organization.enableTitle') : t('system.organization.endTitle'); const title = isEnable ? t('system.organization.enableTitle') : t('system.organization.endTitle');
const content = isEnable ? t('system.organization.enableContent') : t('system.organization.endContent'); const content = isEnable ? t('system.organization.enableContent') : t('system.organization.endContent');
const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd'); const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd');
@ -276,7 +276,11 @@
}); });
}; };
const showOrganizationModal = (record: any) => { function enableChange(record: OrgProjectTableItem, newValue: string | number | boolean) {
handleEnableOrDisableOrg(record, newValue as boolean);
}
const showOrganizationModal = (record: OrgProjectTableItem) => {
currentOrganizationId.value = record.id; currentOrganizationId.value = record.id;
orgVisible.value = true; orgVisible.value = true;
currentUpdateOrganization.value = { currentUpdateOrganization.value = {
@ -287,7 +291,7 @@
}; };
}; };
const showAddUserModal = (record: any) => { const showAddUserModal = (record: OrgProjectTableItem) => {
currentOrganizationId.value = record.id; currentOrganizationId.value = record.id;
userVisible.value = true; userVisible.value = true;
}; };

View File

@ -1,5 +1,5 @@
<template> <template>
<MsBaseTable v-bind="propsRes" v-on="propsEvent"> <MsBaseTable v-bind="propsRes" v-on="propsEvent" @enable-change="enableChange">
<template #revokeDelete="{ record }"> <template #revokeDelete="{ record }">
<a-tooltip class="ms-tooltip-white"> <a-tooltip class="ms-tooltip-white">
<template #content> <template #content>
@ -37,11 +37,6 @@
}}</MsButton> }}</MsButton>
</template> </template>
<template v-else-if="!record.enable"> <template v-else-if="!record.enable">
<MsButton
v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE']"
@click="handleEnableOrDisableProject(record)"
>{{ t('common.enable') }}</MsButton
>
<MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{ <MsButton v-permission="['SYSTEM_ORGANIZATION_PROJECT:READ+DELETE']" @click="handleDelete(record)">{{
t('common.delete') t('common.delete')
}}</MsButton> }}</MsButton>
@ -164,6 +159,7 @@
title: 'system.organization.status', title: 'system.organization.status',
dataIndex: 'enable', dataIndex: 'enable',
disableTitle: 'common.end', disableTitle: 'common.end',
permission: ['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'],
}, },
{ {
title: 'common.desc', title: 'common.desc',
@ -238,11 +234,6 @@
}); });
const tableActions: ActionsItem[] = [ const tableActions: ActionsItem[] = [
{
label: 'common.end',
eventTag: 'end',
permission: ['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'],
},
{ {
label: 'system.user.delete', label: 'system.user.delete',
eventTag: 'delete', eventTag: 'delete',
@ -250,7 +241,7 @@
}, },
]; ];
const handleEnableOrDisableProject = async (record: any, isEnable = true) => { const handleEnableOrDisableProject = async (record: OrgProjectTableItem, isEnable = true) => {
const title = isEnable ? t('system.project.enableTitle') : t('system.project.endTitle'); const title = isEnable ? t('system.project.enableTitle') : t('system.project.endTitle');
const content = isEnable ? t('system.project.enableContent') : t('system.project.endContent'); const content = isEnable ? t('system.project.enableContent') : t('system.project.endContent');
const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd'); const okText = isEnable ? t('common.confirmStart') : t('common.confirmEnd');
@ -274,7 +265,11 @@
}); });
}; };
const showAddProjectModal = (record: any) => { function enableChange(record: OrgProjectTableItem, newValue: string | number | boolean) {
handleEnableOrDisableProject(record, newValue as boolean);
}
const showAddProjectModal = (record: OrgProjectTableItem) => {
const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record; const { id, name, description, enable, adminList, organizationId, moduleIds, resourcePoolList } = record;
addProjectVisible.value = true; addProjectVisible.value = true;
currentUpdateProject.value = { currentUpdateProject.value = {
@ -289,7 +284,7 @@
}; };
}; };
const showAddUserModal = (record: any) => { const showAddUserModal = (record: OrgProjectTableItem) => {
currentProjectId.value = record.id; currentProjectId.value = record.id;
userVisible.value = true; userVisible.value = true;
}; };
@ -376,9 +371,6 @@
const handleMoreAction = (tag: ActionsItem, record: TableData) => { const handleMoreAction = (tag: ActionsItem, record: TableData) => {
const { eventTag } = tag; const { eventTag } = tag;
switch (eventTag) { switch (eventTag) {
case 'end':
handleEnableOrDisableProject(record, false);
break;
case 'delete': case 'delete':
handleDelete(record); handleDelete(record);
break; break;

View File

@ -82,4 +82,5 @@ export default {
'system.project.projectAdminIsNotNull': 'Project administrator cannot be empty', 'system.project.projectAdminIsNotNull': 'Project administrator cannot be empty',
'system.project.pleaseSelectAdmin': 'Please select project administrator', 'system.project.pleaseSelectAdmin': 'Please select project administrator',
'system.project.poolIsNotNull': 'Resource pool cannot be empty', 'system.project.poolIsNotNull': 'Resource pool cannot be empty',
'system.project.enterOrganization': 'Enter the organization',
}; };

View File

@ -78,4 +78,5 @@ export default {
'system.project.projectAdminIsNotNull': '项目管理员不能为空', 'system.project.projectAdminIsNotNull': '项目管理员不能为空',
'system.project.pleaseSelectAdmin': '请选择项目管理员', 'system.project.pleaseSelectAdmin': '请选择项目管理员',
'system.project.poolIsNotNull': '资源池不能为空', 'system.project.poolIsNotNull': '资源池不能为空',
'system.project.enterOrganization': '进入组织',
}; };

View File

@ -60,14 +60,12 @@
</a-table-column> </a-table-column>
<a-table-column :title="t('system.plugin.tableColumnsStatus')"> <a-table-column :title="t('system.plugin.tableColumnsStatus')">
<template #cell="{ record }"> <template #cell="{ record }">
<div v-if="record.enable" class="flex items-center"> <a-switch
<icon-check-circle-fill class="mr-[2px] text-[rgb(var(--success-6))]" /> v-model:model-value="record.enable"
{{ t('system.user.tableEnable') }} size="small"
</div> :disabled="!hasAnyPermission(['SYSTEM_PLUGIN:READ+UPDATE'])"
<div v-else class="flex items-center text-[var(--color-text-4)]"> :before-change="(val: string | number | boolean) => handleChangeEnable(val, record)"
<MsIcon type="icon-icon_disable" class="mr-[2px] text-[var(--color-text-4)]" /> />
{{ t('system.user.tableDisable') }}
</div>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column :title="t('system.plugin.tableColumnsApplicationScene')" data-index="scenario"> <a-table-column :title="t('system.plugin.tableColumnsApplicationScene')" data-index="scenario">
@ -115,7 +113,7 @@
<span>{{ getTime(record.updateTime) }}</span> <span>{{ getTime(record.updateTime) }}</span>
</template> </template>
</a-table-column> </a-table-column>
<a-table-column v-if="hasOperationPluginPermission" :width="180" fixed="right" :bordered="false"> <a-table-column v-if="hasOperationPluginPermission" :width="150" fixed="right" :bordered="false">
<template #title> <template #title>
{{ t('system.plugin.tableColumnsActions') }} {{ t('system.plugin.tableColumnsActions') }}
</template> </template>
@ -124,15 +122,6 @@
<MsButton v-permission="['SYSTEM_PLUGIN:READ+UPDATE']" @click="update(record)">{{ <MsButton v-permission="['SYSTEM_PLUGIN:READ+UPDATE']" @click="update(record)">{{
t('system.plugin.edit') t('system.plugin.edit')
}}</MsButton> }}</MsButton>
<MsButton
v-if="record.enable"
v-permission="['SYSTEM_PLUGIN:READ+UPDATE']"
@click="disableHandler(record)"
>{{ t('system.plugin.tableDisable') }}</MsButton
>
<MsButton v-else v-permission="['SYSTEM_PLUGIN:READ+UPDATE']" @click="enableHandler(record)">{{
t('system.plugin.tableEnable')
}}</MsButton>
<MsTableMoreAction <MsTableMoreAction
v-permission="['SYSTEM_PLUGIN:READ+DELETE']" v-permission="['SYSTEM_PLUGIN:READ+DELETE']"
:list="tableActions" :list="tableActions"
@ -393,6 +382,16 @@
console.log(error); console.log(error);
} }
}; };
function handleChangeEnable(value: string | number | boolean, record: PluginItem) {
if (value) {
enableHandler(record);
} else {
disableHandler(record);
}
return false;
}
const detailScript = async (record: PluginItem, item: PluginForms) => { const detailScript = async (record: PluginItem, item: PluginForms) => {
showDrawer.value = true; showDrawer.value = true;
config.value = { config.value = {

View File

@ -120,6 +120,7 @@
import { computed, ref, watch, watchEffect } from 'vue'; import { computed, ref, watch, watchEffect } from 'vue';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import MsButton from '@/components/pure/ms-button/index.vue';
import MsUpload from '@/components/pure/ms-upload/index.vue'; import MsUpload from '@/components/pure/ms-upload/index.vue';
import { addPlugin } from '@/api/modules/setting/pluginManger'; import { addPlugin } from '@/api/modules/setting/pluginManger';

View File

@ -37,6 +37,7 @@
:action-config="tableBatchActions" :action-config="tableBatchActions"
v-on="propsEvent" v-on="propsEvent"
@batch-action="handleTableBatch" @batch-action="handleTableBatch"
@enable-change="enableChange"
> >
<template #userGroup="{ record }"> <template #userGroup="{ record }">
<MsTagGroup <MsTagGroup
@ -71,9 +72,6 @@
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<template v-if="!record.enable"> <template v-if="!record.enable">
<MsButton v-permission="['SYSTEM_USER:READ+UPDATE']" @click="enableUser(record)">
{{ t('system.user.enable') }}
</MsButton>
<MsButton v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteUser(record)"> <MsButton v-permission="['SYSTEM_USER:READ+DELETE']" @click="deleteUser(record)">
{{ t('system.user.delete') }} {{ t('system.user.delete') }}
</MsButton> </MsButton>
@ -387,6 +385,7 @@
slotName: 'enable', slotName: 'enable',
dataIndex: 'enable', dataIndex: 'enable',
showDrag: true, showDrag: true,
permission: ['SYSTEM_USER:READ+UPDATE'],
}, },
{ {
title: hasOperationSysUserPermission.value ? 'system.user.tableColumnActions' : '', title: hasOperationSysUserPermission.value ? 'system.user.tableColumnActions' : '',
@ -543,6 +542,14 @@
}); });
} }
function enableChange(record: UserListItem, newValue: string | number | boolean) {
if (newValue) {
enableUser(record);
} else {
disabledUser(record);
}
}
/** /**
* 删除用户 * 删除用户
*/ */
@ -589,11 +596,6 @@
eventTag: 'resetPassword', eventTag: 'resetPassword',
permission: ['SYSTEM_USER:READ+UPDATE'], permission: ['SYSTEM_USER:READ+UPDATE'],
}, },
{
label: 'system.user.disable',
eventTag: 'disabled',
permission: ['SYSTEM_USER:READ+UPDATE'],
},
{ {
isDivider: true, isDivider: true,
}, },
@ -705,9 +707,6 @@
case 'resetPassword': case 'resetPassword':
resetPassword(record); resetPassword(record);
break; break;
case 'disabled':
disabledUser(record);
break;
case 'delete': case 'delete':
deleteUser(record); deleteUser(record);
break; break;

View File

@ -17,6 +17,28 @@ const userStore = useUserStore();
const appStore = useAppStore(); const appStore = useAppStore();
const licenseStore = useLicenseStore(); const licenseStore = useLicenseStore();
// 进入组织
export async function enterOrganization(organizationId: string) {
try {
appStore.showLoading();
if (appStore.currentOrgId !== organizationId) {
if (!licenseStore.hasLicense()) {
router.push({
name: NO_PROJECT_ROUTE_NAME,
});
return;
}
await switchUserOrg(organizationId, userStore.id || '');
await userStore.isLogin();
await userStore.checkIsLogin(true);
}
} catch (error) {
console.log(error);
} finally {
appStore.hideLoading();
}
}
export async function enterProject(projectId: string, organizationId?: string) { export async function enterProject(projectId: string, organizationId?: string) {
try { try {
appStore.showLoading(); appStore.showLoading();