fix(系统设置): 修改组织管理模板启用模板显示bug

This commit is contained in:
xinxin.wu 2024-04-23 14:15:39 +08:00 committed by 刘瑞斌
parent 2af3240e2d
commit 0e635a3252
4 changed files with 35 additions and 19 deletions

View File

@ -199,12 +199,21 @@ export function initFormCreate(customFields: CustomAttributes[], permission: str
const optionsIds = optionsValue.map((e: any) => e.value);
currentDefaultValue = (optionsIds || []).filter((e: any) => tempValue.includes(e));
} else if (memberType.includes(item.type)) {
// @desc 上来为空成员且不包含默认值成员
if (Array.isArray(item.defaultValue) && !item.defaultValue.includes('CREATE_USER')) {
currentDefaultValue = item.type === 'MEMBER' ? '' : [];
// @desc 包含默认值成员
} else if (item.defaultValue.includes('CREATE_USER')) {
currentDefaultValue = item.type === 'MEMBER' ? '' : [];
} else {
currentDefaultValue = item.type === 'MEMBER' ? item.defaultValue : JSON.parse(item.defaultValue);
// @desc 如果默认原本的成员被系统移除则过滤掉该用户不展示
const optionsIds = optionsValue.map((e: any) => e.value);
if (item.type === 'MULTIPLE_MEMBER') {
const tempValue = JSON.parse(item.defaultValue);
currentDefaultValue = (optionsIds || []).filter((e: any) => tempValue.includes(e));
} else {
currentDefaultValue = (optionsIds || []).find((e: any) => item.defaultValue === e) || '';
}
}
} else if (multipleInputType.includes(item.type)) {
currentDefaultValue = Array.isArray(item.defaultValue) ? item.defaultValue : JSON.parse(item.defaultValue);

View File

@ -336,7 +336,7 @@
selectAll: !!selectAll,
excludeIds: excludeIds || [],
selectIds: selectedIds || [],
roleIds: roleIds.value ? [roleIds.value] : [],
roleIds: target,
condition: {
keyword: keyword.value,
filter: {

View File

@ -315,7 +315,7 @@
dataIndex: 'operation',
fixed: 'right',
showDrag: false,
width: hasOperationPermission.value ? 180 : 100,
width: 180,
},
];

View File

@ -8,38 +8,40 @@
<div class="template-operation">
<div class="flex items-center">
<span class="font-medium">{{ props.cardItem.name }}</span>
<span v-if="!isEnableProject" class="enable">{{ t('system.orgTemplate.enabledTemplates') }}</span>
<span v-if="isEnableProject" class="enable">{{ t('system.orgTemplate.enabledTemplates') }}</span>
</div>
<div class="flex min-w-[300px] flex-nowrap items-center">
<!-- 字段设置 -->
<span class="operation hover:text-[rgb(var(--primary-5))]">
<span @click="fieldSetting">{{ t('system.orgTemplate.fieldSetting') }}</span>
<a-divider direction="vertical" />
</span>
<!-- 模板列表 -->
<span class="operation hover:text-[rgb(var(--primary-5))]">
<span @click="templateManagement">{{ t('system.orgTemplate.TemplateManagementList') }}</span>
<a-divider
v-if="hasEnablePermission && isEnableProject && props.cardItem.key === 'BUG'"
direction="vertical"
/>
<a-divider v-if="isShow" direction="vertical" />
</span>
<!-- 工作流 -->
<span v-if="props.cardItem.key === 'BUG'" class="operation hover:text-[rgb(var(--primary-5))]">
<a-divider
v-if="!(hasEnablePermission && isEnableProject) && props.cardItem.key === 'BUG'"
direction="vertical"
/>
<span @click="workflowSetup">{{ t('system.orgTemplate.workflowSetup') }}</span>
<a-divider
v-if="hasEnablePermission && props.mode === 'organization' && isEnableProject"
v-if="
hasEnablePermission &&
props.mode === 'organization' &&
!isEnableProject &&
props.cardItem.key === 'BUG'
"
v-permission="['ORGANIZATION_TEMPLATE:READ+ENABLE']"
direction="vertical"
/>
</span>
<!-- 启用项目模板 只有组织可以启用 -->
<span
v-if="hasEnablePermission && props.mode === 'organization' && isEnableProject"
v-if="hasEnablePermission && props.mode === 'organization' && !isEnableProject"
class="rounded p-[2px] hover:bg-[rgb(var(--primary-9))]"
>
<MsTableMoreAction :list="moreActions" @select="handleMoreActionSelect"
/></span>
<MsTableMoreAction :list="moreActions" @select="handleMoreActionSelect" />
</span>
</div>
</div>
</div>
@ -130,9 +132,7 @@
//
const isEnableProject = computed(() => {
return props.mode === 'organization'
? templateStore.ordStatus[props.cardItem.key]
: templateStore.projectStatus[props.cardItem.key];
return templateStore.projectStatus[props.cardItem.key];
});
const moreActions = ref<ActionsItem[]>([
@ -214,6 +214,13 @@
const hasEnablePermission = computed(() => hasAnyPermission(['ORGANIZATION_TEMPLATE:READ+ENABLE']));
const isShow = computed(() => {
if (props.cardItem.key === 'BUG') {
return true;
}
return !hasEnablePermission.value ? false : !isEnableProject.value;
});
function cancelHandler() {
showEnableVisible.value = false;
validateKeyWord.value = '';