Browse Source

缺陷版本,业务线更改

wangziqian 4 years ago
parent
commit
b68c1516ea

+ 1 - 1
src/layout/components/Navbar.vue

@@ -31,7 +31,7 @@ import { EncryptId, desDecryptId, analysisBizId_id } from '@/utils/crypto-js.js'
 // import Breadcrumb from '@/components/Breadcrumb' // 面包屑
 // import Hamburger from '@/components/Hamburger'  // 导航开关
 import { logoutUrl } from '@/apiConfig/requestIP.js'
-import { memberGetLoginInMemberInfoByLdap, settingGetBizList, settingUserSetBiz, settingUserGetBiz } from '@/api/projectIndex'
+import { memberGetLoginInMemberInfoByLdap, settingGetBizList, settingUserGetBiz } from '@/api/projectIndex'
 
 export default {
   // components: {

+ 1 - 2
src/router/index.js

@@ -180,10 +180,9 @@ export const constantRoutes = [{
     meta: { title: '缺陷' }
   },
   {
-    path: 'bugDetails/:id',
+    path: 'bugDetails',
     name: '缺陷详情',
     hidden: true,
-    props: true,
     component: (resolve) => require(['@/views/projectManage/bugList/details/index.vue'], resolve),
     meta: { title: '缺陷详情' }
   },

+ 2 - 1
src/router/needIdList.js

@@ -3,5 +3,6 @@ export const needIdList = [
   '需求详情',
   '任务详情',
   '子任务详情',
-  '迭代详情'
+  '迭代详情',
+  '缺陷详情'
 ]

+ 26 - 24
src/views/projectManage/bugList/bugindex.vue

@@ -215,7 +215,6 @@
                         value-format="yyyy-MM-dd HH:mm:ss"
                         :default-time="['00:00:00','23:59:59']"
                         :picker-options="pickerOptions"
-                        @change="changDate"
                       />
                     </div>
                   </div>
@@ -271,11 +270,11 @@
 
 <script>
 const _ = require('lodash')
+import { mapGetters } from 'vuex'
 import bugTableDialog from '@/views/projectManage/bugList/details/bugTableDialog' // 缺陷主页表格
 import createdBug from '@/views/projectManage/bugList/file/createdBug' // 新建缺陷
 import normalDialog from '@/components/dialog/normalDialog'
 import filterList from '@/views/projectManage/bugList/details/filterList' // 筛选过滤器
-import { deepClone } from '@/utils/global'
 import searchPeople from '@/components/select/searchPeople' // 人员select
 import '@/styles/PublicStyle/index.scss'
 import {
@@ -370,6 +369,20 @@ export default {
       indexPage: {}
     }
   },
+  computed: {
+    ...mapGetters(['bizId'])
+  },
+  watch: {
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.bugListSelect() // 获取下拉option
+        this.taskListCreate() // 获取所属任务
+        this.getFilterList() // 筛选项保存
+      },
+      immediate: true
+    }
+  },
   created() {
     if (this.$route.query.startDate && this.$route.query.endDate) {
       this.stratAndEnd = [this.$route.query.startDate, this.$route.query.endDate]
@@ -377,14 +390,8 @@ export default {
     if (this.$route.query.filterId) {
       this.getFilterItem(this.$route.query.filterId)
     }
-    this.bugListSelect() // 获取下拉option
-    this.taskListCreate() // 获取所属任务
-    this.getFilterList() // 筛选项保存
     this.$store.state.data.status = true
   },
-  mounted() {
-    this.$refs.bugTableDialog.bugGetTableList({})
-  },
   destroyed() {
     this.$store.state.data.status = false
   },
@@ -392,13 +399,6 @@ export default {
     changeSelect() {
       this.$forceUpdate()
     },
-    changDate(date) { // 创建时间添加到url参数中
-      if (date) {
-        this.$router.push({ path: this.$route.path, query: { startDate: date[0], endDate: date[1] }})
-      } else {
-        this.$router.push({ path: this.$route.path })
-      }
-    },
     getBugList() { // 查询功能
       this.$forceUpdate()
       if (!this.stratAndEnd) {
@@ -415,10 +415,12 @@ export default {
       this.indexPage.curIndex = e.curIndex
     },
     resetQuery() { // 重置
-      this.$router.push({ path: this.$route.path })
+      const query = _.cloneDeep(this.$route.query)
+      delete query.filterId
+      this.$router.replace({ path: this.$route.path, query: query })
       this.stratAndEnd = []
       let combination = {}
-      combination = deepClone(this.formInline)
+      combination = _.cloneDeep(this.formInline)
       this.formInline = { bugName: combination.bugName }
       this.$set(this.formInline, 'bugId', combination.bugId)
       this.$set(this.formInline, 'status', combination.status)
@@ -452,7 +454,7 @@ export default {
     }, 500),
     async taskListCreate(val) { // 获取所属任务
       const params = {
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       }
       if (val) {
         params.name = val
@@ -498,7 +500,7 @@ export default {
     },
     bugDataGet() {
       // 所属模块
-      settingQueryBizModuleList(Number(localStorage.getItem('bizId'))).then(
+      settingQueryBizModuleList(this.bizId).then(
         res => {
           this.business_platform_Modular = res.data.map(item => ({
             ...item,
@@ -554,13 +556,13 @@ export default {
       })
     },
     async toSave() {
-      const saveObj = deepClone(this.formInline)
+      const saveObj = _.cloneDeep(this.formInline)
       delete saveObj.curIndex
       delete saveObj.pageSize
       const res = await createFilter({
         name: this.searchForm.name,
         content: JSON.stringify(saveObj),
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       })
       if (res.code === 200) {
         this.$message({ showClose: true, message: '保存成功', type: 'success' })
@@ -571,17 +573,17 @@ export default {
     },
     async getFilterList() { // 获取过滤器列表
       const params = {
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       }
       const res = await getFilterList(params)
       this.filterList = res.data
     },
     async getFilterItem(filterId) { // 获取单个过滤器
       this.stratAndEnd = []
-      const combination = deepClone(this.formInline)
+      const combination = _.cloneDeep(this.formInline)
       const { bugId, status, priorityLevel } = combination
       this.formInline = { bugId, status, priorityLevel }
-      this.$router.push({ path: this.$route.path, query: { filterId: filterId }})
+      this.$router.push({ path: this.$route.path, query: { ...this.$route.query, filterId: filterId }})
       const res = await getFilterItem(filterId)
       if (res.code === 200) {
         const filter = JSON.parse(res.data.content)

+ 11 - 5
src/views/projectManage/bugList/details/bugTableDialog.vue

@@ -52,7 +52,7 @@
     <el-drawer v-if="drawerShow" :visible.sync="drawerShow" :modal="false" :with-header="false" size="50%" class="bug_manage_drawer" @click.stop>
       <div @click.stop>
         <bug-details
-          :id="bugQuery.id+''"
+          :id="bugQuery.id"
           ref="bugDetails"
           :type="'drawer'"
           :drawer-show="drawerShow"
@@ -67,6 +67,7 @@
 
 <script>
 const _ = require('lodash')
+import { mapGetters } from 'vuex'
 import statusChange from '@/views/projectManage/bugList/details/statusChange'
 import { bugList, bugGetEnum } from '@/api/defectManage'
 import BugDetails from './index'
@@ -106,11 +107,11 @@ export default {
       drawerShow: false, // drawer展示
       queryData: {}, // 查询条件
       data: {}, // 查询条件
-      bizId: Number(localStorage.getItem('bizId')), // 业务线
       statusObj: null // 状态对象
     }
   },
   computed: {
+    ...mapGetters(['bizId']),
     clickCount() {
       return this.$store.state.app.clickCount
     }
@@ -127,11 +128,16 @@ export default {
       },
       deep: true,
       immediate: true
+    },
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.getBugSelect()
+        this.bugGetTableList(this.queryData, false)
+      },
+      immediate: true
     }
   },
-  created() {
-    this.getBugSelect()
-  },
   methods: {
     async getBugSelect() { //  获取下拉菜单option
       const res = await bugGetEnum()

+ 12 - 1
src/views/projectManage/bugList/details/filterList.vue

@@ -61,6 +61,7 @@
   </div>
 </template>
 <script>
+import { mapGetters } from 'vuex'
 import {
   getFilterList,
   deleteFilter,
@@ -98,10 +99,20 @@ export default {
       isControl: NaN
     }
   },
+  computed: {
+    ...mapGetters(['bizId'])
+  },
   watch: {
     showFilter(newV) {
       this.show = newV
       this.getFilterList()
+    },
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.getFilterList()
+      },
+      immediate: true
     }
   },
   created() {
@@ -112,7 +123,7 @@ export default {
       const params = {
         pageSize: this.pageSize,
         curIndex: this.curIndex,
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       }
       const res = await getFilterList(params)
       if (res.code === 200) {

+ 37 - 17
src/views/projectManage/bugList/details/index.vue

@@ -538,6 +538,8 @@
 
 <script>
 const _ = require('lodash')
+import { mapGetters } from 'vuex'
+import { EncryptId, analysisBizId_id } from '@/utils/crypto-js.js'
 import statusChange from '@/views/projectManage/bugList/details/statusChange'
 import '@/styles/PublicStyle/index.scss'
 import { getCommentList, addComment } from '@/api/requirement.js'
@@ -587,8 +589,8 @@ export default {
   },
   props: {
     id: {
-      type: String,
-      default: '0'
+      type: Number,
+      default: -1
     },
     type: {
       type: String,
@@ -601,6 +603,7 @@ export default {
   },
   data() {
     return {
+      bugId: -1, // 当前缺陷Id
       configure: {
         language_url: '/tinymce/langs/zh_CN.js',
         language: 'zh_CN',
@@ -695,6 +698,9 @@ export default {
       theBugTypeEnumList: [] // 缺陷类型
     }
   },
+  computed: {
+    ...mapGetters(['bizId'])
+  },
   watch: {
     id(newVal, oldVal) {
       this.bug = {}
@@ -709,9 +715,18 @@ export default {
         this.init()
         this.uploadButton = newV
       }
+    },
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.taskListCreate() // 获取所属任务
+        this.getBusinessLinePlatformModule()
+      },
+      immediate: true
     }
   },
   created() {
+    this.analysisBizId_id()
     this.getBugSelect()
     if (this.type !== 'page') {
       var height = window.innerHeight > document.body.clientHeight ? window.innerHeight : document.body.clientHeight
@@ -725,27 +740,29 @@ export default {
   mounted() {
     tinymce.init({ selector: '.tinymce', height: '100' })
     this.bugGetEnum()
-    this.$nextTick(() => {
-      this.bugGet(this.id, false).then(res => {
-        this.changeWidthOnBlur()
-        releaseList().then(res => {
-          this.appClientList = res.data.appClient // 客户端
-          this.getVersionList(this.bug.appId)
-        })
-        this.RichText()
+    const id = this.id === -1 ? this.bugId : this.id
+    this.bugGet(id, false).then(res => {
+      this.changeWidthOnBlur()
+      releaseList().then(res => {
+        this.appClientList = res.data.appClient // 客户端
+        this.getVersionList(this.bug.appId)
       })
+      this.RichText()
     })
     this.getCommentList()
-    this.getBusinessLinePlatformModule()
-    this.taskListCreate()
   },
   methods: {
+    analysisBizId_id() { // 解析路由中的bizId_id
+      if (!this.$route.query.bizId_id) return
+      const bizId_id = analysisBizId_id(this.$route.query.bizId_id)
+      this.bugId = bizId_id[1]
+    },
     debounceQuery: _.debounce(function() {
       this.taskListCreate(...arguments)
     }, 500),
     async taskListCreate(val) { // 获取所属任务
       const params = {
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       }
       if (val) {
         params.name = val
@@ -813,10 +830,12 @@ export default {
       return false
     },
     JumpRequire(id) {
-      this.$router.push({ name: '需求详情', query: { id: id }})
+      const bizId_id = EncryptId(`${this.bizId}_${id}`)
+      this.$router.push({ name: '需求详情', query: { bizId_id: bizId_id }})
     },
     getToDetails() {
-      this.$router.push({ name: '缺陷详情', params: { id: this.id }})
+      const bizId_id = EncryptId(`${this.bizId}_${this.id}`)
+      this.$router.push({ name: '缺陷详情', query: { bizId_id: bizId_id }})
     },
     isImage(arr) {
       const reg = new RegExp(/.*(\.gif|\.jpeg|\.png|\.jpg|\.bmp)/i)
@@ -1163,7 +1182,7 @@ export default {
       }
     },
     getBusinessLinePlatformModule() {
-      settingQueryBizModuleList(Number(localStorage.getItem('bizId'))).then(res => {
+      settingQueryBizModuleList(this.bizId).then(res => {
         this.business_platform_Modular = res.data.map(item => ({
           ...item,
           value: item.id,
@@ -1187,7 +1206,8 @@ export default {
       this.statusDialogVisible = true
     },
     JumpTask(id) { // 转到任务
-      this.$router.push({ name: '任务详情', query: { id: id }})
+      const bizId_id = EncryptId(`${this.bizId}_${id}`)
+      this.$router.push({ name: '任务详情', query: { bizId_id: bizId_id }})
     },
     statusDialogConfirm() {
       const userData = { id: '', ename: this.userInformation, name: this.userNames }

+ 26 - 9
src/views/projectManage/bugList/file/createdBug.vue

@@ -181,6 +181,8 @@
 
 <script>
 const _ = require('lodash')
+import { mapGetters } from 'vuex'
+import { analysisBizId_id } from '@/utils/crypto-js.js'
 import E from 'wangeditor'
 import {
   bugGetEnum,
@@ -237,6 +239,7 @@ export default {
   },
   data() {
     return {
+      nowPageId: -1, // 当前页面的id
       dialogImageUrl: '', // 附件展示图片
       modalShow: false, // 缺陷新建弹窗
       dialogVisible: false,
@@ -322,11 +325,25 @@ export default {
       }
     }
   },
-  created() {
-    this.bugListSelect()
-    this.bugDataGet()
+  computed: {
+    ...mapGetters(['bizId'])
+  },
+  watch: {
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.bugListSelect()
+        this.bugDataGet()
+      },
+      immediate: true
+    }
   },
   methods: {
+    analysisBizId_id() { // 解析路由中的bizId_id
+      if (!this.$route.query.bizId_id) return
+      const bizId_id = analysisBizId_id(this.$route.query.bizId_id)
+      this.nowPageId = bizId_id[1]
+    },
     init(e, ele) {
       this.modalShow = true
       this.$nextTick(() => {
@@ -340,7 +357,7 @@ export default {
         'creatorList',
         localStorage.getItem('realname')
       )
-      this.$set(this.formInline, 'bizId', Number(localStorage.getItem('bizId')))
+      this.$set(this.formInline, 'bizId', this.bizId)
 
       if (e === 1) {
         this.titleName = '新建缺陷'
@@ -523,17 +540,17 @@ export default {
     async getTaskList(val) {
       // 获取所属任务列表
       const params = {
-        bizId: Number(localStorage.getItem('bizId'))
+        bizId: this.bizId
       }
       switch (this.$route.name) {
         case '项目详情':
-          params.projectId = this.$route.query.id
+          params.projectId = this.nowPageId
           break
         case '需求详情':
-          params.requireId = this.$route.query.id
+          params.requireId = this.nowPageId
           break
         case '任务详情':
-          params.id = this.$route.query.id
+          params.id = this.nowPageId
           break
       }
       if (val) {
@@ -587,7 +604,7 @@ export default {
     },
     bugDataGet() {
       // 所属模块
-      settingQueryBizModuleList(Number(localStorage.getItem('bizId'))).then(
+      settingQueryBizModuleList(this.bizId).then(
         res => {
           this.business_platform_Modular = res.data.map(item => ({
             ...item,

+ 6 - 3
src/views/projectManage/projectList/projectIndex.vue

@@ -389,12 +389,15 @@ export default {
     ...mapGetters(['bizId'])
   },
   watch: {
-    bizId() {
-      this.get_projectList()
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.get_projectList()
+      },
+      immediate: true
     }
   },
   created() {
-    this.get_projectList()
     this.$store.state.data.status = true
   },
   destroyed() {

+ 8 - 5
src/views/projectManage/requirement/list/index.vue

@@ -280,15 +280,18 @@ export default {
     ...mapGetters(['bizId'])
   },
   watch: {
-    bizId() {
-      this.getTableData()
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.getTableData()
+        this.showRequirementEnum()
+        this.getFilterList() // 筛选项保存
+      },
+      immediate: true
     }
   },
   created() {
     this.$store.state.data.status = true
-    this.showRequirementEnum()
-    this.getTableData()
-    this.getFilterList() // 筛选项保存
   },
   destroyed() {
     this.$store.state.data.status = false

+ 1 - 1
src/views/projectManage/version/components/scheduleList.vue

@@ -95,7 +95,7 @@ import Sortable from 'sortablejs'
 import moment from 'moment'
 import 'moment/locale/zh-cn'
 import { listByTask, sortForTask } from '@/api/projectViewDetails'
-import modifySchedule from './modifySchedule'
+import modifySchedule from '@/views/projectManage/projectList/components/modifySchedule'
 import move from '@/assets/麻将@2x.png'
 export default {
   components: {

+ 18 - 8
src/views/projectManage/version/components/taskList.vue

@@ -122,6 +122,8 @@
   </div>
 </template>
 <script>
+import { EncryptId } from '@/utils/crypto-js.js'
+import { mapGetters } from 'vuex'
 import imgUrl from '@/assets/建立档案@2x.png'
 import '@/styles/PublicStyle/index.scss'
 import TestReport from '@/views/reportManagement/components/TestingReport' // 提测
@@ -179,23 +181,30 @@ export default {
       selectTaskList: [] // 已选任务的id
     }
   },
+  computed: {
+    ...mapGetters(['bizId'])
+  },
   watch: {
-    'searchForms': {
+    searchForms: {
       handler: function(newValue, oldValue) {
         this.searchForms = newValue
         this.get_allTask()
       },
       deep: true
+    },
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.getTaskStatus()
+        this.get_allTask()
+      },
+      immediate: true
     }
   },
-  created() {
-    this.getTaskStatus()
-    this.get_allTask()
-  },
   methods: {
     async get_allTask() { // 获取全部任务
       const res = await getVersionHomeTaskList({
-        bizId: localStorage.getItem('bizId'),
+        bizId: this.$bizId,
         curIndex: this.searchForm.curIndex,
         pageSize: this.searchForm.pageSize,
         versionType: this.searchForms.versionType,
@@ -211,7 +220,7 @@ export default {
       if (res.code === 200) {
         this.taskScheduleEvent = res.data.taskScheduleEvent || []
       }
-      const res1 = await configShowTaskStatusEnum(localStorage.getItem('bizId'))
+      const res1 = await configShowTaskStatusEnum(this.bizId)
       if (res1.code === 200) {
         this.allStatus = res1.data.taskStatus
       }
@@ -333,7 +342,8 @@ export default {
       }
     },
     link_task(id) { // 跳转到任务详情页
-      this.$router.push({ name: '任务详情', query: { id: id }})
+      const bizId_id = EncryptId(`${this.bizId}_${id}`)
+      this.$router.push({ name: '任务详情', query: { bizId_id: bizId_id }})
     },
     // 分页pageSize选择
     handleSizeChange(pageSize) {

+ 18 - 6
src/views/projectManage/version/list/index.vue

@@ -116,6 +116,8 @@
 </template>
 
 <script>
+import { EncryptId } from '@/utils/crypto-js.js'
+import { mapGetters } from 'vuex'
 import TimeLine from './timeLine'
 import { getEvent } from '@/api/versionsCalendar'
 import { getVersionHomePageList, showAppClientEnum, showVersionEnum } from '@/api/version.js'
@@ -305,16 +307,25 @@ export default {
       taskHealthOptionList: []
     }
   },
+  computed: {
+    ...mapGetters(['bizId'])
+  },
+  watch: {
+    bizId: {
+      handler(newV) {
+        if (newV === -1) return
+        this.showAppClientEnum()
+        this.showVersionEnum()
+      },
+      immediate: true
+    }
+  },
   created() {
     this.$store.state.data.status = true
   },
   destroyed() {
     this.$store.state.data.status = false
   },
-  mounted() {
-    this.showAppClientEnum()
-    this.showVersionEnum()
-  },
   methods: {
     getTitle(str) {
       if (str.length <= 6) {
@@ -328,7 +339,8 @@ export default {
       tab.label === '需求' ? this.getVersionHomePageList() : ''
     },
     getToRequirementDetails(id) {
-      this.$router.push({ name: '需求详情', query: { id: id }})
+      const bizId_id = EncryptId(`${this.bizId}_${id}`)
+      this.$router.push({ name: '需求详情', query: { bizId_id: bizId_id }})
     },
     // 分页pageSize选择
     handleSizeChange(pageSize) {
@@ -342,7 +354,7 @@ export default {
     },
     async getVersionHomePageList() {
       this.loading = true
-      this.searchForm.bizId = localStorage.getItem('bizId')
+      this.searchForm.bizId = this.bizId
       const res = await getVersionHomePageList(this.searchForm)
       this.getEvent(this.searchForm.versionType)
       if (res.code === 200) {