Plan.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <el-card shadow="hover">
  3. <template #header>
  4. <vab-icon icon="send-plane-2-line" />
  5. 计划
  6. <el-tag class="card-header-tag" type="success">
  7. 祝用框架的小伙伴都能住上别墅,开上保时捷
  8. </el-tag>
  9. </template>
  10. <el-table :data="tableData" row-key="title" height="283px">
  11. <el-table-column align="center" label="拖拽" width="50px">
  12. <template #default="{}">
  13. <vab-icon
  14. style="cursor: pointer"
  15. :icon="['fas', 'arrows-alt']"
  16. ></vab-icon>
  17. </template>
  18. </el-table-column>
  19. <el-table-column width="20px" />
  20. <el-table-column prop="title" label="目标" width="230px" />
  21. <el-table-column label="进度" width="220px">
  22. <template #default="{ row }">
  23. <el-progress :percentage="row.percentage" :color="row.color" />
  24. </template>
  25. </el-table-column>
  26. <el-table-column width="50px" />
  27. <el-table-column prop="endTIme" label="完成时间" />
  28. </el-table>
  29. </el-card>
  30. </template>
  31. <script>
  32. import Sortable from 'sortablejs'
  33. export default {
  34. data() {
  35. return {
  36. tableData: [
  37. {
  38. title: '帮助中小企业盈利1个亿',
  39. endTIme: '2099-12-31',
  40. percentage: 50,
  41. color: '#95de64',
  42. },
  43. {
  44. title: '帮助10万个人',
  45. endTIme: '2029-12-31',
  46. percentage: 8,
  47. color: '#69c0ff',
  48. },
  49. {
  50. title: '交个帅气的男朋友',
  51. endTIme: '2021-12-31',
  52. percentage: 76,
  53. color: '#1890FF',
  54. },
  55. {
  56. title: 'vue-admin-beautiful标星过1K',
  57. endTIme: '2020-03-31',
  58. percentage: 100,
  59. color: '#ffc069',
  60. },
  61. {
  62. title: '活到老,学到老',
  63. endTIme: '2094-12-16',
  64. percentage: 25,
  65. color: '#5cdbd3',
  66. },
  67. {
  68. title: '变成像尤雨溪一样优秀的人',
  69. endTIme: '此生无望',
  70. percentage: 1,
  71. color: '#b37feb',
  72. },
  73. ],
  74. }
  75. },
  76. mounted() {
  77. const tbody = document.querySelector('.el-table__body-wrapper tbody')
  78. const _this = this
  79. Sortable.create(tbody, {
  80. onEnd({ newIndex, oldIndex }) {
  81. const currRow = _this.tableData.splice(oldIndex, 1)[0]
  82. _this.tableData.splice(newIndex, 0, currRow)
  83. },
  84. })
  85. },
  86. }
  87. </script>