feat(测试计划): 列表拖拽
This commit is contained in:
parent
153a5a3860
commit
3c464ed536
|
@ -314,10 +314,6 @@
|
|||
const protocolOptions = ref(['HTTP']);
|
||||
const modulesCount = ref<Record<string, any>>({});
|
||||
const isExpandAll = ref(false);
|
||||
// 全部展开或折叠
|
||||
const expandHandler = () => {
|
||||
isExpandAll.value = !isExpandAll.value;
|
||||
};
|
||||
|
||||
// 选中用例类型
|
||||
const caseType = computed({
|
||||
|
|
|
@ -320,9 +320,8 @@
|
|||
border: 1px dashed rgba(var(--primary-5));
|
||||
background-color: rgba(var(--primary-1));
|
||||
}
|
||||
|
||||
:deep(.arco-checkbox-group .arco-checkbox) {
|
||||
margin-right: 20px;
|
||||
margin-top: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<div v-if="$slots.quickCreate" class="ms-base-table-quickCreate">
|
||||
<slot name="quickCreate"></slot>
|
||||
</div>
|
||||
<!-- 表只做自适应不做可拖拽列 -->
|
||||
<a-table
|
||||
v-bind="{ ...$attrs, ...scrollObj }"
|
||||
v-model:selected-keys="originalSelectedKeys"
|
||||
|
@ -241,11 +240,6 @@
|
|||
</div>
|
||||
</slot>
|
||||
</template>
|
||||
|
||||
<!-- 控制拖拽类 -->
|
||||
<template #tr="{ record }">
|
||||
<tr :class="!record.parent ? 'parent-tr' : 'children-tr'" />
|
||||
</template>
|
||||
</a-table>
|
||||
<div
|
||||
v-if="showBatchAction || !!attrs.showPagination"
|
||||
|
@ -637,12 +631,12 @@
|
|||
return;
|
||||
}
|
||||
|
||||
if (extra && extra.dragTarget?.id) {
|
||||
if (extra && extra.dragTarget?.[rowKey || 'id']) {
|
||||
let newDragData: TableData[] = data;
|
||||
let oldDragData: TableData[] = currentData;
|
||||
let oldDragData: TableData[] = attrs.data as TableData[]; // attrs.data 在这仍保留了原本数据顺序
|
||||
|
||||
const newDragItem = getCurrentList(data, 'id', extra.dragTarget.id);
|
||||
const oldDragItem = getCurrentList(currentData, 'key', extra.dragTarget.id);
|
||||
const newDragItem = getCurrentList(data, rowKey || 'id', extra.dragTarget[rowKey || 'id']);
|
||||
const oldDragItem = getCurrentList(oldDragData, rowKey || 'id', extra.dragTarget[rowKey || 'id']);
|
||||
|
||||
if (newDragItem && newDragItem.children && oldDragItem && oldDragItem.children) {
|
||||
newDragData = newDragItem.children;
|
||||
|
@ -652,8 +646,8 @@
|
|||
let oldIndex = 0;
|
||||
let newIndex = 0;
|
||||
|
||||
newIndex = newDragData.findIndex((item: any) => item.id === extra.dragTarget?.id);
|
||||
oldIndex = oldDragData.findIndex((item: any) => item.key === extra.dragTarget?.id);
|
||||
newIndex = newDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']);
|
||||
oldIndex = oldDragData.findIndex((item: any) => item[rowKey || 'id'] === extra.dragTarget?.[rowKey || 'id']);
|
||||
let position: 'AFTER' | 'BEFORE' = 'BEFORE';
|
||||
|
||||
position = newIndex > oldIndex ? 'AFTER' : 'BEFORE';
|
||||
|
@ -661,7 +655,7 @@
|
|||
projectId: appStore.currentProjectId,
|
||||
targetId: '', // 放置目标id
|
||||
moveMode: position,
|
||||
moveId: extra.dragTarget.id as string, // 拖拽id
|
||||
moveId: extra.dragTarget[rowKey || 'id'] as string, // 拖拽id
|
||||
};
|
||||
|
||||
let targetIndex;
|
||||
|
@ -676,9 +670,10 @@
|
|||
params.moveMode = 'AFTER';
|
||||
targetIndex = newIndex - 1;
|
||||
}
|
||||
params.targetId = newDragData[targetIndex]?.id ?? newDragData[newIndex]?.id;
|
||||
params.targetId = newDragData[targetIndex]?.[rowKey || 'id'] ?? newDragData[newIndex]?.[rowKey || 'id'];
|
||||
|
||||
if (params.targetId !== params.moveId) {
|
||||
if (oldIndex !== newIndex) {
|
||||
// 原地移动不触发
|
||||
emit('dragChange', params);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,50 +17,52 @@
|
|||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.authorizationTime') }}</span>
|
||||
<div
|
||||
><span>{{ licenseInfo?.license?.expired }}</span></div
|
||||
>
|
||||
<div>
|
||||
<span>{{ licenseInfo?.license?.expired }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.productName') }}</span>
|
||||
<div
|
||||
><span>{{ licenseInfo?.license?.product }}</span></div
|
||||
>
|
||||
<div>
|
||||
<span>{{ licenseInfo?.license?.product }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.productionVersion') }}</span>
|
||||
<div
|
||||
><span>{{ licenseInfo?.license?.edition }}</span></div
|
||||
>
|
||||
<div>
|
||||
<span>{{ licenseInfo?.license?.edition }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.authorizedVersion') }}</span>
|
||||
<div>
|
||||
<span>{{ licenseInfo?.license?.licenseVersion }}</span></div
|
||||
>
|
||||
<span>{{ licenseInfo?.license?.licenseVersion }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.authorizationsCount') }}</span>
|
||||
<div
|
||||
><span>{{ addCommasToNumber(licenseInfo?.license?.count || 0) }}</span></div
|
||||
>
|
||||
<div>
|
||||
<span>{{ addCommasToNumber(licenseInfo?.license?.count || 0) }}</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<span>{{ t('system.authorized.authorizationStatus') }}</span>
|
||||
<div
|
||||
><span>{{
|
||||
licenseInfo?.status === 'valid'
|
||||
? t('system.authorized.valid')
|
||||
: licenseInfo?.status === 'expired'
|
||||
? t('system.authorized.invalid')
|
||||
: t('system.authorized.failure')
|
||||
}}</span></div
|
||||
>
|
||||
<div>
|
||||
<span
|
||||
>{{
|
||||
licenseInfo?.status === 'valid'
|
||||
? t('system.authorized.valid')
|
||||
: licenseInfo?.status === 'expired'
|
||||
? t('system.authorized.invalid')
|
||||
: t('system.authorized.failure')
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<MsButton v-permission="['SYSTEM_AUTH:READ+UPDATE']" class="font-medium" @click="authChecking">{{
|
||||
t('system.authorized.authorityChecking')
|
||||
}}</MsButton>
|
||||
<MsButton v-permission="['SYSTEM_AUTH:READ+UPDATE']" class="font-medium" @click="authChecking">
|
||||
{{ t('system.authorized.authorityChecking') }}
|
||||
</MsButton>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -43,11 +43,11 @@
|
|||
disabledChildren: true,
|
||||
parentKey: 'parent',
|
||||
}"
|
||||
:first-column-width="32"
|
||||
v-on="propsEvent"
|
||||
@batch-action="handleTableBatch"
|
||||
@filter-change="filterChange"
|
||||
@drag-change="handleDragChange"
|
||||
@sorter-change="saveSort"
|
||||
>
|
||||
<!-- TODO: 快捷创建暂时不上 -->
|
||||
<!-- <template v-if="hasAnyPermission(['PROJECT_TEST_PLAN:READ+ADD'])" #quickCreate>
|
||||
|
@ -907,11 +907,6 @@
|
|||
setLoadListParams(await initTableParams());
|
||||
loadList();
|
||||
}
|
||||
// 排序
|
||||
const sort = ref<{ [key: string]: string }>({});
|
||||
function saveSort(sortObj: { [key: string]: string }) {
|
||||
sort.value = sortObj;
|
||||
}
|
||||
|
||||
// 获取父组件模块数量
|
||||
async function emitTableParams(isInit = false) {
|
||||
|
@ -1482,8 +1477,7 @@
|
|||
() => showType.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
tableProps.value.draggableCondition =
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) && val !== 'TEST_PLAN' && !Object.keys(sort.value).length;
|
||||
tableProps.value.draggableCondition = hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']);
|
||||
setPagination({
|
||||
current: 1,
|
||||
});
|
||||
|
@ -1494,21 +1488,6 @@
|
|||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => sort.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
tableProps.value.draggableCondition =
|
||||
hasAnyPermission(['PROJECT_TEST_PLAN:READ+UPDATE']) &&
|
||||
showType.value !== 'GROUP' &&
|
||||
!Object.keys(sort.value).length;
|
||||
}
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => props.activeFolder,
|
||||
(val) => {
|
||||
|
@ -1646,14 +1625,4 @@
|
|||
padding-top: 8px;
|
||||
color: var(--color-text-1);
|
||||
}
|
||||
:deep(.parent-tr) {
|
||||
.arco-table-drag-handle {
|
||||
pointer-events: none;
|
||||
.arco-table-cell {
|
||||
svg {
|
||||
color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue