scorpio преди 2 години
родител
ревизия
422420109b
променени са 5 файла, в които са добавени 114 реда и са изтрити 16 реда
  1. 11 0
      src/api/task/index.js
  2. 8 9
      src/components/filepicker/index.vue
  3. 58 6
      src/views/task/component/task.vue
  4. 13 0
      src/views/task/component/tasker.vue
  5. 24 1
      src/views/task/component/wt-label.vue

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

@@ -51,6 +51,17 @@ export default {
       params
     )
   },
+  /**
+   * 删除成果文件
+   * @param params
+   * @returns {Promise | Promise<unknown>}
+   */
+  delTaskFile(params) {
+    return fetch(
+      '/blade-project-manage-v2/task-management/v2/delete-file',
+      params
+    )
+  },
   /**
    * 任务成果文件详情
    * @param params

+ 8 - 9
src/components/filepicker/index.vue

@@ -119,15 +119,7 @@
                     @before="goBefore"
                     @goHome="getHome"
                   />
-                  <el-button
-                    text
-                    type="primary"
-                    @click="
-                      $router.push({
-                        path: '/resource',
-                        query: { id: projectId }
-                      })
-                    "
+                  <el-button text type="primary" @click="openResource"
                     >资料管理
                     <el-icon class="ml-10">
                       <ArrowRight />
@@ -445,6 +437,13 @@ export default {
         this.currentCommand ? this.currentCommand : '',
         this.extra ? this.extra : ''
       )
+    },
+    openResource() {
+      this.$router.push({
+        path: '/resource',
+        query: { id: this.projectId }
+      })
+      this.show = false
     }
   }
 }

+ 58 - 6
src/views/task/component/task.vue

@@ -1,5 +1,10 @@
 <template>
-  <el-dialog v-model="showDialog" width="800" @close="close">
+  <el-dialog
+    v-model="showDialog"
+    width="800"
+    @close="close"
+    :close-on-click-modal="false"
+  >
     <template #header>
       <div class="full-width flex flex-center flex-justify-between">
         <h4>任务详情</h4>
@@ -83,12 +88,22 @@
             />
           </div>
         </div>
+        <div
+          class="mt-20 flex lex-align-start flex-justify-start"
+          v-if="form && form.createUserName && form.createUserName.length > 0"
+        >
+          <span class="mr-10 title flex flex-justify-start">创建人:</span>
+          <div class="tag">
+            <div class="ml-5">{{ form.createUserName }}</div>
+          </div>
+        </div>
         <div class="mt-20 flex lex-align-start flex-justify-start">
           <span class="mr-10 title flex flex-justify-start">执行者:</span>
           <div>
             <tasker
               :data="executeUser === null ? [] : executeUser"
               :disabled="!canEdit"
+              ref="tasker"
               @success="selected"
             />
           </div>
@@ -145,11 +160,20 @@
           </div>
           <div class="full-width flex flex-justify-start flex-center">
             <div class="title mr-10" />
-            <div v-for="item in resultFiles" :key="item.id">
-              <div class="flex flex-justify-start flex-center">
-                {{ item.fileVO.originalFileName }}
-                ({{ item.createUserName }})
-                <preview :id="item.fileVO.id" :show-action="true"></preview>
+            <div>
+              <div v-for="item in resultFiles" :key="item.id">
+                <div class="flex flex-justify-start flex-center">
+                  {{ item.fileVO.originalFileName }}
+                  ({{ item.createUserName }})
+                  <preview :id="item.fileVO.id" :show-action="true"></preview>
+                  <el-button
+                    text
+                    type="primary"
+                    v-if="isFinish === false"
+                    @click="removeFile(item)"
+                    >删除</el-button
+                  >
+                </div>
               </div>
             </div>
           </div>
@@ -457,6 +481,7 @@ export default {
       this.editResult = false
       this.isMove = false
       this.isFinish = false
+      this.$refs.tasker.reset()
     },
     /**
      * 文件移动成功
@@ -464,6 +489,23 @@ export default {
     moveSucc() {
       this.isMove = true
     },
+    removeFile(item) {
+      console.log(item)
+      this.$confirm('确定将选择数据删除?', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(res => {
+        console.log(res)
+        if (res === 'confirm') {
+          this.$api.task.delTaskFile({ ids: item.id }).then(res => {
+            if (res.code === 200) {
+              this.resultFiles = this.resultFiles.filter(e => e.id !== item.id)
+            }
+          })
+        }
+      })
+    },
     goProject() {
       const routeData = this.$router.resolve({
         path: '/project',
@@ -491,4 +533,14 @@ export default {
   box-shadow: none;
   background-color: #eeeeee;
 }
+
+.tag {
+  min-width: 60px;
+  height: 20px;
+  border-radius: 20px;
+  background-color: #a3773d;
+  padding: 2px 10px;
+  margin: 0 5px;
+  color: white;
+}
 </style>

+ 13 - 0
src/views/task/component/tasker.vue

@@ -103,6 +103,16 @@ export default {
         }
       },
       immediate: true
+    },
+    keyword: {
+      handler(val) {
+        if (val.length > 0) {
+          setTimeout(() => {
+            this.getUser()
+          }, 200)
+        }
+      },
+      immediate: false
     }
   },
   data() {
@@ -151,6 +161,9 @@ export default {
     },
     remove(res) {
       this.selectedList = this.selectedList.filter(ele => ele.id !== res.id)
+    },
+    reset() {
+      this.selectedList.length = 0
     }
   }
 }

+ 24 - 1
src/views/task/component/wt-label.vue

@@ -61,6 +61,17 @@ export default {
       default: false
     }
   },
+  watch: {
+    ids: {
+      handler(val) {
+        this.tags.length = 0
+        if (val.length > 0) {
+          this.initTags()
+        }
+      },
+      immediate: true
+    }
+  },
   data() {
     return {
       show: false,
@@ -100,11 +111,23 @@ export default {
           })
           if (this.ids.length > 1) {
             const tmp = this.options1.find(ele => ele.id === this.ids[1])
-            this.tags.push(tmp)
+            if (tmp) {
+              this.tags.push(tmp)
+            }
           }
         }
       })
     },
+    initTags() {
+      const tmp = this.options.find(ele => ele.id === this.ids[0])
+      if (tmp) {
+        this.tags.push(tmp)
+      }
+      const tmp2 = this.options1.find(ele => ele.id === this.ids[1])
+      if (tmp) {
+        this.tags.push(tmp2)
+      }
+    },
     submit() {
       this.tags = [
         this.options.find(ele => ele.dictKey === this.form.tag1),