|
@@ -9,7 +9,7 @@
|
|
size="medium"
|
|
size="medium"
|
|
class="child-status"
|
|
class="child-status"
|
|
:class="{'status0':item.status === 0,'status1':item.status === 10,'status2':item.status === 20}"
|
|
:class="{'status0':item.status === 0,'status1':item.status === 10,'status2':item.status === 20}"
|
|
- @change="update()"
|
|
|
|
|
|
+ @change="updateStatus(item)"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="val in allStatus"
|
|
v-for="val in allStatus"
|
|
@@ -22,8 +22,8 @@
|
|
<span v-if="!item.edit" @click="toDetail(item.id)">{{ item.name }}</span>
|
|
<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" clearable />
|
|
<div v-if="item.edit" class="footer">
|
|
<div v-if="item.edit" class="footer">
|
|
- <el-button size="mini" @click="cancelChild(index,item.newNode)">取消</el-button>
|
|
|
|
- <el-button type="primary" size="mini" @click="confirmChild(index,item.name)">确定</el-button>
|
|
|
|
|
|
+ <el-button size="mini" @click="cancelChild(index,item)">取消</el-button>
|
|
|
|
+ <el-button type="primary" size="mini" @click="confirmChild(index,item)">确定</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="child-endTime">
|
|
<div class="child-endTime">
|
|
@@ -34,7 +34,7 @@
|
|
value-format="yyyy.MM.dd"
|
|
value-format="yyyy.MM.dd"
|
|
size="small"
|
|
size="small"
|
|
:class="[item.endTime?'all':'icon']"
|
|
:class="[item.endTime?'all':'icon']"
|
|
- @change="update()"
|
|
|
|
|
|
+ @change="updateDate(item)"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="select-people">
|
|
<div class="select-people">
|
|
@@ -49,19 +49,42 @@
|
|
>
|
|
>
|
|
<div class="edit-cancel">
|
|
<div class="edit-cancel">
|
|
<p @click="editChild(index,item)">编辑</p>
|
|
<p @click="editChild(index,item)">编辑</p>
|
|
- <p @click="deleteChild(index)">删除</p>
|
|
|
|
|
|
+ <p @click="cancelChild(index,item)">删除</p>
|
|
</div>
|
|
</div>
|
|
<div slot="reference"><i class="el-icon-more" /></div>
|
|
<div slot="reference"><i class="el-icon-more" /></div>
|
|
</el-popover>
|
|
</el-popover>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <!-- 操作 -->
|
|
|
|
+ <normal-dialog
|
|
|
|
+ v-if="deleteDialog"
|
|
|
|
+ :show-dialog.sync="deleteDialog"
|
|
|
|
+ title="删除确认"
|
|
|
|
+ width="45%"
|
|
|
|
+ :is-default-close="false"
|
|
|
|
+ buttom-type="danger"
|
|
|
|
+ @confirm="subTaskDelete()"
|
|
|
|
+ @cancel="deleteDialog = false"
|
|
|
|
+ >
|
|
|
|
+ <article>
|
|
|
|
+ <div class="danger-img">
|
|
|
|
+ <img :src="dangerImg">
|
|
|
|
+ </div>
|
|
|
|
+ <div class="danger-title">{{ nowSubTask.name }}及其所有子任务会被删除,此操作不可撤销,是否确定?</div>
|
|
|
|
+ </article>
|
|
|
|
+ </normal-dialog>
|
|
|
|
+ <change-status v-if="statusDialog" :show-dialog.sync="statusDialog" :data="noCompleteTask" @confirm="changeArea('status')" @cancel="$emit('change')" />
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
|
|
+import { subTaskUpdate, subTaskDelete, subTaskCreate } from '@/api/taskChild'
|
|
|
|
+import changeStatus from './changeStatus'
|
|
|
|
+import normalDialog from '@/components/dialog/normalDialog'
|
|
import selectPeople from '@/components/select/selectPeople'
|
|
import selectPeople from '@/components/select/selectPeople'
|
|
|
|
+import danger from '@/assets/感叹@2x.png'
|
|
export default {
|
|
export default {
|
|
- components: { selectPeople },
|
|
|
|
|
|
+ components: { selectPeople, changeStatus, normalDialog },
|
|
props: {
|
|
props: {
|
|
list: {
|
|
list: {
|
|
type: Array,
|
|
type: Array,
|
|
@@ -87,12 +110,22 @@ export default {
|
|
type: String,
|
|
type: String,
|
|
default: 'add',
|
|
default: 'add',
|
|
required: false
|
|
required: false
|
|
|
|
+ },
|
|
|
|
+ add: {
|
|
|
|
+ type: Boolean,
|
|
|
|
+ default: false,
|
|
|
|
+ required: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
|
|
+ dangerImg: danger,
|
|
childrenList: this.list,
|
|
childrenList: this.list,
|
|
- formData: this.data
|
|
|
|
|
|
+ formData: this.data,
|
|
|
|
+ deleteDialog: false, // 删除弹窗
|
|
|
|
+ statusDialog: false, // 状态弹框
|
|
|
|
+ noCompleteTask: [], // 当前任务中未完成的子任务
|
|
|
|
+ nowSubTask: null // 当前子任务
|
|
}
|
|
}
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
@@ -130,7 +163,7 @@ export default {
|
|
addChild() { // 添加子任务
|
|
addChild() { // 添加子任务
|
|
this.childrenList.push({
|
|
this.childrenList.push({
|
|
name: null,
|
|
name: null,
|
|
- bizId: this.formData.parentId,
|
|
|
|
|
|
+ bizId: this.formData.bizId,
|
|
endTime: null,
|
|
endTime: null,
|
|
owner: '',
|
|
owner: '',
|
|
status: 0,
|
|
status: 0,
|
|
@@ -144,34 +177,96 @@ export default {
|
|
document.getElementById(id).scrollIntoView({ block: 'start', behavior: 'smooth' })
|
|
document.getElementById(id).scrollIntoView({ block: 'start', behavior: 'smooth' })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- cancelChild(index, newNode) { // 取消添加子任务
|
|
|
|
- if (newNode) {
|
|
|
|
|
|
+ cancelChild(index, item) { // 取消添加子任务
|
|
|
|
+ if (item.newNode) {
|
|
this.childrenList.splice(index, 1)
|
|
this.childrenList.splice(index, 1)
|
|
this.$emit('list:update', this.childrenList)
|
|
this.$emit('list:update', this.childrenList)
|
|
} else {
|
|
} else {
|
|
|
|
+ if (this.add) return
|
|
|
|
+ this.nowSubTask = item
|
|
|
|
+ this.deleteDialog = true
|
|
this.$set(this.childrenList[index], 'edit', false)
|
|
this.$set(this.childrenList[index], 'edit', false)
|
|
- this.update()
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- deleteChild(index) {
|
|
|
|
- this.childrenList.splice(index, 1)
|
|
|
|
- this.update()
|
|
|
|
|
|
+ updateDate(e) { // 变更截止时间
|
|
|
|
+ if (this.add) return
|
|
|
|
+ if (e.newNode) return
|
|
|
|
+ this.nowSubTask = e
|
|
|
|
+ this.changeArea('endTime')
|
|
},
|
|
},
|
|
- confirmChild(index, name) { // 确认添加子任务
|
|
|
|
- const value = name && name.replace(/\s*/, '')
|
|
|
|
|
|
+ updateStatus(e) { // 变更状态
|
|
|
|
+ if (this.add) return
|
|
|
|
+ if (e.newNode) return
|
|
|
|
+ this.nowSubTask = e
|
|
|
|
+ if (this.nowSubTask.status === 20) {
|
|
|
|
+ this.noCompleteTask = []
|
|
|
|
+ this.findNoComplete(this.nowSubTask.childSubTaskInfos)
|
|
|
|
+ this.noCompleteTask = this.noCompleteTask.filter(item => item.status !== 20)
|
|
|
|
+ if (this.noCompleteTask.length > 0) {
|
|
|
|
+ this.statusDialog = true
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.changeArea('status')
|
|
|
|
+ },
|
|
|
|
+ findNoComplete(arr) { // 查找未完成子任务
|
|
|
|
+ arr.map(item => {
|
|
|
|
+ this.noCompleteTask = this.noCompleteTask.concat(item)
|
|
|
|
+ this.findNoComplete(item.childSubTaskInfos)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ async changeArea(e) { // area修改
|
|
|
|
+ const params = {
|
|
|
|
+ id: this.nowSubTask.id,
|
|
|
|
+ taskId: this.nowSubTask.taskId,
|
|
|
|
+ bizId: this.nowSubTask.bizId
|
|
|
|
+ }
|
|
|
|
+ params[e] = this.nowSubTask[e]
|
|
|
|
+ const res = await subTaskUpdate(params)
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
|
|
|
|
+ this.statusDialog = false
|
|
|
|
+ }
|
|
|
|
+ this.$emit('change')
|
|
|
|
+ },
|
|
|
|
+ async subTaskDelete() { // 删除
|
|
|
|
+ const res = await subTaskDelete(this.nowSubTask.id)
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message({ message: '删除成功', type: 'success', duration: 1000, offset: 150 })
|
|
|
|
+ this.deleteDialog = false
|
|
|
|
+ }
|
|
|
|
+ this.$emit('change')
|
|
|
|
+ },
|
|
|
|
+ confirmChild(index, item) { // 确认添加子任务
|
|
|
|
+ const value = item.name && item.name.replace(/\s*/, '')
|
|
if (value === null || value === '') {
|
|
if (value === null || value === '') {
|
|
this.$message({ message: '请输入任务名称', type: 'error', duration: 1000, offset: 150 })
|
|
this.$message({ message: '请输入任务名称', type: 'error', duration: 1000, offset: 150 })
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
this.childrenList[index].edit = false
|
|
this.childrenList[index].edit = false
|
|
this.update()
|
|
this.update()
|
|
|
|
+ if (this.add) return
|
|
|
|
+ this.nowSubTask = item
|
|
|
|
+ this.createChildren(item)
|
|
|
|
+ },
|
|
|
|
+ async createChildren(item) { // 新加
|
|
|
|
+ const param = {
|
|
|
|
+ taskId: this.formData.taskId,
|
|
|
|
+ ...item
|
|
|
|
+ }
|
|
|
|
+ delete param.edit
|
|
|
|
+ delete param.newNode
|
|
|
|
+ const res = await subTaskCreate(param)
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ this.$message({ message: '创建成功', type: 'success', duration: 1000, offset: 150 })
|
|
|
|
+ }
|
|
|
|
+ this.$emit('change')
|
|
},
|
|
},
|
|
editChild(index, item) { // 编辑子任务
|
|
editChild(index, item) { // 编辑子任务
|
|
this.$set(this.childrenList[index], 'edit', true)
|
|
this.$set(this.childrenList[index], 'edit', true)
|
|
},
|
|
},
|
|
update() {
|
|
update() {
|
|
this.$emit('list:update', this.childrenList)
|
|
this.$emit('list:update', this.childrenList)
|
|
- this.$emit('change')
|
|
|
|
},
|
|
},
|
|
toDetail(id) {
|
|
toDetail(id) {
|
|
this.$emit('toDetail', id)
|
|
this.$emit('toDetail', id)
|
|
@@ -254,7 +349,7 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.child-endTime {
|
|
.child-endTime {
|
|
- max-width: 30%;
|
|
|
|
|
|
+ width: 30%;
|
|
height: 36px;
|
|
height: 36px;
|
|
padding-left: 20px;
|
|
padding-left: 20px;
|
|
display: flex;
|
|
display: flex;
|
|
@@ -321,6 +416,23 @@ export default {
|
|
color: #409EFF
|
|
color: #409EFF
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+.danger-img {
|
|
|
|
+ width: 100%;
|
|
|
|
+ padding: 0 60px 50px 60px;
|
|
|
|
+ margin-bottom: 50px;
|
|
|
|
+ position: relative;
|
|
|
|
+ img {
|
|
|
|
+ height: 50px;
|
|
|
|
+ width: 50px;
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 50%;
|
|
|
|
+ transform: translate(-50%,0);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.danger-title {
|
|
|
|
+ text-align: center;
|
|
|
|
+ padding-bottom: 50px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|
|
<style>
|
|
<style>
|
|
.popper-control {
|
|
.popper-control {
|