fix(用例管理): 修复增加需求未校验需求URL以及部分权限问题

--bug=1036101 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036101
--bug=1037142 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037142
--bug=1037145 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001037145
This commit is contained in:
guoyuqi 2024-03-13 20:24:00 +08:00 committed by Craftsman
parent 435e1c193d
commit dac0d93608
8 changed files with 67 additions and 24 deletions

View File

@ -76,7 +76,7 @@ public class FunctionalCaseDemandController {
@PostMapping("/third/list/page")
@Operation(summary = "用例管理-功能用例-关联需求-获取三方需求列表")
@RequiresPermissions(value = {PermissionConstants.FUNCTIONAL_CASE_READ_ADD, PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, PermissionConstants.FUNCTIONAL_CASE_READ_DELETE}, logical = Logical.OR)
@RequiresPermissions(value = {PermissionConstants.FUNCTIONAL_CASE_READ, PermissionConstants.FUNCTIONAL_CASE_READ_ADD, PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE, PermissionConstants.FUNCTIONAL_CASE_READ_DELETE}, logical = Logical.OR)
public PluginPager<PlatformDemandDTO> pageDemand(@RequestBody @Validated FunctionalThirdDemandPageRequest request) {
return functionalCaseDemandService.pageDemand(request);
}

View File

@ -80,6 +80,7 @@
import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal';
import useFeatureCaseStore from '@/store/modules/case/featureCase';
import { hasAnyPermission } from '@/utils/permission';
import { CaseManagementRouteEnum } from '@/enums/routeEnum';
@ -119,21 +120,25 @@
}
async function getAllCommentList() {
switch (activeComment.value) {
case 'caseComment':
await initCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'reviewComment':
await initReviewCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'executiveComment':
await initCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
default:
break;
if (hasAnyPermission(['FUNCTIONAL_CASE:READ+COMMENT'])) {
switch (activeComment.value) {
case 'caseComment':
await initCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'reviewComment':
await initReviewCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
case 'executiveComment':
await initCommentList();
featureCaseStore.getCaseCounts(props.caseId);
break;
default:
break;
}
} else {
Message.error(t('common.noPermission'));
}
}

View File

@ -12,6 +12,7 @@
<span> {{ characterLimit(title) }}</span>
</a-tooltip>
</template>
<div class="form">
<a-form ref="demandFormRef" :model="modelForm" size="large" layout="vertical">
<a-form-item :label="t('caseManagement.featureCase.tableColumnID')" asterisk-position="end" field="demandId">
@ -33,7 +34,26 @@
:placeholder="t('caseManagement.featureCase.pleaseEnterTitle')"
/>
</a-form-item>
<a-form-item :label="t('caseManagement.featureCase.requirementUrl')" asterisk-position="end" field="demandUrl">
<a-form-item
:label="t('caseManagement.featureCase.requirementUrl')"
asterisk-position="end"
field="demandUrl"
:rules="[
{
validator(value, cb) {
if (value) {
if (regexUrl.test(value)) {
return cb();
} else {
return cb(t('caseManagement.featureCase.pleaseEnterCorrectURLFormat'));
}
} else {
return cb();
}
},
},
]"
>
<a-input
v-model="modelForm.demandUrl"
:max-length="255"
@ -54,11 +74,11 @@
<script setup lang="ts">
import { ref } from 'vue';
import { FormInstance, Message, ValidatedError } from '@arco-design/web-vue';
import { FormInstance, ValidatedError } from '@arco-design/web-vue';
import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store';
import { characterLimit } from '@/utils';
import { characterLimit, regexUrl } from '@/utils';
import type { CreateOrUpdateDemand, DemandFormList, DemandItem } from '@/models/caseManagement/featureCase';

View File

@ -2,10 +2,20 @@
<div>
<div class="mb-4 flex items-center justify-between">
<div>
<a-button v-if="platformInfo.platform_key" type="primary" @click="associatedDemand">
<a-button
v-if="platformInfo.platform_key"
v-permission="['FUNCTIONAL_CASE:READ+ADD', 'FUNCTIONAL_CASE:READ+UPDATE', 'FUNCTIONAL_CASE:READ+DELETE']"
type="primary"
@click="associatedDemand"
>
{{ t('caseManagement.featureCase.associatedDemand') }}</a-button
>
<a-button class="mx-3" type="outline" @click="addDemand">
<a-button
v-permission="['FUNCTIONAL_CASE:READ+ADD', 'FUNCTIONAL_CASE:READ+UPDATE', 'FUNCTIONAL_CASE:READ+DELETE']"
class="mx-3"
type="outline"
@click="addDemand"
>
{{ t('caseManagement.featureCase.addDemand') }}</a-button
>
</div>

View File

@ -2,10 +2,16 @@
<div>
<div class="mb-4 flex items-center justify-between">
<div>
<a-button v-if="showType === 'preposition'" class="mr-3" type="primary" @click="addCase">
<a-button
v-if="showType === 'preposition'"
v-permission="['FUNCTIONAL_CASE:READ+UPDATE']"
class="mr-3"
type="primary"
@click="addCase"
>
{{ t('caseManagement.featureCase.addPresetCase') }}
</a-button>
<a-button v-else type="primary" @click="addCase">
<a-button v-else v-permission="['FUNCTIONAL_CASE:READ+UPDATE']" type="primary" @click="addCase">
{{ t('caseManagement.featureCase.addPostCase') }}
</a-button>
</div>

View File

@ -156,6 +156,7 @@ export default {
'caseManagement.featureCase.pleaseEnterTitle': 'Please enter a requirement title',
'caseManagement.featureCase.requirementUrl': 'Demand url',
'caseManagement.featureCase.pleaseEnterRequirementUrl': 'Please input requirements url',
'caseManagement.featureCase.pleaseEnterCorrectURLFormat': 'Please enter the correct URL format',
'caseManagement.featureCase.cancelAssociation': 'Cancel Association',
'caseManagement.featureCase.caseDetailTitle': '【{id}】{name}',
'caseManagement.featureCase.share': 'share',

View File

@ -155,6 +155,7 @@ export default {
'caseManagement.featureCase.pleaseEnterTitle': '请输入需求标题',
'caseManagement.featureCase.requirementUrl': '需求地址',
'caseManagement.featureCase.pleaseEnterRequirementUrl': '请输入需求地址',
'caseManagement.featureCase.pleaseEnterCorrectURLFormat': '请输入正确的URL格式',
'caseManagement.featureCase.cancelAssociation': '取消关联',
'caseManagement.featureCase.caseDetailTitle': '【{id}】{name}',
'caseManagement.featureCase.share': '分享',

View File

@ -49,7 +49,7 @@
<MsIcon type="icon-icon_copy_outlined" class="mr-[8px]" />
{{ t('common.copy') }}
</MsButton>
<MsButton type="button" status="default" :loading="followLoading" @click="toggleFollowReview">
<MsButton v-permission="['CASE_REVIEW:READ+UPDATE']" type="button" status="default" :loading="followLoading" @click="toggleFollowReview">
<MsIcon
:type="reviewDetail.followFlag ? 'icon-icon_collect_filled' : 'icon-icon_collection_outlined'"
:class="`mr-[8px] ${reviewDetail.followFlag ? 'text-[rgb(var(--warning-6))]' : ''}`"