bugTableList.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div>
  3. <el-dropdown class="dropdown" trigger="click">
  4. <span class="el-dropdown-link">
  5. {{ title }}<i class="el-icon-arrow-down el-icon--right" />
  6. </span>
  7. <el-dropdown-menu slot="dropdown">
  8. <el-dropdown-item v-for="(item, index) in bugProcessStatusList" :key="index" @click.native="handleClick(item)">{{ item.name }}</el-dropdown-item>
  9. </el-dropdown-menu>
  10. </el-dropdown>
  11. <el-table
  12. ref="bug_tableHeader"
  13. size="small"
  14. :data="tableData"
  15. class="bug_tableHeader"
  16. show-overflow-tooltip="true"
  17. :header-cell-style="{ color: '#4A4A4A', fontSize: '14px', fontWeight: '500' }"
  18. row-key="id"
  19. >
  20. <el-table-column label="优先级" prop="priorityCode" min-width="100" sortable align="center">
  21. <template slot-scope="scope" style="text-align: center;">
  22. <span class="div_priority" :class="[{'priority_color': scope.row.priorityLevel === 'High'},{'priority_color1': scope.row.priorityLevel === 'Medium'},{'priority_color3': scope.row.priorityLevel === 'Low'}]">
  23. {{ scope.row.priorityLevel.substring(0, 1) }}
  24. </span>
  25. </template>
  26. </el-table-column>
  27. <el-table-column prop="bugName" label="缺陷标题" min-width="360" align="left" show-overflow-tooltip>
  28. <template slot-scope="scope">
  29. <span style=" color: #A7AEBC; font-size: 10px;">{{ 'BUG-' + scope.row.id }}</span>
  30. <br>
  31. <span class="bugNameSty" @click.stop="click_bugName(scope.row.id)">{{ scope.row.bugName }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="priorityName" label="缺陷等级" align="center" />
  35. <el-table-column prop="bugStatusName" label="状态" min-width="110" align="center">
  36. <template slot-scope="scope">
  37. <statusChange :bug-id="scope.row.id" :status-code="Number(scope.row.status)" :bug-data="scope.row" :status-obj="statusObj" @bugGet="bugGetTableList" />
  38. </template>
  39. </el-table-column>
  40. <el-table-column prop="taskName" label="所属任务" align="center" min-width="250" show-overflow-tooltip />
  41. <el-table-column prop="creatorList" label="提报人" align="center" />
  42. <el-table-column prop="assignerList" label="责任人" min-width="150" align="center" show-overflow-tooltip />
  43. <el-table-column prop="currentHandlerList" label="修复人" min-width="150" align="center" show-overflow-tooltip />
  44. <el-table-column prop="gmtCreate" label="创建日期" min-width="120" align="center">
  45. <template slot-scope="scope">{{ scope.row.gmtCreate | naspOut }}</template>
  46. </el-table-column>
  47. </el-table>
  48. <div align="right">
  49. <el-pagination
  50. :page-sizes="[15, 30, 45, total]"
  51. :current-page.sync="curIndex"
  52. :page-size="pageSize"
  53. background
  54. layout="total, sizes, prev, pager, next, jumper"
  55. :total="total"
  56. @size-change="handleSizeChange"
  57. @current-change="handleCurrentChange"
  58. />
  59. </div>
  60. <el-drawer v-if="drawerShow" :visible.sync="drawerShow" :modal="false" :with-header="false" size="50%" class="bug_manage_drawer" @click.stop>
  61. <div @click.stop>
  62. <bug-details
  63. :id="bugQuery.id+''"
  64. ref="bugDetails"
  65. :type="'drawer'"
  66. :drawer-show="drawerShow"
  67. @close="drawerShow = false"
  68. @delete="drawerShow = false;type === 'page'?this.$emit('getBugList'):this.$emit('getBugSelfList')"
  69. @update="type === 'page'?this.$emit('getBugList'):this.$emit('getBugSelfList')"
  70. />
  71. </div>
  72. </el-drawer>
  73. </div>
  74. </template>
  75. <script>
  76. import statusChange from '@/views/projectManage/bugList/details/statusChange'
  77. import { bugGetEnum, bugTeamList, bugSelfList } from '@/api/defectManage'
  78. import BugDetails from '@/views/projectManage/bugList/details/index'
  79. import '@/styles/PublicStyle/index.scss'
  80. export default {
  81. components: {
  82. statusChange,
  83. BugDetails
  84. },
  85. filters: {
  86. naspOut(value) {
  87. if (!value) return ''
  88. var da = value.split(/\s+/)
  89. return da[0]
  90. }
  91. },
  92. props: {
  93. name: { type: String, default: null },
  94. bizId: { type: Number, default: null },
  95. teamId: { type: Number, default: null }
  96. },
  97. data() {
  98. return {
  99. title: '待团队成员处理',
  100. tableData: [], // tableData
  101. statusCode: 1, // 当前筛选的状态
  102. pageSize: 15, // 分页
  103. curIndex: 1, // 分页
  104. total: 0, // 总数
  105. bugQuery: '', // bug详情
  106. drawerShow: false, // drawer展示
  107. bugProcessStatusList: [], // 筛选
  108. statusObj: null // 状态对象
  109. }
  110. },
  111. computed: {
  112. clickCount() {
  113. return this.$store.state.app.clickCount
  114. }
  115. },
  116. watch: {
  117. clickCount(newVal, oldVal) {
  118. this.drawerShow = false
  119. }
  120. },
  121. created() {
  122. // this.bugGetTableList()
  123. this.getBugSelect()
  124. },
  125. methods: {
  126. handleClick(vel) {
  127. this.title = vel.name
  128. this.statusCode = vel.code
  129. this.curIndex = 1
  130. this.bugGetTableList()
  131. },
  132. getBugSelect() { // 获取下拉菜单option
  133. bugGetEnum().then(res => {
  134. if (this.name === '个人') {
  135. this.title = '待我处理'
  136. this.bugProcessStatusList = res.data.bugProcessStatusList // 个人
  137. }
  138. if (this.name === '团队') {
  139. this.title = '待团队成员处理'
  140. this.bugProcessStatusList = res.data.bugProcessTeamStatusList // 待团队成员处理
  141. }
  142. this.statusObj = {
  143. bugEnumList: res.data.bugEnumList, // status
  144. repairResultEnumList: res.data.repairResultEnumList, // 修复结果
  145. bugReasonEnumList: res.data.bugReasonEnumList // 缺陷原因
  146. }
  147. })
  148. },
  149. async bugGetTableList(name, value) {
  150. const teamSearchInfo = value || { teamId: this.teamId, bizId: this.bizId }
  151. if (value) {
  152. this.curIndex = 1
  153. }
  154. const pageInfoDO = {}
  155. pageInfoDO.pageSize = this.pageSize
  156. pageInfoDO.curIndex = this.curIndex
  157. if (this.name === '团队') {
  158. const res = await bugTeamList({ pageInfoDO, status: this.statusCode, teamSearchInfo })
  159. if (res.code === 200) {
  160. this.$forceUpdate()
  161. this.tableData = res.data.map(item => { return { ...item, isSelected: false } })
  162. this.total = res.total
  163. }
  164. }
  165. if (this.name === '个人') {
  166. const res = await bugSelfList({ pageInfoDO, status: this.statusCode })
  167. if (res.code === 200) {
  168. this.$forceUpdate()
  169. this.tableData = res.data.map(item => { return { ...item, isSelected: false } })
  170. this.total = res.total
  171. }
  172. }
  173. },
  174. handleSizeChange(val) {
  175. this.pageSize = val
  176. },
  177. handleCurrentChange(val) {
  178. this.curIndex = val
  179. this.bugGetTableList()
  180. },
  181. click_bugName(e) {
  182. this.bugQuery = JSON.parse(
  183. JSON.stringify(this.tableData.filter(value => value.id === e)[0])
  184. )
  185. this.drawerShow = true
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped lang="scss">
  191. .dropdown {
  192. margin: 20px;
  193. }
  194. .el-dropdown-link {
  195. cursor: pointer;
  196. color: #409EFF;
  197. }
  198. .el-icon-arrow-down {
  199. font-size: 12px;
  200. }
  201. .bug_tableHeader {
  202. width: 100%;
  203. font-size: 14px;
  204. color:rgba(102,102,102,1);
  205. }
  206. .div_priority {
  207. text-align: center;
  208. color: #ffffff;
  209. padding: inherit;
  210. border-radius: 4px;
  211. margin-right: 14%;
  212. width: 35px;
  213. display: inline-block;
  214. }
  215. .bugNameSty:hover {
  216. cursor: pointer;
  217. color: #409EFF !important;
  218. }
  219. .bug_manage_drawer .el-drawer__header{
  220. margin-bottom: 15px;
  221. }
  222. .bug_manage_drawer {
  223. pointer-events: none;
  224. margin-top: 55px;
  225. }
  226. .bug_manage_drawer .el-drawer{
  227. pointer-events: auto;
  228. }
  229. </style>