taskList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <div>
  3. <div class="table-top">
  4. <label>{{ name }}的任务</label>
  5. <span class="new-tab-open">
  6. <el-switch
  7. v-model="newTabOpen"
  8. active-text="新标签页跳转"
  9. />
  10. </span>
  11. </div>
  12. <el-row v-if="!showHeader" class="select-main" type="flex" align="center">
  13. <el-col :span="1" class="flex-align-center">
  14. <el-checkbox v-model="planChecked" class="plan-checked" @change="changeCheck" />
  15. </el-col>
  16. <el-col :span="3" class="item-checked">已选择<span style="color: #409EFF">{{ curcentChecked }}</span>个</el-col>
  17. <el-col :span="1" class="item-line">|</el-col>
  18. <el-col :span="2" class="item-click" @click.native="addSechedule()"><img :src="imgUrl">添加排期</el-col>
  19. <el-col :span="2" class="item-click" @click.native="handlePlan('test')"><img :src="imgUrl">提测</el-col>
  20. <el-col :span="2" class="item-click" @click.native="handlePlan('allow')"><img :src="imgUrl">准出</el-col>
  21. <el-col :span="4" class="item-click" @click.native="handlePlan('daily')"><img :src="imgUrl">建立测试日报</el-col>
  22. <el-col :span="4" class="item-click" @click.native="handlePlan('cancel')">取消选择</el-col>
  23. </el-row>
  24. <el-table
  25. ref="planTable"
  26. :data="all_task"
  27. style="width: 100%;"
  28. size="mini"
  29. row-key="id"
  30. :header-cell-style="{ color: 'rgb(74, 74, 74)', fontSize: '14px', fontWeight: '500'}"
  31. :row-style="{ fontSize: '14px' }"
  32. show-overflow-tooltip="true"
  33. :show-header="showHeader"
  34. :header-row-style="{height: '50px'}"
  35. @selection-change="handleSelectionChange"
  36. >
  37. <el-table-column type="selection" width="55" align="center" />
  38. <el-table-column label="优先级" prop="priority" width="90" sortable align="center">
  39. <template slot-scope="scope" style="text-align: center;">
  40. <span class="div_priority" :class="scope.row.priorityString">
  41. {{ scope.row.priorityString }}
  42. </span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="任务名称" min-width="250" align="left" show-overflow-tooltip>
  46. <template slot-scope="scope">
  47. <div class="task-main">
  48. <span class="task-id">TASK-{{ scope.row.id }}
  49. <span
  50. v-if="scope.row.tagNotification !== null"
  51. :class="{
  52. 'tagNotification': scope.row.tagType === 0,
  53. 'tagNotification1': scope.row.tagType === 1
  54. }"
  55. >
  56. {{ scope.row.tagNotification }}
  57. </span>
  58. </span>
  59. <span class="task-title" @click="link_task(scope.row.id)">{{ scope.row.name }}</span>
  60. </div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="状态" width="150" align="center">
  64. <template slot-scope="scope">
  65. <el-select
  66. v-model="scope.row.status"
  67. :class="{
  68. 'status0':scope.row.status===0,
  69. 'status1':scope.row.status > 0 && scope.row.status <100,
  70. 'status2':scope.row.status===100,
  71. 'public_btn':scope.row.status!==10 || scope.row.status!==40 || scope.row.status!==20 || scope.row.status!==30,
  72. 'public_btn1':scope.row.status===40,
  73. 'public_btn2':scope.row.status===10,
  74. 'public_btn3':scope.row.status===20 || scope.row.status===30
  75. }"
  76. size="mini"
  77. @change="changeStatus(scope.row)"
  78. >
  79. <el-option v-for="item in scope.row.availableStatusList" :key="item.code" :label="item.name" :value="item.code" />
  80. </el-select>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="开发负责人" width="100" align="center" show-overflow-tooltip>
  84. <template slot-scope="scope">{{ scope.row.rdObject ? scope.row.rdObject.name : '' }}</template>
  85. </el-table-column>
  86. <el-table-column label="测试负责人" width="100" align="center" show-overflow-tooltip>
  87. <template slot-scope="scope">{{ scope.row.qaObject ? scope.row.qaObject.name : '' }}</template>
  88. </el-table-column>
  89. <el-table-column label="交付日期" width="150" align="center" show-overflow-tooltip>
  90. <template slot-scope="scope">{{ scope.row.optionsObject ? scope.row.optionsObject.endTime : '' }}</template>
  91. </el-table-column>
  92. <el-table-column label="所属模块" width="200" align="center" show-overflow-tooltip>
  93. <template slot-scope="scope">{{ scope.row.moduleInfoName }}</template>
  94. </el-table-column>
  95. <el-table-column label="跟版客户端" width="150" align="center" show-overflow-tooltip>
  96. <template slot-scope="scope">{{ scope.row.involveAppString || '无' }}</template>
  97. </el-table-column>
  98. <el-table-column label="缺陷数量" width="100" align="center" show-overflow-tooltip>
  99. <template slot-scope="scope">{{ scope.row.bugCount }}</template>
  100. </el-table-column>
  101. <el-table-column label="任务进度" width="150" align="center">
  102. <template slot-scope="scope">
  103. <el-progress :percentage="Number(scope.row.rate && scope.row.rate.substring(0,4))" color="#409eff" />
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <div align="right">
  108. <el-pagination
  109. :page-sizes="[15, 30, 45, total]"
  110. :current-page.sync="pages.curIndex"
  111. :page-size="pages.pageSize"
  112. background
  113. layout="total, sizes, prev, pager, next, jumper"
  114. :total="total"
  115. @size-change="handleSizeChange"
  116. @current-change="handleCurrentChange"
  117. />
  118. </div>
  119. <TestReport v-if="dialogTestReport" ref="TestReport" />
  120. <DailyReport v-if="dialogDailyReport" ref="DailyReport" />
  121. <ReleaseReport v-if="dialogClientReport" ref="ClientReport" />
  122. <task-dialog v-if="showTaskDialog" :show.sync="showTaskDialog" :task-id="taskId.id" :status-name="taskId.statusString" @getList="getNew" />
  123. <!-- 批量排期 -->
  124. <modify-schedule
  125. v-if="visibleSchedule"
  126. :visible.sync="visibleSchedule"
  127. :select-task-list="selectTaskList"
  128. title="新建排期"
  129. @update="get_allTask()"
  130. />
  131. </div>
  132. </template>
  133. <script>
  134. import imgUrl from '@/assets/建立档案@2x.png'
  135. import '@/styles/PublicStyle/index.scss'
  136. import TestReport from '@/views/reportManagement/components/TestingReport' // 提测
  137. import DailyReport from '@/views/reportManagement/components/DailyReport' // 日报
  138. import ReleaseReport from '@/views/reportManagement/components/ReleaseReport' // 准出
  139. import { taskUpdate } from '@/api/projectViewDetails'
  140. import { configShowTaskEnum, configShowTaskStatusEnum, taskList } from '@/api/taskIndex'
  141. import modifySchedule from '@/views/projectManage/projectList/components/modifySchedule'
  142. import taskDialog from '@/views/projectManage/taskList/dialog/taskDialog' // 任务状态修改(已上线/已提测/已准出)
  143. import { dailyReportCheckStatus, reportreleaseCheckStatus, reportdelivertestCheckStatus } from '@/api/reportTemplate'
  144. export default {
  145. components: {
  146. TestReport,
  147. DailyReport,
  148. ReleaseReport,
  149. taskDialog,
  150. modifySchedule
  151. },
  152. props: {
  153. idList: {
  154. type: Array,
  155. default: () => [],
  156. required: true
  157. },
  158. name: {
  159. type: String,
  160. default: '',
  161. required: false
  162. }
  163. },
  164. data() {
  165. return {
  166. newTabOpen: true, // 是否新的tab页打开
  167. imgUrl: imgUrl,
  168. tableList: [], // 排期bable验证
  169. showTaskDialog: false, // 状态弹窗
  170. all_task: [], // 任务列表
  171. allStatus: [], // 任务所有状态
  172. taskScheduleEvent: [], // 排期类型
  173. showHeader: true, // 任务列表的表头是否显示
  174. curcentList: [], // 当前已选择的列表
  175. curcentChecked: 0, // 当前已选择的数量
  176. planChecked: false,
  177. planHandleType: '', // 任务列表操作类型
  178. dialogTestReport: false, // 提测
  179. dialogDailyReport: false, // 日报
  180. dialogClientReport: false, // 准出
  181. changeStatusDate: null, // 状态改变时间
  182. nowChangeTask: null, // 当前正在改变的任务对象
  183. taskId: '', // 将要修改状态的任务id
  184. visibleSchedule: false, // 排期弹框
  185. selectTaskList: [], // 已选任务的id
  186. total: 0,
  187. status: null, // 列表状态
  188. pages: {
  189. pageSize: 15,
  190. curIndex: 1
  191. }
  192. }
  193. },
  194. watch: {
  195. idList: {
  196. handler(newV) {
  197. this.get_allTask()
  198. },
  199. deep: true
  200. },
  201. name: {
  202. handler(newV) {},
  203. immediate: true
  204. }
  205. },
  206. created() {
  207. this.getTaskStatus()
  208. },
  209. methods: {
  210. setStatus(val) {
  211. this.status = val
  212. this.pages.curIndex = 1
  213. this.get_allTask()
  214. },
  215. handleSizeChange(val) {
  216. this.pageSize = val
  217. this.get_allTask()
  218. },
  219. handleCurrentChange(val) {
  220. this.curIndex = val
  221. this.get_allTask()
  222. },
  223. async get_allTask() { // 获取全部任务
  224. if (this.idList.length === 0) {
  225. this.all_task = []
  226. return
  227. }
  228. const res = await taskList({ ids: this.idList, ...this.pages })
  229. if (res && res.code === 200) {
  230. this.all_task = res.data
  231. this.total = res.total
  232. }
  233. },
  234. async getTaskStatus() { // 获取任务状态列表
  235. const res = await configShowTaskEnum()
  236. if (res.code === 200) {
  237. this.taskScheduleEvent = res.data.taskScheduleEvent || []
  238. }
  239. const res1 = await configShowTaskStatusEnum(localStorage.getItem('bizId'))
  240. if (res1.code === 200) {
  241. this.allStatus = res1.data.taskStatus
  242. }
  243. },
  244. changeCheck(val) {
  245. if (val) {
  246. this.all_task.forEach(row => {
  247. this.$refs.planTable.toggleRowSelection(row, true)
  248. })
  249. } else {
  250. this.$refs.planTable.clearSelection()
  251. }
  252. },
  253. async changeStatus(e) { // 状态改变
  254. if (e.status === 70 || e.status === 90 || e.status === 100) {
  255. this.taskId = e
  256. this.allStatus.map(item => {
  257. item.code === e.status ? this.taskId.statusString = item.msg : ''
  258. })
  259. this.showTaskDialog = true
  260. this.nowChangeTask = e
  261. return
  262. } else {
  263. const user = {
  264. name: localStorage.getItem('username'),
  265. ename: localStorage.getItem('realname'),
  266. id: ''
  267. }
  268. const taskInfoDO = e
  269. const resTask = await taskUpdate({ taskInfoDO, user })
  270. if (resTask.code === 200) {
  271. this.$message({ message: '修改成功', type: 'success', offset: 150 })
  272. // this.get_allTask()
  273. this.$emit('change', '任务')// 通知父组件,让父组件去执行子组件的数据更新
  274. }
  275. }
  276. },
  277. getNew() { // 状态改变成功回调
  278. this.$emit('change', '任务')// 通知父组件,让父组件去执行子组件的数据更新
  279. },
  280. handleSelectionChange(val) { // 任务列表删选操作
  281. this.tableList = []
  282. this.tableList = val
  283. val.length > 0 ? this.showHeader = false : this.showHeader = true
  284. this.curcentChecked = val.length
  285. this.curcentList = val
  286. if (val.length === this.all_task.length) {
  287. this.planChecked = true
  288. }
  289. },
  290. handlePlan(type) { // 任务列表操作
  291. this.planHandleType = type
  292. switch (type) {
  293. case 'test':
  294. this.filtrateTest()
  295. break
  296. case 'allow':
  297. this.filtrateAllow()
  298. break
  299. case 'daily':
  300. this.filtrateDaily()
  301. break
  302. case 'cancel':
  303. this.$refs.planTable.clearSelection()
  304. break
  305. }
  306. },
  307. addSechedule() { // 添加排期
  308. const taskA = []
  309. this.tableList.map(item => {
  310. if (item.isScheduleLocked === 1) {
  311. taskA.push(item.taskIdSting)
  312. }
  313. })
  314. if (taskA.length !== 0) {
  315. this.$message({ message: '任务 ' + taskA + ' 的排期已锁定,请先解锁排期后再添加排期', type: 'warning', offset: 150 })
  316. return
  317. }
  318. this.visibleSchedule = true
  319. this.selectTaskList = this.curcentList
  320. },
  321. async filtrateTest() { // 提测筛选
  322. const data = this.curcentList.map(item => { return item.id })
  323. const res = await reportdelivertestCheckStatus(data)
  324. if (res.code === 200) {
  325. this.dialogTestReport = true
  326. this.$nextTick(() => {
  327. this.$refs.TestReport.init(7, this.curcentList.map(item => { return item.id }))
  328. })
  329. }
  330. },
  331. async filtrateAllow() { // 准出筛选
  332. const data = this.curcentList.map(item => { return item.id })
  333. const res = await reportreleaseCheckStatus(data)
  334. if (res.code === 200) {
  335. this.dialogClientReport = true
  336. this.$nextTick(() => {
  337. this.$refs.ClientReport.init(7, this.curcentList.map(item => { return item.id }))
  338. })
  339. }
  340. },
  341. async filtrateDaily() { // 建立日报
  342. const data = this.curcentList.map(item => { return item.id })
  343. const res = await dailyReportCheckStatus(data)
  344. if (res.code === 200) {
  345. this.dialogDailyReport = true
  346. this.$nextTick(() => {
  347. this.$refs.DailyReport.init(7, this.curcentList.map(item => { return item.id }))
  348. })
  349. }
  350. },
  351. link_task(id) { // 跳转到任务详情页
  352. if (this.newTabOpen) {
  353. const newTab = this.$router.resolve({ name: '任务详情', query: { id: id }})
  354. window.open(newTab.href, '_blank')
  355. } else {
  356. this.$router.push({ name: '任务详情', query: { id: id }})
  357. }
  358. }
  359. }
  360. }
  361. </script>
  362. <style scoped>
  363. .tagNotification {
  364. background: rgba(255,137,82,15%);
  365. color: #FF8952;
  366. padding: 0 5px;
  367. border-radius: 8px;
  368. margin-left: 10px;
  369. }
  370. .tagNotification1 {
  371. background: rgba(245,108,108,17%);
  372. color: #F56C6C;
  373. padding: 0 5px;
  374. border-radius: 8px;
  375. margin-left: 10px;
  376. }
  377. </style>
  378. <style lang="scss" scoped>
  379. @mixin setStatus($color) {
  380. input {
  381. color:$color;
  382. border: 1px solid $color;
  383. }
  384. >>> .el-select__caret{
  385. color:$color;
  386. }
  387. >>> .el-input__inner{
  388. color:$color;
  389. border-color: $color;
  390. }
  391. >>> .el-input__inner:focus {
  392. border-color: $color;
  393. }
  394. }
  395. >>>.el-row .el-col {
  396. margin: 10px 0;
  397. }
  398. .table-top {
  399. color: #333333;
  400. font-size: 16px;
  401. width: 100%;
  402. padding: 10px 15px 0 15px;
  403. display: flex;
  404. justify-content: space-between;
  405. }
  406. .task-main {
  407. display: flex;
  408. flex-direction: column;
  409. .task-title {
  410. cursor: pointer;
  411. color: #666666;
  412. font-size: 14px;
  413. overflow: hidden;
  414. white-space: nowrap;
  415. text-overflow: ellipsis;
  416. }
  417. .task-id {
  418. color: #A7AEBC;
  419. font-size: 10px;
  420. }
  421. }
  422. .color-blue {
  423. color:#409EFF;
  424. }
  425. .P0 {
  426. background-color: #F56C6C;
  427. }
  428. .P1 {
  429. background-color: #FF8952;
  430. }
  431. .P2 {
  432. background-color: #F5E300;
  433. }
  434. .P3 {
  435. background-color: #7ED321;
  436. }
  437. .P4 {
  438. background-color: #61D3B8;
  439. }
  440. .P5 {
  441. background-color: #69B3FF;
  442. }
  443. .P6 {
  444. background-color: #BDBDBD;
  445. }
  446. .status0 {
  447. @include setStatus(#409EFF)
  448. }
  449. .status1{
  450. @include setStatus(#FF8952)
  451. }
  452. .status2 {
  453. @include setStatus(#7ED321)
  454. }
  455. .expand i {
  456. border:1px solid #DCDFE6;
  457. }
  458. >>>.el-table__expand-icon{
  459. font-size: 14px;
  460. .el-icon{
  461. margin: 0;
  462. transform: translate(-50%, -50%);
  463. border:1px solid #DCDFE6;
  464. }
  465. }
  466. >>>.el-table__expand-icon .el-icon-arrow-right::before{
  467. content: "\E6D9";
  468. }
  469. >>>.el-table__expand-icon--expanded .el-icon-arrow-right::before{
  470. content: "\E6D8";
  471. }
  472. >>>.el-table__expand-icon--expanded {
  473. transform: rotate(180deg);
  474. }
  475. >>>.el-table__expanded-cell {
  476. background-color: #FFFFFF;
  477. padding: 0;
  478. }
  479. >>>.el-table__expanded-cell:hover {
  480. background-color: #FFFFFF !important;
  481. }
  482. .div_priority {
  483. text-align: center;
  484. color: #ffffff;
  485. padding: inherit;
  486. border-radius: 4px;
  487. width: 40px;
  488. display: inline-block;
  489. }
  490. .plan-checked {
  491. padding-left: 21px;
  492. }
  493. .select-main {
  494. height: 50px;
  495. border-bottom: 1px solid #DCDFE6;
  496. .flex-align-center {
  497. display: flex;
  498. align-items: center;
  499. }
  500. .item-checked {
  501. width: auto;
  502. margin-right: 28px;
  503. color: #606266;
  504. font-size: 14px;
  505. display: flex;
  506. align-items: center;
  507. justify-content: left;
  508. cursor: pointer;
  509. }
  510. .item-click,.item-line{
  511. margin: 0;
  512. width: auto;
  513. color: #666666;
  514. font-size: 14px;
  515. display: flex;
  516. align-items: center;
  517. cursor: pointer;
  518. margin-right: 28px;
  519. img {
  520. height: 13.5px;
  521. widows: 13.5px;
  522. margin-right: 5px;
  523. }
  524. }
  525. .item-line {
  526. color:rgba(102,102,102,0.6);
  527. }
  528. .cancel {
  529. position: absolute;
  530. right: 0;
  531. top: 50%;
  532. transform: translateY(-50%);
  533. }
  534. }
  535. .descr {
  536. display: flex;
  537. justify-content: flex-start;
  538. }
  539. .planList >>> .el-table th>.cell {
  540. padding-left: 14px;
  541. padding-right: 14px;
  542. }
  543. .dialog-change-status {
  544. margin: 2% 3%;
  545. display: flex;
  546. justify-content: space-between;
  547. align-items: center;
  548. white-space:nowrap;
  549. }
  550. </style>
  551. <style lang="scss">
  552. .btns .el-input--suffix .el-input__inner {
  553. padding-right: 10px;
  554. padding-left: 10px;
  555. width: 73px;
  556. }
  557. .item{
  558. /deep/ input {
  559. color: rgb(126, 211, 33);
  560. border: 1px solid rgb(126, 211, 33);
  561. border-color: rgb(126, 211, 33) !important;
  562. font-weight: 900;
  563. }
  564. /deep/ .el-input__suffix {
  565. color: rgb(126, 211, 33) !important;
  566. right: 1px;
  567. }
  568. /deep/ .el-select__caret {
  569. color: rgb(126, 211, 33) !important;
  570. }
  571. }
  572. .item1 {
  573. /deep/ input {
  574. color: rgb(255, 204, 102);
  575. border: 1px solid rgb(255, 204, 102);
  576. border-color: rgb(255, 204, 102) !important;
  577. font-weight: 900;
  578. }
  579. /deep/ .el-input__suffix {
  580. color: rgb(255, 204, 102) !important;
  581. right: 1px;
  582. }
  583. /deep/ .el-select__caret {
  584. color: rgb(255, 204, 102) !important;
  585. }
  586. }
  587. .item2 {
  588. /deep/ input {
  589. color: rgb(245, 108, 108);
  590. border: 1px solid rgb(245, 108, 108);
  591. border-color: rgb(245, 108, 108) !important;
  592. font-weight: 900;
  593. }
  594. /deep/ .el-input__suffix {
  595. color: rgb(245, 108, 108) !important;
  596. right: 1px;
  597. }
  598. /deep/ .el-select__caret {
  599. color: rgb(245, 108, 108) !important;
  600. }
  601. }
  602. .item3 {
  603. /deep/ input {
  604. color: #D675F0;
  605. border: 1px solid #D675F0;
  606. border-color: #D675F0 !important;
  607. font-weight: 900;
  608. }
  609. /deep/ .el-input__suffix {
  610. color: #D675F0 !important;
  611. right: 1px;
  612. }
  613. /deep/ .el-select__caret {
  614. color: #D675F0 !important;
  615. }
  616. }
  617. .item-color {
  618. /deep/ input {
  619. color: rgb(106, 180, 255);
  620. border: 1px solid rgb(106, 180, 255);
  621. border-color: rgb(106, 180, 255) !important;
  622. font-weight: 900;
  623. }
  624. /deep/ .el-input__suffix {
  625. color: rgb(106, 180, 255) !important;
  626. right: 1px;
  627. }
  628. /deep/ .el-select__caret {
  629. color: rgb(106, 180, 255) !important;
  630. }
  631. }
  632. </style>