Skip to content

Commit

Permalink
fix: 创建任务-默认节点勾选逻辑同步 --bug=119078037
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 2396
  • Loading branch information
ywywZhou authored and luofann committed Jan 31, 2024
1 parent 9aba5a0 commit a59e25a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/desktop/src/pages/task/TaskCreate/TaskScheme.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
this.schemeList.forEach(scheme => {
this.$set(scheme, 'isChecked', false)
this.$set(scheme, 'isDefault', false)
if (this.defaultSchemeList.includes(scheme.id)) {
if (this.viewMode !== 'appmaker' && this.defaultSchemeList.includes(scheme.id)) {
scheme.isDefault = true
if (!reuseTaskId && this.viewMode !== 'appmaker') { // 优先复用变量的勾选
scheme.isChecked = true
Expand Down
11 changes: 8 additions & 3 deletions frontend/desktop/src/pages/task/TaskCreate/TaskSelectNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@onSelectSubflow="onSelectSubflow">
</NodePreview>
<component
v-if="!templateLoading"
:is="schemeTemplate"
ref="taskScheme"
:project_id="project_id"
Expand Down Expand Up @@ -129,6 +130,10 @@
isEditProcessPage: {
type: Boolean,
default: true
},
isStepChange: {
type: Boolean,
default: true
}
},
data () {
Expand Down Expand Up @@ -234,7 +239,7 @@
selectedNodes.push(item.id)
}
})
this.selectedNodes = this.selectedNodes.length ? this.selectedNodes : selectedNodes
this.selectedNodes = selectedNodes
if (this.viewMode === 'appmaker') {
const appmakerData = await this.loadAppmakerDetail(this.app_id)
Expand All @@ -257,7 +262,6 @@
this.$set(item, 'checked', true)
}
})
this.updateExcludeNodes()
} catch (e) {
if (e.status === 404) {
this.$router.push({ name: 'notFoundPage' })
Expand Down Expand Up @@ -489,7 +493,8 @@
* 设置默认勾选值
*/
async setCanvasSelected (selectNodes = []) {
if (this.viewMode === 'appmaker') return
// 该方法在创建任务路由中只执行一次
if (this.isStepChange || this.viewMode === 'appmaker') return
if (selectNodes.length) {
// 使用传进来的选中节点,取消画布默认全选
this.selectedNodes = selectNodes
Expand Down
11 changes: 11 additions & 0 deletions frontend/desktop/src/pages/task/TaskCreate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
:entrance="entrance"
:template_id="template_id"
:exclude-node="excludeNode"
:is-step-change="isStepChange"
@setExcludeNode="setExcludeNode">
</task-select-node>
<task-param-fill
Expand All @@ -46,6 +47,7 @@
import TaskCreateHeader from '../TaskCreateHeader.vue'
import TaskSelectNode from './TaskSelectNode.vue'
import TaskParamFill from './TaskParamFill.vue'
import { mapMutations } from 'vuex'
const STEP_DICT = [
{
Expand Down Expand Up @@ -79,6 +81,7 @@
return {
stepList: this.addStepIcon(STEP_DICT),
currentStep: this.$route.params.step,
isStepChange: false,
excludeNode: []
}
},
Expand All @@ -93,14 +96,22 @@
this.stepList = this.addStepIcon(STEP_DICT)
}
this.currentStep = val
// 如果step从selectnode跳转到其他则设置为true
this.isStepChange = this.isStepChange || val !== 'selectnode'
}
},
created () {
if (this.$route.name === 'functionTemplateStep') {
this.toggleFunctionalStep(true)
}
},
beforeDestroy () {
this.resetTemplateData()
},
methods: {
...mapMutations('template/', [
'resetTemplateData'
]),
addStepIcon (steps) {
return steps.map((item, index) => Object.assign({}, item, { icon: index + 1 }))
},
Expand Down

0 comments on commit a59e25a

Please sign in to comment.