MemberTable.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="member-table-container">
  3. <Table :columns="columns" :data="data" height="750" :loading="tableLoading">
  4. <template slot-scope="{ row, index }" slot="header">
  5. <PersonalPhoto :name="row.name" :picture="row.picture"></PersonalPhoto>
  6. </template>
  7. </Table>
  8. </div>
  9. </template>
  10. <script>
  11. import PersonalPhoto from '@/components/public/personalPhoto/Index.vue'
  12. export default {
  13. props: ["members"],
  14. components:{
  15. PersonalPhoto
  16. },
  17. data() {
  18. return {
  19. tableLoading:false,
  20. columns: [
  21. {
  22. slot: "header",
  23. title: " ",
  24. align: "center",
  25. width: 120,
  26. },
  27. {
  28. key: "name",
  29. title: this.$t("stuAccount.stuName"),
  30. align: "center",
  31. },
  32. {
  33. key: "id",
  34. title: this.$t("stuAccount.account"),
  35. align: "center",
  36. sortable: true,
  37. sortMethod: (a, b, type) => {
  38. if (type == "asc") {
  39. return a.localeCompare(b);
  40. } else {
  41. return b.localeCompare(a);
  42. }
  43. },
  44. },
  45. {
  46. key: "no",
  47. title: this.$t("stuAccount.seatNo"),
  48. align: "center",
  49. width: 120,
  50. sortable: true,
  51. sortMethod: (a, b, type) => {
  52. if (type == "desc") {
  53. return parseInt(a) > parseInt(b) ? -1 : 1;
  54. } else {
  55. return parseInt(a) < parseInt(b) ? -1 : 1;
  56. }
  57. },
  58. },
  59. {
  60. key: "irs",
  61. title: this.$t('courseManage.classroom.studentTableC9'),
  62. align: "center",
  63. width: 120,
  64. },
  65. ],
  66. data: [],
  67. };
  68. },
  69. created() {
  70. console.log(this.members);
  71. this.data = this.members;
  72. },
  73. watch: {
  74. members: {
  75. immediate:true,
  76. handler(n, o) {
  77. this.data = this.members
  78. },
  79. },
  80. },
  81. };
  82. </script>