Browse Source

版本首页改版

reedliuqing_i 5 years ago
parent
commit
66e06254f8

+ 46 - 10
src/views/projectManage/version/list/index.vue

@@ -18,7 +18,7 @@
               clearable
               filterable
               placeholder="请选择"
-              @change="getVersionHomePageList()"
+              @change="onChangeClientType(searchForm.clientType);getVersionHomePageList()"
             >
               <el-option
                 v-for="item in searchInfo.clients"
@@ -35,7 +35,7 @@
               clearable
               filterable
               placeholder="请选择"
-              @change="getVersionHomePageList()"
+              @change="onChangeVersionType(searchForm.versionType);getVersionHomePageList()"
             >
               <el-option
                 v-for="item in searchInfo.versions"
@@ -130,7 +130,9 @@
 
 <script>
 import TimeLine from './timeLine'
+import { getEvent } from '@/api/versionsCalendar'
 import { getVersionHomePageList, showAppClientEnum, showVersionEnum } from '@/api/version.js'
+
 import VersionChart from '@/components/chart/index.vue'
 
 export default {
@@ -140,14 +142,7 @@ export default {
   },
   data() {
     return {
-      timeLineSteps: [
-        { dateLabel: 'January 2017', title: 'Gathering Information' },
-        { dateLabel: 'February 2017', title: 'Planning' },
-        { dateLabel: 'March 2017', title: 'Design' },
-        { dateLabel: 'April 2017', title: 'Content Writing and Assembly' },
-        { dateLabel: 'May 2017', title: 'Coding' },
-        { dateLabel: 'June 2017', title: 'Testing, Review & Launch' },
-        { dateLabel: 'July 2017', title: 'Maintenance' }],
+      timeLineSteps: [],
       timeLineShow: false,
       priorityColors: ['#F56C6C', '#FF8952', '#F5E300', '#7ED321', '#61D3B8', '#69B3FF', '#BDBDBD'],
       tableData: [],
@@ -349,6 +344,7 @@ export default {
       this.loading = true
       getVersionHomePageList(this.searchForm)
         .then(res => {
+          this.getEvent(this.searchForm.versionType)
           if (res.code === 200) {
             this.createTaskOption(res.data.list)
             this.createTaskHealthOption(res.data.list)
@@ -361,6 +357,21 @@ export default {
           this.loading = false
         })
     },
+    // 获取版本事件
+    getEvent(id) {
+      getEvent(id).then(res => {
+        this.timeLineSteps = []
+        if (res.data) {
+          for (const i in res.data) {
+            const item = {
+              dateLabel: res.data[i].endTime,
+              title: res.data[i].name
+            }
+            this.timeLineSteps.push(item)
+          }
+        }
+      })
+    },
     createTaskOption(data) {
       this.taskOptionList = []
       for (const i in data) {
@@ -419,6 +430,31 @@ export default {
           }
         })
     },
+    onChangeClientType(clientType) {
+      for (const i in this.searchInfo.clients) {
+        if (this.searchInfo.clients[i].code === clientType) {
+          this.searchTitle.client = this.searchInfo.clients[i].msg
+          if (this.searchInfo.clients[i].childEnumInfos && this.searchInfo.clients[i].childEnumInfos.length > 0) {
+            this.searchInfo.versions = this.searchInfo.clients[i].childEnumInfos
+            this.searchForm.versionType = this.searchInfo.versions[0].code
+            this.searchTitle.version = this.searchInfo.versions[0].msg
+          } else {
+            this.searchInfo.versions = []
+            this.searchForm.versionType = ''
+            this.searchTitle.version = ''
+          }
+        }
+      }
+    },
+    onChangeVersionType(versionType) {
+      for (const i in this.searchInfo.versions) {
+        if (this.searchInfo.versions[i].code === versionType) {
+          this.searchTitle.version = this.searchInfo.versions[i].msg
+          return
+        }
+      }
+      this.searchTitle.version = ''
+    },
     showVersionEnum() {
       showVersionEnum()
         .then(res => {

+ 0 - 2
src/views/projectManage/version/list/timeLine.vue

@@ -79,8 +79,6 @@ export default {
     swiper() {
       return this.$refs.mySwiper.$swiper
     }
-  },
-  mounted() {
   }
 }
 </script>