index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <ProductSearch @search="reload" />
  5. <ele-split-layout
  6. width="244px"
  7. allow-collapse
  8. :right-style="{ overflow: 'hidden' }"
  9. >
  10. <div class="ele-border-lighter split-layout-right-content">
  11. <AssetTree
  12. ref="assetTreeRef"
  13. id="9"
  14. @handleNodeClick="handleNodeClick"
  15. />
  16. </div>
  17. <!-- 表格 -->
  18. <template v-slot:content>
  19. <ele-pro-table
  20. ref="table"
  21. :columns="columns"
  22. :datasource="datasource"
  23. height="calc(100vh - 350px)"
  24. class="dict-table"
  25. >
  26. <!-- 表头工具栏 -->
  27. <template v-slot:action="{ row }">
  28. <el-link
  29. type="primary"
  30. :underline="false"
  31. icon="el-icon-edit"
  32. @click="handleEdit(row)"
  33. >
  34. 修改
  35. </el-link>
  36. </template>
  37. </ele-pro-table>
  38. </template>
  39. </ele-split-layout>
  40. </el-card>
  41. </div>
  42. </template>
  43. <script>
  44. import AssetTree from '@/components/AssetTree';
  45. import ProductSearch from './components/product-search.vue';
  46. import { getList } from '@/api/classifyManage/itemInformation';
  47. export default {
  48. name: 'SystemDictionary',
  49. components: { AssetTree, ProductSearch },
  50. data () {
  51. return {
  52. // 表格列配置
  53. columns: [
  54. {
  55. columnKey: 'index',
  56. type: 'index',
  57. width: 55,
  58. align: 'center',
  59. reserveSelection: true,
  60. label: '序号',
  61. showOverflowTooltip: true
  62. },
  63. {
  64. prop: 'code',
  65. label: '产品编码'
  66. },
  67. {
  68. prop: 'name',
  69. label: '产品名称',
  70. showOverflowTooltip: true
  71. },
  72. {
  73. prop: 'brandNum',
  74. label: '牌号'
  75. },
  76. {
  77. prop: 'modelType',
  78. label: '型号'
  79. },
  80. {
  81. prop: 'measuringUnit',
  82. label: '计量单位'
  83. },
  84. {
  85. prop: 'packingUnit',
  86. label: '包装单位'
  87. },
  88. {
  89. action: 'action',
  90. slot: 'action',
  91. label: '操作'
  92. }
  93. ],
  94. categoryLevelId: '9'
  95. };
  96. },
  97. methods: {
  98. /* 表格数据源 */
  99. datasource ({ page, where, limit }) {
  100. return getList({
  101. ...where,
  102. pageNum: page,
  103. size: limit,
  104. isProduct: true,
  105. categoryLevelId: this.categoryLevelId
  106. });
  107. },
  108. handleNodeClick (data) {
  109. this.categoryLevelId = data.id;
  110. this.reload();
  111. },
  112. /* 刷新表格 */
  113. reload (where) {
  114. this.$refs.table.reload({ where });
  115. },
  116. handleEdit ({ id }) {
  117. this.$router.push({
  118. path: '/material/product/detail',
  119. query: {
  120. id
  121. }
  122. });
  123. }
  124. }
  125. };
  126. </script>
  127. <style lang="scss" scoped></style>