index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. <template>
  2. <el-drawer
  3. :modal="false"
  4. size="100%"
  5. :class="drawerBox"
  6. destroy-on-close
  7. :visible.sync="drawer"
  8. :before-close="handleClose"
  9. @click.stop
  10. @open="setBoxShadow('')"
  11. @opened="setBoxShadow"
  12. @close="setBoxShadow('')"
  13. >
  14. <template slot="title">
  15. <div v-if="title" @click.stop>{{ title }}<span class="sub-title">{{ subTitle }}</span></div>
  16. </template>
  17. <!-- 时间线 -->
  18. <div
  19. v-if="openDrawer && isTimeLine(1)"
  20. class="drawer-padding drawer-header"
  21. :style="{paddingTop: !isTimeLine(2) ? '30px':'10px'}"
  22. @click.stop
  23. >
  24. <div id="index" ref="timeline1" class="drawer-scll">
  25. <timeline
  26. :num="timelineData.firstActive"
  27. bg-margin
  28. :data="timelineData.first"
  29. @update="(params) => timeLineClick(params, 1)"
  30. />
  31. </div>
  32. <div v-if="isTimeLine(2)" ref="timeline2" class="drawer-scll">
  33. <timeline
  34. :num="timelineData.secondActive"
  35. :data="timelineData.second"
  36. bg-margin
  37. @update="(params)=>timeLineClick(params, 2)"
  38. />
  39. </div>
  40. </div>
  41. <!-- 表格 -->
  42. <dmTable
  43. v-if="openDrawer"
  44. v-loading="loading"
  45. :table-list="tableList"
  46. :total="tableList"
  47. :column="column"
  48. :table-height="tableHeight"
  49. @click.stop
  50. @change="dmTableChange"
  51. >
  52. <template #bugStatusNameSlot="{scope}">
  53. <div @click.stop="print(scope)">自定义</div>
  54. </template>
  55. <!-- 报告名称 -->
  56. <template #returnReasonSlot="{scope}">
  57. <div v-if="scope.row.reportName" @click.stop>
  58. <div class="drawer-name" @click.stop="jumper(scope.row,'提测')">{{ scope.row.reportName }}</div>
  59. <div v-if="scope.row.returnReason" style="color: red">打开报告:{{ scope.row.returnReason }}</div>
  60. </div>
  61. </template>
  62. <!-- 报告人 -->
  63. <template #creatorObjectSlot="{scope}">
  64. <div v-if="scope && scope.row && scope.row.creatorObject" @click.stop>{{ scope.row.creatorObject.name }}</div>
  65. </template>
  66. <!-- 质量:线上问题_改进方案 -->
  67. <template #starFlowerDoneSlot="{scope}">
  68. <div @click.stop>
  69. <div>{{ scope.row.done + scope.row.undone }}项任务</div>
  70. <div
  71. v-if="scope.row.done === scope.row.done + scope.row.undone"
  72. class="antdv3-tag antdv3-tag-green"
  73. >
  74. 已完成:{{ scope.row.done }}项
  75. </div>
  76. <div v-else class="antdv3-tag antdv3-tag-orange">已完成:{{ scope.row.done }}项</div>
  77. </div>
  78. </template>
  79. <!-- 质量:线上问题_改进方案 -->
  80. <template #gmtCreateSlot="{scope}">
  81. <div @click.stop>
  82. <div>{{ rTime(scope.row.gmtCreate) }}</div>
  83. </div>
  84. </template>
  85. </dmTable>
  86. <!-- 下拉 -->
  87. <div class="footer-laout" @click.stop>
  88. <div style="line-height: 60px;">
  89. <!-- <el-button type="primary" size="mini" @click="exportTable">导 出</el-button>-->
  90. </div>
  91. <el-pagination
  92. :current-page.sync="paging.curIndex"
  93. :page-size="paging.pageSize"
  94. :pager-count="5"
  95. layout="total, sizes, prev, pager, next, jumper"
  96. :page-sizes="[10, 15, 20, 30]"
  97. :total="paging.pageTotal"
  98. @size-change="handleSizeChange"
  99. @current-change="handleCurrentChange"
  100. />
  101. </div>
  102. </el-drawer>
  103. </template>
  104. <script>
  105. // import { mapGetters } from 'vuex'
  106. import { bugList } from '@/api/defectManage'
  107. import _ from 'lodash'
  108. import { getReportList } from '@/api/reportTemplate'
  109. import dmTable from '@/components/baseTable/table'
  110. // import timeline from '@/components/timeline/index'
  111. import timeline from './components/timeline'
  112. import { columns, timelineList } from './drawerModalData'
  113. import { EncryptId } from '@/utils/crypto-js'
  114. import Clickoutside from 'element-ui/src/utils/clickoutside'
  115. import { requirementQueryRequirementInfoList, taskList } from '@/api/projectIndex'
  116. import {
  117. // 质量
  118. getRequireAvgData, // 需求平均交付周期
  119. getTaskData, // 任务平均交付周期
  120. getRequirePeopleData, // 平均需求使用人力
  121. getDelayLaunchData, // 延期提测率
  122. getDelayReleaseData, // 延期准出率
  123. bugRepairData, // 缺陷24小时修复率
  124. bugRepair2Data, // 缺陷平均修复时长
  125. getStarFlowerList, // 线上问题:半浮层 列表
  126. getProjectList, // 需求任务项目列表: 半浮层
  127. getOdinJobList // 获取上线过程列表
  128. } from '@/api/dataMarket'
  129. export default {
  130. name: 'DrawerModal',
  131. components: {
  132. dmTable, timeline
  133. },
  134. directives: { Clickoutside },
  135. props: {
  136. // title: {
  137. // type: String,
  138. // required: false,
  139. // default: ''
  140. // },
  141. // subTitle: {
  142. // type: String,
  143. // required: false,
  144. // default: ''
  145. // },
  146. openDrawer: {
  147. type: Boolean,
  148. required: false,
  149. default: false
  150. },
  151. drawerData: {
  152. type: Object,
  153. required: false,
  154. default: () => {}
  155. }
  156. },
  157. data() {
  158. return {
  159. drawer: false,
  160. loading: false,
  161. title: '',
  162. headerTitle: '',
  163. // timelineData,
  164. tableList: [],
  165. tableListOld: [],
  166. tableHeight: 'auto',
  167. column: [],
  168. ids: [],
  169. label: '',
  170. activeLabel: '',
  171. drawerBox: '',
  172. subTitle: '',
  173. sourceData: null,
  174. /* S 新增缺陷*/
  175. priorityList: [],
  176. /* E 新增缺陷*/
  177. timelineData: {
  178. first: [],
  179. firstActive: 0,
  180. second: [],
  181. secondActive: 0
  182. },
  183. paging: {
  184. curIndex: 1,
  185. pageTotal: 0,
  186. pageSize: 10
  187. }
  188. }
  189. },
  190. watch: {
  191. drawerData(v, o) {
  192. if (JSON.stringify(v) !== JSON.stringify(o)) {
  193. this.init()
  194. }
  195. },
  196. openDrawer(value) {
  197. this.drawer = value
  198. }
  199. },
  200. mounted() {
  201. this.drawer = false
  202. },
  203. methods: {
  204. print(slotProp) {
  205. console.log(slotProp)
  206. },
  207. init() {
  208. console.log(this.drawerData, 210)
  209. this.headerTitle = this.drawerData.headerTitle
  210. this.title = this.headerTitle.search(/质量|效率/) > -1 ? this.drawerData.label || '' : this.drawerData.activeLabel
  211. console.log(this.headerTitle, this.title)
  212. if (this.headerTitle && this.title) {
  213. // console.log(this.drawerData)
  214. this.pagingInit()
  215. this.setPageSize()
  216. this.column = []
  217. this.tableList = []
  218. this.drawer = this.openDrawer
  219. this.setTitle()
  220. this.setIds() // 设置ids
  221. this.setTimeLineData()
  222. this.setTitleHeight()
  223. this.setTimeLine()
  224. this.setColumn()
  225. this.setTableList()
  226. } else {
  227. this.handleClose()
  228. }
  229. },
  230. // 设置页数
  231. setPageSize() {
  232. const pageSize = window.localStorage.getItem('pageSize') || 10
  233. // this.paging.pageSize = pageSize
  234. const paging = _.cloneDeep(this.paging)
  235. paging.pageSize = Number.parseInt(pageSize)
  236. this.paging = _.cloneDeep(paging)
  237. },
  238. // 设置标题
  239. setTitle() {
  240. // this.title = this.headerTitle.search(/质量|效率/) > -1 ? this.drawerData.label : this.drawerData.activeLabel
  241. if (this.headerTitle === '质量') {
  242. if (this.drawerData.label === '提测打回率') {
  243. this.title = '提测报告'
  244. }
  245. if (this.drawerData.label === '准出不通过率') {
  246. this.title = '准出记录'
  247. }
  248. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  249. this.title = !this.drawerData.index ? '回滚次数' : this.drawerData[this.drawerData.itemKey].label
  250. }
  251. }
  252. if (this.headerTitle === '效率') {
  253. this.activeLabel = this.drawerData.activeLabel
  254. if (this.drawerData.label === '需求平均交付周期') {
  255. this.title = '需求周期'
  256. }
  257. if (this.drawerData.label === '任务平均交付周期') {
  258. this.title = '任务周期'
  259. }
  260. if (this.drawerData.label === '平均需求使用人力') {
  261. this.title = '需求人力'
  262. }
  263. if (this.drawerData.label === '缺陷平均修复时长') {
  264. this.title = '缺陷修复时长'
  265. }
  266. }
  267. this.sourceData = this.drawerData.list
  268. if (this.headerTitle === '效率' && this.title && this.title.search(/延期准出率|延期提测率/) < 0) {
  269. this.sourceData = [
  270. {
  271. label: this.drawerData.label === '缺陷24小时修复率' ? '全部' : this.drawerData.label,
  272. IdList: this.drawerData.idList
  273. },
  274. ...this.drawerData.subCountList
  275. ]
  276. }
  277. },
  278. // 处理日期格式:JS - 2020-01-01T00:00:00.000000Z 日期格式转换
  279. rTime(date) {
  280. if (!date) return ''
  281. var json_date = new Date(date).toJSON()
  282. return new Date(new Date(json_date) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
  283. },
  284. // 设置ids
  285. setIds() {
  286. if (this.headerTitle === '质量' && !this.drawerData.moduleName) {
  287. this.ids = this.drawerData.IdList.map(e => e)
  288. }
  289. if (this.drawerData.moduleName && this.drawerData.moduleName === '上线过程') {
  290. this.ids = this.drawerData.IdList.map(e => e)
  291. }
  292. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  293. this.ids = this.drawerData[this.drawerData.itemKey].idList.map(e => e)
  294. }
  295. if (this.headerTitle === '吞吐量') {
  296. this.drawerData.list.forEach(elm => {
  297. if (elm.label === this.drawerData.activeLabel && elm.idList) {
  298. this.ids = elm.idList.map(e => e)
  299. }
  300. })
  301. }
  302. if (this.headerTitle === '效率') {
  303. this.ids = this.drawerData.idList.map(e => e) // 提测报告
  304. }
  305. },
  306. // 设置时间轴
  307. setTimeLineData() {
  308. let { firstActive, first, secondActive, second } = this.timelineData
  309. if (this.title.search(/新增问题|reopen|提测报告|准出记录/) < 0) {
  310. if (this.headerTitle === '质量') {
  311. if (this.title.search(/新增缺陷|reopen/) > -1) {
  312. first = [...timelineList.newDefect]
  313. }
  314. if (this.drawerData.moduleName && this.drawerData.moduleName === '上线过程') {
  315. first = [...timelineList.lineRate]
  316. firstActive = this.drawerData.index
  317. }
  318. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  319. first = [...timelineList.returnCase]
  320. firstActive = this.drawerData.index
  321. }
  322. }
  323. if (this.headerTitle === '吞吐量') {
  324. secondActive = 0
  325. firstActive = 0
  326. first = []
  327. this.sourceData.forEach((elm, index) => {
  328. if (this.title.indexOf(elm.label) > -1) {
  329. firstActive = index
  330. }
  331. first.push(elm.label)
  332. })
  333. if (this.title.search(/需求/) > -1) {
  334. first = timelineList.requirementData.map(e => e)
  335. }
  336. }
  337. if (this.headerTitle === '效率') {
  338. secondActive = 0
  339. firstActive = 0
  340. first = []
  341. second = []
  342. if (this.title === '缺陷24小时修复率') {
  343. first = [...timelineList.time]
  344. }
  345. if (this.title === '延期提测率') {
  346. first = [...timelineList.delayLaunchData]
  347. }
  348. if (this.title === '延期准出率') {
  349. first = [...timelineList.delayLaunchData2]
  350. }
  351. if (this.title.search(/延期提测率|延期准出率/) < 0) {
  352. this.sourceData.forEach((elm, index) => {
  353. let label = `${elm.label}`
  354. if (this.activeLabel === label) {
  355. if (this.title === '缺陷24小时修复率') {
  356. secondActive = index
  357. } else {
  358. firstActive = index
  359. }
  360. }
  361. if (this.title === '缺陷24小时修复率') {
  362. second.push(label)
  363. } else {
  364. if (index === 0) {
  365. if (label === '需求平均交付周期') {
  366. label = '需求交付周期'
  367. }
  368. if (label === '任务平均交付周期') {
  369. label = '任务交付周期'
  370. }
  371. if (label === '平均需求使用人力') {
  372. label = '需求使用人力'
  373. }
  374. if (this.drawerData.label === '缺陷平均修复时长') {
  375. label = '全部'
  376. }
  377. }
  378. first.push(label)
  379. }
  380. })
  381. }
  382. }
  383. this.timelineData = { firstActive, first, secondActive, second }
  384. }
  385. },
  386. handleClose() {
  387. this.drawer = false
  388. this.$emit('update:openDrawer', this.drawer)
  389. },
  390. handleSizeChange(value) {
  391. this.paging.pageSize = value
  392. const paging = _.cloneDeep(this.paging)
  393. paging.pageSize = value
  394. this.paging = _.cloneDeep(paging)
  395. window.localStorage.setItem('pageSize', value)
  396. if (this.headerTitle === '效率' && this.title !== '需求人力') {
  397. this.tableListPagination()
  398. } else {
  399. this.setTableList()
  400. }
  401. },
  402. handleCurrentChange(value) {
  403. // this.paging.curIndex = value
  404. const paging = _.cloneDeep(this.paging)
  405. paging.curIndex = value
  406. this.paging = _.cloneDeep(paging)
  407. // console.log(this.title)
  408. if (this.headerTitle === '效率' && this.title !== '需求人力') {
  409. this.tableListPagination()
  410. } else {
  411. this.setTableList()
  412. }
  413. },
  414. // 导出
  415. exportTable() {
  416. },
  417. // 格式化时间
  418. dateFomatter(date) {
  419. return date.substring(0, 10) + ' ' + date.substring(11, 19)
  420. },
  421. // 设置表格头
  422. setColumn() {
  423. if (this.title.search(/新增缺陷|reopen|缺陷24小时修复率/) > -1) {
  424. this.column = columns.bugColumn.map(e => e)
  425. }
  426. if (this.drawerData.moduleName && this.drawerData.moduleName === '上线过程') {
  427. this.column = columns.test_freeOn_lineRateIdListColumns.map(e => e)
  428. }
  429. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  430. // this.ids = this.drawerData[this.drawerData.itemKey].idList.map(e => e)
  431. this.column = columns.test_freeOn_lineRateIdListColumns.map(e => e)
  432. }
  433. if (this.title.search(/新增问题/) > -1) {
  434. this.column = columns.newQuestionColumns.map(e => e)
  435. }
  436. if (this.title.search(/提测报告|准出记录/) > -1) {
  437. this.column = columns.deliverTestReportIdListColumns.map(e => e)
  438. }
  439. if (this.headerTitle === '吞吐量') {
  440. if (this.title.search(/需求/) > -1) {
  441. this.column = columns.requirementListColumns.map(e => e)
  442. }
  443. if (this.title.search(/任务/) > -1) {
  444. this.column = columns.taskListColumns.map(e => e)
  445. }
  446. if (this.title.search(/项目/) > -1) {
  447. this.column = columns.projectListColumns.map(e => e)
  448. }
  449. }
  450. if (this.headerTitle === '效率') {
  451. let columnsKey = 'requirementColumns'
  452. if (this.title === '任务周期') {
  453. columnsKey = 'taskColumns'
  454. }
  455. if (this.title === '需求人力') {
  456. columnsKey = 'requirementPeopleColumns'
  457. }
  458. if (this.title === '延期提测率') {
  459. columnsKey = 'delayLaunchDataColumns'
  460. }
  461. if (this.title === '延期准出率') {
  462. columnsKey = 'delayReleaseData2Columns'
  463. }
  464. if (this.title.search(/缺陷修复时长|缺陷24小时修复率/) > -1) {
  465. columnsKey = 'bugRepairDataColumns'
  466. }
  467. const columnsTipsKey = `${columnsKey}Tips`
  468. this.column = columns.efficiency[columnsKey].map((elm, index) => {
  469. if (index === 2 && this.title.search(/任务周期|需求人力|需求周期/) > -1) {
  470. return columns.efficiency[columnsTipsKey][this.timelineData.firstActive || 0]
  471. }
  472. return elm
  473. })
  474. }
  475. },
  476. // 时间轴点击事件
  477. timeLineClick({ value, name }, index) {
  478. this.pagingInit()
  479. this.ids = []
  480. if (index === 1) {
  481. if (this.headerTitle === '质量') {
  482. if (this.title.search(/新增缺陷|reopen/) > -1) {
  483. this.ids = this.drawerData.IdList.map(e => e)
  484. this.priorityList = value ? [value - 1] : []
  485. }
  486. if (this.drawerData.moduleName && this.drawerData.moduleName === '上线过程') {
  487. // console.log(this.drawerData.parent.list[value])
  488. this.ids = this.drawerData.parent.list[value].IdList.map(e => e)
  489. }
  490. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  491. const items = ['countStr', 'preCountStr', 'fullCountStr', 'lowCountStr']
  492. this.ids = this.drawerData[items[value]].idList.map(e => e)
  493. }
  494. }
  495. if (this.headerTitle === '吞吐量') {
  496. this.timelineData.firstActive = value || 0
  497. if (this.sourceData[value || 0] && this.sourceData[value || 0].idList) {
  498. this.ids = this.sourceData[value || 0].idList
  499. this.title = name
  500. }
  501. }
  502. if (this.headerTitle === '效率') {
  503. this.timelineData.firstActive = value || 0
  504. if (this.title.search(/延期准出率|延期提测率/) > -1) {
  505. // this.ids = this.sourceData[value].IdList
  506. } else {
  507. this.timelineData.firstActive = value || 0
  508. this.ids = this.sourceData[value || 0].IdList
  509. }
  510. this.setColumn()
  511. }
  512. this.setTableList()
  513. }
  514. if (index === 2) {
  515. this.timelineData.secondActive = value || 0
  516. this.ids = this.sourceData[value || 0].IdList
  517. this.setTableList()
  518. }
  519. },
  520. // 设置列表数据
  521. setTableList() {
  522. this.tableList = []
  523. if (this.headerTitle === '质量') {
  524. if (this.title.search(/新增缺陷|reopen/) > -1) {
  525. // console.log(this.ids, 502)
  526. if (this.ids.length) {
  527. // console.log(504)
  528. this.loading = true
  529. this.getBugStatisticData()
  530. }
  531. }
  532. if (this.title.search(/新增问题/) > -1) {
  533. if (this.ids.length) {
  534. this.loading = true
  535. this.setStarFlowerList()
  536. }
  537. }
  538. if (this.title.search(/提测报告|准出记录/) > -1) {
  539. if (this.ids.length) {
  540. this.loading = true
  541. this.setReportList()
  542. }
  543. }
  544. if (this.drawerData.moduleName && (this.drawerData.moduleName === '上线过程' || this.drawerData.moduleName === '回滚次数')) {
  545. if (this.ids.length) {
  546. this.loading = true
  547. this.getOdinJobListFn()
  548. }
  549. }
  550. }
  551. if (this.headerTitle === '吞吐量') {
  552. if (this.title.search(/需求/) > -1) {
  553. if (this.ids.length) {
  554. this.loading = true
  555. this.getRequirementList()
  556. }
  557. }
  558. if (this.title.search(/任务/) > -1) {
  559. if (this.ids.length) {
  560. this.loading = true
  561. this.getTaskList()
  562. }
  563. }
  564. if (this.title.search(/项目/) > -1 && this.ids.length) {
  565. if (this.ids.length) {
  566. this.loading = true
  567. this.setProjectList()
  568. }
  569. }
  570. }
  571. if (this.headerTitle === '效率') {
  572. if (this.title === '需求周期') {
  573. if (this.sourceData[0].IdList.length) {
  574. this.loading = true
  575. this.setRequireAvgData()
  576. }
  577. }
  578. if (this.title === '任务周期') {
  579. this.loading = true
  580. this.setTaskData()
  581. if (this.sourceData[0].IdList.length) {
  582. this.loading = true
  583. this.setTaskData()
  584. }
  585. }
  586. if (this.title === '需求人力') {
  587. if (this.sourceData[0].IdList.length) {
  588. this.loading = true
  589. this.setRequirePeopleData()
  590. }
  591. }
  592. if (this.title === '缺陷修复时长') {
  593. if (this.sourceData[0].IdList.length) {
  594. this.loading = true
  595. this.setBugRepair2Data()
  596. }
  597. }
  598. if (this.title === '缺陷24小时修复率') {
  599. if (this.sourceData[0].IdList.length) {
  600. this.loading = true
  601. this.setBugRepairData()
  602. }
  603. }
  604. if (this.title === '延期提测率') {
  605. if (this.drawerData.idList.length) {
  606. this.loading = true
  607. this.setDelayLaunchData()
  608. }
  609. }
  610. if (this.title === '延期准出率') {
  611. if (this.drawerData.idList.length) {
  612. this.loading = true
  613. this.setDelayReleaseData()
  614. }
  615. }
  616. }
  617. },
  618. // 获取需求
  619. async getRequirementList() {
  620. const paging = this.paging
  621. // {"ids":[14952,15453,15988,16182,17445,17447,17735,18062,18064,18067,18134,18137,18138,18140],"curIndex":2,"pageSize":10}
  622. const res = await requirementQueryRequirementInfoList({
  623. ids: this.ids,
  624. curIndex: this.paging.curIndex,
  625. pageSize: this.paging.pageSize
  626. })
  627. if (res.code === 200) {
  628. this.tableList = res.data.list
  629. this.paging.pageTotal = res.data.total
  630. this.paging = { ...paging }
  631. this.loading = false
  632. }
  633. },
  634. // 获取任务
  635. async getTaskList() {
  636. const paging = this.paging
  637. // {"ids":[14952,15453,15988,16182,17445,17447,17735,18062,18064,18067,18134,18137,18138,18140],"curIndex":2,"pageSize":10}
  638. const res = await taskList({
  639. ids: this.ids,
  640. curIndex: this.paging.curIndex,
  641. pageSize: this.paging.pageSize
  642. })
  643. if (res.code === 200) {
  644. this.tableList = res.data
  645. this.paging.pageTotal = res.total
  646. this.paging = { ...paging }
  647. this.loading = false
  648. }
  649. },
  650. // getStarFlowerList, // 线上问题:半浮层 列表
  651. async setStarFlowerList() {
  652. if (!this.ids.length) {
  653. this.loading = false
  654. return
  655. }
  656. const paging = this.paging
  657. // {"ids":[14952,15453,15988,16182,17445,17447,17735,18062,18064,18067,18134,18137,18138,18140],"curIndex":2,"pageSize":10}
  658. const res = await getStarFlowerList({
  659. idList: this.ids,
  660. curIndex: this.paging.curIndex,
  661. pageSize: this.paging.pageSize
  662. })
  663. if (res.code === 200) {
  664. this.tableList = res.data.result
  665. this.paging.pageTotal = res.data.total
  666. this.paging = { ...paging }
  667. this.loading = false
  668. }
  669. },
  670. // getProjectList // 需求任务项目列表: 半浮层
  671. async setProjectList() {
  672. const paging = this.paging
  673. // {"ids":[14952,15453,15988,16182,17445,17447,17735,18062,18064,18067,18134,18137,18138,18140],"curIndex":2,"pageSize":10}
  674. const res = await getProjectList({
  675. idList: this.ids.length ? this.ids : [],
  676. curIndex: this.paging.curIndex,
  677. pageSize: this.paging.pageSize
  678. })
  679. if (res.code === 200) {
  680. // console.log(res)
  681. this.tableList = res.data.result
  682. paging.pageTotal = res.data.total
  683. this.paging = { ...paging }
  684. this.loading = false
  685. }
  686. },
  687. // 累计新增缺陷
  688. async getBugStatisticData() {
  689. const paging = this.paging
  690. // {"ids":[14952,15453,15988,16182,17445,17447,17735,18062,18064,18067,18134,18137,18138,18140],"curIndex":2,"pageSize":10}
  691. const res = await bugList({
  692. ids: this.ids,
  693. curIndex: this.paging.curIndex,
  694. priorityList: this.priorityList,
  695. pageSize: this.paging.pageSize
  696. })
  697. if (res.code === 200) {
  698. this.tableList = res.data
  699. this.paging.pageTotal = res.total
  700. this.paging = { ...paging }
  701. this.loading = false
  702. }
  703. },
  704. // 提测报告 deliverTestReportIdList 准出记录 releaseReportIdList
  705. async setReportList() {
  706. const key = this.title === '提测报告' ? 'deliverTestReportIdList' : 'releaseReportIdList'
  707. const paging = this.paging
  708. const params = {
  709. ...paging,
  710. [key]: this.ids
  711. }
  712. delete params.pageTotal
  713. const res = await getReportList(params)
  714. if (res.code === 200) {
  715. this.tableList = res.data
  716. paging.pageTotal = res.total
  717. this.paging = { ...paging }
  718. this.loading = false
  719. }
  720. },
  721. // 上线过程
  722. async getOdinJobListFn() {
  723. const paging = this.paging
  724. const res = await getOdinJobList({
  725. idList: this.ids,
  726. curIndex: this.paging.curIndex,
  727. pageSize: this.paging.pageSize
  728. })
  729. if (res.code === 200) {
  730. this.tableList = res.data.result
  731. this.paging.pageTotal = res.data.total
  732. this.paging = { ...paging }
  733. this.loading = false
  734. }
  735. },
  736. /* S 效率:半浮层数据接口 */
  737. // 需求平均交付周期
  738. async setRequireAvgData() {
  739. const paging = this.paging
  740. const params = {
  741. ...paging,
  742. title: this.timelineData.first[this.timelineData.firstActive],
  743. ids: this.sourceData[0].IdList
  744. }
  745. delete params.pageTotal
  746. const res = await getRequireAvgData(params)
  747. if (res.code === 200) {
  748. // this.tableList = res.data
  749. this.tableListOld = res.data.length && res.data.map(e => e)
  750. this.tableListPagination()
  751. paging.pageTotal = this.tableListOld.length
  752. this.paging = { ...paging }
  753. this.loading = false
  754. }
  755. },
  756. // 任务平均交付周期
  757. async setTaskData() {
  758. const paging = this.paging
  759. const params = {
  760. ...paging,
  761. title: this.timelineData.first[this.timelineData.firstActive],
  762. ids: this.sourceData[0].IdList
  763. }
  764. delete params.pageTotal
  765. const res = await getTaskData(params)
  766. if (res.code === 200) {
  767. // this.tableList = res.data
  768. this.tableListOld = res.data.length && res.data.map(e => e)
  769. this.tableListPagination()
  770. paging.pageTotal = this.tableListOld.length
  771. this.paging = { ...paging }
  772. this.loading = false
  773. }
  774. },
  775. // 平均需求使用人力
  776. async setRequirePeopleData() {
  777. const paging = this.paging
  778. const params = {
  779. ...paging,
  780. title: this.timelineData.first[this.timelineData.firstActive],
  781. ids: this.sourceData[0].IdList
  782. }
  783. delete params.pageTotal
  784. const res = await getRequirePeopleData(params)
  785. if (res.code === 200) {
  786. // console.log(res.data)
  787. this.tableList = res.data
  788. // this.tableListOld = res.data.length && res.data.map(e => e)
  789. // this.tableListPagination()
  790. paging.pageTotal = this.sourceData[0].IdList.length
  791. this.paging = { ...paging }
  792. this.loading = false
  793. }
  794. },
  795. // 缺陷平均修复时长
  796. async setbugRepair2Data() {
  797. const paging = this.paging
  798. const params = {
  799. ...paging,
  800. title: this.timelineData.first[this.timelineData.firstActive],
  801. ids: this.sourceData[0].IdList
  802. }
  803. delete params.pageTotal
  804. const res = await bugRepair2Data(params)
  805. if (res.code === 200) {
  806. // this.tableList = res.data
  807. this.tableListOld = res.data.length && res.data.map(e => e)
  808. this.tableListPagination()
  809. paging.pageTotal = this.tableListOld.length
  810. this.paging = { ...paging }
  811. this.loading = false
  812. }
  813. },
  814. // 缺陷24小时修复率
  815. async setbugRepairData() {
  816. const priorityList = [[0, 1, 2, 3], [0, 1], [2, 3]]
  817. const paging = this.paging
  818. const params = {
  819. // ...paging,
  820. title: this.timelineData.first[this.timelineData.firstActive],
  821. priorityList: priorityList[this.timelineData.secondActive],
  822. ids: this.sourceData[0].IdList
  823. }
  824. delete params.pageTotal
  825. const res = await bugRepairData(params)
  826. if (res.code === 200) {
  827. this.tableList = res.data
  828. this.tableListOld = res.data.length && this.tableList.map(e => e)
  829. paging.pageTotal = this.tableListOld.length
  830. this.paging = { ...paging }
  831. this.loading = false
  832. }
  833. },
  834. // getDelayLaunchData, // 延期提测率
  835. async setDelayLaunchData() {
  836. const paging = this.paging
  837. const params = {
  838. ...paging,
  839. title: this.timelineData.first[this.timelineData.firstActive],
  840. ids: this.drawerData.idList
  841. }
  842. delete params.pageTotal
  843. const res = await getDelayLaunchData(params)
  844. if (res.code === 200) {
  845. this.tableList = res.data
  846. this.tableListOld = res.data.length && res.data.map(e => e)
  847. this.tableListPagination()
  848. paging.pageTotal = this.tableListOld.length
  849. this.paging = { ...paging }
  850. this.loading = false
  851. }
  852. },
  853. // getDelayReleaseData, // 延期准出率
  854. async setDelayReleaseData() {
  855. const paging = this.paging
  856. const params = {
  857. ...paging,
  858. title: this.timelineData.first[this.timelineData.firstActive],
  859. ids: this.drawerData.idList
  860. }
  861. delete params.pageTotal
  862. const res = await getDelayReleaseData(params)
  863. if (res.code === 200) {
  864. // this.tableList = res.data
  865. this.tableListOld = res.data.length && res.data.map(e => e)
  866. this.tableListPagination()
  867. paging.pageTotal = this.tableListOld.length
  868. this.paging = { ...paging }
  869. this.loading = false
  870. }
  871. },
  872. // 分页
  873. tableListPagination() {
  874. if (this.tableListOld.length) {
  875. this.tableList = this.tableListOld.map(e => e).splice((this.paging.curIndex - 1 || 0) * this.paging.pageSize, this.paging.pageSize)
  876. // if (this.paging.curIndex - 1 || this.tableListOld.length > this.paging.pageSize.length) {
  877. // this.tableList = this.tableListOld.map(e => e).splice((this.paging.curIndex - 1 || 0) * this.paging.pageSize, this.paging.pageSize)
  878. // } else {
  879. // this.tableList = this.tableListOld.map(e => e) || []
  880. // }
  881. }
  882. },
  883. /* E 效率:半浮层数据接口 */
  884. // 分页数据初始化
  885. pagingInit() {
  886. const pageSize = window.localStorage.getItem('pageSize') || 10
  887. this.paging = {
  888. curIndex: 1,
  889. pageTotal: 0,
  890. pageSize: Number.parseInt(pageSize)
  891. }
  892. },
  893. // 设置表格高度
  894. setTitleHeight() {
  895. if (this.drawerData.moduleName && this.drawerData.moduleName.search(/上线过程|回滚次数/) > -1) {
  896. this.tableHeight = 'calc(100vh - 290px)'
  897. } else if (this.title.search(/状态停留分布图数据|状态累积流量图数据/) > -1) {
  898. this.tableHeight = 'calc(100vh - 363px)'
  899. } else if (this.title.search(/需求周期|新增项目|新增任务|reopen|新增缺陷|需求人力|任务周期|缺陷修复时长|延期准出率|延期提测率/) > -1) {
  900. this.tableHeight = 'calc(100vh - 288px)'
  901. } else if (this.title.search(/需求|任务|项目/) > -1) {
  902. // 吞吐量: 需求
  903. this.tableHeight = 'calc(100vh - 188px)'
  904. } else if (this.title === '缺陷24小时修复率') {
  905. this.tableHeight = 'calc(100vh - 328px)'
  906. } else {
  907. this.tableHeight = 'calc(100vh - 136px)'
  908. }
  909. if (this.headerTitle === '质量' && this.title.search(/新增缺陷|reopen/) < 0 && !this.drawerData.moduleName) {
  910. this.tableHeight = 'calc(100vh - 136px)'
  911. }
  912. if (this.headerTitle === '吞吐量') {
  913. this.tableHeight = 'calc(100vh - 288px)'
  914. }
  915. },
  916. // 设置表头
  917. // 表格跳转
  918. dmTableChange({ column, row }) {
  919. if (this.headerTitle === '质量' && this.drawerData.label === '新增问题') {
  920. const url = `http://odin.xiaojukeji.com/#/risk/starflower/casedetail?id=${row.id}&name=${row.title}`
  921. window.open(url, '_blank')
  922. } else if (this.drawerData.moduleName && this.drawerData.moduleName.search(/上线过程|回滚次数/) > -1) {
  923. const url = `http://odin.v5.intra.xiaojukeji.com/#/deploy/job/status/?jobId=${row.id}`
  924. window.open(url, '_blank')
  925. } else if (this.headerTitle === '质量' && this.drawerData.label.search(/^(提测报告|准出记录)/) > -1) {
  926. this.jumper(row, '报告')
  927. } else if (this.headerTitle === '吞吐量') {
  928. if (this.title.search(/需求/) > -1) {
  929. this.jumper(row, '需求')
  930. }
  931. if (this.title.search(/任务/) > -1) {
  932. this.jumper(row, '任务')
  933. }
  934. if (this.title.search(/项目/) > -1) {
  935. this.jumper(row, '项目')
  936. }
  937. } else if (this.headerTitle === '效率') {
  938. if (column.label.search(/需求/) > -1) {
  939. this.jumper(row, '需求')
  940. }
  941. if (column.label.search(/任务/) > -1) {
  942. this.jumper(row, '任务')
  943. }
  944. if (column.label.search(/缺陷/) > -1) {
  945. this.jumper(row, '缺陷')
  946. }
  947. } else {
  948. this.jumper(row, '缺陷')
  949. }
  950. },
  951. // 设置表格样式
  952. setBoxShadow(key = 'drawer-box') {
  953. if (key) {
  954. setTimeout(() => {
  955. this.drawerBox = key
  956. }, 300)
  957. } else {
  958. this.drawerBox = key
  959. }
  960. },
  961. // 设置时间轴自动滚动
  962. setTimeLine() {
  963. this.$nextTick(() => {
  964. if (this.isTimeLine(1)) {
  965. // Number(this.defaultKey) * 109 - 60
  966. // this.$refs.timeline1.scrollLeft = 100
  967. }
  968. if (this.isTimeLine(2)) {
  969. // Number(this.defaultKey2) * 100 - 60
  970. // this.$refs.timeline2.scrollLeft = 256
  971. }
  972. })
  973. },
  974. jumper(val, name) { // 需求、任务、缺陷跳转
  975. // const { bizId = null } = this.$store.state.global || {}
  976. const { bizId, id } = val
  977. const bizId_id = EncryptId(`${bizId}_${id}`)
  978. const newTab = this.$router.resolve({ name: name + '详情', query: { bizId_id: bizId_id }})
  979. window.open(newTab.href, '_blank')
  980. },
  981. // 设置时间轴自动滚动
  982. isTimeLine(index = 1) {
  983. // 是第一条
  984. if (index === 1) {
  985. if (this.headerTitle.search(/质量/) > -1 && this.title.search(/新增缺陷|reopen/) > -1) {
  986. return true
  987. }
  988. if (this.drawerData.moduleName && this.drawerData.moduleName === '上线过程') {
  989. return true
  990. }
  991. if (this.drawerData.moduleName && this.drawerData.moduleName === '回滚次数') {
  992. return true
  993. }
  994. return this.headerTitle.search(/吞吐量|效率/) > -1
  995. }
  996. // 是第二条
  997. if (index === 2) {
  998. return this.title.search(/缺陷24小时修复率/) > -1
  999. }
  1000. }
  1001. }
  1002. }
  1003. </script>
  1004. <style scoped lang='less'>
  1005. /deep/ .el-drawer__header {
  1006. color: #444;
  1007. font-size: 20px;
  1008. font-weight: 500;
  1009. margin-bottom: 0;
  1010. padding: 20px 30px;
  1011. border-bottom: 1px solid #E2E2E2;
  1012. .sub-title {
  1013. color: #444;
  1014. font-size: 14px;
  1015. margin-left: 20px;
  1016. font-weight: 400;
  1017. }
  1018. }
  1019. .drawer-box {
  1020. 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);
  1021. }
  1022. .el-drawer-fade-enter-active {
  1023. animation: el-drawer-fade-in 10ms;
  1024. }
  1025. .el-drawer-fade-leave-active {
  1026. animation: el-drawer-fade-in 10ms reverse;
  1027. }
  1028. .el-drawer__wrapper {
  1029. width: 100%;
  1030. position: fixed;
  1031. top: 0;
  1032. right: 0;
  1033. bottom: 0;
  1034. left: 50%;
  1035. overflow: hidden;
  1036. margin: 0;
  1037. }
  1038. /deep/.el-drawer__container {
  1039. left: 0;
  1040. right: 0;
  1041. width: 50%;
  1042. }
  1043. /* S 时间轴 */
  1044. .drawer-header {
  1045. text-align: center;
  1046. background: #F7F7F7;
  1047. border-radius: 4px;
  1048. min-height: 120px;
  1049. margin: 20px 30px 10px;
  1050. overflow: hidden;
  1051. }
  1052. .drawer-padding {
  1053. padding: 20px 0;
  1054. }
  1055. .drawer-padding-s {
  1056. padding: 1px 0;
  1057. }
  1058. .drawer-scll {
  1059. overflow-x: scroll;
  1060. }
  1061. .drawer-scll::-webkit-scrollbar { width: 0 !important; height: 0 !important }
  1062. .drawer-H {
  1063. font-size: 16px;
  1064. margin: 0 30px;
  1065. color: #444444;
  1066. }
  1067. .drawer-scll {
  1068. overflow-x: scroll;
  1069. }
  1070. .drawer-scll::-webkit-scrollbar { width: 0 !important; height: 0 !important }
  1071. .drawer-H {
  1072. font-size: 16px;
  1073. margin: 0 30px;
  1074. color: #444444;
  1075. }
  1076. /* E 时间轴 */
  1077. /* S 质量:线上问题_改进方案 */
  1078. .antdv3-tag{
  1079. box-sizing: border-box;
  1080. color: rgba(0,0,0,.65);
  1081. font-variant: tabular-nums;
  1082. list-style: none;
  1083. font-feature-settings: "tnum";
  1084. display: inline-block;
  1085. height: auto;
  1086. margin: 0 8px 0 0;
  1087. padding: 0 7px;
  1088. font-size: 12px;
  1089. line-height: 20px;
  1090. white-space: nowrap;
  1091. background: #fafafa;
  1092. border: 1px solid #d9d9d9;
  1093. border-radius: 2px;
  1094. cursor: default;
  1095. opacity: 1;
  1096. transition: all .3s cubic-bezier(.78,.14,.15,.86);
  1097. }
  1098. .antdv3-tag-orange {
  1099. color: #fa8c16;
  1100. background: #fff7e6;
  1101. border-color: #ffd591;
  1102. }
  1103. .antdv3-tag-green {
  1104. color: #52c41a;
  1105. background: #f6ffed;
  1106. border-color: #b7eb8f;
  1107. }
  1108. /* E 质量:线上问题_改进方案 */
  1109. .footer-laout {
  1110. display: flex;
  1111. justify-content: space-between;
  1112. margin: 0 30px;
  1113. //width: 100%;
  1114. //padding: 0 30px;
  1115. //.el-pagination{
  1116. // width: 100%;
  1117. //}
  1118. }
  1119. .drawer-name:hover {
  1120. color: #409eff;
  1121. cursor: pointer;
  1122. }
  1123. </style>