diff --git a/src/utils/enum/node.ts b/src/utils/enum/node.ts index e63d14fd..e39ab68f 100644 --- a/src/utils/enum/node.ts +++ b/src/utils/enum/node.ts @@ -16,7 +16,8 @@ export enum NODE_TYPE { /** 混合类型,不是某一个具体的nodeType,合并多个 nodeType 的属性到一个 node 上时使用 */ MIXED = 'mixed', /** 算例 */ - RUN = 'run' + RUN = 'run', + WORKSPACE = 'workspace' } export enum LEVEL_TYPE { /** 非任务和指标 */ diff --git a/src/views/task/execution/components/filterProject/index.vue b/src/views/task/execution/components/filterProject/index.vue index d297c53e..1e19ba0d 100644 --- a/src/views/task/execution/components/filterProject/index.vue +++ b/src/views/task/execution/components/filterProject/index.vue @@ -75,7 +75,7 @@ const props = defineProps({ default: () => { }, }, }); -const emits = defineEmits(['filterParamChangeFn']); +const emits = defineEmits(['filterParamChangeFn', 'expandTree']); const filterFormData = reactive({ ProjectType: '', @@ -93,7 +93,7 @@ const dropdownList = ref([ value: 'all', }, { - name: '节点', + name: '工位', value: 'node', }, { @@ -108,6 +108,8 @@ const dropdownList = ref([ const expendChangeFn = (data: string) => { filterFormData.expendType = data; + + emits('expandTree', data); // filterParamChangeFn(); }; diff --git a/src/views/task/execution/components/leftTaskTree/index.vue b/src/views/task/execution/components/leftTaskTree/index.vue index af48c583..01b1d7a6 100644 --- a/src/views/task/execution/components/leftTaskTree/index.vue +++ b/src/views/task/execution/components/leftTaskTree/index.vue @@ -2,7 +2,7 @@
- +
([]); + +const changeExpendTypeFn = (data:any) => { + defaultExpandKeys.value = []; + setExpandElementFn(dataSource.value, data); + for (const key in taskTreeRef.value.store.nodesMap) { + if (defaultExpandKeys.value.includes(key)) { + taskTreeRef.value.store.nodesMap[key].expanded = true; + } else { + taskTreeRef.value.store.nodesMap[key].expanded = false; + } + } +}; + +const setExpandElementFn = (list:any, flag:any = 'all') => { + + for (let i = 0;i < list.length;i++) { + if (flag === 'all') { + defaultExpandKeys.value.push(list[i].id); + } + + if (flag === 'node') { + if (list[i].nodeType === NODE_TYPE.WORKSPACE) { + defaultExpandKeys.value.push(list[i].id); + } + } + + if (flag === 'task') { + if (list[i].nodeType === NODE_TYPE.TASK) { + defaultExpandKeys.value.push(list[i].id); + } + } + + if (flag === 'run') { + if (list[i].nodeType === NODE_TYPE.RUN) { + defaultExpandKeys.value.push(list[i].id); + } + } + + if (list[i]?.children?.length) { + setExpandElementFn(list[i]?.children, flag); + } + } + +}; + // 过滤数内容 const filterParamChangeFn = async (data: any) => { // currentNodeInfo.value = {}; emits('nodeClickFn', { node: currentNodeInfo.value }); await getTaskRunTreeDataFn(data); + console.log(defaultExpandKeys.value, 'defaultExpandKeys.value'); + }; const dataSource = ref([ diff --git a/src/views/task/execution/components/leftTaskTree/operateComponent/createRunDiv.vue b/src/views/task/execution/components/leftTaskTree/operateComponent/createRunDiv.vue index ddaef4dc..1e8505c0 100644 --- a/src/views/task/execution/components/leftTaskTree/operateComponent/createRunDiv.vue +++ b/src/views/task/execution/components/leftTaskTree/operateComponent/createRunDiv.vue @@ -113,10 +113,10 @@ const handleCloseFn = () => { // 确认事件 const createSuccessFn = () => { if (!runInfoFormData.templateName) { - runInfoFormData.templateName = 1; + // runInfoFormData.templateName = 1; - // ElMessage.warning('未选择流程模板,无法新建算例!'); - // return; + ElMessage.warning('未选择流程模板,无法新建算例!'); + return; } if ( operateType.value != 'editRun') { @@ -136,7 +136,7 @@ const createSuccessFn = () => { // 拼接改变 const changeJoinFn = () => { if (runInfoFormData.isJointProjectInfo) { - runInfoFormData.runNames = props.divInfo.nodeName || props.divInfo.runName + '_算例' + new Date().getTime(); + runInfoFormData.runNames = props.divInfo.nodeName || props.divInfo.runName + '_V1' ; } else { runInfoFormData.runNames = '算例_' + 'V1'; } @@ -173,7 +173,7 @@ watch(() => props.operateFlag, (newVal) => { // 如果是新增算例 if (props.divInfo && props.divInfo?.nodeType === NODE_TYPE.TASK) { if (runInfoFormData.isJointProjectInfo) { - runInfoFormData.runNames = props.divInfo.nodeName + '_算例' + new Date().getTime(); + runInfoFormData.runNames = props.divInfo.nodeName + '_算例V1' ; } runInfoFormData.templateName = props.divInfo.flowTemplateName; } @@ -181,7 +181,7 @@ watch(() => props.operateFlag, (newVal) => { // 如果是新增子算例或者复制算例 if (props.divInfo && props.divInfo?.nodeType === NODE_TYPE.RUN) { if (runInfoFormData.isJointProjectInfo) { - runInfoFormData.runNames = props.divInfo.runName + '_算例' + new Date().getTime(); + runInfoFormData.runNames = props.divInfo.runName + '_算例V1'; } runInfoFormData.templateName = props.divInfo.flowTemplateName; }