qinzhipeng_v@didiglobal.com 4 年之前
父节点
当前提交
bee027a9a0

+ 91 - 59
src/views/projectManage/requirement/components/ganntViews.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="ganntt-parent">
     <gantt-elastic
+      v-if="ganttElastic"
       :options="options"
       :tasks="tasks"
-      @options-changed="optionsUpdate"
     >
       <gantt-header slot="header" />
     </gantt-elastic>
@@ -16,42 +16,6 @@ import GanttHeader from 'gantt-elastic-header'
 import teamGanttOptions from './../gannttOptions/requireGannt'
 import { listByRequire } from '@/api/requirement.js'
 import moment from 'moment'
-const tasks = []
-//   {
-//     id: 1,
-//     taskName: 'item.name',
-//     belongModules: 'cdscdscdscs',
-//     devPerson: 'cdscd',
-//     testPerson: 'cdsc',
-//     description: 'cdscdscd',
-//     startDate: 'dscscds',
-//     endDate: 'cdscdscds',
-//     needLegalAllDays: '1/3', // item.workNum.needDays + '/' + item.workNum.legalDays + '/' + item.workNum.allDays,
-//     type: 'task',
-//     start: (-24 * 5),
-//     duration: 15 * 24 * 60 * 60 * 1000
-//     // type: 'project'
-//     // collapsed: true,
-//   },
-//   {
-//     id: 6,
-//     taskName: 'Butch Mario and the Luigi Kid',
-//     user:
-//       '<a href="https://www.google.com/search?q=Mario+Bros" target="_blank"',
-//     parentId: 5,
-//     start: (24),
-//     duration: 1 * 24 * 60 * 60 * 1000,
-//     percent: 50,
-//     type: 'task',
-//     collapsed: true,
-//     style: {
-//       base: {
-//         fill: '#8E44AD',
-//         stroke: '#7E349D'
-//       }
-//     }
-//   }
-// ]
 
 export default {
   components: {
@@ -60,50 +24,71 @@ export default {
   },
   data() {
     return {
-      tasks,
+      ganttElastic: false,
+      tasks: [],
+      scheduleDetail: [],
       options: teamGanttOptions, // 甘特图配置
-      dynamicStyle: {}
+      dynamicStyle: {},
+      mun: {}
     }
   },
-  created() {
-    this.listByRequire()
-  },
   mounted() {
-    const box = document.getElementsByClassName('gantt-elastic__header-label')
-    for (const i in box) {
-      console.log(box[3], 'cdscd')
-      i === '3' ? '' : box[i].style = 'display: none;'
-    }
-    console.log(box)
+    this.listByRequire()
+    this.$nextTick(() => {
+      const box = document.getElementsByClassName('gantt-elastic__header-label')
+      for (const i in box) {
+        console.log(box[3], 'cdscd')
+        i === '3' ? '' : box[i].style = 'display: none;'
+      }
+      console.log(box)
+    })
   },
   methods: {
     async listByRequire() { // 获取排期列表
-      alert()
       const res = await listByRequire(Number(this.$route.query.id))
-      if (res.code === 200) this.handleData(res.data.taskDetailList)
+      if (res.code === 200) {
+        this.mun = res.data.scheduleDetailRespons
+        this.handleData(res.data.taskDetailList)
+        this.scheduleDetailRespons(res.data.scheduleDetailRespons)
+      }
     },
     handleData(data) {
+      this.ganttElastic = false
+      this.tasks = []
       this.tasks = data.map((value, key) => {
         return this.handleItem(value, key)
       })
-      console.log(this.tasks, 'xsaxasxsxas')
+      this.ganttElastic = true
+      this.$nextTick(() => {
+        this.setOption()
+      })
+      this.elastic__header()
     },
+
     handleItem(item, key) {
+      let data = ''
+      for (const key in this.mun) {
+        if (Number(key) === item.id) {
+          data = this.mun[key].length
+        }
+      }
       const colorlist = ['#A1DEFF', '#FAB5B5', '#BCED86', '#FFA87F', '#8E44AD', '#1EBC61', '#0287D0']
-      console.log(item)
       return {
-        id: key,
+        id: item.id,
         taskName: item.name,
+        label: item.name,
         belongModules: item.moduleInfoName || '',
         devPerson: item.rdObject.name || '',
         testPerson: item.qaObject.name || '',
-        description: item.description || '',
+        description: data + '个排期',
         startDate: item.optionsObject.startTime ? moment(item.optionsObject.startTime).format('YYYY-MM-DD') : '',
         endDate: item.optionsObject.endTime ? moment(item.optionsObject.endTime).format('YYYY-MM-DD') : '',
-        needLegalAllDays: '1/3', // item.workNum.needDays + '/' + item.workNum.legalDays + '/' + item.workNum.allDays,
+        needLegalAllDays: item.optionsObject.workDays + '/' + item.optionsObject.days,
         type: 'task',
-        start: (-24 * 5),
-        duration: 15 * 24 * 60 * 60 * 1000,
+        percent: 0,
+        html: true,
+        start: moment(item.optionsObject.startTime).toDate().getTime(),
+        duration: moment(item.optionsObject.endTime).toDate().getTime() - moment(item.optionsObject.startTime).toDate().getTime(),
         style: {
           base: {
             fill: colorlist[key % colorlist.length]
@@ -112,8 +97,55 @@ export default {
       }
     },
 
-    optionsUpdate(options) {
-      this.options = options
+    scheduleDetailRespons(data) { // 处理排期
+      const colorlist = ['#A1DEFF', '#FAB5B5', '#BCED86', '#FFA87F', '#8E44AD', '#1EBC61', '#0287D0']
+      for (const key in data) {
+        const arr = data[key]
+        for (const vel in arr) {
+          const ds = {
+            id: arr[vel].id,
+            taskName: '',
+            label: arr[vel].desc ? arr[vel].name + '-' + arr[vel].desc : arr[vel].name,
+            description: arr[vel].desc ? arr[vel].name + '-' + arr[vel].desc : arr[vel].name,
+            startDate: arr[vel].dayList[0],
+            endDate: arr[vel].dayList[arr[vel].dayList.length - 1],
+            needLegalAllDays: arr[vel].dayLength + '/' + arr[vel].days,
+            type: 'task',
+            percent: 0,
+            html: true,
+            parentId: Number(key),
+            start: moment(arr[vel].dayList[0]).toDate().getTime(),
+            duration: moment(arr[vel].dayList[arr[vel].dayList.length - 1]).toDate().getTime() - moment(arr[vel].dayList[0]).toDate().getTime(),
+            style: {
+              base: {
+                fill: colorlist[key % colorlist.length]
+              }
+            }
+          }
+          this.scheduleDetail.push(ds)
+        }
+      }
+      this.tasks = this.tasks.concat(this.scheduleDetail)
+    },
+
+    setOption() {
+      const node = document.querySelectorAll('.gantt-elastic__header-label')
+      node[3].removeChild(node[3].childNodes[0])
+      const span = document.createElement('span')
+      span.innerText = '列表区域 :'
+      node[3].insertBefore(span, node[3].childNodes[0])
+    },
+
+    elastic__header() {
+      // 隐藏header
+      if (this.ganttElastic) {
+        this.$nextTick(() => {
+          const box = document.getElementsByClassName('gantt-elastic__header-label')
+          for (const i in box) {
+            i === '3' ? '' : box[i].style = 'display: none;'
+          }
+        })
+      }
     }
   }
 }

+ 15 - 16
src/views/projectManage/requirement/gannttOptions/requireGannt.js

@@ -3,7 +3,7 @@ const options = {
     progress: 'percent'
   },
   maxRows: 100,
-  maxHeight: 500,
+  maxHeight: 460,
   title: {
     label: 'Your project title as html (link or whatever...)',
     html: false
@@ -33,14 +33,15 @@ const options = {
         id: 1,
         label: '任务名称',
         value: 'taskName',
-        width: 80,
+        width: 150,
         style: {
           'task-list-header-label': {
             'text-align': 'center',
             width: '100%'
           },
           'task-list-item-value-container': {
-            'font-weight': '500'
+            'text-align': 'center',
+            width: '100%'
           }
         }
       },
@@ -48,23 +49,17 @@ const options = {
         id: 2,
         label: '所属模块',
         value: 'belongModules',
-        width: 200,
-        expander: true,
-        html: true,
+        width: 100,
         style: {
           'task-list-header-label': {
             'text-align': 'center',
             width: '100%'
           },
           'task-list-item-value-container': {
-            'font-weight': '500'
+            'text-align': 'center',
+            width: '100%'
           }
         }
-        // events: {
-        //   click({ data, column }) {
-        //     alert('description clicked!\n' + data.label)
-        //   }
-        // }
       },
       {
         id: 3,
@@ -77,7 +72,8 @@ const options = {
             width: '100%'
           },
           'task-list-item-value-container': {
-            'font-weight': '500'
+            'text-align': 'center',
+            width: '100%'
           }
         }
       },
@@ -92,7 +88,8 @@ const options = {
             width: '100%'
           },
           'task-list-item-value-container': {
-            'font-weight': '500'
+            'text-align': 'center',
+            width: '100%'
           }
         }
       },
@@ -101,13 +98,15 @@ const options = {
         label: '排期类型及描述',
         value: 'description',
         width: 180,
+        expander: true,
         style: {
           'task-list-header-label': {
             'text-align': 'center',
             width: '100%'
           },
           'task-list-item-value-container': {
-            'font-weight': '500'
+            'text-align': 'center',
+            width: '100%'
           }
         }
       },
@@ -145,7 +144,7 @@ const options = {
       },
       {
         id: 8,
-        label: '使用/工作日/全部',
+        label: '时长/周期',
         value: 'needLegalAllDays',
         width: 130,
         style: {

+ 124 - 1
src/views/projectManage/requirement/requirementDetail.vue

@@ -211,6 +211,35 @@
             </el-aside>
           </el-container>
           <gannt-views v-if="listOrGannt === '甘特图'" />
+          <div class="detail-info border-top">
+            <el-divider />
+            <el-form ref="form_query" :inline="true" :model="form_query" class="Layout_space_start" label-position="left" label-width="140px">
+              <el-form-item
+                v-if="brdPassRealTime"
+                label="BRD评审通过时间:"
+              >
+                <el-date-picker v-model="form_query.brdPassRealTime" type="date" :clearable="false" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" size="small" @change="setChangeArea" />
+              </el-form-item>
+              <el-form-item
+                v-if="prdPassRealTime"
+                label="PRD评审通过时间:"
+              >
+                <el-date-picker v-model="form_query.prdPassRealTime" type="date" :clearable="false" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" size="small" @change="setChangeArea" />
+              </el-form-item>
+              <el-form-item
+                v-if="techInRealTime"
+                label="技术准入时间:"
+              >
+                <el-date-picker v-model="form_query.techInRealTime" type="date" :clearable="false" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" size="small" @change="setChangeArea" />
+              </el-form-item>
+              <el-form-item
+                v-if="onlineRealTime"
+                label="实际上线时间:"
+              >
+                <el-date-picker v-model="form_query.onlineRealTime" type="date" :clearable="false" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" size="small" @change="setChangeArea" />
+              </el-form-item>
+            </el-form>
+          </div>
         </section>
         <section class="main-section">
           <div class="el-main-title">
@@ -307,6 +336,34 @@
         @childValInput="childVal"
         @click.stop
       />
+      <el-dialog
+        title="状态变更"
+        :visible.sync="dialogStatusVisible"
+        width="30%"
+        class="public_task"
+      >
+        <div class="blueStripe" />
+        <div align="center">
+          <el-form ref="form_query" :inline="true" :model="form_query" :rules="rules" label-position="left" label-width="158px">
+            <el-form-item v-if="statusName === 'BRD评审通过'" :label="statusName + '时间:'" prop="brdPassRealTime">
+              <el-date-picker v-model="form_query.brdPassRealTime" type="date" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" />
+            </el-form-item>
+            <el-form-item v-if="statusName === 'PRD评审通过'" :label="statusName + '时间:'" prop="prdPassRealTime">
+              <el-date-picker v-model="form_query.prdPassRealTime" type="date" :clearable="false" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" />
+            </el-form-item>
+            <el-form-item v-if="statusName === '技术准入'" :label="statusName + '时间:'" prop="techInRealTime">
+              <el-date-picker v-model="form_query.techInRealTime" type="date" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" />
+            </el-form-item>
+            <el-form-item v-if="statusName === '已上线'" :label="statusName + '时间:'" prop="onlineRealTime">
+              <el-date-picker v-model="form_query.onlineRealTime" type="date" placeholder="请选择" format="yyyy.MM.dd" value-format="yyyy.MM.dd" style="width: 100%;" />
+            </el-form-item>
+          </el-form>
+        </div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="dialogStatusVisible = false">取 消</el-button>
+          <el-button type="primary" @click="setChangeArea">确 定</el-button>
+        </span>
+      </el-dialog>
     </el-container>
   </div>
 </template>
@@ -345,6 +402,7 @@ import image_url from '@/assets/home_images/home_u.png'
 import createdBug from '@/views/projectManage/bugList/file/createdBug'
 import tasksList from './components/taskList'
 import dataStatistics from './components/dataStatistics'
+import moment from 'moment'
 // import scheduleList from './components/scheduleList'
 import bugTableDialog from '@/views/projectManage/bugList/details/bugTableDialog' // 缺陷表格
 import schedule from '@/views/projectManage/schedule' // 排期锁定弹窗
@@ -395,8 +453,21 @@ export default {
         children: 'childRqmtOrnts',
         multiple: true
       },
+      rules: {
+        brdPassRealTime: [{ required: true, message: '请输入BRD评审通过时间', trigger: 'change' }],
+        prdPassRealTime: [{ required: true, message: '请输入PRD评审通过时间', trigger: 'change' }],
+        techInRealTime: [{ required: true, message: '请输入技术准入时间', trigger: 'change' }],
+        onlineRealTime: [{ required: true, message: '请输入实际上线时间', trigger: 'change' }]
+      },
       Latest: true,
+      statusName: '',
+      statusValue: '',
+      dialogStatusVisible: false,
       demandDirection: [], // 需求方向option
+      brdPassRealTime: false, // BRD评审通过时间
+      prdPassRealTime: false, // PRD评审通过时间
+      techInRealTime: false, // 技术准入
+      onlineRealTime: false, // 实际上线
       optionName: 'first',
       visible: false, // Hold任务
       ScheduId: '', // 排期ID
@@ -499,6 +570,15 @@ export default {
     // clickBackToTheLatest() {
     //   this.$refs.ScheduleEvent.rowDrop()
     // },
+    setChangeArea() {
+      this.$refs.form_query.validate((valid) => {
+        if (valid) {
+          this.changeArea()
+        } else {
+          this.$message({ message: '还有必填项未填写', type: 'error', duration: 1000, offset: 150 })
+        }
+      })
+    },
     async changeArea(e) { // area修改
       const requirementInfo = _.cloneDeep(this.form_query)
       requirementInfo.rqmtProposer = requirementInfo.rqmtProposer ? requirementInfo.rqmtProposer.join() : null
@@ -511,8 +591,10 @@ export default {
       if (requirementInfo.referredClientType !== null) {
         requirementInfo.referredClientType = requirementInfo.referredClientType.join()
       }
+      requirementInfo.status = this.statusValue
       const res = await updateRequirement(requirementInfo)
       if (res.code === 200) {
+        this.dialogStatusVisible = false
         this.$message({ message: '修改成功', type: 'success', duration: 1000, offset: 150 })
       }
       this.getRequirementById()
@@ -613,6 +695,28 @@ export default {
           this.form_query.rqmtProposer = this.form_query.rqmtProposer.split(',')
         }
       }
+      this.availableStatusList.map(item => {
+        if (item.name === 'BRD评审通过') {
+          if (this.form_query.status >= item.code) {
+            this.brdPassRealTime = true
+          }
+        }
+        if (item.name === 'PRD评审通过') {
+          if (this.form_query.status >= item.code) {
+            this.prdPassRealTime = true
+          }
+        }
+        if (item.name === '技术准入') {
+          if (this.form_query.status >= item.code) {
+            this.techInRealTime = true
+          }
+        }
+        if (item.name === '已上线') {
+          if (this.form_query.status >= item.code) {
+            this.onlineRealTime = true
+          }
+        }
+      })
     },
     async getCommentList() { // 获取需求评论
       const res = await getCommentList({ type: 4, joinId: this.$route.query.id })
@@ -638,6 +742,16 @@ export default {
       }
     },
     async updateStatus(status) { // 修改状态
+      if (status.label === 'PRD评审通过' || status.label === 'BRD评审通过' || status.label === '技术准入' || status.label === '已上线') {
+        this.statusName = status.label
+        this.statusValue = status.value
+        this.dialogStatusVisible = true
+        status.label === 'BRD评审通过' ? this.form_query.brdPassRealTime = moment().locale('zh-cn').format('YYYY.MM.DD') : '' // BRD评审通过时间
+        status.label === 'PRD评审通过' ? this.form_query.prdPassRealTime = moment().locale('zh-cn').format('YYYY.MM.DD') : '' // PRD评审通过时间
+        status.label === '技术准入' ? this.form_query.techInRealTime = moment().locale('zh-cn').format('YYYY.MM.DD') : '' // 技术准入
+        status.label === '已上线' ? this.form_query.onlineRealTime = moment().locale('zh-cn').format('YYYY.MM.DD') : '' // 实际上线
+        return false
+      }
       const res = await updateRequirementStatus({
         id: this.$route.query.id,
         status: status.value,
@@ -760,7 +874,7 @@ export default {
     }
     .demo-form-inline {
       .el-form-item {
-        width: 33%;
+        width: 20%;
         margin-right: 0;
       }
     }
@@ -829,5 +943,14 @@ export default {
 .el-btn-size {
    margin: 10px 30px;
 }
+.border-top {
+ padding: 0 20px 10px !important;
+ >>>.el-divider--horizontal {
+    display: block;
+    height: 1px;
+    width: 100%;
+    margin: 10px 0;
+}
+}
 </style>