km-my-recommend.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <a-card>
  3. <a-tabs default-active-key="1">
  4. <a-tab-pane key="1" tab="推荐给我">
  5. <sd-data-table
  6. data-url="api/xcoa-mobile/v1/kmknowledge/knowledge_recommend_accountlist"
  7. :columns="columns1"
  8. :row-key="'id'"
  9. :search-fields="['title']"
  10. >
  11. <a slot="bt" slot-scope="text, record" :title="text" @click="click(record)"
  12. >{{ text }}
  13. </a>
  14. </sd-data-table>
  15. </a-tab-pane>
  16. <a-tab-pane key="2" tab="我的推荐" force-render>
  17. <sd-data-table
  18. data-url="api/xcoa-mobile/v1/kmknowledge/knowledge_recommendlist"
  19. :columns="columns2"
  20. :row-key="'id'"
  21. :search-fields="['title']"
  22. >
  23. <a slot="bt" slot-scope="text, record" :title="text" @click="click(record)"
  24. >{{ text }}
  25. </a>
  26. </sd-data-table>
  27. </a-tab-pane>
  28. </a-tabs>
  29. </a-card>
  30. </template>
  31. <script>
  32. import TableColumnTypes from '@/common/services/table-column-types'
  33. import components from './_import-components/km-my-recommend-import'
  34. const columns1 = [
  35. {
  36. title: '序号',
  37. width: '100px',
  38. align: 'center',
  39. customRender: (text, record, index) => `${index + 1}`,
  40. },
  41. {
  42. title: '标题',
  43. dataIndex: 'title',
  44. sdClickable: true,
  45. width: '260px',
  46. align: 'center',
  47. scopedSlots: { customRender: 'bt' },
  48. },
  49. {
  50. title: '版本号',
  51. dataIndex: 'versionNum',
  52. width: '100px',
  53. align: 'center',
  54. },
  55. {
  56. title: '所属分类',
  57. align: 'center',
  58. dataIndex: 'category',
  59. },
  60. {
  61. title: '创建时间',
  62. align: 'center',
  63. dataIndex: 'creationTime',
  64. sorter: (a, b) => a.creationTime - b.creationTime,
  65. sdRender: TableColumnTypes.dateTime, // 特殊处理的数据类型,时间戳会自动调用sdDateFormat处理
  66. },
  67. {
  68. title: '阅读次数',
  69. align: 'center',
  70. dataIndex: 'readTimes',
  71. sorter: (a, b) => a.readTimes - b.readTimes,
  72. width: '150px',
  73. },
  74. {
  75. title: '推荐次数',
  76. align: 'center',
  77. dataIndex: 'recommendTimes',
  78. sorter: (a, b) => a.recommendTimes - b.recommendTimes,
  79. width: '150px',
  80. },
  81. {
  82. title: '点评次数',
  83. align: 'center',
  84. dataIndex: 'commentTimes',
  85. sorter: (a, b) => a.commentTimes - b.commentTimes,
  86. width: '150px',
  87. },
  88. ]
  89. const columns2 = [
  90. {
  91. title: '序号',
  92. align: 'center',
  93. width: '100px',
  94. customRender: (text, record, index) => `${index + 1}`,
  95. },
  96. {
  97. title: '标题',
  98. dataIndex: 'title',
  99. sdClickable: true,
  100. width: '260px',
  101. align: 'center',
  102. scopedSlots: { customRender: 'bt' },
  103. },
  104. {
  105. title: '版本号',
  106. dataIndex: 'versionNum',
  107. width: '100px',
  108. align: 'center',
  109. },
  110. {
  111. title: '所属分类',
  112. align: 'center',
  113. dataIndex: 'category',
  114. },
  115. {
  116. title: '创建时间',
  117. dataIndex: 'creationTime',
  118. align: 'center',
  119. sorter: (a, b) => a.creationTime - b.creationTime,
  120. sdRender: TableColumnTypes.dateTime, // 特殊处理的数据类型,时间戳会自动调用sdDateFormat处理
  121. },
  122. {
  123. title: '阅读次数',
  124. dataIndex: 'readTimes',
  125. align: 'center',
  126. sorter: (a, b) => a.readTimes - b.readTimes,
  127. width: '150px',
  128. },
  129. {
  130. title: '推荐次数',
  131. align: 'center',
  132. dataIndex: 'recommendTimes',
  133. sorter: (a, b) => a.recommendTimes - b.recommendTimes,
  134. },
  135. {
  136. title: '点评次数',
  137. align: 'center',
  138. dataIndex: 'commentTimes',
  139. sorter: (a, b) => a.commentTimes - b.commentTimes,
  140. width: '150px',
  141. },
  142. ]
  143. export default {
  144. name: 'KmMyRecommend',
  145. metaInfo: {
  146. title: '推荐知识',
  147. },
  148. components,
  149. data() {
  150. return {
  151. columns1,
  152. columns2,
  153. }
  154. },
  155. created() {},
  156. methods: {
  157. click(record) {
  158. window.open(`#/km-knowledage-view?id=${record.id}&title=${record.title}`, '_blank')
  159. },
  160. },
  161. }
  162. </script>
  163. <style module lang="scss">
  164. @use '@/common/design' as *;
  165. </style>