wangziqian 5 жил өмнө
parent
commit
afd3b95d9a

+ 2 - 2
src/views/projectManage/taskList/childrenTask/addChildrenList.vue

@@ -228,7 +228,7 @@ export default {
 		}
 	}
 	.input-name {
-		min-width: calc(70% - 70px);
+		width: calc(70% - 70px);
 		padding-left: 14px;
 		line-height: 24px;
 		color: #333333;
@@ -249,7 +249,7 @@ export default {
 		}
 	}
 	.child-endTime {
-		max-width: 30%;
+		width: 30%;
 		height: 36px;
 		padding-left: 20px;
 		display: flex;

+ 89 - 2
src/views/projectManage/taskList/childrenTask/changeStatus.vue

@@ -9,7 +9,20 @@
       top="15vh"
       @close="cancel()"
     >
-      <slot />
+      <div class="center-main">
+        <div class="danger-img">
+          <img :src="dangerImg">
+        </div>
+        <div class="delete-title">
+          当前任务存在未完成状态的子任务,请先将所有子任务的<br>状态变更为已完成状态!
+        </div>
+        <div class="task-list-show">
+          <div v-for="(item,index) in tasksDetailList" :key="'task'+index" class="task-list-item">
+            <div class="item-id">SUBTASK-{{ item.id }}</div>
+            <div class="item-name"><span>{{ item.name }}</span></div>
+          </div>
+        </div>
+      </div>
       <span slot="footer" class="dialog-footer">
         <div class="confirm" @click="confirm()">
           <span>强制变更状态</span>
@@ -21,22 +34,36 @@
   </div>
 </template>
 <script>
+import danger from '@/assets/感叹@2x.png'
 export default {
   props: {
     showDialog: {
       type: Boolean,
       default: false,
       required: true
+    },
+    data: {
+      type: Array,
+      default: () => [],
+      required: false
     }
   },
   data() {
     return {
-      visible: this.showDialog
+      dangerImg: danger,
+      visible: this.showDialog,
+      tasksDetailList: []
     }
   },
   watch: {
     showDialog() {
       this.visible = this.showDialog
+    },
+    data: {
+      handler(newV) {
+        this.tasksDetailList = newV
+      },
+      immediate: true
     }
   },
   methods: {
@@ -71,11 +98,38 @@ export default {
   height: 20px;
   background-color: rgb(64, 158, 255);;
 }
+.center-main {
+	.danger-img {
+		width: 100%;
+		padding: 0 60px 50px 60px;
+		margin-bottom: 50px;
+		position: relative;
+		img {
+			height: 50px;
+			width: 50px;
+			position: absolute;
+			left: 50%;
+			transform: translate(-50%,0);
+		}
+	}
+	.delete-title {
+		width: 100%;
+		padding: 0 60px 60px 60px;
+		color: #333333;
+		font-size: 18px;
+		text-align: center;
+	}
+}
 .dialog-footer {
 	width: 100%;
+	display: flex;
+	justify-content: space-between;
+	padding: 0 150px;
 	.confirm {
+		cursor: pointer;
 		width: 150px;
 		height: 45px;
+		padding: 5px 0;
 		display: flex;
 		flex-direction: column;
 		justify-content: space-around;
@@ -83,8 +137,12 @@ export default {
 		background-color: #CB2B29;
 		border-radius: 4px;
 		color: #ffffff;
+		:nth-child(2n){
+			font-size: 10px;
+		}
 	}
 	.cancel {
+		cursor: pointer;
 		width: 150px;
 		height: 45px;
 		display: flex;
@@ -95,4 +153,33 @@ export default {
 		border-radius: 4px;
 	}
 }
+.task-list-show {
+  width: 100%;
+  padding: 0 60px;
+  .task-list-item {
+    width: 100%;
+    display: flex;
+    margin: 10px 0;
+    .item-id {
+      width: 15%;
+    }
+    .item-name {
+      width: 40%;
+    }
+    .item-qa {
+      width: 20%;
+    }
+    .item-rd {
+      width: 20%;
+    }
+    .item-cancel {
+      font-size: 20px;
+    }
+    div {
+      overflow: hidden;
+      text-overflow:ellipsis;
+      white-space: nowrap;
+    }
+  }
+}
 </style>

+ 24 - 4
src/views/projectManage/taskList/childrenTask/childDetail.vue

@@ -74,7 +74,9 @@
                 <div class="block">
                   <el-slider v-model="formData.process" @change="changeProgres" />
                 </div>
-                <el-input v-model="formData.process" @input="changeProgres">
+              </el-form-item>
+              <el-form-item>
+                <el-input v-model.number="formData.process" style="width: 90px" @change="changeProgres">
                   <template slot="append">%</template>
                 </el-input>
               </el-form-item>
@@ -108,6 +110,7 @@
         </section>
       </el-container>
       <create-children v-if="createChildren" :visible.sync="createChildren" :data="formData" @change="getById()" />
+      <change-status v-if="statusDialog" :show-dialog.sync="statusDialog" :data="noCompleteTask" @confirm="changeArea('status');statusDialog=false" @cancel="getById()" />
       <!-- 删除 -->
       <normal-dialog
         v-if="deleteDialog"
@@ -136,6 +139,7 @@ import searchPeople from '@/components/select/searchPeople'
 import textArea from '@/components/input/textArea'
 import addChildrenList from './addChildrenList'
 import createChildren from './createChildren'
+import changeStatus from './changeStatus'
 import normalDialog from '@/components/dialog/normalDialog'
 import danger from '@/assets/感叹@2x.png'
 export default {
@@ -144,7 +148,8 @@ export default {
     textArea,
     addChildrenList,
     normalDialog,
-    createChildren
+    createChildren,
+    changeStatus
   },
   data() {
     return {
@@ -156,7 +161,9 @@ export default {
       deleteDialog: false, // 删除弹窗
       taskId: Number(this.$route.query.id), // 任务id
       allStatus: [], // 任务所有状态
-      createChildren: false // 新建子任务
+      createChildren: false, // 新建子任务
+      statusDialog: false, // 状态弹框
+      noCompleteTask: [] // 当前任务中未完成的子任务
     }
   },
   computed: {
@@ -183,8 +190,21 @@ export default {
     }, 1500),
     updateStatus(e) { // 变更状态
       this.formData.status = e.value
+      if (this.formData.status === 20) {
+        this.noCompleteTask = []
+        this.findNoComplete(this.formData.childSubTaskInfos)
+        this.noCompleteTask = this.noCompleteTask.filter(item => item.status !== 20)
+        this.statusDialog = true
+        return
+      }
       this.changeArea('status')
     },
+    findNoComplete(arr) { // 查找未完成子任务
+      arr.map(item => {
+        this.noCompleteTask = this.noCompleteTask.concat(item)
+        this.findNoComplete(item.childSubTaskInfos)
+      })
+    },
     async changeArea(e) { // area修改
       const params = {
         id: this.formData.id,
@@ -299,7 +319,7 @@ export default {
   }
   .demo-form-all {
 		.el-form-item {
-			width: 33%;
+			width: 25%;
       margin-right: 0;
       /deep/.el-form-item__content {
         width: calc(100% - 100px)

+ 23 - 3
src/views/projectManage/taskList/childrenTask/childDrawer.vue

@@ -2,7 +2,8 @@
   <el-drawer
     :visible.sync="visible"
     :with-header="false"
-    size="60%"
+    size="50%"
+    :modal="false"
     @close="close"
   >
     <el-container class="is-vertical">
@@ -127,6 +128,7 @@
         </div>
       </section>
       <create-children v-if="createChildren" :visible.sync="createChildren" :data="formData" @change="getById()" />
+      <change-status v-if="statusDialog" :show-dialog.sync="statusDialog" :data="noCompleteTask" @confirm="changeArea('status');statusDialog=false" @cancel="getById()" />
       <!-- 删除 -->
       <normal-dialog
         v-if="deleteDialog"
@@ -156,6 +158,7 @@ import searchPeople from '@/components/select/searchPeople'
 import textArea from '@/components/input/textArea'
 import addChildrenList from './addChildrenList'
 import createChildren from './createChildren'
+import changeStatus from './changeStatus'
 import normalDialog from '@/components/dialog/normalDialog'
 import danger from '@/assets/感叹@2x.png'
 export default {
@@ -164,7 +167,8 @@ export default {
     textArea,
     addChildrenList,
     normalDialog,
-    createChildren
+    createChildren,
+    changeStatus
   },
   props: {
     childId: {
@@ -183,7 +187,9 @@ export default {
       deleteDialog: false, // 删除弹窗
       taskId: this.childId, // 任务id
       allStatus: [], // 任务所有状态
-      createChildren: false // 新建子任务
+      createChildren: false, // 新建子任务
+      statusDialog: false, // 状态弹框
+      noCompleteTask: [] // 当前任务中未完成的子任务
     }
   },
   computed: {
@@ -218,8 +224,21 @@ export default {
     }, 1500),
     updateStatus(e) { // 变更状态
       this.formData.status = e.value
+      if (this.formData.status === 20) {
+        this.noCompleteTask = []
+        this.findNoComplete(this.formData.childSubTaskInfos)
+        this.noCompleteTask = this.noCompleteTask.filter(item => item.status !== 20)
+        this.statusDialog = true
+        return
+      }
       this.changeArea('status')
     },
+    findNoComplete(arr) { // 查找未完成子任务
+      arr.map(item => {
+        this.noCompleteTask = this.noCompleteTask.concat(item)
+        this.findNoComplete(item.childSubTaskInfos)
+      })
+    },
     async changeArea(e) { // area修改
       const params = {
         id: this.formData.id,
@@ -235,6 +254,7 @@ export default {
       if (res.code === 200) {
         this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
         this.getById()
+        this.$emit('change')
       }
     },
     async getTaskStatus() { // 获取任务状态列表

+ 27 - 8
src/views/projectManage/taskList/childrenTask/childrenList.vue

@@ -42,8 +42,8 @@
         </template>
       </el-table-column>
     </el-table>
-    <change-status :show-dialog="statusDialog" />
-    <child-drawer v-if="drawer" :child-id="taskObj.id" @close="drawer = false;getSubTasksList()" />
+    <change-status v-if="statusDialog" :show-dialog.sync="statusDialog" :data="noCompleteTask" @confirm="confirmChange()" @cancel="getSubTasksList()" />
+    <child-drawer v-if="drawer" :child-id="taskObj.id" @close="drawer = false;getSubTasksList()" @change="getSubTasksList()" />
   </div>
 </template>
 <script>
@@ -67,7 +67,8 @@ export default {
       showTaskDialog: false, // 更改状态弹框
       taskObj: { id: 0 }, // 当前任务
       drawer: false,
-      statusDialog: false // 状态弹框
+      statusDialog: false, // 状态弹框
+      noCompleteTask: [] // 当前任务中未完成的子任务
     }
   },
   created() {
@@ -87,18 +88,36 @@ export default {
       const res = await showIterationEnum()
       res.code === 200 ? this.allStatus = res.data.subTaskStatus : this.allStatus = []
     },
-    async changeStatus(e) { // 状态改变
+    changeStatus(e) { // 状态改变
+      this.taskObj = e
+      if (e.status === 20) {
+        this.noCompleteTask = []
+        this.findNoComplete(e.childSubTaskInfos)
+        this.noCompleteTask = this.noCompleteTask.filter(item => item.status !== 20)
+        this.statusDialog = true
+        return
+      }
+      this.confirmChange()
+    },
+    async confirmChange() { // 确认状态更改
       const res = await subTaskUpdate({
-        id: e.id,
-        taskId: e.taskId,
-        bizId: e.bizId,
-        status: e.status
+        id: this.taskObj.id,
+        taskId: this.taskObj.taskId,
+        bizId: this.taskObj.bizId,
+        status: this.taskObj.status
       })
       if (res.code === 200) {
         this.$message({ message: '修改成功', type: 'success', offset: 150 })
+        this.statusDialog = false
       }
       this.getSubTasksList()
     },
+    findNoComplete(arr) { // 查找未完成子任务
+      arr.map(item => {
+        this.noCompleteTask = this.noCompleteTask.concat(item)
+        this.findNoComplete(item.childSubTaskInfos)
+      })
+    },
     showChild(obj) { // 展示子任务
       this.taskObj = obj
       this.drawer = true