Procházet zdrojové kódy

工作台缺陷统计

wangziqian před 4 roky
rodič
revize
774cdd90e5

+ 54 - 71
src/views/workbench/bugTableList.vue

@@ -1,13 +1,8 @@
 <template>
   <div>
-    <el-dropdown class="dropdown" trigger="click">
-      <span class="el-dropdown-link">
-        {{ title }}<i class="el-icon-arrow-down el-icon--right" />
-      </span>
-      <el-dropdown-menu slot="dropdown">
-        <el-dropdown-item v-for="(item, index) in bugProcessStatusList" :key="index" @click.native="handleClick(item)">{{ item.name }}</el-dropdown-item>
-      </el-dropdown-menu>
-    </el-dropdown>
+    <div class="table-top">
+      <label>{{ name }}的缺陷</label>
+    </div>
     <el-table
       ref="bug_tableHeader"
       size="small"
@@ -47,9 +42,9 @@
     </el-table>
     <div align="right">
       <el-pagination
-        :page-sizes="[15, 30, 45, total]"
-        :current-page.sync="curIndex"
-        :page-size="pageSize"
+        :page-sizes="[10, 20, 30, total]"
+        :current-page.sync="pages.curIndex"
+        :page-size="pages.pageSize"
         background
         layout="total, sizes, prev, pager, next, jumper"
         :total="total"
@@ -67,7 +62,7 @@
           :drawer-show="drawerShow"
           @close="drawerShow = false"
           @delete="getBugSelfList"
-          @update="getBugList"
+          @update="bugGetTableList"
         />
       </div>
     </el-drawer>
@@ -76,7 +71,7 @@
 
 <script>
 import statusChange from '@/views/projectManage/bugList/details/statusChange'
-import { bugGetEnum, bugTeamList, bugSelfList } from '@/api/defectManage'
+import { bugGetEnum, bugList } from '@/api/defectManage'
 import BugDetails from '@/views/projectManage/bugList/details/index'
 import '@/styles/PublicStyle/index.scss'
 
@@ -93,61 +88,57 @@ export default {
     }
   },
   props: {
-    name: { type: String, default: null },
-    bizId: { type: Number, default: null },
-    teamId: { type: Number, default: null }
+    idList: {
+      type: Array,
+      default: () => [],
+      required: true
+    },
+    name: {
+      type: String,
+      default: '',
+      required: false
+    }
   },
   data() {
     return {
-      title: '待团队成员处理',
       tableData: [], // tableData
       statusCode: 1, // 当前筛选的状态
-      pageSize: 15, // 分页
-      curIndex: 1, // 分页
+      pages: {
+        pageSize: 10, // 分页
+        curIndex: 1 // 分页
+      },
       total: 0, // 总数
       bugQuery: '', // bug详情
       drawerShow: false, // drawer展示
-      bugProcessStatusList: [], // 筛选
       statusObj: null // 状态对象
     }
   },
