wangziqian il y a 5 ans
Parent
commit
544afcbed9

+ 9 - 4
src/views/projectManage/taskList/childrenTask/addChildrenList.vue

@@ -19,8 +19,8 @@
           />
         </el-select>
         <div class="input-name">
-          <span v-if="!item.edit">{{ item.name }}</span>
-          <el-input v-if="item.edit" v-model="item.name" placeholder="请输入任务名称(必填)" size="medium" clearable="" />
+          <span v-if="!item.edit" @click="toDetail(item.id)">{{ item.name }}</span>
+          <el-input v-if="item.edit" v-model="item.name" placeholder="请输入任务名称(必填)" size="medium" clearable />
           <div v-if="item.edit" class="footer">
             <el-button size="mini" @click="cancelChild(index,item.newNode)">取消</el-button>
             <el-button type="primary" size="mini" @click="confirmChild(index,item.name)">确定</el-button>
@@ -49,7 +49,7 @@
           >
             <div class="edit-cancel">
               <p @click="editChild(index,item)">编辑</p>
-              <p @click="cancelChild(index)">删除</p>
+              <p @click="deleteChild(index)">删除</p>
             </div>
             <div slot="reference"><i class="el-icon-more" /></div>
           </el-popover>
@@ -150,8 +150,13 @@ export default {
         this.$emit('list:update', this.childrenList)
       } else {
         this.$set(this.childrenList[index], 'edit', false)
+        this.update()
       }
     },
+    deleteChild(index) {
+      this.childrenList.splice(index, 1)
+      this.update()
+    },
     confirmChild(index, name) { // 确认添加子任务
       const value = name && name.replace(/\s*/, '')
       if (value === null || value === '') {
@@ -249,7 +254,7 @@ export default {
 		}
 	}
 	.child-endTime {
-		width: 30%;
+		max-width: 30%;
 		height: 36px;
 		padding-left: 20px;
 		display: flex;

+ 10 - 0
src/views/projectManage/taskList/childrenTask/childDetail.vue

@@ -105,6 +105,7 @@
               :data="formData"
               :all-status="allStatus"
               @change="changeArea('childSubTaskInfos')"
+              @toDetail="toChild"
             />
           </div>
         </section>
@@ -171,6 +172,12 @@ export default {
       return this.allStatus.find(item => item.code === this.formData.status) || { msg: null }
     }
   },
+  watch: {
+    '$route'(to, from) {
+      this.taskId = Number(this.$route.query.id)
+      this.getById()
+    }
+  },
   created() {
     this.$store.state.data.status = true
     this.$store.state.data.bizId = true
@@ -251,6 +258,9 @@ export default {
         this.$message({ message: '删除成功', type: 'success', duration: 1000, offset: 150 })
         this.$router.go(-1)
       }
+    },
+    toChild(id) { // 前往子任务
+      this.$router.push({ name: '子任务详情', query: { id: id }})
     }
   }
 }