wjj 4 anni fa
parent
commit
eed6014b3b
2 ha cambiato i file con 44 aggiunte e 2 eliminazioni
  1. 21 1
      src/components/task/Task.vue
  2. 23 1
      src/components/task/TaskCreate.vue

+ 21 - 1
src/components/task/Task.vue

@@ -233,9 +233,11 @@
               </el-button>
 
               <el-button v-if="taskOperationControl.forkTask" type="primary" size="mini"
-                         @click="showTaskCodeModal = !showTaskCodeModal">
+                         @click="showTaskForkModal = !showTaskForkModal">
                 fork任务
               </el-button>
+
+
               <!--<div class="btn btn-small btn-info"-->
               <!--v-if="taskOperationControl.confirmFinish"-->
               <!--@click="endTask()">确认结束-->
@@ -288,6 +290,14 @@
         <el-button type="primary" @click="handleTaskCodeValid()">确 定</el-button>
       </div>
     </el-dialog>
+
+    <el-dialog title="Fork任务?" :visible.sync="showTaskForkModal">
+      <div>确定基于该任务Fork新任务?</div>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="showTaskForkModal = false;">取 消</el-button>
+        <el-button type="primary" @click="handleForkTask()">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -329,6 +339,7 @@ export default {
   data() {
     return {
       showTaskCodeModal: false,
+      showTaskForkModal: false,
       taskValidCode:'',
       featureTaskRecommend: CONFIG.feature_task_recommend,
       taskRecommendUrl: CONFIG.task_recommend_url,
@@ -486,6 +497,14 @@ export default {
         this.showTaskCodeModal = false;
       }
     },
+    handleForkTask(){
+      //跳转到taskFork
+      this.$router.push({
+        name: 'TaskCreate',
+        params: this.task
+      })
+      this.showTaskForkModal = false;
+    },
     //跳转到任务对应的数据面板
     gotoDataboard() {
       window.open(this.task.endPoint.token)
@@ -735,6 +754,7 @@ export default {
       this.cancelMode()
       this.taskId = res.crowdTaskVO.id
       this.projectId = res.crowdTaskVO.projectId
+      this.task.projectId = res.crowdTaskVO.projectId
       this.task.title = res.crowdTaskVO.title
       this.task.description = res.crowdTaskVO.description
       this.task.serviceType = res.crowdTaskVO.serviceType

+ 23 - 1
src/components/task/TaskCreate.vue

@@ -92,7 +92,12 @@
               将文件拖到此处,或
               <em>点击上传</em>
             </div>
+
           </el-upload>
+          <span v-if="task.requireDocUrl != null && task.requireDocUrl != ''">
+                <a :href="task.requireDocUrl"><el-link :underline="false" type="primary"><i
+                  class="el-icon-document"></i>{{task.name}}的需求文档</el-link></a>
+              </span>
         </el-form-item>
         <el-form-item size="small" label="任务截止时间" prop="datetime">
           <div class="block">
@@ -277,10 +282,28 @@
       },
       init() {
         this.projectId = this.$route.params.projectId
+        this.$route.params.code && this.initTask()
         this.setServiceType()
         this.setInstitutions()
         this.setUserInfo()
       },
+      initTask(){
+        const defaultTask = this.$route.params;
+        console.log(this.$route.params);
+        this.task.name = defaultTask.title;
+        this.task.desc = defaultTask.description;
+        this.task.type = defaultTask.serviceType;
+        this.task.resource = defaultTask.resource;
+        this.task.institution = defaultTask.institution;
+        this.task.datetime = defaultTask.datetime;
+        this.task.quotePrice = defaultTask.quotePrice;
+        this.task.fixedPrice = defaultTask.fixedPrice;
+        this.task.requireDocUrl = defaultTask.requireDocUrl;
+        this.task.doc = defaultTask.requireDocUrl;
+        this.task.participantCount = defaultTask.participantCount;
+        this.task.endPoint = defaultTask.endPoint;
+        this.task.serverCode = defaultTask.serverCode;
+      },
       updateLocation(location) {
         var provinceName = ''
         var cityName = ''
@@ -408,7 +431,6 @@
       setInstitutions() {
         getAllAgencyAndTestUser().then((res) => {
           this.institutionArray = res
-          console.log(this.institutionArray)
         }).catch((error) => {
           notify('error', '测评机构加载失败')
         })