boat-list.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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. import axios from 'axios';
  41. import {
  42. API_BASE_URL,
  43. TOKEN_HEADER_NAME,
  44. LAYOUT_PATH
  45. } from '@/config/setting';
  46. import { download } from '@/utils/file';
  47. import { getToken, setToken } from '@/utils/token-util';
  48. export default {
  49. mixins: [dictMixins],
  50. components: { BoatSearch },
  51. props: {
  52. // 类别id
  53. categoryId: [Number, String],
  54. rootId: [Number, String]
  55. },
  56. data() {
  57. return {
  58. // 表格列配置
  59. columns: [
  60. {
  61. columnKey: 'index',
  62. type: 'index',
  63. label: '序号',
  64. width: 55,
  65. align: 'center',
  66. showOverflowTooltip: true,
  67. fixed: 'left'
  68. },
  69. {
  70. prop: 'code',
  71. label: '类别编码',
  72. showOverflowTooltip: true,
  73. minWidth: 110,
  74. slot: 'code'
  75. },
  76. {
  77. prop: 'name',
  78. label: '类别名称',
  79. showOverflowTooltip: true,
  80. minWidth: 110
  81. },
  82. {
  83. prop: 'module',
  84. label: '型号',
  85. showOverflowTooltip: true,
  86. minWidth: 110
  87. },
  88. {
  89. prop: 'specification',
  90. label: '规格',
  91. showOverflowTooltip: true,
  92. minWidth: 110
  93. },
  94. // {
  95. // prop: 'angle',
  96. // label: '角度',
  97. // showOverflowTooltip: true,
  98. // minWidth: 110,
  99. // formatter: (row) => {
  100. // return this.getDictValue('角度', row.detail.angle);
  101. // }
  102. // },
  103. // {
  104. // prop: 'width',
  105. // label: '长*宽*高',
  106. // showOverflowTooltip: true,
  107. // minWidth: 200,
  108. // formatter: (row) => {
  109. // return (
  110. // row.detail.palletLen +
  111. // ' * ' +
  112. // row.detail.wilde +
  113. // ' * ' +
  114. // row.detail.hight
  115. // );
  116. // }
  117. // },
  118. {
  119. prop: 'categoryLevelPath',
  120. label: '分类',
  121. showOverflowTooltip: true,
  122. minWidth: 110
  123. },
  124. {
  125. prop: 'inUseSum',
  126. label: '在用',
  127. showOverflowTooltip: true,
  128. minWidth: 110
  129. },
  130. {
  131. prop: 'inLibrarySum',
  132. label: '在库',
  133. showOverflowTooltip: true,
  134. minWidth: 110
  135. },
  136. {
  137. prop: 'consumeSum',
  138. label: '消耗',
  139. showOverflowTooltip: true,
  140. minWidth: 110
  141. },
  142. {
  143. prop: 'totalSum',
  144. label: '总数量',
  145. showOverflowTooltip: true,
  146. minWidth: 110
  147. }
  148. ]
  149. };
  150. },
  151. created() {
  152. this.requestDict('角度');
  153. },
  154. methods: {
  155. /* 表格数据源 */
  156. datasource({ page, limit, where, order }) {
  157. return getBoatList({
  158. ...where,
  159. ...order,
  160. pageNum: page,
  161. size: limit,
  162. categoryLevelId: this.categoryId,
  163. rootCategoryLevelId: this.rootId
  164. });
  165. },
  166. /* 刷新表格 */
  167. reload(where) {
  168. this.$refs.table.reload({ pageNum: 1, where: where });
  169. },
  170. // 跳转到详情页
  171. details({ id }) {
  172. this.$router.push({
  173. path: '/ledgerAssets/boat/detail',
  174. query: {
  175. id
  176. }
  177. });
  178. },
  179. // 导出
  180. btnExport() {
  181. let params = {
  182. ...this.$refs.searchRef.where,
  183. exportType: 1,
  184. categoryLevelId: this.categoryId,
  185. rootCategoryLevelId: this.rootId
  186. };
  187. // downloadCategory(params, '舟皿台账导出数据');
  188. axios({
  189. url: `${API_BASE_URL}/main/asset/page/export`,
  190. method: 'post',
  191. responseType: 'blob',
  192. headers: {
  193. Authorization: getToken()
  194. },
  195. data: params
  196. }).then((res) => {
  197. download(res.data, '舟皿台账导出数据');
  198. });
  199. }
  200. },
  201. watch: {
  202. // 监听类别id变化
  203. categoryId() {
  204. this.reload();
  205. }
  206. }
  207. };
  208. </script>