deepsea 1 year ago
parent
commit
4495b407bf

+ 6 - 0
src/api/plan.js

@@ -49,3 +49,9 @@ export const getPlanResult = (data) => {
         param
     });
 }
+
+export const getAutoPlanDetail = (planId) => {
+  return api('/plan/'+planId, {
+    method: 'GET'
+  })
+}

+ 9 - 2
src/components/TabList/index.vue

@@ -37,7 +37,7 @@
           </div>
         </div>
         <div class="task task-item" v-if="isShowPlanList && isShowTaskList===false">
-          <div style="margin-bottom: 1.85vh" id="TaskHeaderName" @click="clickBackToTaskList">{{taskName}}</div>
+          <!-- <div style="margin-bottom: 1.85vh" id="TaskHeaderName" @click="clickBackToTaskList">{{taskName}}</div>
           <div class="task-table">
               <el-table @row-click="selectRowPlan" :data="planList" :row-class-name="rowClassName"  style="background-color: transparent;" >
                   <el-table-column label="M-ID" prop="id"></el-table-column>
@@ -45,6 +45,9 @@
                   <el-table-column label="Avaliable Carline" prop="carline"></el-table-column>
                   <el-table-column label="Avaliable Variant" prop="project"></el-table-column>
               </el-table>
+          </div> -->
+          <div v-for="(item, index) in planList" :key="index" class="item">
+            <div v-html="planRender(item)"></div>
           </div>
         </div>
         <div class="task task-item" v-if="isShowCaseList && isShowTaskList===false">
@@ -177,12 +180,16 @@ export default {
     },
     TextTrackListRender: {
       type: Function,
-      required: true
+      required: false
     },
     taskRender: {
       type: Function,
       required: true
     },
+    planRender: {
+      type: Function,
+      required: true
+    },
     issueRender: {
       type: Function,
       required: true

+ 8 - 0
src/store/modules/plan/actions.js

@@ -17,5 +17,13 @@ export default {
     } catch (err) {
       console.log("error", "服务异常", 1000);
     }
+  },
+  async fetchPlanDetail({ commit }, data) {
+    try {
+      const detail = await planApi.getAutoPlanDetail(data.planId)
+      commit('setAutoPlanDetail', detail)
+    } catch (err) {
+      console.log("error", "服务异常", 1000);
+    }
   }
 };

+ 39 - 4
src/store/modules/plan/mutations.js

