index.vue 37 KB

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