bugTableList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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="100" sortable align="center">
  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="bugGetTableList" />
  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. console.log(this.idList)
  155. if (this.idList.length === 0) {
  156. this.tableData = []
  157. return
  158. }
  159. const res = await bugList({ ids: this.idList, ...this.pages })
  160. if (res && res.code === 200) {
  161. this.tableData = res.data
  162. this.total = res.total
  163. }
  164. },
  165. getBugSelfList() {
  166. this.bugGetTableList()
  167. this.$nextTick(() => {
  168. this.drawerShow = false
  169. })
  170. },
  171. handleSizeChange(val) {
  172. this.pages.pageSize = val
  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. }
  185. }
  186. </script>
  187. <style scoped lang="scss">
  188. .table-top {
  189. color: #333333;
  190. font-size: 16px;
  191. width: 100%;
  192. padding: 10px 15px 0 15px;
  193. display: flex;
  194. justify-content: space-between;
  195. }
  196. .dropdown {
  197. margin: 20px;
  198. }
  199. .el-dropdown-link {
  200. cursor: pointer;
  201. color: #409EFF;
  202. }
  203. .el-icon-arrow-down {
  204. font-size: 12px;
  205. }
  206. .bug_tableHeader {
  207. width: 100%;
  208. font-size: 14px;
  209. color:rgba(102,102,102,1);
  210. }
  211. .div_priority {
  212. text-align: center;
  213. color: #ffffff;
  214. padding: inherit;
  215. border-radius: 4px;
  216. margin-right: 14%;
  217. width: 35px;
  218. display: inline-block;
  219. }
  220. .bugNameSty:hover {
  221. cursor: pointer;
  222. color: #409EFF !important;
  223. }
  224. .bug_manage_drawer .el-drawer__header{
  225. margin-bottom: 15px;
  226. }
  227. .bug_manage_drawer {
  228. pointer-events: none;
  229. margin-top: 55px;
  230. }
  231. .bug_manage_drawer .el-drawer{
  232. pointer-events: auto;
  233. }
  234. </style>