@@ -1,20 +1,55 @@
 export default {
   setPlanList(state, planList) {
-    planList.forEach((plan) => {
-      if(!state.planList.some(p => p.id == plan.id)) {
+    planList.forEach((planId) => {
+      if(!state.planList.some(p => p.id == planId)) {
+        let plan = {};
+        plan.id = planId;
         plan.checked = false;
         state.planList.push(plan)
       }
     });
   },
   setAutoPlanList(state, planList) {
-    planList.forEach((plan) => {
-      if(!state.autoPlanList.some(p => p.id == plan.id)) {
+    planList.forEach((planId) => {
+      if(!state.autoPlanList.some(p => p.id == planId)) {
+        let plan = {}
+        plan.id = planId;
         plan.checked = false;
+        plan.active_time = null
+        plan.active_user = null
+        plan.case_quantity = 5
+        plan.comment = null
+        plan.create_time = "2023-04-21T06:55:18.403Z"
+        plan.create_user = "testserver@audi.com.cn"
+        plan.create_user_name = "testserver@audi.com.cn"
+        plan.description =  ""
+        plan.is_delete = 1
+        plan.lastrun_time = null
+        plan.modify_time =  null
+        plan.modify_user = null
+        plan.modify_user_name = null
+        plan.name = "testplan"
+        plan.repeats =  ["1", "1", "1", "1", "1"]
+        plan.repository = "repo3"
+        plan.skips = ["not", "not", "not", "not", "not"]
+        plan.skips_count = 0
+        plan.task_array = null
+        plan.task_quantity = null
+        plan.testcase_array = [2863, 2824, 2915, 2820, 2722]
+        plan.type = null
+        plan.auto = true;
         state.autoPlanList.push(plan)
       }
     });
   },
+  setAutoPlanDetail(state, planDetail) {
+    let detail = state.autoPlanList[planDetail.data.id - 101];
+    if (detail) {
+      for (let key in planDetail) {
+        detail[key] = planDetail[key];
+      }
+    }
+  },
   setTaskList(state, taskList) {
     taskList.forEach((task) => {
       if(!state.taskList.some(p => p.id == task.id)) {

+ 0 - 19
src/store/modules/task/actions.js

@@ -1,25 +1,6 @@
 import * as taskApi from "../../../api/task.js";
 
 export default {
-  async fetchBenchList({ commit }) {
-    try {
-      const benchList = await taskApi.fetchBenchList()
-      commit("setBenchList", benchList.data);
-    } catch (err) {
-      console.log("error", "服务异常", 1000);
-    }
-  },
-  async getBenchDetail({commit}, benchId) {
-    try {
-      const bench = await taskApi.getBenchDetail(benchId);
-      commit("setBenchDetail", bench.data)
-    } catch (err) {
-      console.log("error", "服务异常", 1000)
-    }
-  },
-  setBenchImgList({commit}, benchId, img) {
-    commit(benchId, img)
-  },
   async fetchTaskList({ commit }, data) {
     try {
       const taskList = await taskApi.fetchTaskList(data)

+ 1 - 13
src/store/modules/task/mutations.js

@@ -1,23 +1,11 @@
 export default {
-  setAllBillings(state, billings) {
-    state.allBillings = billings;
-  },
-  setMyBillings(state, billings) {
-    state.myBillings = billings;
-  },
-  addToAllBillings(state, billings) {
-    state.allBillings.push(...billings);
-  },
-  addToMyBillings(state, billings) {
-    state.myBillings.push(...billings);
-  },
   setTaskList(state, taskList) {
     console.log('setTaskList',taskList);
     taskList.forEach((task, i) => {
       if(!state.taskList.some(t => t.id == task.id)) {
         task.checked = false;
         task.itemtype = 2;
-        i % 2 == 0 ? (task.auto = true) : (task.auto = false)
+        task.auto = false;
         state.taskList.push(task)
       }
     });

+ 17 - 5
src/views/ordinaryPage/index.less

@@ -136,7 +136,9 @@
         .item-tag {
           display: flex;
           margin-top: 0vh;
-          width: 10vw;
+          width: 12vw;
+          // width: max-content;
+          overflow: auto;
           .tag {
             margin-bottom: 0.2vh;
             //width: 3.13vw;
@@ -148,6 +150,8 @@
             border-radius: 10px;
             color: #f2f2f2;
             margin-right: 0.2vw;
+            padding: 0px 10px;
+            width: max-content;
           }
         }
       }
@@ -209,10 +213,7 @@
       font-weight: 400;
       color: #fbfbfb;
       line-height: 4.17vh;
-      width: 150px;
-      overflow: hidden;
-      text-overflow: ellipsis;
-      white-space: nowrap;
+      // width: 150px;
     }
     .item-description {
       margin-top: 0.37vh;
@@ -371,4 +372,15 @@
   color: #fff;
   text-align: center;
   margin-left: 10px;
+}
+
+.plan-tag {
+  margin-bottom: 0.2vh;
+  font-size: xx-small;
+  padding: 5px 10px;
+  text-align: center;
+  background-color: #5d9a6d;
+  border-radius: 10px;
+  color: #f2f2f2;
+  margin-right: 0.2vw;
 }

+ 37 - 25
src/views/ordinaryPage/index.vue

@@ -220,7 +220,7 @@
         </div>
 
         <div class="ordinary-list">
-            <TabList :tabs="tabs" :itemRender="itemRender" :taskRender="taskRender" :issueRender="issueRender" :planList="planList" :caseList="caseList" :planName="planName" :taskName="taskName" :caseName="caseName"
+            <TabList :tabs="tabs" :itemRender="itemRender" :planRender="planRender" :taskRender="taskRender" :issueRender="issueRender" :planList="planList" :caseList="caseList" :planName="planName" :taskName="taskName" :caseName="caseName"
             :is-show-plan-list="isShowPlanList" :is-show-task-list="isShowTaskList" :is-show-case-commit="isShowCaseCommit" :is-show-case-list="isShowCaseList" :is-show-case-detail="isShowCaseDetail" :clickBackToTaskList="clickBackToTaskList" 
             :clickBackToPlanList="clickBackToPlanList" :selectRowPlan="selectRowPlan" :caseProject="caseProject" 
             :caseActive="caseActive" :caseFunction="caseFunction" caseContent="caseContent" 
@@ -372,7 +372,10 @@
                   return state.taskList.taskList;
               },
               planList: state => {
-                return state.planList.planList;
+                console.log(state.planList.planList, 'planList==============');
+                let planList = state.planList.planList.concat(state.planList.autoPlanList);
+                planList = planList.sort((p1, p2) => p1.id - p2.id);
+                return planList;
               },
               caseList: state => {
                 return state.caseList.caseList;
@@ -471,7 +474,7 @@
           clickBackToTaskList() {
             this.isShowPlanList = false;
             this.isShowTaskList = true;
-            this.planList = [];
+            // this.planList = [];
           },
           selectRowPlan(row){
             console.log(row, 'selectrowdata')
@@ -575,25 +578,18 @@
                 this.isOpen = false;
             },
             handleClickTask(taskId, auto) {
-              that.$store.dispatch('planList/fetchPlanList', {
-                page_num: 1,
-                page_size: 100,
-                task_id: ""
+              let task = that.taskList.find(t => t.id == taskId);
+              // 获取手动测试plan列表
+              let manualList = task.plan_list[1];
+              // 获取自动测试plan列表
+              let autoList = task.plan_list[2];
+              autoList.forEach(at => {
+                that.$store.dispatch('planList/fetchPlanDetail', { planId: at+101})
               })
-              if (auto) {
-                that.isShowCaseCommit = true;
-                that.isShowPlanList = false;
-              } else {
-                that.$store.dispatch('caseList/fetchCaseList',{
-                    uuid: taskId,
-                    page_num: 1,
-                    page_size: 100
-                })
-                that.isShowPlanList = false;
-                that.isShowCaseList = true;
-                that.planName = '< ' + "";
-              }
-              console.log(taskId, '任务id');
+              that.isShowPlanList = true;
+              that.isShowTaskList = false;
+              this.$store.commit('planList/setAutoPlanList', autoList)
+              console.log(task, '任务详情');
             },
             handleClickIssue(issueId) {
               console.log(issueId, 'issueid')
@@ -708,18 +704,34 @@
             taskRender(item) {
               return `<div class="item-box" style="display:flex;align-items: top; justify-content: space-between;">
                     <div class="left">
-                        <div style="display:flex;align-items: center;">
+                        <div style="">
                           <div class="item-title">${item.name}</div>
-                          <div class="task-auto" style="display:${item.auto ? 'block': 'none'}">Auto</div>
+                          <div class="item-title">${item.description}</div>
                         </div>
                         <div class="item-tag">
-                            <div class="tag">3b</div>
-                            <div class="tag">MHIS_AS_AU_E4235</div>
+                            <div class="tag">${item.processor_name}</div>
+                            <div class="tag">${item.sw}</div>
                         </div>
                     </div>
                     <div class="taskBtn" onClick="handleClickTask('${item.uuid || item.id}', '${item.auto}')">To Do</div>
                 </div>`
             },
+            planRender(item) {
+              return `<div class="el-icon-arrow-left"></div>
+              <div class="item-box" style="display:flex;align-items: top; justify-content: space-between;color: #fff">
+                    <div class="left">
+                        <div style="display:flex;align-items: center;">
+                          <div class="item-title">${item.name}</div>
+                          <div class="task-auto" style="display:${item.auto ? 'block': 'none'}">Auto</div>
+                        </div>
+                        <div class="item-tag" style="display: flex;margin-top: 10px">
+                            <div class="plan-tag">3b</div>
+                            <div class="plan-tag">MHIS_AS_AU_E4235</div>
+                        </div>
+                    </div>
+                    <!-- <div class="taskBtn" onClick="handleClickTask('${item.uuid || item.id}', '${item.auto}')">To Do</div> -->
+                </div>`
+            },
             issueRender(item) {
               return `<div class="item-box" style="display:flex;align-items: center;justify-content: space-between;" onClick="handleClickIssue('${item.uuid || item.id}')">
                     <div class="left">

+ 1 - 2
src/views/originPage/index.less

@@ -134,14 +134,13 @@
         .tag {
           margin-bottom: 0.2vh;
           //width: 3.13vw;
-          height: 1.96vh;
           font-size: xx-small;
-          line-height: 1.96vh;
           text-align: center;
           background-color: #5d9a6d;
           border-radius: 10px;
           color: #f2f2f2;
           margin-right: 0.2vw;
+          padding: 5px 10px;
         }
       }
     }

+ 0 - 1
src/views/task1/list.vue

@@ -131,7 +131,6 @@
                 })
             },
             handleClickItem(uuid) {
-                debugger
                 let plan = this.planList.find(p => p.uuid == uuid)
                 if (plan) {
                     plan.checked = !plan.checked;