scorpio преди 2 години
родител
ревизия
abf0c888f1

+ 22 - 0
src/api/task/index.js

@@ -39,5 +39,27 @@ export default {
    */
   taskInfo(params) {
     return fetch('/blade-project-manage-v2/task-management/v2/detail', params)
+  },
+  /**
+   * 任务成果文件提交
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  taskFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/task-management/v2/submit-file',
+      params
+    )
+  },
+  /**
+   * 任务成果文件详情
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  taskFileInfo(params) {
+    return fetch(
+      '/blade-project-manage-v2/task-management/v2/file-list',
+      params
+    )
   }
 }

+ 148 - 0
src/components/upload-office/index.vue

@@ -0,0 +1,148 @@
+<template>
+  <div>
+    <el-upload
+      :action="action"
+      v-model:file-list="fileList"
+      :headers="headers"
+      :data="data"
+      :limit="max"
+      :accept="accept"
+      :multiple="max > 1"
+      :on-success="success"
+      :on-progress="progress"
+      :show-file-list="false"
+    >
+      <el-button type="primary" icon="Upload">{{ btnText }}</el-button>
+    </el-upload>
+    <div class="flex flex-justify-start flex-wrap mt-10">
+      <div
+        v-for="item in resultList"
+        :key="item.id"
+        class="padding-left padding-right radius-5 white grey-9-bg ml-5"
+      ></div>
+    </div>
+    <div class="upload" v-if="drawer">
+      <div>
+        <div class="full-width flex flex-justify-end">
+          <el-icon @click="drawer = false">
+            <CircleClose />
+          </el-icon>
+        </div>
+        <div class="mt-20 file-content">
+          <div v-for="file in fileList" :key="file.name" class="mb-20">
+            <div class="flex flex-align-center">
+              <div>{{ file.name }} , ({{ bytesToSize(file.size) }})</div>
+              <div></div>
+            </div>
+            <el-progress :percentage="file.percentage" />
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import api from '@/api/index.js'
+import { bytesToSize } from '@/utils/tools.js'
+import website from '@/config/website.js'
+import { getToken } from '@/utils/auth.js'
+import { Base64 } from 'js-base64'
+
+export default {
+  props: {
+    btnText: {
+      type: String,
+      default: '文件上传'
+    },
+    accept: {
+      type: String,
+      default: '.pdf, .doc,.docx,.ppt, .pptx, .xls, .xlsx,.PDF'
+    },
+    max: {
+      type: Number,
+      default: 9
+    },
+    data: Object,
+    action: {
+      type: String,
+      default: api.uploadPath
+    }
+  },
+  data() {
+    return {
+      drawer: false,
+      headers: {
+        Authorization: `Basic ${Base64.encode(
+          `${website.clientId}:${website.clientSecret}`
+        )}`,
+        'Blade-Auth': 'bearer ' + getToken()
+      },
+      fileList: [],
+      resultList: []
+    }
+  },
+  methods: {
+    bytesToSize,
+    progress(res) {
+      this.drawer = true
+    },
+    success(res) {
+      if (res.code === 200) {
+        this.resultList.push(res.data)
+      }
+      if (this.resultList.length === this.fileList.length) {
+        this.saveLibrary()
+      }
+    },
+    /**
+     * 保存到library
+     */
+    saveLibrary() {
+      this.resultList
+        .filter(ele => api.offices.includes(ele.suffix))
+        .forEach(ele => {
+          console.log(ele)
+          const item = {
+            category: 4,
+            fileId: ele.id,
+            parentId: this.parentId,
+            projectId: this.projectId,
+            stageId: this.stageId,
+            type: 1,
+            title: ele.originalFileName,
+            content: ''
+          }
+          this.$api.common.submit(item).then(res => {
+            if (res.code === 200) {
+              this.drawer = false
+              this.$message.success(res.msg)
+              this.$emit('success', this.resultList)
+            }
+          })
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.upload {
+  position: fixed;
+  z-index: 99;
+  bottom: 0;
+  right: 0;
+  background-color: white;
+  height: 300px;
+  width: 480px;
+  border-top-left-radius: 10px;
+  border: #eeeeee solid 1px;
+  box-shadow: -2px 2px 20px rgba(0, 0, 0, 0.1);
+  padding: 20px;
+}
+
+.file-content {
+  height: 280px;
+  overflow-y: scroll;
+}
+</style>

+ 13 - 7
src/views/resource/component/preview.vue

@@ -28,12 +28,12 @@
         </div>
         <div
           class="bottom flex flex-center flex-justify-center"
-          v-if="info.isAccess === 2"
+          v-if="info.isAccess === 2 || showAction"
         >
           <el-button type="primary" icon="Download" @click="downloadClick"
             >下 载</el-button
           >
-          <share class="ml-20" :row="info" />
+          <share class="ml-20" :row="info" v-if="info.isAccess === 2" />
         </div>
       </div>
     </el-drawer>
@@ -49,6 +49,10 @@ export default {
     share
   },
   props: {
+    showAction: {
+      type: Boolean,
+      default: false
+    },
     info: {
       type: Object,
       default: null
@@ -83,11 +87,13 @@ export default {
       }
     },
     detail() {
-      this.$api.resource.fileDetail(this.info.fileId).then(res => {
-        if (res.code === 200) {
-          this.data = res.data
-        }
-      })
+      this.$api.resource
+        .fileDetail(this.info.fileId ? this.info.fileId : this.info.id)
+        .then(res => {
+          if (res.code === 200) {
+            this.data = res.data
+          }
+        })
     },
     async downloadClick() {
       const link = document.createElement('a')

+ 252 - 0
src/views/task/component/move.vue

@@ -0,0 +1,252 @@
+<template>
+  <div>
+    <el-dialog v-model="show" width="800" :show-close="false">
+      <template #header>
+        <div class="full-width flex flex-center flex-justify-between">
+          <h4>移动文件</h4>
+          <div class="flex flex-center flex-justify-end">
+            <div class="flex flex-center">
+              <span class="mr-10">项目阶段:</span>
+              <el-select
+                v-model="stageId"
+                remote
+                filterable
+                clearable
+                placeholder="筛选项目阶段"
+                style="width: 200px"
+              >
+                <el-option
+                  v-for="item in stageList"
+                  :key="item.id"
+                  :label="item.name"
+                  :value="item.id"
+                >
+                </el-option>
+              </el-select>
+            </div>
+            <el-button
+              type="info"
+              class="ml-10"
+              circle
+              icon="Close"
+              @click="show = false"
+            >
+            </el-button>
+          </div>
+        </div>
+      </template>
+      <div>
+        <file-way
+          class="mb-10"
+          :next="currentFolder"
+          @before="goBefore"
+          @goHome="getFolderList"
+        />
+        <div class="mt-20 border-top flex flex-center flex-col">
+          <div
+            v-if="data.length === 0"
+            class="flex flex-center content flex-col full-height"
+          >
+            <el-empty
+              :description="loading ? '加载中...' : '暂无数据'"
+            ></el-empty>
+          </div>
+          <div v-else class="full-width content border-top">
+            <div
+              v-for="i in data"
+              class="padding light-green-bg row"
+              :key="i.id"
+              @click="getFileList(i)"
+            >
+              <div class="flex flex-center flex-justify-start">
+                <img
+                  v-if="i.isAccess === 1"
+                  src="../../../assets/svg/folder/see.svg"
+                />
+                <img
+                  v-if="i.isAccess === 2"
+                  src="../../../assets/svg/folder/edit.svg"
+                />
+                <img
+                  v-if="i.isAccess === 3"
+                  src="../../../assets/svg/folder/invisible.svg"
+                />
+                {{ i.title }}
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="full-width flex flex-justify-end flex-center mt-20">
+        <el-button type="primary" plain @click="show = false">取 消</el-button>
+        <el-button type="primary" @click="move">移动到此</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import fileWay from '@/components/file-way/index.vue'
+
+export default {
+  components: {
+    fileWay
+  },
+  props: {
+    projectId: {
+      required: true,
+      type: String,
+      default: ''
+    },
+    fileId: {
+      required: true,
+      type: String,
+      default: ''
+    }
+  },
+  watch: {
+    show: {
+      handler(val) {
+        if (val) {
+          this.getStage()
+        }
+      },
+      immediate: true
+    }
+  },
+  data() {
+    return {
+      loading: false,
+      show: false,
+      currentFolder: null,
+      stageId: '',
+      topFolder: true,
+      data: [],
+      stageList: [],
+      page: {
+        current: 1,
+        size: 10
+      }
+    }
+  },
+  methods: {
+    show() {
+      this.show = true
+    },
+    /**
+     * 获取项目阶段
+     */
+    getStage() {
+      this.$api.project
+        .includeStage({ projectId: this.projectId })
+        .then(res => {
+          if (res.code === 200) {
+            this.stageList = res.data
+            const tmp = this.stageList.find(ele => ele.isLastSelect === 1)
+            if (tmp) {
+              this.stageId = tmp.id
+            } else {
+              this.stageId = this.stageList[0].id
+            }
+            this.getFolderList()
+          }
+        })
+    },
+    /**
+     * 获取阶段对应的一级文件夹
+     */
+    getFolderList() {
+      this.loading = true
+      this.topFolder = true
+      const data = {
+        projectId: this.projectId,
+        stageId: this.stageId,
+        dictKey: 1,
+        current: this.page.current,
+        size: this.page.size
+      }
+      this.data.length = 0
+      this.loading = true
+      this.top = true
+      this.$api.resource.folderList(data).then(res => {
+        this.loading = false
+        this.loading = false
+        if (res.code === 200) {
+          this.data = res.data.records
+          this.page.total = res.data.total
+        }
+      })
+    },
+    /**
+     * 获取文件夹下面的文件及文件夹
+     * @param row
+     */
+    getFileList(row) {
+      if (row.isAccess !== 2) {
+        this.$message.error('您暂无权限访问此文件夹,如需访问请主动申请授权')
+        return
+      }
+      this.loading = true
+      this.topFolder = false
+      this.currentFolder = row
+      const item = {
+        id: row.id,
+        current: this.page.current,
+        size: this.page.size,
+        type: 2
+      }
+      this.loading = true
+      this.data.length = 0
+      this.$api.resource.fileList(item).then(res => {
+        this.loading = false
+        if (res.code === 200) {
+          this.data = res.data.records
+          this.page.total = res.data.total
+        } else {
+          this.$message.error(res.msg)
+        }
+      })
+    },
+    goBefore(res) {
+      if (!this.topFolder) {
+        this.getFileList(res)
+      } else {
+        this.getFolderList()
+      }
+    },
+    move() {
+      this.$api.resource
+        .fileMove({ fileId: this.fileId, folderId: this.currentFolder.id })
+        .then(res => {
+          if (res.code === 200) {
+            this.$message.success(res.msg)
+            this.show = false
+            this.$emit('on-success')
+          }
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.content {
+  height: 500px;
+  overflow-y: scroll;
+}
+
+.row {
+  border-bottom: #eeeeee solid 1px;
+  background-color: white;
+
+  img {
+    width: 30px;
+    height: auto;
+    margin-right: 10px;
+  }
+}
+
+.row:hover {
+  background-color: #f7f9fc;
+}
+</style>

+ 38 - 30
src/views/task/component/task-table.vue

@@ -1,9 +1,14 @@
 <template>
   <div>
     <div class="full-width flex flex-center flex-justify-between">
-      <el-button type="primary" icon="el-icon-plus" @click="addTask"
+      <el-button
+        type="primary"
+        icon="el-icon-plus"
+        @click="addTask"
+        v-if="option.addBtn || option.addBtn === undefined"
         >新增任务
       </el-button>
+      <div v-else></div>
       <el-button circle icon="Refresh" @click="refresh" />
     </div>
     <div class="header flex flex-justify-between full-width mt-10">
@@ -47,22 +52,23 @@
               <div
                 class="level"
                 :style="
-                  `background-color:` + row && row.currentLevel
-                    ? row.currentLevel.color
-                    : 'white'
+                  `background-color:` +
+                  (row && row.currentLevel ? row.currentLevel.color : 'white')
                 "
               ></div>
               <wt-tag
                 :data="status"
                 :status="row.taskStatus"
                 :disabled="true"
-                @change="changeStatus()"
               />
               {{ row[column.prop] }}
             </div>
           </div>
+          <div v-else-if="index === 1" class="flex flex-center full-height">
+            {{ row[column.prop] }}
+          </div>
           <div
-            v-else-if="index === 1"
+            v-else-if="index === 2"
             class="flex-child-average full-height full-width flex flex-center"
           >
             <div>
@@ -72,11 +78,22 @@
             </div>
           </div>
           <div
-            v-else-if="index === 2"
+            v-else-if="index === 3"
             class="flex-child-average full-height full-width flex flex-center"
           >
             <div>
-              <div>{{ row.startTime }} 至 {{ row.endTime }}</div>
+              <div v-if="row.startTime.length > 0 && row.endTime.length === 0">
+                {{ row.startTime.substring(5) }} 开始
+              </div>
+              <div
+                v-else-if="row.startTime.length === 0 && row.endTime.length > 0"
+              >
+                {{ row.endTime.substring(5) }} 截止
+              </div>
+              <div v-else>
+                {{ row.startTime.substring(5) }} 至
+                {{ row.endTime.substring(5) }}
+              </div>
             </div>
           </div>
           <div
@@ -102,7 +119,12 @@
         </div>
       </div>
     </div>
-    <task ref="task" :task="task" :project-id="projectId"></task>
+    <task
+      ref="task"
+      :task="task"
+      :project-id="projectId"
+      @success="refresh"
+    ></task>
   </div>
 </template>
 
@@ -161,15 +183,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
         },
         {
@@ -220,29 +242,16 @@ export default {
       return list
     },
     addTask() {
-      this.$refs.task.show()
+      this.task = null
+      this.$refs.task.show(1)
     },
     rowClick(item) {
       this.$emit('rowClick', item)
       this.task = item
-      this.$refs.task.show()
-    },
-    changeStatus(res) {
-      this.info.taskStatus = res.value
-      this.submit()
+      this.$refs.task.show(2)
     },
     refresh() {
       this.$emit('refresh')
-    },
-    submit() {
-      this.$api.task.addTask(this.info).then(res => {
-        this.showDialog = false
-        if (res.code === 200) {
-          this.$message.success(res.msg)
-        } else {
-          this.$message.error(res.msg)
-        }
-      })
     }
   }
 }
@@ -272,6 +281,5 @@ export default {
   width: 5px;
   height: 100%;
   margin-right: 10px;
-  background-color: red;
 }
 </style>

+ 189 - 46
src/views/task/component/task.vue

@@ -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)
     }
   }
 }

+ 8 - 2
src/views/task/component/tasker.vue

@@ -8,7 +8,7 @@
       >
         <el-avatar :size="15" :src="i.avatar"></el-avatar>
         <div class="ml-5">{{ i.name }}</div>
-        <el-icon class="ml-10" @click="remove(i)">
+        <el-icon class="ml-10" @click="remove(i)" v-if="!disabled">
           <CircleCloseFilled />
         </el-icon>
       </div>
@@ -18,6 +18,7 @@
       class="padding-left padding-right"
       color="#A3773D"
       @click="show = true"
+      v-if="!disabled"
     >
       <CirclePlusFilled />
     </el-icon>
@@ -79,6 +80,10 @@ import { useStore } from '@/store/user.js'
 
 export default {
   props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    },
     data: {
       type: Array,
       default: []
@@ -91,9 +96,10 @@ export default {
   watch: {
     data: {
       handler(val) {
-        console.log(val)
         if (val && val.length > 0) {
           this.selectedList = val
+        } else {
+          this.selectedList.length = 0
         }
       },
       immediate: true

+ 7 - 0
src/views/task/component/wt-label.vue

@@ -11,6 +11,7 @@
       class="padding-left padding-right"
       color="#A3773D"
       @click="show = true"
+      v-if="!disabled"
     >
       <CirclePlusFilled />
     </el-icon>
@@ -44,6 +45,12 @@
 
 <script>
 export default {
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
   data() {
     return {
       show: false,

+ 11 - 9
src/views/task/component/wt-tag.vue

@@ -2,12 +2,13 @@
   <el-dropdown @command="dropDown" :disabled="disabled">
     <span class="flex flex-center">
       <div
+        v-if="current"
         class="tag flex flex-center"
         :style="`background-color:` + current.color"
         style="min-width: 60px"
       >
-        <div class="font-12 bold black">{{ current.title }}</div>
-        <el-icon class="el-icon--right">
+        <div class="font-12 bold black white">{{ current.title }}</div>
+        <el-icon class="el-icon--right" color="white">
           <arrow-down />
         </el-icon>
       </div>
@@ -22,7 +23,7 @@
           <template #default>
             <div
               :style="`background-color:` + item.color"
-              class="black padding-left padding-right flex flex-center"
+              class="black padding-left padding-right flex flex-center white"
               style="min-width: 50px"
             >
               {{ item.title }}
@@ -51,15 +52,16 @@ export default {
     }
   },
   watch: {
-    data: {
+    status: {
       handler(val) {
-        if (val && val.length > 0) {
-          if (this.status !== -1) {
-            this.current = val.find(e => e.value === this.status)
+        console.log(this.data)
+        setTimeout(() => {
+          if (val !== -1) {
+            this.current = this.data.find(e => e.value === this.status)
           } else {
-            this.current = val.find(e => e.checked)
+            this.current = this.data[0]
           }
-        }
+        }, 200)
       },
       immediate: true
     }

+ 10 - 2
src/views/task/index.vue

@@ -19,11 +19,12 @@
         <task-table
           :option="option"
           :data="data"
+          :total="total"
           @rowClick="rowClick"
           @refresh="getTaskList"
         ></task-table>
       </div>
-      <task ref="task" :task="task"></task>
+      <task type="view" ref="task" :task="task"></task>
     </div>
   </el-card>
 </template>
@@ -46,15 +47,21 @@ export default {
       data: [],
       task: [],
       taskId: '',
+      total: 0,
       option: {
         showCheckBox: false,
         folderChecked: true,
+        addBtn: false,
         column: [
           {
             label: '共20个任务',
             prop: 'title',
             display: false,
-            width: 600
+            width: 500
+          },
+          {
+            label: '所属项目',
+            prop: 'projectName'
           },
           {
             label: '标签',
@@ -80,6 +87,7 @@ export default {
       this.$api.task.taskList({}).then(res => {
         if (res.code === 200) {
           this.data = res.data.records
+          this.total = res.data.total
         }
       })
     },