fix: 修改全局部分bugFix

This commit is contained in:
xinxin.wu 2024-03-16 13:00:24 +08:00 committed by 刘瑞斌
parent bc707b8cc7
commit b86f722afe
17 changed files with 123 additions and 109 deletions

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="flex flex-row gap-[8px]"> <div class="flex flex-row gap-[8px] break-words">
<div class="p-1"> <MsAvatar :avatar="creatorInfo.avatar" /></div> <div class="p-1"> <MsAvatar :avatar="creatorInfo.avatar" /></div>
<div class="flex w-full flex-col"> <div class="flex w-full flex-col">
<div class="font-medium text-[var(--color-text-1)]"> <div class="font-medium text-[var(--color-text-1)]">
{{ creatorInfo.name }} {{ creatorInfo.name }}
<span v-if="props.element.replyUser">{{ t('ms.comment.reply') }} {{ replyUserName }}</span> <span v-if="props.element.replyUser">{{ t('ms.comment.reply') }} {{ replyUserName }}</span>
</div> </div>
<div v-dompurify-html="props.element.content" class="markdown-body mt-[4px]"></div> <div v-dompurify-html="props.element.content" class="markdown-body mt-[4px] break-words break-all"></div>
<div class="mb-4 mt-[16px] flex flex-row items-center"> <div class="mb-4 mt-[16px] flex flex-row items-center">
<div class="text-[var(--color-text-4)]">{{ <div class="text-[var(--color-text-4)]">{{

View File

@ -264,6 +264,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore, useTableStore } from '@/store'; import { useAppStore, useTableStore } from '@/store';
import { characterLimit } from '@/utils';
import { DragSortParams } from '@/models/common'; import { DragSortParams } from '@/models/common';
import { ColumnEditTypeEnum, SelectAllEnum, SpecialColumnEnum } from '@/enums/tableEnum'; import { ColumnEditTypeEnum, SelectAllEnum, SpecialColumnEnum } from '@/enums/tableEnum';
@ -279,7 +280,6 @@
} from './type'; } from './type';
import type { TableChangeExtra, TableColumnData, TableData } from '@arco-design/web-vue'; import type { TableChangeExtra, TableColumnData, TableData } from '@arco-design/web-vue';
import type { TableOperationColumn } from '@arco-design/web-vue/es/table/interface'; import type { TableOperationColumn } from '@arco-design/web-vue/es/table/interface';
import { log } from 'console';
const batchLeft = ref('10px'); const batchLeft = ref('10px');
const { t } = useI18n(); const { t } = useI18n();

View File

@ -44,7 +44,7 @@ export enum ProjectManagementRouteEnum {
PROJECT_MANAGEMENT_PERMISSION_BASIC_INFO = 'projectManagementPermissionBasicInfo', PROJECT_MANAGEMENT_PERMISSION_BASIC_INFO = 'projectManagementPermissionBasicInfo',
PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT = 'projectManagementPermissionMenuManagement', PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT = 'projectManagementPermissionMenuManagement',
PROJECT_MANAGEMENT_TEMPLATE = 'projectManagementTemplate', PROJECT_MANAGEMENT_TEMPLATE = 'projectManagementTemplate',
PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT = 'projectManagementTemplateManagement', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT = 'projectManagementTemplateList',
PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL = 'projectManagementTemplateManagementCaseDetail', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL = 'projectManagementTemplateManagementCaseDetail',
PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL = 'projectManagementTemplateManagementApiDetail', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL = 'projectManagementTemplateManagementApiDetail',
PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL = 'projectManagementTemplateManagementBugDetail', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL = 'projectManagementTemplateManagementBugDetail',

View File

@ -123,7 +123,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 項目管理模板 // 項目管理模板
{ {
path: 'template', path: 'projectManagementTemplate',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE,
component: () => import('@/views/project-management/template/index.vue'), component: () => import('@/views/project-management/template/index.vue'),
meta: { meta: {
@ -134,7 +134,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 模板列表-模板字段设置 // 模板列表-模板字段设置
{ {
path: 'templateFiledSetting', path: 'projectManagementTemplateField',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_FIELD_SETTING, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_FIELD_SETTING,
component: () => import('@/views/project-management/template/components/projectFieldSetting.vue'), component: () => import('@/views/project-management/template/components/projectFieldSetting.vue'),
meta: { meta: {
@ -156,7 +156,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 模板列表-模板管理列表 // 模板列表-模板管理列表
{ {
path: 'templateManagement', path: 'projectManagementTemplateList',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT,
component: () => import('@/views/project-management/template/components/templateManagement.vue'), component: () => import('@/views/project-management/template/components/templateManagement.vue'),
meta: { meta: {
@ -178,7 +178,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 项目-模板-用例模板 // 项目-模板-用例模板
{ {
path: 'templateManagementCaseDetail/:mode?', path: 'projectManagementTemplateCaseDetail/:mode?',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL,
component: () => import('@/views/project-management/template/components/detail.vue'), component: () => import('@/views/project-management/template/components/detail.vue'),
meta: { meta: {
@ -206,7 +206,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 项目-模板-接口模板 // 项目-模板-接口模板
{ {
path: 'templateManagementApiDetail/:mode?', path: 'projectManagementTemplateApiDetail/:mode?',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL,
component: () => import('@/views/project-management/template/components/detail.vue'), component: () => import('@/views/project-management/template/components/detail.vue'),
meta: { meta: {
@ -234,7 +234,7 @@ const ProjectManagement: AppRouteRecordRaw = {
}, },
// 项目-模板-缺陷模板 // 项目-模板-缺陷模板
{ {
path: 'templateManagementBugDetail/:mode?', path: 'projectManagementTemplateBugDetail/:mode?',
name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL, name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL,
component: () => import('@/views/project-management/template/components/detail.vue'), component: () => import('@/views/project-management/template/components/detail.vue'),
meta: { meta: {

View File

@ -337,7 +337,7 @@ const Setting: AppRouteRecordRaw = {
query: ['type'], query: ['type'],
}, },
{ {
name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_API_DETAIL,
locale: 'system.orgTemplate.createApiTemplate', locale: 'system.orgTemplate.createApiTemplate',
editTag: 'id', editTag: 'id',
editLocale: 'system.orgTemplate.updateApiTemplate', editLocale: 'system.orgTemplate.updateApiTemplate',
@ -365,7 +365,7 @@ const Setting: AppRouteRecordRaw = {
query: ['type'], query: ['type'],
}, },
{ {
name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_BUG_DETAIL,
locale: 'system.orgTemplate.createDefectTemplate', locale: 'system.orgTemplate.createDefectTemplate',
editTag: 'id', editTag: 'id',
editLocale: 'system.orgTemplate.updateDefectTemplate', editLocale: 'system.orgTemplate.updateDefectTemplate',

View File

@ -9,7 +9,7 @@
</div> </div>
</div> </div>
<!-- 左侧布局默认内容(非平台默认模板时默认展示) --> <!-- 左侧布局默认内容(非平台默认模板时默认展示) -->
<div v-if="!isPlatformDefaultTemplate" class="default-content"> <div v-if="!isPlatformDefaultTemplate" class="default-content !break-words break-all">
<div class="header-title">{{ t('bugManagement.edit.content') }}</div> <div class="header-title">{{ t('bugManagement.edit.content') }}</div>
<div class="mb-4 mt-[16px]" :class="{ 'max-h-[260px]': contentEditAble }"> <div class="mb-4 mt-[16px]" :class="{ 'max-h-[260px]': contentEditAble }">
<MsRichText <MsRichText

View File

@ -699,8 +699,12 @@
// //
const optionsIds = (multipleOptions || []).map((e: any) => e.value); const optionsIds = (multipleOptions || []).map((e: any) => e.value);
if (item.type !== 'MULTIPLE_INPUT') { if (item.type !== 'MULTIPLE_INPUT') {
const currentDefaultValue = optionsIds.filter((e: any) => JSON.parse(item.value).includes(e)); if (item.value) {
tmpObj[item.id] = currentDefaultValue; const currentDefaultValue = optionsIds.filter((e: any) => JSON.parse(item.value).includes(e));
tmpObj[item.id] = currentDefaultValue;
} else {
tmpObj[item.id] = [];
}
} else { } else {
tmpObj[item.id] = JSON.parse(item.value); tmpObj[item.id] = JSON.parse(item.value);
} }
@ -739,7 +743,7 @@
title: res.title, title: res.title,
description: res.description, description: res.description,
templateId: res.templateId, templateId: res.templateId,
tags: res.tags, tags: res.tags || [],
projectId: res.projectId, projectId: res.projectId,
platformSystemFields, platformSystemFields,
}; };

View File

@ -12,17 +12,18 @@
@refresh="fetchData()" @refresh="fetchData()"
> >
<template #left> <template #left>
<a-tooltip <a-popover title="" position="bottom">
:content="moduleNamePath + '(' + (props.modulesCount[props.activeFolder] || 0) + ')'"
position="bottom"
background-color="#FFFFFF"
:content-style="{ color: '#000000' }"
>
<div class="one-line-text max-h-[32px] max-w-[116px] text-[var(--color-text-1)]" <div class="one-line-text max-h-[32px] max-w-[116px] text-[var(--color-text-1)]"
>{{ moduleNamePath }} >{{ moduleNamePath }}
<span class="text-[var(--color-text-4)]"> ({{ props.modulesCount[props.activeFolder] || 0 }})</span></div <span class="text-[var(--color-text-4)]"> ({{ props.modulesCount[props.activeFolder] || 0 }})</span></div
> >
</a-tooltip> <template #content>
<div class="text-[14px] font-medium text-[var(--color-text-1)]">
{{ moduleNamePath }}
<span class="text-[var(--color-text-4)]">({{ props.modulesCount[props.activeFolder] || 0 }})</span>
</div>
</template>
</a-popover>
</template> </template>
<template #right> <template #right>
<a-radio-group v-model:model-value="showType" type="button" class="file-show-type"> <a-radio-group v-model:model-value="showType" type="button" class="file-show-type">
@ -48,7 +49,7 @@
</template> </template>
<template #name="{ record, rowIndex }"> <template #name="{ record, rowIndex }">
<a-button type="text" class="flex w-full" @click="showCaseDetail(record.id, rowIndex)">{{ <a-button type="text" class="flex w-full" @click="showCaseDetail(record.id, rowIndex)">{{
record.name characterLimit(record.name)
}}</a-button> }}</a-button>
</template> </template>
<template #updateUserName="{ record }"> <template #updateUserName="{ record }">
@ -1590,4 +1591,7 @@
} }
} }
} }
// :deep(.moduleNameClass) {
// box-shadow: 0 3px 14px 2px rgba(0/ 0/0 5%), 0 8px 10px 1px rgba(0/ 0/0 6%), 0 5px 5px -3px rgba(0/ 0/0 1%);
// }
</style> </style>

View File

@ -73,17 +73,18 @@
@refresh="fetchData()" @refresh="fetchData()"
> >
<template #left> <template #left>
<a-tooltip <a-popover title="" position="bottom">
:content="moduleNamePath + '(' + (recycleModulesCount[activeFolder] || 0) + ')'"
position="bottom"
background-color="#FFFFFF"
:content-style="{ color: '#000000' }"
>
<div class="one-line-text max-h-[32px] max-w-[116px] text-[var(--color-text-1)]" <div class="one-line-text max-h-[32px] max-w-[116px] text-[var(--color-text-1)]"
>{{ moduleNamePath }} >{{ moduleNamePath }}
<span class="text-[var(--color-text-4)]"> ({{ recycleModulesCount[activeFolder] || 0 }})</span></div <span class="text-[var(--color-text-4)]"> ({{ recycleModulesCount[activeFolder] || 0 }})</span></div
> >
</a-tooltip> <template #content>
<div class="text-[14px] font-medium text-[var(--color-text-1)]">
{{ moduleNamePath }}
<span class="text-[var(--color-text-4)]">({{ recycleModulesCount[activeFolder] || 0 }})</span>
</div>
</template>
</a-popover>
</template> </template>
</MsAdvanceFilter> </MsAdvanceFilter>
<ms-base-table <ms-base-table

View File

@ -52,16 +52,17 @@
@search="getFetch" @search="getFetch"
@press-enter="getFetch" @press-enter="getFetch"
@clear="resetFetch" @clear="resetFetch"
@input="changeHandler"
></a-input-search> ></a-input-search>
</div> </div>
</div> </div>
<ms-base-table v-if="showType === 'link'" ref="tableRef" v-bind="linkPropsRes" v-on="linkTableEvent"> <ms-base-table v-if="showType === 'link'" ref="tableRef" v-bind="linkPropsRes" v-on="linkTableEvent">
<template #name="{ record }"> <template #name="{ record }">
<span class="one-line-text max-w-[300px]"> {{ record.name }}</span> <span class="one-line-text max-w-[300px]"> {{ record.name }}</span>
<a-popover title="" position="right" style="width: 480px"> <a-popover title="" position="right" style="width: 480px">
<span class="ml-1 text-[rgb(var(--primary-5))]">{{ t('caseManagement.featureCase.preview') }}</span> <span class="ml-1 text-[rgb(var(--primary-5))]">{{ t('caseManagement.featureCase.preview') }}</span>
<template #content> <template #content>
<div class="markdown-body" style="margin-left: 48px" v-html="record.content"> </div> <div v-dompurify-html="record.content" class="markdown-body" style="margin-left: 48px"> </div>
</template> </template>
</a-popover> </a-popover>
</template> </template>
@ -532,6 +533,13 @@
total.value = res.total; total.value = res.total;
} }
function changeHandler() {
console.log(keyword.value);
if (keyword.value.trim().length === 0) {
getFetch();
}
}
onMounted(() => { onMounted(() => {
getFetch(); getFetch();
initFilterOptions(); initFilterOptions();

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="mb-4 flex items-center justify-between"> <div class="mb-4 flex items-center justify-between break-words break-all">
<div class="font-medium">{{ t('caseManagement.featureCase.commentList') }}</div> <div class="font-medium">{{ t('caseManagement.featureCase.commentList') }}</div>
<div> <div>
<a-radio-group v-model="activeComment" type="button"> <a-radio-group v-model="activeComment" type="button">
@ -52,12 +52,19 @@
<div class="markdown-body" style="margin-left: 48px" v-html="item.contentText"></div> <div class="markdown-body" style="margin-left: 48px" v-html="item.contentText"></div>
<div class="ml-[48px] mt-[8px] text-[var(--color-text-4)]"> <div class="ml-[48px] mt-[8px] text-[var(--color-text-4)]">
{{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }} {{ dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') }}
<span v-if="item.deleted" class="ml-[16px]"> <a-tooltip :content="item.reviewName" :mouse-enter-delay="300">
{{ item.reviewName }} <span v-if="item.deleted" class="one-text-line ml-[16px] max-w-[300px] break-words break-all">
</span> {{ characterLimit(item.reviewName) }}
<span v-else class="ml-[16px] cursor-pointer text-[rgb(var(--primary-5))]" @click="review(item)"> </span>
{{ item.reviewName }}
</span> <span
v-else
class="one-text-line ml-[16px] max-w-[300px] cursor-pointer break-words break-all text-[rgb(var(--primary-5))]"
@click="review(item)"
>
{{ characterLimit(item.reviewName) }}
</span>
</a-tooltip>
</div> </div>
</div> </div>
<MsEmpty v-if="reviewCommentList.length === 0" /> <MsEmpty v-if="reviewCommentList.length === 0" />
@ -87,6 +94,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import useFeatureCaseStore from '@/store/modules/case/featureCase'; import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { characterLimit } from '@/utils';
import { hasAnyPermission } from '@/utils/permission'; import { hasAnyPermission } from '@/utils/permission';
import { CaseManagementRouteEnum } from '@/enums/routeEnum'; import { CaseManagementRouteEnum } from '@/enums/routeEnum';

View File

@ -1,6 +1,6 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<div class="caseDetailWrapper ml-1"> <div class="caseDetailWrapper ml-1 !break-words break-all">
<a-form ref="caseFormRef" class="rounded-[4px]" :model="detailForm" layout="vertical"> <a-form ref="caseFormRef" class="rounded-[4px]" :model="detailForm" layout="vertical">
<a-form-item <a-form-item
class="relative" class="relative"

View File

@ -172,56 +172,37 @@ export function getTableFields(customFields: CustomAttributes[], itemDataIndex:
export function initFormCreate(customFields: CustomAttributes[], permission: string[]) { export function initFormCreate(customFields: CustomAttributes[], permission: string[]) {
return customFields.map((item: any) => { return customFields.map((item: any) => {
const multipleType = ['MULTIPLE_SELECT', 'CHECKBOX', 'MULTIPLE_MEMBER', 'MULTIPLE_INPUT']; const multipleType = ['MULTIPLE_SELECT', 'CHECKBOX'];
const numberType = ['INT', 'FLOAT']; const numberType = ['INT', 'FLOAT'];
const memberType = ['MEMBER', 'MULTIPLE_MEMBER']; const memberType = ['MEMBER', 'MULTIPLE_MEMBER'];
const multipleInputType = ['MULTIPLE_INPUT'];
const singleType = ['SELECT', 'RADIO'];
let currentDefaultValue; let currentDefaultValue;
let optionsValue = item.options; const optionsValue = item.options || [];
// 处理数字类型 // 处理数字类型
if (numberType.includes(item.type)) { if (numberType.includes(item.type)) {
currentDefaultValue = item.defaultValue * 1; currentDefaultValue = Number(item.defaultValue);
// 处理多选项类型为空的默认值 // 处理多选项类型为空的默认值
} else if (multipleType.includes(item.type) && Array.isArray(item.defaultValue) && item.defaultValue.length === 0) { } else if (multipleType.includes(item.type) && Array.isArray(item.defaultValue) && item.defaultValue.length === 0) {
currentDefaultValue = item.defaultValue; currentDefaultValue = item.defaultValue;
// 处理多选情况 // 处理多选情况
} else if (multipleType.includes(item.type)) { } else if (multipleType.includes(item.type)) {
if (item.type !== 'MULTIPLE_INPUT' && !item.type.includes('MEMBER')) { const tempValue = JSON.parse(item.defaultValue);
const tempValue = JSON.parse(item.defaultValue); const optionsIds = optionsValue.map((e: any) => e.value);
const optionsIds = item.options?.map((e: any) => e.value); currentDefaultValue = (optionsIds || []).filter((e: any) => tempValue.includes(e));
currentDefaultValue = optionsIds.filter((e: any) => tempValue.includes(e));
// 多选成员
} else if (memberType.includes(item.type)) {
optionsValue = [
{
fieldId: item.fieldId,
internal: item.internal,
text: userStore.name || '',
value: userStore.id || '',
},
];
// 多选成员没有选择CREATE_USER
if (Array.isArray(item.defaultValue) && !item.defaultValue.includes('CREATE_USER')) {
currentDefaultValue = [];
// 选择了创建人
} else if (item.defaultValue.includes('CREATE_USER')) {
currentDefaultValue = [userStore.id];
// 已选择成员
} else {
currentDefaultValue = JSON.parse(item.defaultValue);
}
} else {
currentDefaultValue = JSON.parse(item.defaultValue);
}
} else if (memberType.includes(item.type)) { } else if (memberType.includes(item.type)) {
optionsValue = [ if (Array.isArray(item.defaultValue) && !item.defaultValue.includes('CREATE_USER')) {
{ currentDefaultValue = item.type === 'MEMBER' ? '' : [];
fieldId: item.fieldId, } else if (item.defaultValue.includes('CREATE_USER')) {
internal: item.internal, currentDefaultValue = item.type === 'MEMBER' ? '' : [];
text: userStore.name || '', } else {
value: userStore.id || '', currentDefaultValue = item.type === 'MEMBER' ? item.defaultValue : JSON.parse(item.defaultValue);
}, }
]; } else if (multipleInputType.includes(item.type)) {
currentDefaultValue = item.defaultValue; currentDefaultValue = JSON.parse(item.defaultValue);
} else if (singleType.includes(item.type)) {
const optionsIds = optionsValue.map((e: any) => e.value);
currentDefaultValue = (optionsIds || []).find((e: any) => item.defaultValue === e) || '';
} else { } else {
currentDefaultValue = item.defaultValue; currentDefaultValue = item.defaultValue;
} }

View File

@ -280,12 +280,12 @@
confirmLoading.value = true; confirmLoading.value = true;
const { status, params } = form; const { status, params } = form;
paramsList.value = JSON.parse(params); paramsList.value = JSON.parse(params);
const paramTableList = paramsList.value.slice(0, -1); // const paramTableList = paramsList.value.slice(0, -1);
const paramsObj: AddOrUpdateCommonScript = { const paramsObj: AddOrUpdateCommonScript = {
...form, ...form,
status: status || 'DRAFT', status: status || 'DRAFT',
projectId: currentProjectId.value, projectId: currentProjectId.value,
params: JSON.stringify(paramTableList), params,
}; };
await addOrUpdateCommonScriptReq(paramsObj); await addOrUpdateCommonScriptReq(paramsObj);
showScriptDrawer.value = false; showScriptDrawer.value = false;

View File

@ -421,7 +421,7 @@
} else if (route.query.type === 'API') { } else if (route.query.type === 'API') {
routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL; routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL;
} else { } else {
routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL; routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL;
} }
}); });
</script> </script>

View File

@ -93,12 +93,30 @@
/> />
</a-form-item> </a-form-item>
<!-- 日期和数值 --> <!-- 日期和数值 -->
<a-form-item <a-form-item
v-if="showDateOrNumber?.length" v-if="fieldForm.type === 'NUMBER'"
field="selectFormat" field="selectFormat"
:label=" :label="t('system.orgTemplate.numberFormat')"
fieldForm.type === 'NUMBER' ? t('system.orgTemplate.numberFormat') : t('system.orgTemplate.dateFormat') asterisk-position="end"
" >
<a-select
v-model="selectNumber"
class="w-[260px]"
:placeholder="t('system.orgTemplate.formatPlaceholder')"
allow-clear
:default-value="numberTypeOptions[0].value"
:disabled="isEdit"
>
<a-option v-for="item of numberTypeOptions" :key="item.value" :value="item.value">
<div class="flex items-center">{{ item.label }}</div>
</a-option>
</a-select>
</a-form-item>
<a-form-item
v-if="fieldForm.type === 'DATE'"
field="selectFormat"
:label="t('system.orgTemplate.dateFormat')"
asterisk-position="end" asterisk-position="end"
> >
<a-select <a-select
@ -107,8 +125,9 @@
:placeholder="t('system.orgTemplate.formatPlaceholder')" :placeholder="t('system.orgTemplate.formatPlaceholder')"
allow-clear allow-clear
:disabled="isEdit" :disabled="isEdit"
:default-value="dateOptions[0].value"
> >
<a-option v-for="item of showDateOrNumber" :key="item.value" :value="item.value"> <a-option v-for="item of dateOptions" :key="item.value" :value="item.value">
<div class="flex items-center">{{ item.label }}</div> <div class="flex items-center">{{ item.label }}</div>
</a-option> </a-option>
</a-select> </a-select>
@ -138,7 +157,7 @@
import type { AddOrUpdateField, fieldIconAndNameModal, FieldOptions } from '@/models/setting/template'; import type { AddOrUpdateField, fieldIconAndNameModal, FieldOptions } from '@/models/setting/template';
import { fieldIconAndName, getFieldRequestApi, getFieldType } from './fieldSetting'; import { dateOptions, fieldIconAndName, getFieldRequestApi, getFieldType, numberTypeOptions } from './fieldSetting';
const { t } = useI18n(); const { t } = useI18n();
const route = useRoute(); const route = useRoute();
@ -174,6 +193,7 @@
const fieldForm = ref<AddOrUpdateField>({ ...initFieldForm }); const fieldForm = ref<AddOrUpdateField>({ ...initFieldForm });
const isEdit = ref<boolean>(false); const isEdit = ref<boolean>(false);
const selectFormat = ref<FormItemType>(); // const selectFormat = ref<FormItemType>(); //
const selectNumber = ref<FormItemType>(); //
const isMultipleSelectMember = ref<boolean | undefined>(false); // const isMultipleSelectMember = ref<boolean | undefined>(false); //
const fieldType = ref<FormItemType>(); // const fieldType = ref<FormItemType>(); //
@ -183,18 +203,6 @@
return showOptionsType.includes(fieldForm.value.type as FormItemType); return showOptionsType.includes(fieldForm.value.type as FormItemType);
}); });
//
const showDateOrNumber = computed(() => {
// if (getFieldType(fieldForm.value.type)[0]) {
// selectFormat.value = getFieldType(fieldForm.value.type)[0]?.value;
// if (fieldForm.value.type) return getFieldType(fieldForm.value.type);
// }
selectFormat.value = getFieldType(fieldForm.value.type)[0]?.value;
if (fieldForm.value.type) {
return getFieldType(fieldForm.value.type);
}
});
// -1. // -1.
const onlyOptions: Ref<FormItemModel> = ref({ const onlyOptions: Ref<FormItemModel> = ref({
filed: 'text', filed: 'text',
@ -263,7 +271,7 @@
formCopy.scene = route.query.type; formCopy.scene = route.query.type;
formCopy.scopeId = scopeId.value; formCopy.scopeId = scopeId.value;
// //
if (selectFormat.value) { if (selectFormat.value) {
formCopy.type = selectFormat.value; formCopy.type = selectFormat.value;
} }
@ -273,9 +281,9 @@
formCopy.type = isMultipleSelectMember.value ? 'MULTIPLE_MEMBER' : 'MEMBER'; formCopy.type = isMultipleSelectMember.value ? 'MULTIPLE_MEMBER' : 'MEMBER';
} }
// //
if (selectFormat.value) { if (selectNumber.value) {
formCopy.type = selectFormat.value; formCopy.type = selectNumber.value;
} }
// //
@ -362,10 +370,10 @@
const getSpecialHandler = (itemType: FormItemType): FormItemType => { const getSpecialHandler = (itemType: FormItemType): FormItemType => {
switch (itemType) { switch (itemType) {
case 'INT': case 'INT':
selectFormat.value = itemType; selectNumber.value = itemType;
return 'NUMBER'; return 'NUMBER';
case 'FLOAT': case 'FLOAT':
selectFormat.value = itemType; selectNumber.value = itemType;
return 'NUMBER'; return 'NUMBER';
case 'MULTIPLE_MEMBER': case 'MULTIPLE_MEMBER':
return 'MEMBER'; return 'MEMBER';

View File

@ -38,7 +38,7 @@ const { t } = useI18n();
const templateStore = useTemplateStore(); const templateStore = useTemplateStore();
// 字段类型-日期 // 字段类型-日期
const dateOptions: { label: string; value: FormItemType }[] = [ export const dateOptions: { label: string; value: FormItemType }[] = [
{ {
label: dayjs().format('YYYY-MM-DD'), label: dayjs().format('YYYY-MM-DD'),
value: 'DATE', value: 'DATE',
@ -50,7 +50,7 @@ const dateOptions: { label: string; value: FormItemType }[] = [
]; ];
// 字段类型- 数字 // 字段类型- 数字
const numberTypeOptions: { label: string; value: FormItemType }[] = [ export const numberTypeOptions: { label: string; value: FormItemType }[] = [
{ {
label: '整数', label: '整数',
value: 'INT', value: 'INT',