|
|
@@ -1,33 +1,48 @@
|
|
|
<template>
|
|
|
- <el-dialog v-model="showDialog" width="800">
|
|
|
+ <el-dialog v-model="showDialog" width="800" @close="close">
|
|
|
<template #header>
|
|
|
<div class="full-width flex flex-center flex-justify-between">
|
|
|
<h4>任务详情</h4>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div>
|
|
|
- <el-input v-model="form.title" placeholder="请输入任务名称"></el-input>
|
|
|
- <div class="mt-10">
|
|
|
+ <el-input
|
|
|
+ v-model="form.title"
|
|
|
+ maxlength="20"
|
|
|
+ clearable
|
|
|
+ :disabled="!canEdit"
|
|
|
+ style="height: 50px"
|
|
|
+ class="font-16 bold"
|
|
|
+ placeholder="请输入任务名称(最大20个字符)"
|
|
|
+ ></el-input>
|
|
|
+ <div class="mt-20">
|
|
|
<div class="flex flex-center flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">状态:</span>
|
|
|
<wt-tag
|
|
|
:data="status"
|
|
|
+ :status="form.taskStatus"
|
|
|
@change="changeStatus($event, 1)"
|
|
|
:disabled="false"
|
|
|
/>
|
|
|
</div>
|
|
|
|
|
|
- <div class="mt-10 flex flex-center flex-justify-start">
|
|
|
+ <div class="mt-20 flex flex-center flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">优先级:</span>
|
|
|
- <wt-tag :data="level" @change="changeStatus($event, 2)" />
|
|
|
+ <wt-tag
|
|
|
+ :data="level"
|
|
|
+ :disabled="!canEdit"
|
|
|
+ :status="form.level"
|
|
|
+ @change="changeStatus($event, 2)"
|
|
|
+ />
|
|
|
</div>
|
|
|
|
|
|
- <div class="mt-10 flex flex-center flex-justify-start">
|
|
|
+ <div class="mt-20 flex flex-center flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">时间:</span>
|
|
|
<div class="flex flex-center">
|
|
|
<el-date-picker
|
|
|
v-model="form.startTime"
|
|
|
type="date"
|
|
|
+ :disabled="!canEdit"
|
|
|
placeholder="设置开始日期"
|
|
|
format="YYYY-MM-DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
|
@@ -37,6 +52,7 @@
|
|
|
<el-date-picker
|
|
|
v-model="form.endTime"
|
|
|
type="date"
|
|
|
+ :disabled="!canEdit"
|
|
|
placeholder="设置截止日期"
|
|
|
format="YYYY-MM-DD"
|
|
|
value-format="YYYY-MM-DD"
|
|
|
@@ -45,36 +61,49 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="mt-10 flex lex-align-start flex-justify-start">
|
|
|
+ <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" />
|
|
|
+ <wt-label @submit="handleTags" :disabled="!canEdit" />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="mt-10 flex lex-align-start flex-justify-start">
|
|
|
+ <div class="mt-20 flex lex-align-start flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">执行者:</span>
|
|
|
<div>
|
|
|
<tasker
|
|
|
- :data="task === null ? [] : task.users"
|
|
|
+ :data="executeUser === null ? [] : executeUser"
|
|
|
+ :disabled="!canEdit"
|
|
|
@success="selected"
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="mt-10 flex flex-align-start flex-justify-start">
|
|
|
+ <div class="mt-20 flex flex-align-start flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">备注:</span>
|
|
|
- <el-input type="textarea" :rows="5" v-model="form.remark"></el-input>
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ :rows="5"
|
|
|
+ v-model="form.remark"
|
|
|
+ :disabled="!canEdit"
|
|
|
+ ></el-input>
|
|
|
</div>
|
|
|
|
|
|
- <div class="mt-10 flex flex-align-start flex-justify-start flex-col">
|
|
|
+ <div class="mt-20 flex flex-align-start flex-justify-start flex-col">
|
|
|
<div class="flex flex-center flex-justify-start">
|
|
|
<span class="mr-10 title flex flex-justify-start">关联附件:</span>
|
|
|
- <filepicker :project-id="projectId" @submit="selection" />
|
|
|
+ <filepicker
|
|
|
+ :project-id="projectId"
|
|
|
+ @submit="selection"
|
|
|
+ v-if="canEdit"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="flex flex-center flex-justify-start full-width mt-10">
|
|
|
<div class="title mr-10"></div>
|
|
|
<div>
|
|
|
<div v-for="item in fileList" :key="item.id">
|
|
|
- {{ item.title }}
|
|
|
+ <div class="flex flex-center">
|
|
|
+ {{ item.title }}
|
|
|
+ <preview :info="item" :show-action="true" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -89,12 +118,19 @@
|
|
|
v-model="form.taskProcess"
|
|
|
></el-input>
|
|
|
</div>
|
|
|
- <div class="flex flex-justify-start flex-center mt-10 full-width">
|
|
|
+ <div class="flex flex-justify-start mt-10 full-width">
|
|
|
+ <div class="title mr-10">成果文件:</div>
|
|
|
+ <upload-office @success="uploadResult" :max="1" />
|
|
|
+ </div>
|
|
|
+ <div class="full-width flex flex-justify-start">
|
|
|
<div class="title mr-10" />
|
|
|
- <el-icon>
|
|
|
- <Paperclip />
|
|
|
- </el-icon>
|
|
|
- <div>附件</div>
|
|
|
+ <div v-for="item in resultFiles" :key="item.id">
|
|
|
+ <div class="flex flex-justify-start flex-center">
|
|
|
+ {{ item.fileVO.originalFileName }}
|
|
|
+ ({{ item.createUserName }})
|
|
|
+ <preview :info="item.fileVO" :show-action="true"></preview>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -104,6 +140,11 @@
|
|
|
</el-button>
|
|
|
<el-button type="primary" @click="submit">确 定</el-button>
|
|
|
</div>
|
|
|
+ <move
|
|
|
+ ref="move"
|
|
|
+ :file-id="resultFiles.map(ele => ele.id).join(',')"
|
|
|
+ :project-id="form.projectId"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
@@ -113,9 +154,27 @@ import WtTag from '@/views/task/component/wt-tag.vue'
|
|
|
import Tasker from '@/views/task/component/tasker.vue'
|
|
|
import filepicker from '@/components/filepicker/index.vue'
|
|
|
import WtLabel from '@/views/task/component/wt-label.vue'
|
|
|
+import { useStore } from '@/store/user.js'
|
|
|
+import Preview from '@/views/resource/component/preview.vue'
|
|
|
+import api from '@/api/index.js'
|
|
|
+import uploadOffice from '@/components/upload-office/index.vue'
|
|
|
+import move from '@/views/task/component/move.vue'
|
|
|
|
|
|
export default {
|
|
|
- components: { WtLabel, Tasker, WtTag, filepicker },
|
|
|
+ computed: {
|
|
|
+ api() {
|
|
|
+ return api
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ Preview,
|
|
|
+ WtLabel,
|
|
|
+ Tasker,
|
|
|
+ WtTag,
|
|
|
+ filepicker,
|
|
|
+ uploadOffice,
|
|
|
+ move
|
|
|
+ },
|
|
|
props: {
|
|
|
projectId: {
|
|
|
type: String,
|
|
|
@@ -131,31 +190,44 @@ export default {
|
|
|
watch: {
|
|
|
task: {
|
|
|
handler(val) {
|
|
|
- if (val) {
|
|
|
+ if (val !== null) {
|
|
|
this.form = val
|
|
|
- this.status = this.fetchIndex(this.status, this.form.taskStatus)
|
|
|
- this.level = this.fetchIndex(this.level, this.form.level)
|
|
|
+ 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.map(ele => {
|
|
|
- return {
|
|
|
- fileId: ele.id,
|
|
|
- title: ele.title
|
|
|
- }
|
|
|
- })
|
|
|
+ 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 }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
showDialog: false,
|
|
|
fileList: [],
|
|
|
+ loading: false,
|
|
|
+ canEdit: true,
|
|
|
+ executeUser: [],
|
|
|
+ resultFiles: [],
|
|
|
form: {
|
|
|
title: '',
|
|
|
- taskStatus: '',
|
|
|
- level: '',
|
|
|
+ taskStatus: -1,
|
|
|
+ level: -1,
|
|
|
remark: '',
|
|
|
startTime: '',
|
|
|
endTime: '',
|
|
|
@@ -177,15 +249,15 @@ export default {
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
- title: '已完成',
|
|
|
+ title: '已提交',
|
|
|
value: 2,
|
|
|
- color: '#80B336',
|
|
|
+ color: '#ECAB56',
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
- title: '已关闭',
|
|
|
+ title: '已完成',
|
|
|
value: 3,
|
|
|
- color: '#ECAB56',
|
|
|
+ color: '#80B336',
|
|
|
checked: false
|
|
|
},
|
|
|
{
|
|
|
@@ -235,9 +307,32 @@ export default {
|
|
|
}
|
|
|
return list
|
|
|
},
|
|
|
- show() {
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param type = 1 新增 2 查看
|
|
|
+ */
|
|
|
+ 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.showDialog = true
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 获取成果文件info
|
|
|
+ */
|
|
|
+ resultFileInfo() {
|
|
|
+ if (this.task.id !== undefined) {
|
|
|
+ this.$api.task.taskFileInfo({ id: this.task.id }).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.resultFiles = res.data
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
changeStatus(res, type) {
|
|
|
if (type === 1) {
|
|
|
this.form.taskStatus = res.value
|
|
|
@@ -246,8 +341,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
submit() {
|
|
|
+ if (this.form.taskStatus === 2 && this.resultFiles.length === 0) {
|
|
|
+ this.$message.error('请上传成果文件')
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.saveResultFile()
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.taskStatus === 3) {
|
|
|
+ // 已完成 需要转移文件
|
|
|
+ this.$refs.move.show()
|
|
|
+ return
|
|
|
+ }
|
|
|
this.form.projectId = this.projectId
|
|
|
- this.form.relatedIds = this.fileList.map(ele => ele.fileId).join(',')
|
|
|
+ this.form.relatedIds = this.fileList.map(ele => ele.id).join(',')
|
|
|
this.$api.task.addTask(this.form).then(res => {
|
|
|
this.showDialog = false
|
|
|
if (res.code === 200) {
|
|
|
@@ -255,26 +362,62 @@ export default {
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
+ this.$emit('success')
|
|
|
})
|
|
|
},
|
|
|
+ saveResultFile() {
|
|
|
+ this.$api.task
|
|
|
+ .taskFile({
|
|
|
+ taskId: this.form.id,
|
|
|
+ ids: this.resultFiles.map(ele => ele.id).join(',')
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
selection(list) {
|
|
|
- this.fileList = list.map(ele => {
|
|
|
- return {
|
|
|
- fileId: ele.id,
|
|
|
- title: ele.title
|
|
|
- }
|
|
|
- })
|
|
|
+ this.fileList = list
|
|
|
},
|
|
|
selected(list) {
|
|
|
this.form.executeUser = list.map(ele => ele.id).join(',')
|
|
|
},
|
|
|
handleTags(tags) {
|
|
|
- console.log(tags)
|
|
|
this.form.tags = tags
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 成果文件上传成果
|
|
|
+ * @param res
|
|
|
+ */
|
|
|
+ uploadResult(list) {
|
|
|
+ this.resultFiles = list.map(ele => {
|
|
|
+ return {
|
|
|
+ id: ele.id,
|
|
|
+ fileVO: ele,
|
|
|
+ createUserName: this.user.info.nickName
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
close() {
|
|
|
- this.form = {}
|
|
|
+ this.form = {
|
|
|
+ title: '',
|
|
|
+ taskStatus: -1,
|
|
|
+ level: -1,
|
|
|
+ remark: '',
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ executeUser: '',
|
|
|
+ tags: '',
|
|
|
+ taskProcess: ''
|
|
|
+ }
|
|
|
+ this.resultFiles.length = 0
|
|
|
+ this.executeUser.length = 0
|
|
|
+ this.fileList.length = 0
|
|
|
this.showDialog = false
|
|
|
+ },
|
|
|
+ upload(res) {
|
|
|
+ console.log(res)
|
|
|
}
|
|
|
}
|
|
|
}
|