|
@@ -20,7 +20,7 @@
|
|
|
</el-select>
|
|
|
<div class="input-name">
|
|
|
<span v-if="!item.edit" @click="toDetail(item.id)">{{ item.name }}</span>
|
|
|
- <el-input v-if="item.edit" v-model="item.name" placeholder="请输入任务名称(必填)" size="medium" clearable />
|
|
|
+ <el-input v-if="item.edit" v-model="item.name" placeholder="请输入任务名称(必填)" size="medium" />
|
|
|
<div v-if="item.edit" class="footer">
|
|
|
<el-button size="mini" @click="cancelChild(index,item)">取消</el-button>
|
|
|
<el-button type="primary" size="mini" @click="confirmChild(index,item)">确定</el-button>
|
|
@@ -49,7 +49,7 @@
|
|
|
>
|
|
|
<div class="edit-cancel">
|
|
|
<p @click="editChild(index,item)"><i class="el-icon-edit-outline" />编辑</p>
|
|
|
- <p @click="cancelChild(index,item)"><i class="el-icon-delete" />删除</p>
|
|
|
+ <p @click="deleteChild(index,item)"><i class="el-icon-delete" />删除</p>
|
|
|
</div>
|
|
|
<div slot="reference"><i class="el-icon-more" /></div>
|
|
|
</el-popover>
|
|
@@ -178,6 +178,16 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
cancelChild(index, item) { // 取消添加子任务
|
|
|
+ if (item.newNode) {
|
|
|
+ this.childrenList.splice(index, 1)
|
|
|
+ this.$emit('list:update', this.childrenList)
|
|
|
+ } else {
|
|
|
+ if (this.add) return
|
|
|
+ this.nowSubTask = item
|
|
|
+ this.$set(this.childrenList[index], 'edit', false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deleteChild(index, item) { // 删除子任务
|
|
|
if (item.newNode) {
|
|
|
this.childrenList.splice(index, 1)
|
|
|
this.$emit('list:update', this.childrenList)
|
|
@@ -251,9 +261,13 @@ export default {
|
|
|
}
|
|
|
this.childrenList[index].edit = false
|
|
|
this.update()
|
|
|
- if (this.add) return
|
|
|
+ if (this.add) return// 是新增的弹框,就返回
|
|
|
this.nowSubTask = item
|
|
|
- this.createChildren(item)
|
|
|
+ if (item.newNode) { // 是否是新插入的节点
|
|
|
+ this.createChildren(item)
|
|
|
+ } else {
|
|
|
+ this.changeArea('name')
|
|
|
+ }
|
|
|
},
|
|
|
async createChildren(item) { // 新加
|
|
|
const param = {
|