turnovercar-list.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div>
  3. <turnovercar-search
  4. ref="searchRef"
  5. @search="reload"
  6. :isConsumer="isConsumer"
  7. >
  8. </turnovercar-search>
  9. <!-- 数据表格 -->
  10. <ele-pro-table
  11. ref="table"
  12. :columns="columns"
  13. :datasource="datasource"
  14. height="calc(100vh - 265px)"
  15. full-height="calc(100vh - 116px)"
  16. tool-class="ele-toolbar-form"
  17. cache-key="systemOrgUserTable"
  18. >
  19. <!-- 表头工具栏 -->
  20. <template v-slot:toolbar>
  21. <el-checkbox v-model="isConsumer">显示已消耗</el-checkbox>
  22. <el-button
  23. size="small"
  24. type="primary"
  25. icon="el-icon-download"
  26. class="ele-btn-icon"
  27. @click="btnExport"
  28. >
  29. 导出
  30. </el-button>
  31. </template>
  32. <!-- 编码列 -->
  33. <template v-slot:code="{ row }">
  34. <el-link type="primary" :underline="false" @click="details(row)">
  35. {{ row.code }}
  36. </el-link>
  37. </template>
  38. <!-- 分类列 -->
  39. <template v-slot:categoryLevelPath="{ row }">
  40. <div>
  41. {{ row.category.categoryLevelPath }}
  42. </div>
  43. </template>
  44. <!-- 操作列 -->
  45. <template v-slot:action="{ row }">
  46. <el-link
  47. type="primary"
  48. :underline="false"
  49. icon="el-icon-edit"
  50. @click="goEdit(row)"
  51. >
  52. 编辑
  53. </el-link>
  54. </template>
  55. </ele-pro-table>
  56. </div>
  57. </template>
  58. <script>
  59. import TurnovercarSearch from './turnovercar-search.vue';
  60. import { getAssetList , downloadAsset } from '@/api/ledgerAssets';
  61. import dictMixins from '@/mixins/dictMixins';
  62. // import { downloadAction } from '@/api/flowable/manage';
  63. export default {
  64. components: { TurnovercarSearch },
  65. mixins: [dictMixins],
  66. props: {
  67. // 类别id
  68. categoryId: [Number, String],
  69. rootId: [Number, String],
  70. },
  71. data() {
  72. return {
  73. // 表格列配置
  74. columns: [
  75. {
  76. columnKey: 'selection',
  77. type: 'selection',
  78. width: 45,
  79. align: 'center',
  80. fixed: 'left'
  81. },
  82. {
  83. columnKey: 'index',
  84. type: 'index',
  85. label: '序号',
  86. width: 55,
  87. align: 'center',
  88. showOverflowTooltip: true,
  89. fixed: 'left'
  90. },
  91. {
  92. prop: 'code',
  93. label: '编码',
  94. showOverflowTooltip: true,
  95. minWidth: 110,
  96. slot: 'code',
  97. fixed: 'left'
  98. },
  99. {
  100. prop: 'name',
  101. label: '名称',
  102. showOverflowTooltip: true,
  103. minWidth: 110
  104. },
  105. {
  106. prop: 'fixCode',
  107. label: '固资编码',
  108. showOverflowTooltip: true,
  109. minWidth: 110
  110. },
  111. {
  112. prop: 'materialQuality',
  113. label: '材质',
  114. showOverflowTooltip: true,
  115. minWidth: 110,
  116. formatter: (_row, _column, cellValue) => {
  117. return this.getDictValue('周转车材质', _row.categoryDetail.materialQuality)
  118. }
  119. },
  120. {
  121. prop: 'modelType',
  122. label: '型号',
  123. showOverflowTooltip: true,
  124. minWidth: 110,
  125. formatter: (_row, _column, cellValue) => {
  126. return _row.category.modelType
  127. }
  128. },
  129. {
  130. prop: 'categoryLevelPath',
  131. label: '分类',
  132. showOverflowTooltip: true,
  133. minWidth: 110,
  134. slot: 'categoryLevelPath'
  135. },
  136. {
  137. prop: 'ownershipGroupName',
  138. label: '所在部门',
  139. showOverflowTooltip: true,
  140. minWidth: 110
  141. },
  142. {
  143. prop: 'totalSum',
  144. label: '生命周期',
  145. showOverflowTooltip: true,
  146. minWidth: 110,
  147. formatter: (_row, _column, cellValue) => {
  148. return this.getDictValue('生命周期', _row.position[0].type)
  149. }
  150. },
  151. {
  152. columnKey: 'action',
  153. label: '操作',
  154. width: 100,
  155. align: 'left',
  156. resizable: false,
  157. slot: 'action',
  158. showOverflowTooltip: true,
  159. fixed: 'right'
  160. }
  161. ],
  162. isConsumer:false
  163. };
  164. },
  165. created () {
  166. this.requestDict('生命周期');
  167. this.requestDict('周转车材质');
  168. },
  169. methods: {
  170. /* 表格数据源 */
  171. datasource({ page, limit, where, order }) {
  172. return getAssetList({
  173. ...where,
  174. ...order,
  175. pageNum: page,
  176. size: limit,
  177. categoryLevelId: this.categoryId,
  178. rootCategoryLevelId: this.rootId
  179. });
  180. },
  181. /* 刷新表格 */
  182. reload(where) {
  183. this.$refs.table.reload({ pageNum: 1, where: where });
  184. },
  185. // 跳转到详情页
  186. details ({ id }) {
  187. this.$router.push({
  188. path: '/ledgerAssets/turnoverCar/detail',
  189. query: {
  190. id
  191. }
  192. })
  193. },
  194. // 跳转到编辑页
  195. goEdit ({ id }) {
  196. this.$router.push({
  197. path: '/ledgerAssets/turnoverCar/edit',
  198. query: {
  199. id
  200. }
  201. })
  202. },
  203. // 导出
  204. btnExport() {
  205. let params = {
  206. ...this.$refs.searchRef.where,
  207. exportType:2,
  208. categoryLevelId: this.categoryId,
  209. rootCategoryLevelId:this.rootId
  210. }
  211. downloadAsset(params, '周转车台账导出数据');
  212. },
  213. },
  214. watch: {
  215. // 监听类别id变化
  216. categoryId() {
  217. this.reload();
  218. }
  219. }
  220. };
  221. </script>
  222. <style lang="scss" scoped>
  223. .ele-btn-icon{
  224. margin-left: 20px;
  225. }
  226. </style>