drawerAll.vue 19 KB

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