-  computed: {
-    clickCount() {
-      return this.$store.state.app.clickCount
-    }
-  },
   watch: {
-    clickCount(newVal, oldVal) {
-      this.drawerShow = false
+    idList: {
+      handler(newV) {
+        this.bugGetTableList()
+      },
+      deep: true
+    },
+    name: {
+      handler(newV) {},
+      immediate: true
     }
   },
   created() {
     this.getBugSelect()
   },
   methods: {
-    handleClick(vel) {
-      this.title = vel.name
-      this.statusCode = vel.code
-      this.curIndex = 1
-      this.bugGetTableList()
-    },
-    getBugSelect() { //  获取下拉菜单option
-      bugGetEnum().then(res => {
-        if (this.name === '个人') {
-          this.title = '待我处理'
-          this.bugProcessStatusList = res.data.bugProcessStatusList // 个人
-        }
-        if (this.name === '团队') {
-          this.title = '待团队成员处理'
-          this.bugProcessStatusList = res.data.bugProcessTeamStatusList // 待团队成员处理
-        }
+    async getBugSelect() { //  获取下拉菜单option
+      const res = await bugGetEnum()
+      if (res.code === 200) {
         this.statusObj = {
           bugEnumList: res.data.bugEnumList, // status
           repairResultEnumList: res.data.repairResultEnumList, // 修复结果
           bugReasonEnumList: res.data.bugReasonEnumList, // 缺陷原因
           theBugTypeEnumList: this.deleteChild(res.data.theBugTypeEnumList) // 缺陷类型
         }
-      })
+      }
     },
     deleteChild(arr) { // 删除无用子属性
       const bfs = arr => {
@@ -162,34 +153,18 @@ export default {
       bfs(arr)
       return arr
     },
-    async bugGetTableList(name, value) {
-      const teamSearchInfo = value || { teamId: this.teamId, bizId: this.bizId }
-      if (value) {
-        this.curIndex = 1
+    async bugGetTableList() { // 获取缺陷列表
+      console.log(this.idList)
+      if (this.idList.length === 0) {
+        this.tableData = []
+        return
       }
-      const pageInfoDO = {}
-      pageInfoDO.pageSize = this.pageSize
-      pageInfoDO.curIndex = this.curIndex
-      if (this.name === '团队') {
-        const res = await bugTeamList({ pageInfoDO, status: this.statusCode, teamSearchInfo })
-        if (res.code === 200) {
-          this.$forceUpdate()
-          this.tableData = res.data.map(item => { return { ...item, isSelected: false } })
-          this.total = res.total
-        }
-      }
-      if (this.name === '个人') {
-        const res = await bugSelfList({ pageInfoDO, status: this.statusCode })
-        if (res.code === 200) {
-          this.$forceUpdate()
-          this.tableData = res.data.map(item => { return { ...item, isSelected: false } })
-          this.total = res.total
-        }
+      const res = await bugList({ ids: this.idList, ...this.pages })
+      if (res && res.code === 200) {
+        this.tableData = res.data
+        this.total = res.total
       }
     },
-    getBugList() {
-      this.bugGetTableList()
-    },
     getBugSelfList() {
       this.bugGetTableList()
       this.$nextTick(() => {
@@ -197,10 +172,10 @@ export default {
       })
     },
     handleSizeChange(val) {
-      this.pageSize = val
+      this.pages.pageSize = val
     },
     handleCurrentChange(val) {
-      this.curIndex = val
+      this.pages.curIndex = val
       this.bugGetTableList()
     },
     click_bugName(e) {
@@ -214,6 +189,14 @@ export default {
 </script>
 
 <style scoped lang="scss">
+.table-top {
+  color: #333333;
+  font-size: 16px;
+  width: 100%;
+  padding: 10px 15px 0 15px;
+  display: flex;
+  justify-content: space-between;
+}
 .dropdown {
   margin: 20px;
 }

+ 1 - 1
src/views/workbench/components/statisticsSection.vue

@@ -130,7 +130,6 @@ export default {
       const res = await requestUrl({ teamSearchInfo: this.searchForm })
       if (res.code === 200) {
         this.statisticsList = res.data || []
-        console.log(res.data)
         this.changeData(this.statisticsList[0].idList, this.statisticsList[0].label)
       }
     },
@@ -232,6 +231,7 @@ export default {
     label {
       font-weight: 400;
       color: #666666;
+      cursor:pointer;
     }
     .number {
       font-weight: 500;

+ 3 - 2
src/views/workbench/team/index.vue

@@ -133,7 +133,7 @@
           }"
           @change="changeData"
         />
-        <bugTableList ref="bugTableDialog" :name="'团队'" :team-id="searchForm.teamId" :biz-id="searchForm.bizId" />
+        <bugTableList :name="listName.bugList" :id-list="idList.bugList" />
       </section>
     </el-container>
     <!-- 日程 -->
@@ -494,7 +494,8 @@ export default {
         this.idList.taskList = idList
         this.listName.taskList = name
       } else if (e === '缺陷') {
-        this.handleClick()
+        this.idList.bugList = idList
+        this.listName.bugList = name
       }
     }
   }