|
|
@@ -64,7 +64,11 @@
|
|
|
<div class="mt-20 flex lex-align-start flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">标签:</span>
|
|
|
<div>
|
|
|
- <wt-label @submit="handleTags" :disabled="!canEdit" />
|
|
|
+ <wt-label
|
|
|
+ @submit="handleTags"
|
|
|
+ :ids="form.tags.split(',')"
|
|
|
+ :disabled="!canEdit"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mt-20 flex lex-align-start flex-justify-start">
|
|
|
@@ -142,8 +146,9 @@
|
|
|
</div>
|
|
|
<move
|
|
|
ref="move"
|
|
|
- :file-id="resultFiles.map(ele => ele.id).join(',')"
|
|
|
+ :file-id="resultFiles.map(ele => ele.fileId).join(',')"
|
|
|
:project-id="form.projectId"
|
|
|
+ @on-success="moveSucc"
|
|
|
/>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -161,6 +166,9 @@ import uploadOffice from '@/components/upload-office/index.vue'
|
|
|
import move from '@/views/task/component/move.vue'
|
|
|
|
|
|
export default {
|
|
|
+ /**
|
|
|
+ * 任务添加、查看
|
|
|
+ */
|
|
|
computed: {
|
|
|
api() {
|
|
|
return api
|
|
|
@@ -187,31 +195,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- task: {
|
|
|
- handler(val) {
|
|
|
- if (val !== null) {
|
|
|
- this.form = val
|
|
|
- if (val.users !== undefined) {
|
|
|
- this.executeUser = [...val.users]
|
|
|
- }
|
|
|
- this.canEdit = this.form.createUser === this.user.info.userId
|
|
|
- if (val.taskStatus > 1) {
|
|
|
- this.canEdit = false
|
|
|
- }
|
|
|
- if (val.files !== undefined && val.files.length > 0) {
|
|
|
- this.fileList = val.files
|
|
|
- }
|
|
|
- this.resultFileInfo()
|
|
|
- } else {
|
|
|
- this.form.taskStatus = 0
|
|
|
- this.form.level = 0
|
|
|
- this.canEdit = true
|
|
|
- }
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
- },
|
|
|
setup() {
|
|
|
const user = useStore()
|
|
|
return { user }
|
|
|
@@ -224,6 +207,8 @@ export default {
|
|
|
canEdit: true,
|
|
|
executeUser: [],
|
|
|
resultFiles: [],
|
|
|
+ editResult: false,
|
|
|
+ isMove: false,
|
|
|
form: {
|
|
|
title: '',
|
|
|
taskStatus: -1,
|
|
|
@@ -296,6 +281,22 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ this.form = this.task
|
|
|
+ console.log(this.task)
|
|
|
+ if (this.task.users !== undefined) {
|
|
|
+ this.executeUser = [...this.task.users]
|
|
|
+ }
|
|
|
+ this.canEdit = this.form.createUser === this.user.info.userId
|
|
|
+ if (this.task.taskStatus > 1) {
|
|
|
+ this.canEdit = false
|
|
|
+ }
|
|
|
+ if (this.task.files !== undefined && this.task.files.length > 0) {
|
|
|
+ this.fileList = this.task.files
|
|
|
+ console.log(this.fileList)
|
|
|
+ }
|
|
|
+ this.resultFileInfo()
|
|
|
+ },
|
|
|
fetchIndex(list, key) {
|
|
|
const index = list.findIndex(ele => ele.value === key)
|
|
|
if (index > -1) {
|
|
|
@@ -313,11 +314,12 @@ export default {
|
|
|
*/
|
|
|
show(type) {
|
|
|
if (type !== 1) {
|
|
|
- this.canEdit = true
|
|
|
this.form = this.task
|
|
|
- }
|
|
|
- if (this.form !== null && this.form.users !== undefined) {
|
|
|
- this.executeUser = [...this.form.users]
|
|
|
+ this.init(this.task)
|
|
|
+ } else {
|
|
|
+ this.form.taskStatus = 0
|
|
|
+ this.form.level = 0
|
|
|
+ this.canEdit = true
|
|
|
}
|
|
|
this.showDialog = true
|
|
|
},
|
|
|
@@ -348,12 +350,15 @@ export default {
|
|
|
this.saveResultFile()
|
|
|
}
|
|
|
|
|
|
- if (this.form.taskStatus === 3) {
|
|
|
+ if (this.form.taskStatus === 3 && this.isMove === false) {
|
|
|
// 已完成 需要转移文件
|
|
|
- this.$refs.move.show()
|
|
|
+ this.$refs.move.showDialog()
|
|
|
return
|
|
|
}
|
|
|
- this.form.projectId = this.projectId
|
|
|
+ // 从项目详情,添加任务
|
|
|
+ if (this.projectId !== undefined && this.projectId.length > 0) {
|
|
|
+ this.form.projectId = this.projectId
|
|
|
+ }
|
|
|
this.form.relatedIds = this.fileList.map(ele => ele.id).join(',')
|
|
|
this.$api.task.addTask(this.form).then(res => {
|
|
|
this.showDialog = false
|
|
|
@@ -366,6 +371,9 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
saveResultFile() {
|
|
|
+ if (this.editResult === false) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$api.task
|
|
|
.taskFile({
|
|
|
taskId: this.form.id,
|
|
|
@@ -377,8 +385,10 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- selection(list) {
|
|
|
- this.fileList = list
|
|
|
+ selection(list, extra) {
|
|
|
+ this.fileList = list.map(ele => {
|
|
|
+ return ele
|
|
|
+ })
|
|
|
},
|
|
|
selected(list) {
|
|
|
this.form.executeUser = list.map(ele => ele.id).join(',')
|
|
|
@@ -388,9 +398,10 @@ export default {
|
|
|
},
|
|
|
/**
|
|
|
* 成果文件上传成果
|
|
|
- * @param res
|
|
|
+ * @param list
|
|
|
*/
|
|
|
uploadResult(list) {
|
|
|
+ this.editResult = true
|
|
|
this.resultFiles = list.map(ele => {
|
|
|
return {
|
|
|
id: ele.id,
|
|
|
@@ -415,9 +426,14 @@ export default {
|
|
|
this.executeUser.length = 0
|
|
|
this.fileList.length = 0
|
|
|
this.showDialog = false
|
|
|
+ this.editResult = false
|
|
|
+ this.isMove = false
|
|
|
},
|
|
|
- upload(res) {
|
|
|
- console.log(res)
|
|
|
+ /**
|
|
|
+ * 文件移动成功
|
|
|
+ */
|
|
|
+ moveSucc() {
|
|
|
+ this.isMove = true
|
|
|
}
|
|
|
}
|
|
|
}
|