index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <div>
  5. <!-- 搜索区域 -->
  6. <div class="search-area">
  7. <seek-page
  8. :seekList="seekList"
  9. @search="handleSearch"
  10. :formLength="4"
  11. />
  12. </div>
  13. <!-- 列表视图 -->
  14. <div class="list-view">
  15. <ele-pro-table
  16. ref="table"
  17. row-key="id"
  18. :columns="columns"
  19. :datasource="datasource"
  20. :cache-key="cacheKeyUrl"
  21. height="calc(100vh - 340px)"
  22. @columns-change="handleColumnChange"
  23. >
  24. <template v-slot:action="{ row }">
  25. <div class="action-links">
  26. <el-link
  27. type="primary"
  28. :underline="false"
  29. @click="handleStart(row)"
  30. >开始学习</el-link
  31. >
  32. <el-link
  33. type="primary"
  34. :underline="false"
  35. @click="handleDetail(row)"
  36. >查看详情</el-link
  37. >
  38. </div>
  39. </template>
  40. </ele-pro-table>
  41. </div>
  42. <!-- 详情弹窗 -->
  43. <detail ref="detailRef" />
  44. </div>
  45. </el-card>
  46. </div>
  47. </template>
  48. <script>
  49. import detail from './detail.vue';
  50. import tabMixins from '@/mixins/tableColumnsMixin';
  51. export default {
  52. components: {
  53. detail
  54. },
  55. mixins: [tabMixins],
  56. data() {
  57. return {
  58. columns: [
  59. {
  60. columnKey: 'index',
  61. label: '序号',
  62. type: 'index',
  63. width: 60,
  64. align: 'center'
  65. },
  66. {
  67. prop: 'name',
  68. label: '培训名称',
  69. align: 'center',
  70. minWidth: 180,
  71. showOverflowTooltip: true
  72. },
  73. {
  74. prop: 'responsibleUserName',
  75. label: '责任人',
  76. align: 'center',
  77. minWidth: 100
  78. },
  79. {
  80. prop: 'creator',
  81. label: '制定人',
  82. align: 'center',
  83. minWidth: 100
  84. },
  85. {
  86. prop: 'startTime',
  87. label: '开始时间',
  88. align: 'center',
  89. minWidth: 160
  90. },
  91. {
  92. prop: 'content',
  93. label: '培训内容',
  94. align: 'center',
  95. minWidth: 200,
  96. showOverflowTooltip: true
  97. },
  98. {
  99. prop: 'assigner',
  100. label: '下达人',
  101. align: 'center',
  102. minWidth: 100
  103. },
  104. {
  105. prop: 'assignTime',
  106. label: '下达时间',
  107. align: 'center',
  108. minWidth: 160
  109. },
  110. {
  111. prop: 'requiredFinishTime',
  112. label: '要求完成时间',
  113. align: 'center',
  114. minWidth: 160
  115. },
  116. {
  117. columnKey: 'action',
  118. label: '操作',
  119. width: 160,
  120. align: 'center',
  121. slot: 'action'
  122. }
  123. ],
  124. cacheKeyUrl: 'ehs-myTraining-list'
  125. };
  126. },
  127. computed: {
  128. seekList() {
  129. return [
  130. {
  131. label: '培训名称:',
  132. value: 'name',
  133. type: 'input',
  134. width: 220,
  135. placeholder: '请输入培训名称'
  136. },
  137. {
  138. label: '制定人:',
  139. value: 'creator',
  140. type: 'input',
  141. width: 220,
  142. placeholder: '请输入制定人'
  143. },
  144. {
  145. label: '开始时间:',
  146. value: 'startTime',
  147. type: 'date',
  148. width: 220,
  149. placeholder: '请选择开始时间'
  150. }
  151. ];
  152. }
  153. },
  154. methods: {
  155. // 开始学习
  156. handleStart(row) {
  157. // TODO: 开始培训逻辑
  158. console.log('开始学习', row);
  159. },
  160. // 查看详情
  161. handleDetail(row) {
  162. this.$refs.detailRef.open(row);
  163. },
  164. // 搜索
  165. handleSearch(where) {
  166. this.$refs.table.reload({ page: 1, where });
  167. },
  168. // 表格数据源
  169. datasource({ page, limit, where, order }) {
  170. const body = {
  171. ...where,
  172. ...order,
  173. pageNum: page,
  174. size: limit
  175. };
  176. return [{}];
  177. }
  178. }
  179. };
  180. </script>
  181. <style lang="scss" scoped>
  182. .search-area {
  183. margin-bottom: 15px;
  184. padding-bottom: 15px;
  185. border-bottom: 1px solid #ebeef5;
  186. }
  187. .list-view {
  188. ::v-deep .ele-pro-table {
  189. .el-table {
  190. border: 1px solid #ebeef5;
  191. border-radius: 4px;
  192. }
  193. }
  194. }
  195. .action-links {
  196. display: flex;
  197. flex-wrap: wrap;
  198. justify-content: center;
  199. gap: 8px;
  200. .el-link {
  201. font-size: 12px;
  202. }
  203. }
  204. </style>