drawerAll.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <template>
  2. <el-drawer :title="Statistics.title" :visible.sync="drawer_" :direction="direction" :modal="false" :class="{'drawer-box': showClass}" size="100%" :before-close="handleClose">
  3. <div v-if="Statistics.title === '任务分布图数据'" class="qz-drawer-grade">按任务等级分布</div>
  4. <div v-if="Statistics.title === '分布图数据'" class="qz-drawer-grade-tow">按缺陷等级分布</div>
  5. <div>
  6. <div v-if="Statistics.title !== '模块分布数据'" :class="[Statistics.towTimeLine ? 'qz-drawer-padding' : 'qz-drawer-padding-s', 'qz-drawer-header']">
  7. <div class="qz-drawer-scll">
  8. <timeline :data="list" :num="defaultKey" :bgmargin="bgMargin" @update="getvalue" />
  9. </div>
  10. <div v-if="Statistics.towTimeLine" class="qz-drawer-scll">
  11. <timeline :data="Statistics.towTimeLine" :num="defaultKey2" :bgmargin="bgMargin" @update="getvalueTow" />
  12. </div>
  13. </div>
  14. <div v-if="Statistics.title === '需求分布图数据' || Statistics.title === '任务分布图数据'" class="qz-drawer-H">
  15. <span>{{ status }}</span>为<span>{{ type }}</span>的{{ Statistics.toType }}
  16. </div>
  17. <div v-if="Statistics.title === '状态停留分布图数据'" class="qz-drawer-H">
  18. 在<span>{{ type }}</span>状态停留时长为<span>{{ typeTow }}</span>的{{ Statistics.toType }}
  19. </div>
  20. <div v-if="Statistics.title === '模块分布数据'" class="qz-drawer-H" style="margin: 20px 30px 10px;">
  21. 模块<span>{{ Statistics.name }}</span>的缺陷
  22. </div>
  23. <div v-if="Statistics.title === `${Statistics.qz_holiday}的修复时长区间数据`" class="qz-drawer-H" style="margin: 20px 30px 10px;">
  24. {{ Statistics.qz_holiday }}修复时间区间为<span>{{ type }}</span>的<span>{{ typeTow }}</span>级缺陷
  25. </div>
  26. <qzTable
  27. :data="tableData"
  28. :title="Statistics.title"
  29. :type="Statistics.title === '需求分布图数据' || Statistics.title === '任务分布图数据' || Statistics.title === '分布图数据' ? status : Statistics.toType"
  30. :oftype="type"
  31. />
  32. </div>
  33. <el-pagination
  34. style="text-align: right; margin-right: 30px;"
  35. :current-page.sync="currentPage"
  36. :page-size="10"
  37. layout="total, prev, pager, next, jumper"
  38. :total="total"
  39. @size-change="handleSizeChange"
  40. @current-change="handleCurrentChange"
  41. />
  42. </el-drawer>
  43. </template>
  44. <script>
  45. import { getRequirement } from '@/api/requirement.js'
  46. import { taskList } from '@/api/taskIndex'
  47. import { bugList } from '@/api/defectManage'
  48. import { getReportList } from '@/api/reportTemplate'
  49. import timeline from '@/components/timeline'
  50. import qzTable from './tables'
  51. export default {
  52. components: { timeline, qzTable },
  53. props: {
  54. data: { type: Object, required: true },
  55. drawer: { type: Boolean, default: false },
  56. status: { type: String, default: '' }
  57. },
  58. data() {
  59. return {
  60. list: [],
  61. bgMargin: false,
  62. dataList: [],
  63. Statistics: {}, // title
  64. direction: 'rtl',
  65. showClass: false,
  66. defaultKey2: 0,
  67. defaultKey: 0,
  68. bugList: [],
  69. type: '',
  70. typeTow: '',
  71. towVal: '',
  72. oneVal: '',
  73. currentPage: 1,
  74. total: 0,
  75. reportData: {},
  76. paging: {
  77. curIndex: 1, // 分页
  78. pageSize: 10 // 分页
  79. },
  80. tableData: []
  81. }
  82. },
  83. computed: {
  84. drawer_: {
  85. get() { return this.drawer },
  86. set(v) { this.$emit('clone', v) }
  87. }
  88. },
  89. watch: {
  90. data: {
  91. handler(newV, oldV) {
  92. if (newV) {
  93. console.log(newV, this.drawer, '刚进来')
  94. this.Statistics = newV
  95. this.list = newV.xaxis
  96. this.type = newV.name
  97. this.bgMargin = false
  98. this.currentPage = 1
  99. this.paging = { curIndex: 1, pageSize: 10 }
  100. this.setDrawerDate()
  101. }
  102. },
  103. immediate: true
  104. }
  105. },
  106. mounted() {
  107. this.$nextTick(() => {
  108. this.showClass = true
  109. })
  110. },
  111. methods: {
  112. setDrawerDate() {
  113. if (this.Statistics.title === '需求分布图数据' || this.Statistics.title === '任务分布图数据' || this.Statistics.title === '分布图数据') {
  114. this.defaultKey = this.Statistics.dataIndex
  115. this.dataList = this.Statistics.yaxis[0].idList[this.defaultKey]
  116. this.getTableData(this.dataList)
  117. } else if (this.Statistics.title === '缺陷统计数据' || this.Statistics.title === '去除节假日的修复时长数据') {
  118. const key = this.Statistics.xaxis.indexOf(this.Statistics.label)
  119. this.defaultKey = key === -1 ? 0 : key
  120. this.dataList = this.Statistics.idList
  121. this.getTableData(this.dataList)
  122. } else if (this.Statistics.title === '状态停留分布图数据') {
  123. this.bgMargin = true
  124. this.typeTow = this.Statistics.seriesName // 停留时长
  125. this.defaultKey = this.Statistics.dataIndex
  126. this.defaultKey2 = Number(this.Statistics.seriesIndex)
  127. this.dataList = this.Statistics.statusList.yaxis[this.defaultKey2].idList[this.defaultKey]
  128. this.getTableData(this.dataList)
  129. } else if (this.Statistics.title === '报告统计数据') {
  130. const key = this.Statistics.xaxis.indexOf(this.Statistics.label)
  131. this.defaultKey = key === -1 ? 0 : key
  132. this.Statistics.label === '总数' ? this.getIdList({ deliverTestReportIdList: this.Statistics.subCountList[0].idList, dailyReportIdList: this.Statistics.subCountList[1].idList, releaseReportIdList: this.Statistics.subCountList[2].idList }) : ''
  133. key === 1 ? this.getIdList({ deliverTestReportIdList: this.Statistics.subCountList[0].idList }) : '' // 提测
  134. key === 2 ? this.getIdList({ dailyReportIdList: this.Statistics.subCountList[0].idList }) : '' // 日报
  135. key === 3 ? this.getIdList({ releaseReportIdList: this.Statistics.subCountList[0].idList }) : '' // 准出
  136. } else if (this.Statistics.title === '模块分布数据') {
  137. this.getTableData(this.Statistics.newData.idList)
  138. } else if (this.Statistics.title === `${this.Statistics.qz_holiday}的修复时长区间数据`) {
  139. this.bgMargin = true
  140. this.typeTow = this.Statistics.seriesName
  141. this.defaultKey = this.Statistics.dataIndex
  142. this.defaultKey2 = Number(this.Statistics.seriesIndex)
  143. this.dataList = this.Statistics.series[this.defaultKey2].idList[this.defaultKey]
  144. this.getTableData(this.dataList)
  145. }
  146. },
  147. getvalue(e) { // 时间轴one
  148. this.oneVal = e
  149. this.type = e.name
  150. this.defaultKey = e.value
  151. this.getTimeLine()
  152. },
  153. getvalueTow(e) { // 时间轴tow
  154. this.towVal = e
  155. this.typeTow = e.name
  156. this.defaultKey2 = e.value
  157. this.getTimeLine()
  158. },
  159. getTimeLine() { // 数据筛选
  160. this.dataList = []
  161. this.currentPage = 1
  162. this.paging = { curIndex: 1, pageSize: 10 }
  163. if (this.Statistics.title === '需求分布图数据' || this.Statistics.title === '任务分布图数据' || this.Statistics.title === '分布图数据') {
  164. this.dataList = this.Statistics.yaxis[0].idList[this.oneVal.value]
  165. } else if (this.Statistics.title === '缺陷统计数据') {
  166. this.dataList = this.Statistics.yaxis[this.oneVal.value].idList
  167. } else if (this.Statistics.title === '状态停留分布图数据') {
  168. this.dataList = this.Statistics.statusList.yaxis[this.defaultKey2].idList[this.defaultKey]
  169. } else if (this.Statistics.title === '报告统计数据') {
  170. this.defaultKey === 0 ? this.getIdList({ deliverTestReportIdList: this.Statistics.reportData[1].subCountList[0].idList, dailyReportIdList: this.Statistics.reportData[2].subCountList[0].idList, releaseReportIdList: this.Statistics.reportData[3].subCountList[0].idList }) : ''
  171. this.defaultKey === 1 ? this.getIdList({ deliverTestReportIdList: this.Statistics.reportData[1].subCountList[0].idList }) : '' // 提测
  172. this.defaultKey === 2 ? this.getIdList({ dailyReportIdList: this.Statistics.reportData[2].subCountList[0].idList }) : '' // 日报
  173. this.defaultKey === 3 ? this.getIdList({ releaseReportIdList: this.Statistics.reportData[3].subCountList[0].idList }) : '' // 准出
  174. return
  175. } else if (this.Statistics.title === '去除节假日的修复时长数据') {
  176. this.dataList = this.Statistics[this.defaultKey].idList
  177. } else if (this.Statistics.title === `${this.Statistics.qz_holiday}的修复时长区间数据`) {
  178. this.dataList = this.Statistics.series[this.defaultKey2].idList[this.defaultKey]
  179. }
  180. if (this.dataList[0]) { // 判断idList有没有数据
  181. this.getTableData(this.dataList)
  182. } else { // 没有数据初始化table
  183. this.tableData = []
  184. this.total = 0
  185. }
  186. },
  187. async getTableData(taskIdList) { // 获取需求、任务、缺陷表格数据
  188. if (taskIdList.length <= 0) {
  189. this.tableData = []
  190. this.total = 0
  191. return
  192. }
  193. const data = { ids: taskIdList, ...this.paging }
  194. if (this.Statistics.title === '需求分布图数据' || this.Statistics.title === '状态停留分布图数据' && this.Statistics.toType === '需求') {
  195. const res = await getRequirement(data)
  196. if (res.code === 200) {
  197. this.tableData = res.data.list
  198. this.total = res.data.total
  199. }
  200. } else if (this.Statistics.title === '任务分布图数据' || this.Statistics.title === '状态停留分布图数据' && this.Statistics.toType === '任务') {
  201. const res = await taskList(data)
  202. if (res.code === 200) {
  203. this.tableData = res.data
  204. this.total = res.total
  205. }
  206. } else if (this.Statistics.title === '缺陷统计数据' || this.Statistics.title === '分布图数据' || this.Statistics.title === '去除节假日的修复时长数据' || this.Statistics.title === '模块分布数据' || this.Statistics.title === `${this.Statistics.qz_holiday}的修复时长区间数据`) {
  207. const res = await bugList(data)
  208. if (res.code === 200) {
  209. this.tableData = res.data
  210. this.total = res.total
  211. }
  212. }
  213. },
  214. async getIdList(value) {
  215. this.reportData = value
  216. const data = { ...value, ...this.paging }
  217. const res = await getReportList(data)
  218. if (res.code === 200) {
  219. this.tableData = res.data
  220. this.total = res.total
  221. }
  222. },
  223. handleSizeChange(val) {
  224. this.paging.pageSize = val
  225. this.Statistics.title === '报告统计数据' ? this.getIdList(this.reportData) : this.getTableData(this.dataList)
  226. },
  227. handleCurrentChange(val) {
  228. this.paging.curIndex = val
  229. this.Statistics.title === '报告统计数据' ? this.getIdList(this.reportData) : this.getTableData(this.dataList)
  230. },
  231. handleClose(done) { // 关闭
  232. this.$emit('clone')
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. .qz-drawer-header {
  239. text-align: center;
  240. background: #F7F7F7;
  241. border-radius: 4px;
  242. min-height: 120px;
  243. margin: 20px 30px;
  244. overflow: hidden;
  245. }
  246. .qz-drawer-padding {
  247. padding: 20px 0;
  248. }
  249. .qz-drawer-padding-s {
  250. padding: 1px 0;
  251. }
  252. .qz-drawer-scll {
  253. overflow-x: auto;
  254. }
  255. .qz-drawer-scll::-webkit-scrollbar { width: 0 !important; height: 0 !important }
  256. .qz-drawer-H {
  257. font-size: 16px;
  258. margin: 0 30px;
  259. color: #444444;
  260. }
  261. .qz-drawer-H span {
  262. color: #333333;
  263. font-weight: 600;
  264. }
  265. .qz-message { color: #444; font-size: 14px;}
  266. .qz-drawer-grade {
  267. @extend .qz-message;
  268. position: absolute;
  269. top: 28px;
  270. left: 185px;
  271. }
  272. .qz-drawer-grade-tow {
  273. @extend .qz-message;
  274. position: absolute;
  275. top: 28px;
  276. left: 150px;
  277. }
  278. >>> :focus{outline:0;}
  279. >>>.el-table::before {
  280. left: 0;
  281. bottom: 0;
  282. width: 100%;
  283. height: 0px;
  284. }
  285. >>>.el-drawer__header {
  286. color: #444;
  287. font-size: 20px;
  288. font-weight: 500;
  289. margin-bottom: 0px;
  290. padding: 20px 30px;
  291. border-bottom: 1px solid #E2E2E2;
  292. }
  293. .drawer-box {
  294. box-shadow: 0 8px 10px -5px rgba(0,0,0,.2), 0 16px 24px 2px rgba(0,0,0,.14), 0 6px 30px 5px rgba(0,0,0,.12);
  295. }
  296. .el-drawer__wrapper {
  297. width: 100%;
  298. position: fixed;
  299. top: 0;
  300. right: 0;
  301. bottom: 0;
  302. left: 50%;
  303. overflow: hidden;
  304. margin: 0;
  305. }
  306. >>>.el-drawer__container {
  307. left: 0;
  308. right: 0;
  309. width: 50%;
  310. }
  311. >>>.el-table td, .el-table th {
  312. padding: 5px 0;
  313. }
  314. </style>