|
@@ -3,11 +3,17 @@
|
|
|
<label v-if="isTitle">子任务<i class="el-icon-circle-plus child-add" @click="addChild()" /></label>
|
|
|
<div class="children-list">
|
|
|
<div v-for="(item,index) in childrenList" :id="'child' + id + index" :key="'child' + index" class="children-item">
|
|
|
- <el-select v-model="item.status" placeholder="请选择" size="medium" class="child-status" :class="'status'+ item.status">
|
|
|
+ <el-select
|
|
|
+ v-model="item.status"
|
|
|
+ placeholder="请选择"
|
|
|
+ size="medium"
|
|
|
+ class="child-status"
|
|
|
+ :class="{'status0':item.status === 0,'status1':item.status === 10,'status2':item.status === 20}"
|
|
|
+ @change="update()"
|
|
|
+ >
|
|
|
<el-option
|
|
|
v-for="val in allStatus"
|
|
|
:key="val.code"
|
|
|
- :class="{'status0':item.status===0,'status1':item.status > 0 && item.status <100,'status2':item.status===100,}"
|
|
|
:label="val.msg"
|
|
|
:value="val.code"
|
|
|
/>
|
|
@@ -16,7 +22,7 @@
|
|
|
<span v-if="!item.edit">{{ item.name }}</span>
|
|
|
<el-input v-if="item.edit" v-model="item.name" placeholder="请输入任务名称(必填)" size="medium" clearable="" />
|
|
|
<div v-if="item.edit" class="footer">
|
|
|
- <el-button size="mini" @click="cancelChild(index)">取消</el-button>
|
|
|
+ <el-button size="mini" @click="cancelChild(index,item.newNode)">取消</el-button>
|
|
|
<el-button type="primary" size="mini" @click="confirmChild(index,item.name)">确定</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -30,10 +36,11 @@
|
|
|
default-time="23:59:59"
|
|
|
size="small"
|
|
|
:class="[item.endTime?'all':'icon']"
|
|
|
+ @change="update()"
|
|
|
/>
|
|
|
</div>
|
|
|
<div class="select-people">
|
|
|
- <select-people :value.sync="item.owner" :init="!item.edit" />
|
|
|
+ <select-people :value.sync="item.owner" :init="!item.edit" @change="update()" />
|
|
|
</div>
|
|
|
<div class="child-control">
|
|
|
<el-popover
|
|
@@ -105,6 +112,13 @@ export default {
|
|
|
immediate: true,
|
|
|
deep: true
|
|
|
},
|
|
|
+ allStatus: {
|
|
|
+ handler(newV) {
|
|
|
+ this.allStatus = newV
|
|
|
+ },
|
|
|
+ immediate: true,
|
|
|
+ deep: true
|
|
|
+ },
|
|
|
isTitle: {
|
|
|
handler(newV) {
|
|
|
this.isTitle = newV
|
|
@@ -122,7 +136,8 @@ export default {
|
|
|
endTime: null,
|
|
|
owner: '',
|
|
|
status: 0,
|
|
|
- edit: true
|
|
|
+ edit: true,
|
|
|
+ newNode: true
|
|
|
})
|
|
|
this.scroll(`child` + this.id + (this.childrenList.length - 1))
|
|
|
},
|
|
@@ -131,9 +146,13 @@ export default {
|
|
|
document.getElementById(id).scrollIntoView({ block: 'start', behavior: 'smooth' })
|
|
|
})
|
|
|
},
|
|
|
- cancelChild(index) { // 取消添加子任务
|
|
|
- this.childrenList.splice(index, 1)
|
|
|
- this.$emit('list:update', this.childrenList)
|
|
|
+ cancelChild(index, newNode) { // 取消添加子任务
|
|
|
+ if (newNode) {
|
|
|
+ this.childrenList.splice(index, 1)
|
|
|
+ this.$emit('list:update', this.childrenList)
|
|
|
+ } else {
|
|
|
+ this.$set(this.childrenList[index], 'edit', false)
|
|
|
+ }
|
|
|
},
|
|
|
confirmChild(index, name) { // 确认添加子任务
|
|
|
const value = name && name.replace(/\s*/, '')
|
|
@@ -142,11 +161,14 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
this.childrenList[index].edit = false
|
|
|
- this.$emit('list:update', this.childrenList)
|
|
|
- this.$emit('change')
|
|
|
+ this.update()
|
|
|
},
|
|
|
editChild(index, item) { // 编辑子任务
|
|
|
- item.edit = true
|
|
|
+ this.$set(this.childrenList[index], 'edit', true)
|
|
|
+ },
|
|
|
+ update() {
|
|
|
+ this.$emit('list:update', this.childrenList)
|
|
|
+ this.$emit('change')
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -182,7 +204,7 @@ export default {
|
|
|
margin: 20px 0;
|
|
|
}
|
|
|
.child-status {
|
|
|
- width: 64px;
|
|
|
+ width: 70px;
|
|
|
padding-top: 5px;
|
|
|
>>> input{
|
|
|
height: 20px;
|
|
@@ -205,7 +227,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.input-name {
|
|
|
- width: calc(70% - 64px);
|
|
|
+ width: calc(70% - 70px);
|
|
|
padding-left: 14px;
|
|
|
line-height: 24px;
|
|
|
color: #333333;
|
|
@@ -222,7 +244,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
.child-endTime {
|
|
|
- width: 30%;
|
|
|
+ max-width: 30%;
|
|
|
height: 36px;
|
|
|
padding-left: 20px;
|
|
|
display: flex;
|