boat-list.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div>
  3. <boat-search @search="reload">
  4. </boat-search>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. height="calc(100vh - 265px)"
  11. full-height="calc(100vh - 116px)"
  12. tool-class="ele-toolbar-form"
  13. cache-key="systemOrgUserTable"
  14. >
  15. <!-- 表头工具栏 -->
  16. <template v-slot:toolbar>
  17. <el-button
  18. size="small"
  19. type="primary"
  20. icon="el-icon-download"
  21. class="ele-btn-icon"
  22. >
  23. 导出
  24. </el-button>
  25. </template>
  26. <!-- 编码列 -->
  27. <template v-slot:code="{ row }">
  28. <el-link @click="details(row)">
  29. {{ row.code }}
  30. </el-link>
  31. </template>
  32. </ele-pro-table>
  33. </div>
  34. </template>
  35. <script>
  36. import BoatSearch from './boat-search.vue';
  37. import {
  38. getBoatList
  39. } from '@/api/ledgerAssets/boat.js';
  40. export default {
  41. components: { BoatSearch },
  42. props: {
  43. // 类别id
  44. categoryId: [Number, String],
  45. rootId: [Number, String],
  46. },
  47. data() {
  48. return {
  49. // 表格列配置
  50. columns: [
  51. {
  52. columnKey: 'index',
  53. type: 'index',
  54. label: '序号',
  55. width: 55,
  56. align: 'center',
  57. showOverflowTooltip: true,
  58. fixed: 'left'
  59. },
  60. {
  61. prop: 'code',
  62. label: '类别编码',
  63. showOverflowTooltip: true,
  64. minWidth: 110,
  65. slot: 'code',
  66. },
  67. {
  68. prop: 'name',
  69. label: '类别名称',
  70. showOverflowTooltip: true,
  71. minWidth: 110
  72. },
  73. {
  74. prop: 'module',
  75. label: '型号',
  76. showOverflowTooltip: true,
  77. minWidth: 110
  78. },
  79. {
  80. prop: 'specification',
  81. label: '规格',
  82. showOverflowTooltip: true,
  83. minWidth: 110
  84. },
  85. {
  86. prop: 'angle',
  87. label: '角度',
  88. showOverflowTooltip: true,
  89. minWidth: 110
  90. },
  91. {
  92. prop: 'width',
  93. label: '长*宽*高',
  94. showOverflowTooltip: true,
  95. minWidth: 110
  96. },
  97. {
  98. prop: 'categoryLevelPath',
  99. label: '分类',
  100. showOverflowTooltip: true,
  101. minWidth: 110
  102. },
  103. {
  104. prop: 'inUseSum',
  105. label: '在用',
  106. showOverflowTooltip: true,
  107. minWidth: 110
  108. },
  109. {
  110. prop: 'inLibrarySum',
  111. label: '在库',
  112. showOverflowTooltip: true,
  113. minWidth: 110
  114. },
  115. {
  116. prop: 'consumeSum',
  117. label: '消耗',
  118. showOverflowTooltip: true,
  119. minWidth: 110
  120. },
  121. {
  122. prop: 'totalSum',
  123. label: '总数量',
  124. showOverflowTooltip: true,
  125. minWidth: 110
  126. },
  127. ]
  128. };
  129. },
  130. methods: {
  131. /* 表格数据源 */
  132. datasource({ page, limit, where, order }) {
  133. return getBoatList({
  134. ...where,
  135. ...order,
  136. pageNum: page,
  137. size: limit,
  138. categoryId: this.categoryId,
  139. rootCategoryLevelId: this.rootId
  140. });
  141. },
  142. /* 刷新表格 */
  143. reload(where) {
  144. this.$refs.table.reload({ pageNum: 1, where: where });
  145. },
  146. // 跳转到详情页
  147. details ({ id }) {
  148. this.$router.push({
  149. path: '/ledgerAssets/boat/detail',
  150. query: {
  151. id
  152. }
  153. })
  154. }
  155. },
  156. watch: {
  157. // 监听类别id变化
  158. categoryId() {
  159. this.reload();
  160. }
  161. }
  162. };
  163. </script>