Browse Source

[Fix-4908][UI] Fix dependent task item cannot delete and select (#4909)

pull/3/MERGE
Shiwen Cheng 4 years ago committed by GitHub
parent
commit
54fc458e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue
  2. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue
  3. 1
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue

34
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/dependItemList.vue

@ -16,17 +16,17 @@
*/ */
<template> <template>
<div class="dep-list-model"> <div class="dep-list-model">
<div v-for="(el,$index) in dependItemList" :key='$index' @click="itemIndex = $index"> <div v-for="(el,$index) in dependItemList" :key='$index'>
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.projectId" @change="_onChangeProjectId" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.projectId" @change="v => _onChangeProjectId(v, $index)" size="small">
<el-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label"></el-option> <el-option v-for="item in projectList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select> </el-select>
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.definitionId" @change="_onChangeDefinitionId" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.definitionId" @change="v => _onChangeDefinitionId(v, $index)" size="small">
<el-option v-for="item in el.definitionList" :key="item.value" :value="item.value" :label="item.label"></el-option> <el-option v-for="item in el.definitionList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select> </el-select>
<el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.depTasks" size="small"> <el-select filterable :disabled="isDetails" style="width: 450px" v-model="el.depTasks" size="small">
<el-option v-for="item in el.depTasksList || []" :key="item" :value="item" :label="item"></el-option> <el-option v-for="item in el.depTasksList || []" :key="item" :value="item" :label="item"></el-option>
</el-select> </el-select>
<el-select v-model="el.cycle" :disabled="isDetails" @change="_onChangeCycle" size="small"> <el-select v-model="el.cycle" :disabled="isDetails" @change="v => _onChangeCycle(v, $index)" size="small">
<el-option v-for="item in cycleList" :key="item.value" :value="item.value" :label="item.label"></el-option> <el-option v-for="item in cycleList" :key="item.value" :value="item.value" :label="item.label"></el-option>
</el-select> </el-select>
<el-select v-model="el.dateValue" :disabled="isDetails" size="small"> <el-select v-model="el.dateValue" :disabled="isDetails" size="small">
@ -62,8 +62,7 @@
list: [], list: [],
projectList: [], projectList: [],
cycleList: cycleList, cycleList: cycleList,
isInstance: false, isInstance: false
itemIndex: null
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -105,7 +104,8 @@
* remove task * remove task
*/ */
_remove (i) { _remove (i) {
// this.dependTaskList[this.index].dependItemList.splice(i, 1) // eslint-disable-next-line
this.dependTaskList[this.index].dependItemList.splice(i, 1)
this._removeTip() this._removeTip()
if (!this.dependItemList.length || this.dependItemList.length === 0) { if (!this.dependItemList.length || this.dependItemList.length === 0) {
this.$emit('on-delete-all', { this.$emit('on-delete-all', {
@ -170,33 +170,33 @@
/** /**
* change process get dependItemList * change process get dependItemList
*/ */
_onChangeProjectId (value) { _onChangeProjectId (value, itemIndex) {
this._getProcessByProjectId(value).then(definitionList => { this._getProcessByProjectId(value).then(definitionList => {
/* this.$set(this.dependItemList, this.itemIndex, this._dlOldParams(value, definitionList, item)) */ /* this.$set(this.dependItemList, itemIndex, this._dlOldParams(value, definitionList, item)) */
let definitionId = definitionList[0].value let definitionId = definitionList[0].value
this._getDependItemList(definitionId).then(depTasksList => { this._getDependItemList(definitionId).then(depTasksList => {
let item = this.dependItemList[this.itemIndex] let item = this.dependItemList[itemIndex]
// init set depTasks All // init set depTasks All
item.depTasks = 'ALL' item.depTasks = 'ALL'
// set dependItemList item data // set dependItemList item data
this.$set(this.dependItemList, this.itemIndex, this._cpOldParams(value, definitionId, definitionList, depTasksList, item)) this.$set(this.dependItemList, itemIndex, this._cpOldParams(value, definitionId, definitionList, depTasksList, item))
}) })
}) })
}, },
_onChangeDefinitionId (value) { _onChangeDefinitionId (value, itemIndex) {
// get depItem list data // get depItem list data
this._getDependItemList(value).then(depTasksList => { this._getDependItemList(value).then(depTasksList => {
let item = this.dependItemList[this.itemIndex] let item = this.dependItemList[itemIndex]
// init set depTasks All // init set depTasks All
item.depTasks = 'ALL' item.depTasks = 'ALL'
// set dependItemList item data // set dependItemList item data
this.$set(this.dependItemList, this.itemIndex, this._rtOldParams(value, item.definitionList, depTasksList, item)) this.$set(this.dependItemList, itemIndex, this._rtOldParams(value, item.definitionList, depTasksList, item))
}) })
}, },
_onChangeCycle (value) { _onChangeCycle (value, itemIndex) {
let list = _.cloneDeep(dateValueList[value]) let list = _.cloneDeep(dateValueList[value])
this.$set(this.dependItemList[this.itemIndex], 'dateValue', list[0].value) this.$set(this.dependItemList[itemIndex], 'dateValue', list[0].value)
this.$set(this.dependItemList[this.itemIndex], 'dateValueList', list) this.$set(this.dependItemList[itemIndex], 'dateValueList', list)
}, },
_rtNewParams (value, definitionList, depTasksList, projectId) { _rtNewParams (value, definitionList, depTasksList, projectId) {
return { return {

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/nodeStatus.vue

@ -87,6 +87,8 @@
* remove task * remove task
*/ */
_remove (i) { _remove (i) {
// eslint-disable-next-line
this.dependTaskList[this.index].dependItemList.splice(i, 1)
this._removeTip() this._removeTip()
if (!this.dependItemList.length || this.dependItemList.length === 0) { if (!this.dependItemList.length || this.dependItemList.length === 0) {
this.$emit('on-delete-all', { this.$emit('on-delete-all', {

1
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue

@ -99,7 +99,6 @@
$('body').find('.tooltip.fade.top.in').remove() $('body').find('.tooltip.fade.top.in').remove()
}, },
_onDeleteAll (i) { _onDeleteAll (i) {
this.dependTaskList[this.index].dependItemList.splice(i, 1)
this.dependTaskList.map((item, i) => { this.dependTaskList.map((item, i) => {
if (item.dependItemList.length === 0) { if (item.dependItemList.length === 0) {
this.dependTaskList.splice(i, 1) this.dependTaskList.splice(i, 1)

Loading…
Cancel
Save