km-my-commend.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <a-card>
  3. <sd-data-table
  4. data-url="api/xcoa-mobile/v1/kmknowledge/knowledge_commentlist"
  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: 'category',
  33. align: 'center',
  34. },
  35. {
  36. title: '创建时间',
  37. dataIndex: 'creationTime',
  38. align: 'center',
  39. sorter: (a, b) => a.creationTime - b.creationTime,
  40. sdRender: TableColumnTypes.dateTime, // 特殊处理的数据类型,时间戳会自动调用sdDateFormat处理
  41. },
  42. {
  43. title: '阅读次数',
  44. dataIndex: 'readTimes',
  45. width: '150px',
  46. align: 'center',
  47. sorter: (a, b) => a.readTimes - b.readTimes,
  48. },
  49. {
  50. title: '推荐次数',
  51. dataIndex: 'recommendTimes',
  52. sorter: (a, b) => a.recommendTimes - b.recommendTimes,
  53. width: '150px',
  54. align: 'center',
  55. },
  56. {
  57. title: '点评次数',
  58. dataIndex: 'commentTimes',
  59. sorter: (a, b) => a.commentTimes - b.commentTimes,
  60. width: '150px',
  61. align: 'center',
  62. },
  63. ]
  64. export default {
  65. name: 'KmMyCommend',
  66. metaInfo: {
  67. title: '我的点评',
  68. },
  69. components,
  70. data() {
  71. return {
  72. columns,
  73. }
  74. },
  75. created() {},
  76. methods: {
  77. click(record) {
  78. window.open(`#/km-knowledage-view?id=${record.id}&title=${record.title}`, '_blank')
  79. },
  80. },
  81. }
  82. </script>
  83. <style module lang="scss">
  84. @use '@/common/design' as *;
  85. </style>