drawerAll.vue 17 KB

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