bugTableList.vue 7.1 KB

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