index.vue 37 KB

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