taskList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <div>
  3. <el-row v-if="!showHeader" class="select-main" type="flex" align="center">
  4. <el-col :span="2" class="flex-align-center">
  5. <el-checkbox v-model="planChecked" class="plan-checked" @change="changeCheck" />
  6. </el-col>
  7. <el-col :span="3" class="item-checked">已选择<span style="color: #409EFF">{{ curcentChecked }}</span>个</el-col>
  8. <el-col :span="1" class="item-click">|</el-col>
  9. <el-col :span="2" class="item-click click-blue" @click.native="handlePlan('test')">提测</el-col>
  10. <el-col :span="2" class="item-click click-blue" @click.native="handlePlan('allow')">准出</el-col>
  11. <el-col :span="4" class="item-click click-blue" @click.native="handlePlan('daily')">建立测试日报</el-col>
  12. <el-col :span="4" class="item-click" @click.native="handlePlan('cancel')">取消选择</el-col>
  13. </el-row>
  14. <el-table
  15. ref="planTable"
  16. :data="all_task"
  17. style="width: 100%;"
  18. size="mini"
  19. row-key="id"
  20. :expand-row-keys="expandArr"
  21. :header-cell-style="{ color: 'rgb(74, 74, 74)', fontSize: '14px', fontWeight: '500', textAlign: 'center' }"
  22. show-overflow-tooltip="true"
  23. :show-header="showHeader"
  24. :header-row-style="{height: '50px'}"
  25. @selection-change="handleSelectionChange"
  26. >
  27. <el-table-column type="selection" width="55" align="center" />
  28. <el-table-column type="expand" width="40">
  29. <template slot="header">
  30. <div class="expand"><i v-show="!allChange" class="el-icon-plus" @click="expandAll(true)" /></div>
  31. <div class="expand"><i v-show="allChange" class="el-icon-minus" @click="expandAll(false)" /></div>
  32. </template>
  33. <template slot-scope="props">
  34. <schedule-list :id="props.row.id" :type-list="taskScheduleEvent" />
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="优先级" prop="priority" width="90" sortable align="center">
  38. <template slot-scope="scope" style="text-align: center;">
  39. <span class="div_priority" :class="scope.row.priorityString">
  40. {{ scope.row.priorityString }}
  41. </span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="任务名称" width="200" align="center" show-overflow-tooltip>
  45. <template slot-scope="scope"><span class="task-title" @click="link_task(scope.row.id)">{{ scope.row.name }}</span></template>
  46. </el-table-column>
  47. <el-table-column label="所属模块" width="150" align="center" show-overflow-tooltip>
  48. <template slot-scope="scope">{{ scope.row.moduleInfoName }}</template>
  49. </el-table-column>
  50. <el-table-column label="状态" width="105" align="center">
  51. <template slot-scope="scope">
  52. <el-select
  53. v-model="scope.row.status"
  54. :class="{
  55. 'status_color': scope.row.status === 0,
  56. 'status_color1': scope.row.status === 1,
  57. 'status_color4': scope.row.status === 3,
  58. 'status_color6': scope.row.status === 2,
  59. 'status_color7': scope.row.status === 4,
  60. 'status_color2': scope.row.status === 5
  61. }"
  62. class="btns"
  63. size="mini"
  64. @change="changeStatus(scope.row)"
  65. >
  66. <el-option v-for="item in allStatus" :key="item.code" :label="item.msg" :value="item.code" />
  67. </el-select>
  68. </template>
  69. </el-table-column>
  70. <el-table-column label="所属需求" width="200" align="center" show-overflow-tooltip>
  71. <template slot-scope="scope">{{ scope.row.requireName }}</template>
  72. </el-table-column>
  73. <el-table-column label="跟版客户端" width="120" align="center" show-overflow-tooltip>
  74. <template slot-scope="scope">{{ scope.row.app }}</template>
  75. </el-table-column>
  76. <el-table-column label="开发负责人" width="100" align="center" show-overflow-tooltip>
  77. <template slot-scope="scope">{{ scope.row.rdObject ? scope.row.rdObject.name : '' }}</template>
  78. </el-table-column>
  79. <el-table-column label="测试负责人" width="100" align="center" show-overflow-tooltip>
  80. <template slot-scope="scope">{{ scope.row.qaObject ? scope.row.qaObject.name : '' }}</template>
  81. </el-table-column>
  82. <el-table-column label="任务进度" min-width="150" align="center">
  83. <template slot-scope="scope">
  84. <el-progress :percentage="Number(scope.row.rate && scope.row.rate.substring(0,4))" color="#409eff" />
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <TestReport v-if="dialogTestReport" ref="TestReport" />
  89. <DailyReport v-if="dialogDailyReport" ref="DailyReport" />
  90. <ClientReport v-if="dialogClientReport" ref="ClientReport" />
  91. <taskDialog v-if="showTaskDialog" :show.sync="showTaskDialog" :task-id="taskId.id" :status-name="taskId.statusString" @getList="get_allTask" />
  92. <normal-dialog :show-dialog.sync="statusDialog" :title="'状态变更:已上线'" :width="'50%'" @confirm="confirmStatus()">
  93. <div class="dialog-change-status">
  94. <span>实际上线时间:</span>
  95. <el-date-picker v-model="changeStatusDate" type="date" style="width:100%;" placeholder="选择日期" format="yyyy-MM-dd HH:mm:ss" />
  96. </div>
  97. </normal-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import '@/styles/PublicStyle/index.scss'
  102. import TestReport from '@/views/Platform/presentation/Templates/TestReport' // 提测
  103. import DailyReport from '@/views/Platform/presentation/Templates/DailyReport' // 日报
  104. import ClientReport from '@/views/Platform/presentation/Templates/ClientReport' // 准出
  105. import { taskList } from '@/api/projectIndex'
  106. import { taskUpdate } from '@/api/projectViewDetails'
  107. import { configShowTaskEnum } from '@/api/taskIndex'
  108. import scheduleList from './scheduleList'
  109. import normalDialog from '@/components/dialog/normalDialog'
  110. import taskDialog from '@/views/projectManage/taskList/dialog/taskDialog' // 任务状态修改(已上线/已提测/已准出)
  111. export default {
  112. components: {
  113. normalDialog,
  114. TestReport,
  115. DailyReport,
  116. ClientReport,
  117. scheduleList,
  118. taskDialog
  119. },
  120. data() {
  121. return {
  122. changeData: new Map(),
  123. allChange: false, // 是否全展开
  124. expandArr: [], // 展开行数组
  125. showTaskDialog: false, // 状态弹窗
  126. inputValue: '',
  127. all_task: [], // 任务列表
  128. allStatus: [], // 任务所有状态
  129. taskScheduleEvent: [], // 排期类型
  130. showHeader: true, // 任务列表的表头是否显示
  131. curcentList: [], // 当前已选择的列表
  132. curcentChecked: 0, // 当前已选择的数量
  133. planChecked: false,
  134. planHandleType: '', // 任务列表操作类型
  135. dialogTestReport: false, // 提测
  136. dialogDailyReport: false, // 日报
  137. dialogClientReport: false, // 准出
  138. statusDialog: false, // 修改状态弹框
  139. changeStatusDate: null, // 状态改变时间
  140. nowChangeTask: null, // 当前正在改变的任务对象
  141. taskId: '' // 将要修改状态的任务id
  142. }
  143. },
  144. watch: {
  145. value: {
  146. handler(newV, oldV) {
  147. this.inputValue = newV
  148. },
  149. immediate: true
  150. }
  151. },
  152. created() {
  153. this.getTaskStatus()
  154. this.get_allTask()
  155. },
  156. methods: {
  157. async get_allTask() { // 获取全部任务
  158. const res = await taskList({
  159. projectId: this.$route.query.id
  160. })
  161. if (res.code === 200) {
  162. this.all_task = res.data
  163. // for (const [key, value] of Object.entries(res.data[0])) {
  164. // console.log(`${key}: ${value}`)
  165. // }
  166. }
  167. },
  168. async getTaskStatus() { // 获取任务状态列表
  169. const res = await configShowTaskEnum()
  170. if (res.code === 200) {
  171. this.allStatus = res.data.taskStatus
  172. this.taskScheduleEvent = res.data.taskScheduleEvent || []
  173. }
  174. },
  175. changeCheck(val) {
  176. if (val) {
  177. this.all_task.forEach(row => {
  178. this.$refs.planTable.toggleRowSelection(row, true)
  179. })
  180. } else {
  181. this.$refs.planTable.clearSelection()
  182. }
  183. },
  184. expandAll(isEx) { // 全部展开
  185. this.allChange = isEx
  186. isEx ? this.expandArr = this.all_task.map(item => item.id) : this.expandArr = []
  187. },
  188. async changeStatus(e) { // 状态改变
  189. alert(e)
  190. if (e.status === 2 || e.status === 4 || e.status === 5) {
  191. this.taskId = e
  192. this.allStatus.map(item => {
  193. item.code === e.status ? this.taskId.statusString = item.msg : ''
  194. })
  195. this.showTaskDialog = true
  196. this.nowChangeTask = e
  197. return
  198. } else {
  199. const user = {
  200. name: localStorage.getItem('username'),
  201. ename: localStorage.getItem('realname'),
  202. id: ''
  203. }
  204. const taskInfoDO = e
  205. const resTask = await taskUpdate({ taskInfoDO, user })
  206. if (resTask.code === 200) {
  207. this.$message({ message: resTask.msg, type: 'success', offset: 150 })
  208. }
  209. }
  210. },
  211. // async confirmStatus() { // 确认更改状态
  212. // const user = { name: localStorage.getItem('username'), ename: localStorage.getItem('realname'), id: '' }
  213. // const taskInfoDO = this.nowChangeTask
  214. // taskInfoDO.onlineRealTime = this.changeStatusDate
  215. // const resTask = await taskUpdate({ taskInfoDO, user })
  216. // if (resTask.code === 200) {
  217. // this.$message({ message: resTask.msg, type: 'success', offset: 150 })
  218. // }
  219. // },
  220. handleSelectionChange(val) { // 任务列表删选操作
  221. val.length > 0 ? this.showHeader = false : this.showHeader = true
  222. this.curcentChecked = val.length
  223. this.curcentList = val
  224. if (val.length === this.all_task.length) {
  225. this.planChecked = true
  226. }
  227. },
  228. handlePlan(type) { // 任务列表操作
  229. this.planHandleType = type
  230. switch (type) {
  231. case 'test':
  232. this.filtrateTest()
  233. break
  234. case 'allow':
  235. this.filtrateAllow()
  236. break
  237. case 'daily':
  238. this.filtrateDaily()
  239. break
  240. case 'cancel':
  241. this.$refs.planTable.clearSelection()
  242. break
  243. }
  244. },
  245. filtrateTest() { // 提测筛选
  246. this.dialogTestReport = true
  247. this.$nextTick(() => {
  248. this.$refs.TestReport.init(7, this.curcentList.map(item => { return item.id }))
  249. })
  250. },
  251. filtrateAllow() { // 准出筛选
  252. this.dialogClientReport = true
  253. this.$nextTick(() => {
  254. this.$refs.ClientReport.init(7, this.curcentList.map(item => { return item.id }))
  255. })
  256. },
  257. filtrateDaily() { // 建立日报
  258. this.dialogDailyReport = true
  259. this.$nextTick(() => {
  260. this.$refs.DailyReport.init(7, this.curcentList.map(item => { return item.id }))
  261. })
  262. },
  263. link_task(id) { // 跳转到任务详情页
  264. this.$router.push({ name: '任务详情', query: { id: id }})
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="scss" scoped>
  270. @mixin setStatus($color) {
  271. input {
  272. color:$color;
  273. border: 1px solid $color;
  274. }
  275. >>> .el-select__caret{
  276. color:$color;
  277. }
  278. >>> .el-input__inner{
  279. color:$color;
  280. border-color: $color;
  281. }
  282. >>> .el-input__inner:focus {
  283. border-color: $color;
  284. }
  285. }
  286. >>>.el-row .el-col {
  287. margin: 10px 0;
  288. }
  289. .task-title {
  290. cursor: pointer;
  291. }
  292. .P0 {
  293. background-color: #F56C6C;
  294. }
  295. .P1 {
  296. background-color: #FF8952;
  297. }
  298. .P2 {
  299. background-color: #F5E300;
  300. }
  301. .P3 {
  302. background-color: #7ED321;
  303. }
  304. .P4 {
  305. background-color: #61D3B8;
  306. }
  307. .P5 {
  308. background-color: #69B3FF;
  309. }
  310. .P6 {
  311. background-color: #BDBDBD;
  312. }
  313. .status0 {
  314. @include setStatus(#409EFF)
  315. }
  316. .status1 {
  317. @include setStatus(#FF8952)
  318. }
  319. .status3 {
  320. @include setStatus(#13C2C2)
  321. }
  322. .status5 {
  323. @include setStatus(#7ED321)
  324. }
  325. .expand i {
  326. border:1px solid #DCDFE6;
  327. }
  328. >>>.el-table__expand-icon{
  329. font-size: 14px;
  330. .el-icon{
  331. margin: 0;
  332. transform: translate(-50%, -50%);
  333. border:1px solid #DCDFE6;
  334. }
  335. }
  336. >>>.el-table__expand-icon .el-icon-arrow-right::before{
  337. content: "\E6D9";
  338. }
  339. >>>.el-table__expand-icon--expanded .el-icon-arrow-right::before{
  340. content: "\E6D8";
  341. }
  342. >>>.el-table__expand-icon--expanded {
  343. transform: rotate(180deg);
  344. }
  345. >>>.el-table__expanded-cell {
  346. background-color: #FFFFFF;
  347. padding: 0;
  348. }
  349. >>>.el-table__expanded-cell:hover {
  350. background-color: #FFFFFF !important;
  351. }
  352. .div_priority {
  353. text-align: center;
  354. color: #ffffff;
  355. padding: inherit;
  356. border-radius: 4px;
  357. width: 40px;
  358. display: inline-block;
  359. }
  360. .plan-checked {
  361. padding-left: 21px;
  362. }
  363. .select-main {
  364. height: 50px;
  365. border-bottom: 1px solid #DCDFE6;
  366. .flex-align-center {
  367. display: flex;
  368. align-items: center;
  369. }
  370. .item-checked {
  371. color: #606266;
  372. font-size: 14px;
  373. display: flex;
  374. align-items: center;
  375. justify-content: left;
  376. cursor: pointer;
  377. }
  378. .item-click{
  379. color: #606266;
  380. font-size: 14px;
  381. display: flex;
  382. align-items: center;
  383. justify-content: center;
  384. cursor: pointer;
  385. }
  386. .click-blue {
  387. color: #409EFF;
  388. }
  389. }
  390. .descr {
  391. display: flex;
  392. justify-content: flex-start;
  393. }
  394. .planList >>> .el-table th>.cell {
  395. padding-left: 14px;
  396. padding-right: 14px;
  397. }
  398. .dialog-change-status {
  399. margin: 2% 3%;
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. white-space:nowrap;
  404. }
  405. </style>
  406. <style lang="scss">
  407. .btns .el-input--suffix .el-input__inner {
  408. padding-right: 10px;
  409. padding-left: 10px;
  410. width: 73px;
  411. }
  412. .item{
  413. /deep/ input {
  414. color: rgb(126, 211, 33);
  415. border: 1px solid rgb(126, 211, 33);
  416. border-color: rgb(126, 211, 33) !important;
  417. font-weight: 900;
  418. }
  419. /deep/ .el-input__suffix {
  420. color: rgb(126, 211, 33) !important;
  421. right: 1px;
  422. }
  423. /deep/ .el-select__caret {
  424. color: rgb(126, 211, 33) !important;
  425. }
  426. }
  427. .item1 {
  428. /deep/ input {
  429. color: rgb(255, 204, 102);
  430. border: 1px solid rgb(255, 204, 102);
  431. border-color: rgb(255, 204, 102) !important;
  432. font-weight: 900;
  433. }
  434. /deep/ .el-input__suffix {
  435. color: rgb(255, 204, 102) !important;
  436. right: 1px;
  437. }
  438. /deep/ .el-select__caret {
  439. color: rgb(255, 204, 102) !important;
  440. }
  441. }
  442. .item2 {
  443. /deep/ input {
  444. color: rgb(245, 108, 108);
  445. border: 1px solid rgb(245, 108, 108);
  446. border-color: rgb(245, 108, 108) !important;
  447. font-weight: 900;
  448. }
  449. /deep/ .el-input__suffix {
  450. color: rgb(245, 108, 108) !important;
  451. right: 1px;
  452. }
  453. /deep/ .el-select__caret {
  454. color: rgb(245, 108, 108) !important;
  455. }
  456. }
  457. .item3 {
  458. /deep/ input {
  459. color: #D675F0;
  460. border: 1px solid #D675F0;
  461. border-color: #D675F0 !important;
  462. font-weight: 900;
  463. }
  464. /deep/ .el-input__suffix {
  465. color: #D675F0 !important;
  466. right: 1px;
  467. }
  468. /deep/ .el-select__caret {
  469. color: #D675F0 !important;
  470. }
  471. }
  472. .item-color {
  473. /deep/ input {
  474. color: rgb(106, 180, 255);
  475. border: 1px solid rgb(106, 180, 255);
  476. border-color: rgb(106, 180, 255) !important;
  477. font-weight: 900;
  478. }
  479. /deep/ .el-input__suffix {
  480. color: rgb(106, 180, 255) !important;
  481. right: 1px;
  482. }
  483. /deep/ .el-select__caret {
  484. color: rgb(106, 180, 255) !important;
  485. }
  486. }
  487. </style>