km-my-knowledge.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <a-card>
  3. <sd-data-table
  4. data-url="api/xcoa-mobile/v1/kmknowledge/knowledge_account"
  5. :columns="columns"
  6. :row-key="'id'"
  7. :search-fields="['title']"
  8. >
  9. <a slot="bt" slot-scope="text, record" :title="text" @click="click(record)">{{ text }} </a>
  10. </sd-data-table>
  11. </a-card>
  12. </template>
  13. <script>
  14. import TableColumnTypes from '@/common/services/table-column-types'
  15. import components from './_import-components/km-my-commend-import'
  16. const columns = [
  17. {
  18. title: '序号',
  19. width: '100px',
  20. align: 'center',
  21. customRender: (text, record, index) => `${index + 1}`,
  22. },
  23. {
  24. title: '标题',
  25. dataIndex: 'title',
  26. width: '200px',
  27. align: 'center',
  28. scopedSlots: { customRender: 'bt' },
  29. },
  30. {
  31. title: '版本号',
  32. dataIndex: 'versionNum',
  33. width: '100px',
  34. align: 'center',
  35. },
  36. {
  37. title: '所属分类',
  38. dataIndex: 'category',
  39. align: 'center',
  40. },
  41. {
  42. title: '创建时间',
  43. dataIndex: 'creationTime',
  44. align: 'center',
  45. sorter: (a, b) => a.creationTime - b.creationTime,
  46. sdRender: TableColumnTypes.dateTime, // 特殊处理的数据类型,时间戳会自动调用sdDateFormat处理
  47. },
  48. {
  49. title: '点击次数',
  50. dataIndex: 'readTimes',
  51. width: '130px',
  52. align: 'center',
  53. sorter: (a, b) => a.readTimes - b.readTimes,
  54. },
  55. {
  56. title: '被推荐次数',
  57. dataIndex: 'recommendTimes',
  58. sorter: (a, b) => a.recommendTimes - b.recommendTimes,
  59. width: '130px',
  60. align: 'center',
  61. },
  62. {
  63. title: '被点评次数',
  64. dataIndex: 'commentTimes',
  65. sorter: (a, b) => a.commentTimes - b.commentTimes,
  66. width: '150px',
  67. align: 'center',
  68. },
  69. ]
  70. export default {
  71. name: 'KmMyKnowledge',
  72. metaInfo: {
  73. title: '我的知识',
  74. },
  75. components,
  76. data() {
  77. return {
  78. columns,
  79. }
  80. },
  81. created() {},
  82. methods: {
  83. click(record) {
  84. window.open(`#/km-knowledage-view?id=${record.id}&title=${record.title}`, '_blank')
  85. },
  86. },
  87. }
  88. </script>
  89. <style module lang="scss">
  90. @use '@/common/design' as *;
  91. </style>