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