fix(测试用例): 修复用例拖拽无更新权限无法拖拽

This commit is contained in:
xinxin.wu 2024-06-26 10:34:40 +08:00 committed by 刘瑞斌
parent 43b0e2ec2f
commit 5fb19aa6de
2 changed files with 40 additions and 15 deletions

View File

@ -4,7 +4,6 @@
<div class="circle text-[12px] font-medium"> {{ rowIndex + 1 }}</div> <div class="circle text-[12px] font-medium"> {{ rowIndex + 1 }}</div>
</template> </template>
<template v-if="!props.isTestPlan" #caseStep="{ record }"> <template v-if="!props.isTestPlan" #caseStep="{ record }">
<!-- v-if="record.showStep" -->
<a-textarea <a-textarea
:ref="(el: refItem) => setStepRefMap(el, record)" :ref="(el: refItem) => setStepRefMap(el, record)"
v-model="record.step" v-model="record.step"
@ -81,7 +80,7 @@
import { TableChangeExtra, TableData } from '@arco-design/web-vue'; import { TableChangeExtra, TableData } from '@arco-design/web-vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import { MsTableColumn } from '@/components/pure/ms-table/type'; import { MsTableColumn, MsTableProps } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
@ -93,7 +92,6 @@
import type { StepList } from '@/models/caseManagement/featureCase'; import type { StepList } from '@/models/caseManagement/featureCase';
import { LastExecuteResults } from '@/enums/caseEnum'; import { LastExecuteResults } from '@/enums/caseEnum';
import { TableKeyEnum } from '@/enums/tableEnum';
import { executionResultMap } from '@/views/case-management/caseManagementFeature/components/utils'; import { executionResultMap } from '@/views/case-management/caseManagementFeature/components/utils';
@ -209,18 +207,29 @@
return stepData.value.length <= 1 ? moreActions.slice(0, moreActions.length - 2) : moreActions; return stepData.value.length <= 1 ? moreActions.slice(0, moreActions.length - 2) : moreActions;
}); });
const { propsRes, propsEvent, setProps } = useTable(undefined, { const tableProps = ref<Partial<MsTableProps<StepList>>>({
tableKey: TableKeyEnum.CASE_MANAGEMENT_DETAIL_TABLE,
columns: templateFieldColumns.value, columns: templateFieldColumns.value,
scroll: { x: '100%', y: props.isScrollY ? 400 : '' }, scroll: { x: '100%', y: props.isScrollY ? 400 : '' },
selectable: false, selectable: false,
noDisable: true, noDisable: true,
size: 'default',
showSetting: false, showSetting: false,
showPagination: false, showPagination: false,
draggable: { type: 'handle' }, draggable: { type: 'handle' },
draggableCondition: true,
}); });
const { propsRes, propsEvent, setProps } = useTable(undefined, tableProps.value);
watch(
() => props.isDisabled,
(val) => {
tableProps.value.draggableCondition = !val;
},
{
immediate: true,
}
);
// //
function copyStep(record: StepList) { function copyStep(record: StepList) {
const index = stepData.value.map((item: any) => item.id).indexOf(record.id); const index = stepData.value.map((item: any) => item.id).indexOf(record.id);

View File

@ -325,6 +325,7 @@
import MsIcon from '@/components/pure/ms-icon-font/index.vue'; import MsIcon from '@/components/pure/ms-icon-font/index.vue';
import MsBaseTable from '@/components/pure/ms-table/base-table.vue'; import MsBaseTable from '@/components/pure/ms-table/base-table.vue';
import type { BatchActionParams, BatchActionQueryParams, MsTableColumn } from '@/components/pure/ms-table/type'; import type { BatchActionParams, BatchActionQueryParams, MsTableColumn } from '@/components/pure/ms-table/type';
import { MsTableProps } from '@/components/pure/ms-table/type';
import useTable from '@/components/pure/ms-table/useTable'; import useTable from '@/components/pure/ms-table/useTable';
import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue'; import MsTableMoreAction from '@/components/pure/ms-table-more-action/index.vue';
import { ActionsItem } from '@/components/pure/ms-table-more-action/types'; import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
@ -832,9 +833,7 @@
} }
const initDefaultFields = ref<CustomAttributes[]>([]); const initDefaultFields = ref<CustomAttributes[]>([]);
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setKeyword, setAdvanceFilter } = useTable( const tableProps = ref<Partial<MsTableProps<CaseManagementTable>>>({
getCaseList,
{
tableKey: TableKeyEnum.CASE_MANAGEMENT_TABLE, tableKey: TableKeyEnum.CASE_MANAGEMENT_TABLE,
selectable: true, selectable: true,
showSetting: true, showSetting: true,
@ -842,7 +841,12 @@
draggable: { type: 'handle' }, draggable: { type: 'handle' },
showSubdirectory: true, showSubdirectory: true,
paginationSize: 'mini', paginationSize: 'mini',
}, draggableCondition: true,
});
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setKeyword, setAdvanceFilter } = useTable(
getCaseList,
tableProps.value,
(record) => { (record) => {
return { return {
...record, ...record,
@ -860,6 +864,18 @@
updateCaseName updateCaseName
); );
const hasUpdatePermission = computed(() => hasAnyPermission(['FUNCTIONAL_CASE:READ+UPDATE']));
watch(
() => hasUpdatePermission.value,
(val) => {
tableProps.value.draggableCondition = val;
},
{
immediate: true,
}
);
const batchParams = ref<BatchActionQueryParams>({ const batchParams = ref<BatchActionQueryParams>({
selectedIds: [], selectedIds: [],
selectAll: false, selectAll: false,