完成工作项删除功能

main
wuyize 2022-07-07 23:39:26 +08:00
parent aae647ae90
commit a0a0da23d9
3 changed files with 65 additions and 17 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1657203382764" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4182" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M607.897867 768.043004c-17.717453 0-31.994625-14.277171-31.994625-31.994625L575.903242 383.935495c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 351.94087C639.892491 753.593818 625.61532 768.043004 607.897867 768.043004z" p-id="4183" fill="#F56C6C"></path><path d="M415.930119 768.043004c-17.717453 0-31.994625-14.277171-31.994625-31.994625L383.935495 383.935495c0-17.717453 14.277171-31.994625 31.994625-31.994625 17.717453 0 31.994625 14.277171 31.994625 31.994625l0 351.94087C447.924744 753.593818 433.647573 768.043004 415.930119 768.043004z" p-id="4184" fill="#F56C6C"></path><path d="M928.016126 223.962372l-159.973123 0L768.043004 159.973123c0-52.980346-42.659499-95.983874-95.295817-95.983874L351.94087 63.989249c-52.980346 0-95.983874 43.003528-95.983874 95.983874l0 63.989249-159.973123 0c-17.717453 0-31.994625 14.277171-31.994625 31.994625s14.277171 31.994625 31.994625 31.994625l832.032253 0c17.717453 0 31.994625-14.277171 31.994625-31.994625S945.73358 223.962372 928.016126 223.962372zM319.946246 159.973123c0-17.545439 14.449185-31.994625 31.994625-31.994625l320.806316 0c17.545439 0 31.306568 14.105157 31.306568 31.994625l0 63.989249L319.946246 223.962372 319.946246 159.973123 319.946246 159.973123z" p-id="4185" fill="#F56C6C"></path><path d="M736.048379 960.010751 288.123635 960.010751c-52.980346 0-95.983874-43.003528-95.983874-95.983874L192.139761 383.591466c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 480.435411c0 17.717453 14.449185 31.994625 31.994625 31.994625l448.096758 0c17.717453 0 31.994625-14.277171 31.994625-31.994625L768.215018 384.795565c0-17.717453 14.277171-31.994625 31.994625-31.994625s31.994625 14.277171 31.994625 31.994625l0 479.231312C832.032253 916.835209 789.028725 960.010751 736.048379 960.010751z" p-id="4186" fill="#F56C6C"></path></svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,2 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1657095084738" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5826" xmlns:xlink="http://www.w3.org/1999/xlink" width="512" height="512"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M853.333333 501.333333c-17.066667 0-32 14.933333-32 32v320c0 6.4-4.266667 10.666667-10.666666 10.666667H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V213.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h320c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32H170.666667c-40.533333 0-74.666667 34.133333-74.666667 74.666666v640c0 40.533333 34.133333 74.666667 74.666667 74.666667h640c40.533333 0 74.666667-34.133333 74.666666-74.666667V533.333333c0-17.066667-14.933333-32-32-32z" p-id="5827" fill="#409EFF"></path><path d="M405.333333 484.266667l-32 125.866666c-2.133333 10.666667 0 23.466667 8.533334 29.866667 6.4 6.4 14.933333 8.533333 23.466666 8.533333h8.533334l125.866666-32c6.4-2.133333 10.666667-4.266667 14.933334-8.533333l300.8-300.8c38.4-38.4 38.4-102.4 0-140.8-38.4-38.4-102.4-38.4-140.8 0L413.866667 469.333333c-4.266667 4.266667-6.4 8.533333-8.533334 14.933334z m59.733334 23.466666L761.6 213.333333c12.8-12.8 36.266667-12.8 49.066667 0 12.8 12.8 12.8 36.266667 0 49.066667L516.266667 558.933333l-66.133334 17.066667 14.933334-68.266667z" p-id="5828" fill="#409EFF"></path></svg>
</style></defs><path d="M853.333333 501.333333c-17.066667 0-32 14.933333-32 32v320c0 6.4-4.266667 10.666667-10.666666 10.666667H170.666667c-6.4 0-10.666667-4.266667-10.666667-10.666667V213.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h320c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32H170.666667c-40.533333 0-74.666667 34.133333-74.666667 74.666666v640c0 40.533333 34.133333 74.666667 74.666667 74.666667h640c40.533333 0 74.666667-34.133333 74.666666-74.666667V533.333333c0-17.066667-14.933333-32-32-32z" p-id="5827" fill="#E6A23C"></path><path d="M405.333333 484.266667l-32 125.866666c-2.133333 10.666667 0 23.466667 8.533334 29.866667 6.4 6.4 14.933333 8.533333 23.466666 8.533333h8.533334l125.866666-32c6.4-2.133333 10.666667-4.266667 14.933334-8.533333l300.8-300.8c38.4-38.4 38.4-102.4 0-140.8-38.4-38.4-102.4-38.4-140.8 0L413.866667 469.333333c-4.266667 4.266667-6.4 8.533333-8.533334 14.933334z m59.733334 23.466666L761.6 213.333333c12.8-12.8 36.266667-12.8 49.066667 0 12.8 12.8 12.8 36.266667 0 49.066667L516.266667 558.933333l-66.133334 17.066667 14.933334-68.266667z" p-id="5828" fill="#E6A23C"></path></svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -39,7 +39,8 @@
<template #reference>
<el-button :style="{'visibility': ( projectAccessLevel < 3)?'unset':'hidden'}" type="primary" >新增工作项</el-button>
<el-button :style="{'visibility': ( projectAccessLevel < 3)?'unset':'hidden'}" type="primary">新增工作项
</el-button>
</template>
</el-popover>
</div>
@ -147,11 +148,15 @@
(this.$store.state.staff&&scope.row.taskHolderId===this.$store.state.staff.staffId)))?
'unset':'hidden'}"
text>
<svg-icon style="width: 20px;height: 20px;" icon-class="add" ></svg-icon>
<svg-icon style="width: 20px;height: 20px;" icon-class="add"></svg-icon>
</el-button>
</template>
</el-popover>
<el-button
:style="{'padding':'4px','margin-left': '5px','visibility':scope.row.editable?'unset':'hidden'}"
text @click.native="onDeleteClick(scope.row)">
<svg-icon style="width: 20px;height: 20px;" icon-class="delete"></svg-icon>
</el-button>
</div>
@ -169,10 +174,10 @@
width="40%"
top="60px"
>
<el-form :model="form" label-position="top" label-width="120px" >
<el-form :model="form" label-position="top" label-width="120px">
<el-row :gutter="20">
<el-col :span="form.operation==='add'?24:12">
<el-form-item label="标题" >
<el-form-item label="标题">
<el-input v-model="form.taskName" :disabled="form.disabled"/>
</el-form-item>
</el-col>
@ -248,7 +253,7 @@
<el-option value="其他"/>
</el-select>
</el-form-item>
<el-form-item v-if="form.taskType===''" label="严重程度" >
<el-form-item v-if="form.taskType==='缺陷'" label="严重程度">
<el-select style="width: 100%" v-model="form.severity" :disabled="form.disabled">
<el-option value="致命"/>
<el-option value="严重"/>
@ -271,7 +276,7 @@
<el-row>
<el-col :span="24">
<el-form-item label="描述">
<el-input type="textarea" v-model="form.taskDescription" :disabled="form.disabled" />
<el-input type="textarea" v-model="form.taskDescription" :disabled="form.disabled"/>
</el-form-item>
</el-col>
</el-row>
@ -339,11 +344,11 @@ export default {
},
methods: {
statusDisabled(row) {
return !(row.editable||
(this.$store.state.staff&&row.taskHolderId===this.$store.state.staff.staffId))
return !(row.editable ||
(this.$store.state.staff && row.taskHolderId === this.$store.state.staff.staffId))
},
onRowClick(row, column, event) {
if(column.property==="operations")
if (column.property === "operations")
return
this.form = {
disabled: !row.editable,
@ -392,9 +397,9 @@ export default {
taskEndTime: row.taskEndTime,
taskDescription: row.taskDescription,
taskId: row.taskId,
taskStatus:row.taskStatus,
taskCreatedTime:row.taskCreatedTime,
taskClosedTime:row.taskClosedTime
taskStatus: row.taskStatus,
taskCreatedTime: row.taskCreatedTime,
taskClosedTime: row.taskClosedTime
}
console.log(submitForm)
const that = this
@ -456,19 +461,22 @@ export default {
}
console.log(submitForm)
const that = this
if (this.form.operation==='add') {
if (this.form.operation === 'add') {
request({
url: 'project/' + this.$route.params.projectId + '/task',
method: 'post',
data: submitForm
}).then(response => {
console.log(response)
//console.log(response)
if (response.data.code === 200) {
if (submitForm.taskFatherId === 0) {
that.getWorkitems()
} else {
this.form.row.hasChildren = true
let rtr = that.maps.get(submitForm.taskFatherId);
console.log(rtr)
if (rtr) {
rtr.row.hasChildren = true
rtr.treeNode.loading = true
that.loadChildren(rtr.row, rtr.treeNode, rtr.resolve)
}
@ -557,6 +565,7 @@ export default {
},
onAddClick(row, taskType) {
this.form = {
row: row,
operation: 'add',
title: '新增' + taskType,
taskType: taskType,
@ -564,6 +573,41 @@ export default {
}
this.dialogVisible = true
},
onDeleteClick(row) {
const that = this
request({
url: 'project/' + this.$route.params.projectId + '/task/' + row.taskId,
method: 'delete',
}).then(response => {
console.log(response)
if (response.data.code === 200) {
if (row.taskFatherId === 0) {
that.getWorkitems()
} else {
//console.log(that.$refs.tableRef.store.states.lazyTreeNodeMap)
if(that.$refs.tableRef.store.states.lazyTreeNodeMap.value[row.taskFatherId].length===1)
{
that.$refs.tableRef.store.states.lazyTreeNodeMap.value[row.taskFatherId] = []
}
let rtr = that.maps.get(row.taskFatherId);
//console.log(rtr)
if (rtr) {
rtr.treeNode.loading = true
that.loadChildren(rtr.row, rtr.treeNode, rtr.resolve)
}
}
ElMessage({
message: '删除成功',
type: 'success',
})
that.dialogVisible = false
}
}).catch(function (error) {
console.log(error)
})
},
getWorkitems() {
const that = this;
request({
@ -594,6 +638,8 @@ export default {
}).then(response => {
if (response.data.code === 200) {
let records = response.data.data.records
const editable = row.editable || row.taskHolderId === this.$store.state.staff.staffId
for (let workitem of records) {
workitem['editable'] = editable