fix(功能用例): 修复功能用例模块拖拽实际刷新整个页面才能生效&模块保留
This commit is contained in:
parent
2876373f2d
commit
177e1fb868
|
@ -189,7 +189,9 @@
|
|||
};
|
||||
});
|
||||
featureCaseStore.setModulesTree(caseTree.value);
|
||||
featureCaseStore.setModuleId(['all']);
|
||||
if (!featureCaseStore.moduleId) {
|
||||
featureCaseStore.setModuleId(['all']);
|
||||
}
|
||||
|
||||
if (isSetDefaultKey) {
|
||||
selectedNodeKeys.value = [caseTree.value[0].id];
|
||||
|
@ -295,20 +297,13 @@
|
|||
dropPosition,
|
||||
});
|
||||
Message.success(t('caseManagement.featureCase.moduleMoveSuccess'));
|
||||
emits('dragUpdate');
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
await initModules();
|
||||
const treeNode = ref<MsTreeNodeData | null>(null);
|
||||
treeNode.value = dropNode;
|
||||
treeNode.value.children = [];
|
||||
if (dropPosition === 0) {
|
||||
treeNode.value.children.push(dragNode);
|
||||
}
|
||||
caseNodeSelect(dropNode.id, treeNode.value);
|
||||
emits('dragUpdate');
|
||||
initModules();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
* @description 功能测试-功能用例
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import MsButton from '@/components/pure/ms-button/index.vue';
|
||||
import MsCard from '@/components/pure/ms-card/index.vue';
|
||||
|
@ -190,11 +190,14 @@
|
|||
import type { FileItem } from '@arco-design/web-vue';
|
||||
import Message from '@arco-design/web-vue/es/message';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const appStore = useAppStore();
|
||||
const { t } = useI18n();
|
||||
const currentProjectId = computed(() => appStore.currentProjectId);
|
||||
const featureCaseStore = useFeatureCaseStore();
|
||||
|
||||
const isExpandAll = ref(false);
|
||||
const activeCaseType = ref<'folder' | 'module'>('folder'); // 激活用例类型
|
||||
|
@ -205,7 +208,7 @@
|
|||
isExpandAll.value = !isExpandAll.value;
|
||||
};
|
||||
|
||||
const activeFolder = ref<string>('all');
|
||||
const activeFolder = ref<string>(featureCaseStore.moduleId[0] || 'all');
|
||||
const activeFolderName = ref('');
|
||||
|
||||
// 选中节点
|
||||
|
@ -234,14 +237,13 @@
|
|||
return activeFolder.value === type ? 'folder-text case-active' : 'folder-text';
|
||||
};
|
||||
|
||||
const featureCaseStore = useFeatureCaseStore();
|
||||
// 处理用例树节点选中
|
||||
function caseNodeSelect(keys: string[], _offspringIds: string[], node: MsTreeNodeData) {
|
||||
[activeFolder.value] = keys;
|
||||
activeCaseType.value = 'module';
|
||||
offspringIds.value = [..._offspringIds];
|
||||
featureCaseStore.setModuleId(keys);
|
||||
activeFolderName.value = node.title || node.name;
|
||||
activeFolderName.value = node?.title || node?.name;
|
||||
}
|
||||
|
||||
const confirmLoading = ref(false);
|
||||
|
@ -455,8 +457,18 @@
|
|||
}
|
||||
|
||||
function dragUpdate() {
|
||||
caseTableRef.value.emitTableParams();
|
||||
caseTableRef.value.initData();
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
const routeName = [
|
||||
CaseManagementRouteEnum.CASE_MANAGEMENT_CASE,
|
||||
CaseManagementRouteEnum.CASE_MANAGEMENT_CASE_DETAIL,
|
||||
];
|
||||
if (!routeName.includes(route.name as CaseManagementRouteEnum)) {
|
||||
featureCaseStore.setModuleId(['all']);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
|
Loading…
Reference in New Issue