index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <el-card shadow="hover" class="margin">
  3. <div class="full-width flex flex-center flex-justify-start">
  4. <el-button-group>
  5. <el-button type="primary" icon="el-icon-edit">全部任务</el-button>
  6. <el-button type="primary" plain icon="el-icon-share"
  7. >我创建的
  8. </el-button>
  9. <el-button type="primary" plain icon="el-icon-delete"
  10. >我执行的
  11. </el-button>
  12. </el-button-group>
  13. </div>
  14. <div class="flex flex-center flex-justify-start flex-col full-width">
  15. <div class="full-width flex flex-justify-start">
  16. <span>按时间排序</span>
  17. </div>
  18. <div class="full-width">
  19. <task-table
  20. :option="option"
  21. :data="data"
  22. @rowClick="rowClick"
  23. ></task-table>
  24. </div>
  25. <task ref="task" :task="task"></task>
  26. </div>
  27. </el-card>
  28. </template>
  29. <route>
  30. {
  31. path: '/task',
  32. name: '任务列表'
  33. }
  34. </route>
  35. <script>
  36. import TaskTable from '@/views/task/component/task-table.vue'
  37. import Task from '@/views/task/component/task.vue'
  38. export default {
  39. components: { Task, TaskTable },
  40. data() {
  41. return {
  42. data: [],
  43. task: [],
  44. taskId: '',
  45. option: {
  46. showCheckBox: false,
  47. folderChecked: true,
  48. column: [
  49. {
  50. label: '共20个任务',
  51. prop: 'title',
  52. display: false,
  53. width: 600
  54. },
  55. {
  56. label: '标签',
  57. prop: 'createUserName'
  58. },
  59. {
  60. label: '时间',
  61. prop: 'createUserName'
  62. },
  63. {
  64. label: '执行人',
  65. prop: 'createTime'
  66. }
  67. ]
  68. }
  69. }
  70. },
  71. created() {
  72. this.getTaskList()
  73. },
  74. methods: {
  75. getTaskList() {
  76. this.$api.task.taskList({}).then(res => {
  77. if (res.code === 200) {
  78. this.data = res.data.records
  79. }
  80. })
  81. },
  82. rowClick(res) {
  83. this.taskId = res.id
  84. this.getTaskInfo()
  85. },
  86. getTaskInfo() {
  87. this.$api.task.taskInfo({ id: this.taskId }).then(res => {
  88. if (res.code === 200) {
  89. this.task = res.data
  90. } else {
  91. this.$message.error(res.msg)
  92. }
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style scoped></style>