material-list.vue 3.4 KB

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