fix(all): 修复bugs

This commit is contained in:
baiqi 2024-04-11 20:46:23 +08:00 committed by Craftsman
parent 814b0ef679
commit 05f4965813
17 changed files with 95 additions and 98 deletions

View File

@ -33,7 +33,9 @@
<ms-base-table v-bind="propsRes" v-model:selected-key="innerCheckedKey" v-on="propsEvent"> <ms-base-table v-bind="propsRes" v-model:selected-key="innerCheckedKey" v-on="propsEvent">
<template #name="{ record }"> <template #name="{ record }">
<div class="flex items-center"> <div class="flex items-center">
<div class="one-line-text max-w-[200px] cursor-pointer text-[rgb(var(--primary-5))]">{{ record.name }}</div> <a-tooltip :content="record.name">
<div class="one-line-text max-w-[200px] cursor-pointer text-[rgb(var(--primary-5))]">{{ record.name }}</div>
</a-tooltip>
<a-popover :title="record.name" position="bottom"> <a-popover :title="record.name" position="bottom">
<a-button type="text" class="ml-2 px-0"> {{ t('project.commonScript.preview') }}</a-button> <a-button type="text" class="ml-2 px-0"> {{ t('project.commonScript.preview') }}</a-button>
<template #title> <template #title>
@ -223,7 +225,6 @@
slotName: 'name', slotName: 'name',
width: 300, width: 300,
showInTable: true, showInTable: true,
showTooltip: true,
}, },
{ {
title: 'project.commonScript.description', title: 'project.commonScript.description',

View File

@ -33,7 +33,7 @@
<slot name="title" v-bind="_props"></slot> <slot name="title" v-bind="_props"></slot>
</template> </template>
<template v-if="$slots['extra'] || props.nodeMoreActions" #extra="_props"> <template v-if="$slots['extra'] || props.nodeMoreActions" #extra="_props">
<div class="sticky right-0 flex items-center justify-between"> <div class="sticky right-[8px] flex items-center justify-between">
<div v-if="_props.hideMoreAction !== true" class="ms-tree-node-extra"> <div v-if="_props.hideMoreAction !== true" class="ms-tree-node-extra">
<slot name="extra" v-bind="_props"></slot> <slot name="extra" v-bind="_props"></slot>
<MsTableMoreAction <MsTableMoreAction

View File

@ -53,11 +53,11 @@
</template> </template>
</a-table> </a-table>
</div> </div>
<div v-if="props.showBottom" v-permission="props.savePermission || []" class="footer" :style="{ width: props.width }"> <div v-if="props.showBottom" v-permission="props.savePermission || []" class="footer">
<ms-button :disabled="!canSave" @click="handleReset">{{ t('system.userGroup.reset') }}</ms-button> <ms-button :disabled="!canSave" @click="handleReset">{{ t('system.userGroup.reset') }}</ms-button>
<a-button v-permission="props.savePermission || []" :disabled="!canSave" type="primary" @click="handleSave">{{ <a-button v-permission="props.savePermission || []" :disabled="!canSave" type="primary" @click="handleSave">
t('system.userGroup.save') {{ t('system.userGroup.save') }}
}}</a-button> </a-button>
</div> </div>
</template> </template>
@ -91,7 +91,6 @@
export interface TableOperationColumn { export interface TableOperationColumn {
name: OperationName | string; name: OperationName | string;
title?: string | RenderFunction; title?: string | RenderFunction;
width?: number;
fixed?: boolean; fixed?: boolean;
render?: (record: TableData) => VNodeChild; render?: (record: TableData) => VNodeChild;
isLastLeftFixed?: boolean; isLastLeftFixed?: boolean;
@ -101,7 +100,6 @@
defineProps<{ defineProps<{
current: CurrentUserGroupItem; current: CurrentUserGroupItem;
savePermission?: string[]; savePermission?: string[];
width?: string;
showBottom?: boolean; showBottom?: boolean;
disabled?: boolean; disabled?: boolean;
scroll?: { scroll?: {
@ -117,7 +115,7 @@
scroll() { scroll() {
return { return {
x: '800px', x: '800px',
y: 'calc(100vh - 254px)', y: 'calc(100vh - 264px)',
}; };
}, },
} }
@ -492,7 +490,7 @@
<style scoped lang="less"> <style scoped lang="less">
.group-auth-table { .group-auth-table {
position: relative; position: relative;
min-height: calc(100vh - 230px); padding: 24px;
:deep(.arco-table-container) { :deep(.arco-table-container) {
border-top: 1px solid var(--color-text-n8) !important; border-top: 1px solid var(--color-text-n8) !important;
border-right: 1px solid var(--color-text-n8) !important; border-right: 1px solid var(--color-text-n8) !important;
@ -509,10 +507,8 @@
} }
} }
.footer { .footer {
position: fixed; @apply w-full;
right: 17px;
bottom: 24px;
z-index: 999;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
padding: 24px; padding: 24px;

View File

@ -1,17 +1,19 @@
<template> <template>
<MsBaseTable class="mt-[16px]" v-bind="propsRes" v-on="propsEvent"> <div class="px-[24px]">
<template v-if="hasAnyPermission(props.updatePermission || [])" #quickCreate> <MsBaseTable class="mt-[16px]" v-bind="propsRes" v-on="propsEvent">
<MsConfirmUserSelector :ok-loading="okLoading" v-bind="userSelectorProps" @confirm="handleAddMember" /> <template v-if="hasAnyPermission(props.updatePermission || [])" #quickCreate>
</template> <MsConfirmUserSelector :ok-loading="okLoading" v-bind="userSelectorProps" @confirm="handleAddMember" />
<template v-if="hasAnyPermission(props.updatePermission || [])" #action="{ record }"> </template>
<MsRemoveButton <template v-if="hasAnyPermission(props.updatePermission || [])" #action="{ record }">
:title="t('system.userGroup.removeName', { name: characterLimit(record.name) })" <MsRemoveButton
:sub-title-tip="t('system.userGroup.removeTip')" :title="t('system.userGroup.removeName', { name: characterLimit(record.name) })"
:disabled="record.userId === 'admin'" :sub-title-tip="t('system.userGroup.removeTip')"
@ok="handleRemove(record)" :disabled="record.userId === 'admin'"
/> @ok="handleRemove(record)"
</template> />
</MsBaseTable> </template>
</MsBaseTable>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -33,7 +35,6 @@
} from '@/api/modules/setting/usergroup'; } from '@/api/modules/setting/usergroup';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import useUserStore from '@/store/modules/user/index';
import { characterLimit, formatPhoneNumber } from '@/utils'; import { characterLimit, formatPhoneNumber } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
@ -46,7 +47,6 @@
const systemType = inject<AuthScopeEnum>('systemType'); const systemType = inject<AuthScopeEnum>('systemType');
const { t } = useI18n(); const { t } = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
const userStore = useUserStore();
const currentOrgId = computed(() => appStore.currentOrgId); const currentOrgId = computed(() => appStore.currentOrgId);
const okLoading = ref(false); const okLoading = ref(false);
const props = defineProps<{ const props = defineProps<{
@ -114,7 +114,7 @@
getRequestBySystemType(), getRequestBySystemType(),
{ {
columns: userGroupUsercolumns, columns: userGroupUsercolumns,
scroll: { x: '100%', minWidth: 700 }, scroll: { x: '100%', minWidth: 700, y: '100%' },
selectable: false, selectable: false,
noDisable: true, noDisable: true,
showSetting: false, showSetting: false,

View File

@ -46,20 +46,18 @@
if (sameNameSiblings.length > 1) { if (sameNameSiblings.length > 1) {
// 1 xpath // 1 xpath
const sameNodesIndex = document.evaluate( const sameNodesIndex = document.evaluate(
`count(ancestor-or-self::*/preceding-sibling::${node.nodeName}) + 1`, `count(ancestor-or-self::*[local-name()="${node.localName}"]/preceding-sibling::*[local-name()="${node.localName}"]) + 1`,
node, node,
(prefix) => { (prefix) => {
// XML // URI
const root = node.ownerDocument.documentElement; const nsUri = node.lookupNamespaceURI(prefix);
// URI
const nsUri = root.getAttributeNS('http://www.w3.org/2000/xmlns/', prefix || '');
return nsUri || null; return nsUri || null;
}, },
XPathResult.NUMBER_TYPE, XPathResult.NUMBER_TYPE,
null null
).numberValue; // XPATH ).numberValue; // XPATH
const xpath = `${currentPath}/${node.nodeName}[${sameNodesIndex}]`; // /[] const xpath = `${currentPath}/*[local-name()="${node.localName}"][${sameNodesIndex}]`; // /[]
tempXmls.value.push({ content: node.nodeName, xpath }); tempXmls.value.push({ content: node.nodeName, xpath });
const children = Array.from(node.children); const children = Array.from(node.children);
children.forEach((child) => { children.forEach((child) => {
@ -67,7 +65,7 @@
}); });
} else { } else {
// 1 xpath // 1 xpath
const xpath = `${currentPath}/${node.nodeName}`; const xpath = `${currentPath}/*[local-name()="${node.localName}"]`;
tempXmls.value.push({ content: node.nodeName, xpath }); tempXmls.value.push({ content: node.nodeName, xpath });
const children = Array.from(node.children); const children = Array.from(node.children);
children.forEach((child) => { children.forEach((child) => {

View File

@ -135,10 +135,6 @@
return Promise.resolve(false); return Promise.resolve(false);
} }
} }
if (!props.multiple) {
//
innerFileList.value = [];
}
} }
const maxSize = props.maxSize || defaultMaxSize; const maxSize = props.maxSize || defaultMaxSize;
const _maxSize = props.sizeUnit === 'MB' ? maxSize * 1024 * 1024 : maxSize * 1024; const _maxSize = props.sizeUnit === 'MB' ? maxSize * 1024 * 1024 : maxSize * 1024;
@ -146,6 +142,10 @@
Message.warning(t('ms.upload.overSize')); Message.warning(t('ms.upload.overSize'));
return Promise.resolve(false); return Promise.resolve(false);
} }
if (!props.multiple) {
//
innerFileList.value = [];
}
const fileFormatMatch = file.name.match(/\.([a-zA-Z0-9]+)$/); const fileFormatMatch = file.name.match(/\.([a-zA-Z0-9]+)$/);
const fileFormatType = fileFormatMatch ? fileFormatMatch[1] : 'none'; const fileFormatType = fileFormatMatch ? fileFormatMatch[1] : 'none';
// //

View File

@ -550,7 +550,8 @@ export function deleteNodes<T>(
targetKeys: (string | number)[], targetKeys: (string | number)[],
deleteCondition?: (node: TreeNode<T>, parent?: TreeNode<T>) => boolean, deleteCondition?: (node: TreeNode<T>, parent?: TreeNode<T>) => boolean,
customKey = 'key' customKey = 'key'
): void { ): boolean {
let hasDeleted = false;
const targetKeysSet = new Set(targetKeys); const targetKeysSet = new Set(targetKeys);
function deleteNodesInTree(tree: TreeNode<T>[]): void { function deleteNodesInTree(tree: TreeNode<T>[]): void {
for (let i = tree.length - 1; i >= 0; i--) { for (let i = tree.length - 1; i >= 0; i--) {
@ -558,6 +559,7 @@ export function deleteNodes<T>(
if (targetKeysSet.has(node[customKey])) { if (targetKeysSet.has(node[customKey])) {
if (deleteCondition && deleteCondition(node, node.parent)) { if (deleteCondition && deleteCondition(node, node.parent)) {
tree.splice(i, 1); // 直接删除当前节点 tree.splice(i, 1); // 直接删除当前节点
hasDeleted = true;
targetKeysSet.delete(node[customKey]); // 删除后从集合中移除 targetKeysSet.delete(node[customKey]); // 删除后从集合中移除
// 重新调整剩余子节点的 sort 序号 // 重新调整剩余子节点的 sort 序号
for (let j = i; j < tree.length; j++) { for (let j = i; j < tree.length; j++) {
@ -571,6 +573,7 @@ export function deleteNodes<T>(
} }
deleteNodesInTree(treeArr); deleteNodesInTree(treeArr);
return hasDeleted;
} }
/** /**

View File

@ -14,10 +14,8 @@ export function matchXMLWithXPath(xmlText: string, xpathQuery: string): xpath.Se
// 创建一个命名空间解析器 // 创建一个命名空间解析器
const resolver = (prefix: string) => { const resolver = (prefix: string) => {
// 获取 XML 文档的根元素 // 获取命名空间的 URI
const root = xmlDoc.documentElement; const nsUri = xmlDoc.lookupNamespaceURI(prefix);
// 从根元素获取命名空间的 URI
const nsUri = root.getAttributeNS('http://www.w3.org/2000/xmlns/', prefix);
return nsUri || null; return nsUri || null;
}; };

View File

@ -72,7 +72,7 @@
columns, columns,
scroll: { x: '100%' }, scroll: { x: '100%' },
selectable: false, selectable: false,
heightUsed: 374, heightUsed: 454,
}, },
(item) => ({ (item) => ({
...item, ...item,

View File

@ -281,11 +281,20 @@
}, },
maskClosable: false, maskClosable: false,
onBeforeOk: async () => { onBeforeOk: async () => {
deleteNodes(scenario.value.steps, checkedKeys.value, (node) => !node.isQuoteScenarioStep, 'uniqueId'); const deleteResult = deleteNodes(
Message.success(t('common.deleteSuccess')); scenario.value.steps,
if (scenario.value.steps.length === 0) { checkedKeys.value,
checkedAll.value = false; (node) => !node.isQuoteScenarioStep,
indeterminate.value = false; 'uniqueId'
);
if (deleteResult) {
Message.success(t('common.deleteSuccess'));
if (scenario.value.steps.length === 0) {
checkedAll.value = false;
indeterminate.value = false;
}
} else {
Message.warning(t('apiScenario.quoteScenarioStepNotAllowDelete'));
} }
}, },
hideCancel: false, hideCancel: false,

View File

@ -943,10 +943,18 @@
try { try {
saveLoading.value = true; saveLoading.value = true;
if (activeStep.value) { if (activeStep.value) {
let url;
let path = '';
try {
url = new URL(saveModalForm.value.path);
path = url.pathname + url.search + url.hash;
} catch (error) {
// eslint-disable-next-line no-console
console.log(error);
path = saveModalForm.value.path;
}
const detail = stepDetails.value[activeStep.value.id] as RequestParam; const detail = stepDetails.value[activeStep.value.id] as RequestParam;
const fileParams = scenario.value.stepFileParam[activeStep.value.id]; const fileParams = scenario.value.stepFileParam[activeStep.value.id];
const url = new URL(saveModalForm.value.path);
const path = url.pathname + url.search + url.hash;
const res = await addDefinition({ const res = await addDefinition({
...saveModalForm.value, ...saveModalForm.value,
path, path,
@ -1213,11 +1221,11 @@
function applyStepNameChange(step: ScenarioStepItem) { function applyStepNameChange(step: ScenarioStepItem) {
const realStep = findNodeByKey<ScenarioStepItem>(steps.value, step.uniqueId, 'uniqueId'); const realStep = findNodeByKey<ScenarioStepItem>(steps.value, step.uniqueId, 'uniqueId');
if (realStep) { if (realStep) {
realStep.name = tempStepName.value; realStep.name = tempStepName.value || realStep.name;
realStep.draggable = true; // realStep.draggable = true; //
} }
showStepNameEditInputStepId.value = ''; showStepNameEditInputStepId.value = '';
scenario.value.unSaved = true; scenario.value.unSaved = !!tempStepName.value;
} }
/** /**
@ -1242,11 +1250,11 @@
function applyStepDescChange(step: ScenarioStepItem) { function applyStepDescChange(step: ScenarioStepItem) {
const realStep = findNodeByKey<ScenarioStepItem>(steps.value, step.uniqueId, 'uniqueId'); const realStep = findNodeByKey<ScenarioStepItem>(steps.value, step.uniqueId, 'uniqueId');
if (realStep) { if (realStep) {
realStep.name = tempStepDesc.value; realStep.name = tempStepDesc.value || realStep.name;
realStep.draggable = true; // realStep.draggable = true; //
} }
showStepDescEditInputStepId.value = ''; showStepDescEditInputStepId.value = '';
scenario.value.unSaved = true; scenario.value.unSaved = !!tempStepDesc.value;
} }
function handleStepContentChange($event, step: ScenarioStepItem) { function handleStepContentChange($event, step: ScenarioStepItem) {

View File

@ -192,6 +192,7 @@ export default {
'apiScenario.deleteStepConfirm': 'Are you sure you want to delete {name}?', 'apiScenario.deleteStepConfirm': 'Are you sure you want to delete {name}?',
'apiScenario.deleteStepConfirmWithChildren': 'apiScenario.deleteStepConfirmWithChildren':
'Are you sure you want to delete the selected step and all substeps within the step?', 'Are you sure you want to delete the selected step and all substeps within the step?',
'apiScenario.quoteScenarioStepNotAllowDelete': 'Substeps that reference a scenario cannot be deleted',
// Execution History // Execution History
'apiScenario.executeHistory.searchPlaceholder': 'Search by ID or name', 'apiScenario.executeHistory.searchPlaceholder': 'Search by ID or name',
'apiScenario.executeHistory.num': 'No.', 'apiScenario.executeHistory.num': 'No.',

View File

@ -183,6 +183,7 @@ export default {
'apiScenario.syncSaveAsCase': '同步添加测试接口用例', 'apiScenario.syncSaveAsCase': '同步添加测试接口用例',
'apiScenario.deleteStepConfirm': '确认删除 {name} 吗?', 'apiScenario.deleteStepConfirm': '确认删除 {name} 吗?',
'apiScenario.deleteStepConfirmWithChildren': '确认删除所选步骤以及步骤内所有子步骤?', 'apiScenario.deleteStepConfirmWithChildren': '确认删除所选步骤以及步骤内所有子步骤?',
'apiScenario.quoteScenarioStepNotAllowDelete': '引用场景的子步骤不能删除',
// 执行历史 // 执行历史
'apiScenario.executeHistory.searchPlaceholder': '通过ID或名称搜索', 'apiScenario.executeHistory.searchPlaceholder': '通过ID或名称搜索',
'apiScenario.executeHistory.num': '序号', 'apiScenario.executeHistory.num': '序号',

View File

@ -8,7 +8,11 @@
</div> </div>
<ms-base-table v-bind="propsRes" no-disable v-on="propsEvent"> <ms-base-table v-bind="propsRes" no-disable v-on="propsEvent">
<template #name="{ record }"> <template #name="{ record }">
<a-button type="text" class="px-0" @click="openAuthDetail(record.id)">{{ record.name }}</a-button> <a-button type="text" class="w-full overflow-hidden px-0" @click="openAuthDetail(record.id)">
<div class="one-line-text">
{{ record.name }}
</div>
</a-button>
</template> </template>
<template #action="{ record }"> <template #action="{ record }">
<MsButton v-permission="['SYSTEM_PARAMETER_SETTING_AUTH:READ+UPDATE']" @click="editAuth(record)"> <MsButton v-permission="['SYSTEM_PARAMETER_SETTING_AUTH:READ+UPDATE']" @click="editAuth(record)">
@ -637,28 +641,25 @@
slotName: 'name', slotName: 'name',
dataIndex: 'name', dataIndex: 'name',
width: 200, width: 200,
showInTable: true, showTooltip: true,
}, },
{ {
title: 'system.config.auth.status', title: 'system.config.auth.status',
slotName: 'enable', slotName: 'enable',
dataIndex: 'enable', dataIndex: 'enable',
showInTable: true,
}, },
{ {
title: 'system.config.auth.desc', title: 'system.config.auth.desc',
dataIndex: 'description', dataIndex: 'description',
showInTable: true, showTooltip: true,
}, },
{ {
title: 'system.config.auth.createTime', title: 'system.config.auth.createTime',
dataIndex: 'createTime', dataIndex: 'createTime',
showInTable: true,
}, },
{ {
title: 'system.config.auth.updateTime', title: 'system.config.auth.updateTime',
dataIndex: 'updateTime', dataIndex: 'updateTime',
showInTable: true,
}, },
{ {
title: hasOperationPermission.value ? 'system.config.auth.action' : '', title: hasOperationPermission.value ? 'system.config.auth.action' : '',
@ -785,7 +786,7 @@
enable: true, enable: true,
description: '', description: '',
name: '', name: '',
type: 'CAS', type: 'LDAP',
updateTime: 0, updateTime: 0,
createTime: 0, createTime: 0,
configuration: {}, configuration: {},
@ -948,13 +949,14 @@
const showDrawer = ref(false); const showDrawer = ref(false);
const drawerLoading = ref(false); const drawerLoading = ref(false);
const authFormRef = ref<FormInstance>(); const authFormRef = ref<FormInstance>();
const authTypeList = ['CAS', 'OIDC', 'OAuth2', 'LDAP']; // const authTypeList = ['CAS', 'OIDC', 'OAuth2', 'LDAP'];
const authTypeList = ['LDAP'];
const defaultAuth = { const defaultAuth = {
id: '', id: '',
enable: true, enable: true,
description: '', description: '',
name: '', name: '',
type: 'CAS' as AuthType, type: 'LDAP' as AuthType,
configuration: {}, configuration: {},
}; };
const activeAuthForm = ref<AuthForm>({ const activeAuthForm = ref<AuthForm>({

View File

@ -379,7 +379,7 @@
return appStore.menuCollapse ? collapsedWidth : appStore.menuWidth; return appStore.menuCollapse ? collapsedWidth : appStore.menuWidth;
}); });
const pageLoading = ref(false); const pageLoading = ref(false);
const pageConfig = ref({ ...appStore.pageConfig }); const pageConfig = ref({ ...appStore.pageConfig, slogan: t(appStore.pageConfig.slogan) });
const loginPageFullRef = ref<HTMLElement | null>(null); const loginPageFullRef = ref<HTMLElement | null>(null);
const platformPageFullRef = ref<HTMLElement | null>(null); const platformPageFullRef = ref<HTMLElement | null>(null);
const { isFullScreen: isLoginPageFullscreen, toggleFullScreen: loginFullscreenToggle } = const { isFullScreen: isLoginPageFullscreen, toggleFullScreen: loginFullscreenToggle } =

View File

@ -56,7 +56,7 @@ export default {
'system.config.page.loginPageConfig': '平台登录页设置', 'system.config.page.loginPageConfig': '平台登录页设置',
'system.config.page.pagePreview': '页面预览', 'system.config.page.pagePreview': '页面预览',
'system.config.page.reset': '恢复默认', 'system.config.page.reset': '恢复默认',
'system.config.page.icon': '网站 icon', 'system.config.page.icon': '网站 Icon',
'system.config.page.replace': '替换图片', 'system.config.page.replace': '替换图片',
'system.config.page.iconTip': 'system.config.page.iconTip':
'顶部网站显示的 icon建议使用 SVG 或 PNG 格式透明背景图片,宽高 18px图片大小仅支持 200 KB 以内', '顶部网站显示的 icon建议使用 SVG 或 PNG 格式透明背景图片,宽高 18px图片大小仅支持 200 KB 以内',
@ -69,10 +69,10 @@ export default {
'system.config.page.slogan': 'Slogan', 'system.config.page.slogan': 'Slogan',
'system.config.page.sloganPlaceholder': '请输入 Slogan', 'system.config.page.sloganPlaceholder': '请输入 Slogan',
'system.config.page.sloganRequired': 'Slogan不能为空', 'system.config.page.sloganRequired': 'Slogan不能为空',
'system.config.page.sloganTip': '产品Logo下的 slogan', 'system.config.page.sloganTip': '产品Logo下的 Slogan',
'system.config.page.title': '网站名称', 'system.config.page.title': '网站名称',
'system.config.page.titlePlaceholder': '请输入网站名称', 'system.config.page.titlePlaceholder': '请输入网站名称',
'system.config.page.titleTip': '显示在网页tab的平台名称', 'system.config.page.titleTip': '显示在网页Tab的平台名称',
'system.config.page.loginPreviewTip': 'tips:默认为 MeterSphere 系统界面,支持自定义平台界面设置', 'system.config.page.loginPreviewTip': 'tips:默认为 MeterSphere 系统界面,支持自定义平台界面设置',
'system.config.page.platformConfig': '平台设置', 'system.config.page.platformConfig': '平台设置',
'system.config.page.platformLogo': '平台 Logo', 'system.config.page.platformLogo': '平台 Logo',

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="card"> <MsCard simple no-content-padding>
<MsSplitBox v-model:width="leftWidth" @expand-change="handleCollapse"> <MsSplitBox v-model:width="leftWidth" @expand-change="handleCollapse">
<template #first> <template #first>
<UserGroupLeft <UserGroupLeft
@ -12,8 +12,8 @@
/> />
</template> </template>
<template #second> <template #second>
<div class="p-[24px]"> <div class="h-full pt-[24px]">
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between px-[24px]">
<a-tooltip :content="currentUserGroupItem.name"> <a-tooltip :content="currentUserGroupItem.name">
<div class="one-line-text max-w-[300px] font-medium">{{ currentUserGroupItem.name }}</div> <div class="one-line-text max-w-[300px] font-medium">{{ currentUserGroupItem.name }}</div>
</a-tooltip> </a-tooltip>
@ -51,7 +51,6 @@
<AuthTable <AuthTable
v-if="currentTable === 'auth' && couldShowAuth" v-if="currentTable === 'auth' && couldShowAuth"
:current="currentUserGroupItem" :current="currentUserGroupItem"
:width="bottomWidth"
:save-permission="['SYSTEM_USER_ROLE:READ+UPDATE']" :save-permission="['SYSTEM_USER_ROLE:READ+UPDATE']"
:disabled="!hasAnyPermission(['SYSTEM_USER_ROLE:READ+UPDATE'])" :disabled="!hasAnyPermission(['SYSTEM_USER_ROLE:READ+UPDATE'])"
/> />
@ -59,24 +58,22 @@
</div> </div>
</template> </template>
</MsSplitBox> </MsSplitBox>
</div> </MsCard>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
/** /**
* @description 系统设置-系统-用户组 * @description 系统设置-系统-用户组
*/ */
import { computed, nextTick, onMounted, provide, ref, watchEffect } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import MsCard from '@/components/pure/ms-card/index.vue';
import MsSplitBox from '@/components/pure/ms-split-box/index.vue'; import MsSplitBox from '@/components/pure/ms-split-box/index.vue';
import AuthTable from '@/components/business/ms-user-group-comp/authTable.vue'; import AuthTable from '@/components/business/ms-user-group-comp/authTable.vue';
import UserGroupLeft from '@/components/business/ms-user-group-comp/msUserGroupLeft.vue'; import UserGroupLeft from '@/components/business/ms-user-group-comp/msUserGroupLeft.vue';
import UserTable from '@/components/business/ms-user-group-comp/userTable.vue'; import UserTable from '@/components/business/ms-user-group-comp/userTable.vue';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store';
import { addPixelValues } from '@/utils/css';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { CurrentUserGroupItem } from '@/models/setting/usergroup'; import { CurrentUserGroupItem } from '@/models/setting/usergroup';
@ -97,16 +94,8 @@
}); });
const userRef = ref(); const userRef = ref();
const appStore = useAppStore();
const leftCollapse = ref(true); const leftCollapse = ref(true);
const leftWidth = ref('300px'); const leftWidth = ref('300px');
const bottomWidth = computed(() => {
const width = appStore.menuCollapse ? '86px' : `${appStore.menuWidth}px`;
if (leftCollapse.value) {
return `calc(100% - ${addPixelValues(width, leftWidth.value, '20px')})`;
}
return `calc(100% - ${addPixelValues(width, '16px')})`;
});
const tableSearch = () => { const tableSearch = () => {
if (currentTable.value === 'user' && userRef.value) { if (currentTable.value === 'user' && userRef.value) {
@ -162,13 +151,4 @@
}); });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped></style>
.card {
@apply overflow-hidden bg-white;
position: relative;
height: calc(100vh - 88px);
border-radius: var(--border-radius-large);
box-shadow: 0 0 10px rgb(120 56 135 / 5%);
}
</style>