boat-list.vue 4.7 KB

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