index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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="4"
  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. <template v-slot:toolbar>
  27. <el-button
  28. size="small"
  29. type="primary"
  30. icon="el-icon-plus"
  31. class="ele-btn-icon"
  32. @click="add"
  33. >
  34. 新建物品
  35. </el-button>
  36. </template>
  37. <!-- 表头工具栏 -->
  38. <template v-slot:action="{ row }">
  39. <el-link
  40. type="primary"
  41. :underline="false"
  42. icon="el-icon-edit"
  43. @click="handleEdit(row)"
  44. >
  45. 修改
  46. </el-link>
  47. </template>
  48. </ele-pro-table>
  49. </template>
  50. </ele-split-layout>
  51. </el-card>
  52. <DialogItem ref="dialogItemRef" />
  53. </div>
  54. </template>
  55. <script>
  56. import AssetTree from '@/components/AssetTree';
  57. import ProductSearch from './components/product-search.vue';
  58. import { getList, pageSubstance } from '@/api/classifyManage/itemInformation';
  59. import DialogItem from './components/Dialog-item.vue';
  60. export default {
  61. name: 'SystemDictionary',
  62. components: { AssetTree, ProductSearch, DialogItem },
  63. data() {
  64. return {
  65. // 表格列配置
  66. columns: [
  67. {
  68. columnKey: 'index',
  69. type: 'index',
  70. width: 55,
  71. align: 'center',
  72. reserveSelection: true,
  73. label: '序号',
  74. showOverflowTooltip: true
  75. },
  76. {
  77. prop: 'code',
  78. label: '物品编码',
  79. minWidth: 100
  80. },
  81. {
  82. prop: 'name',
  83. label: '物品名称',
  84. showOverflowTooltip: true,
  85. minWidth: 130
  86. },
  87. {
  88. prop: 'categoryLevelGroupCode',
  89. label: '物料组编码',
  90. showOverflowTooltip: true,
  91. width: 100
  92. },
  93. {
  94. prop: 'brandNum',
  95. label: '牌号',
  96. width: 70
  97. },
  98. {
  99. prop: 'modelType',
  100. label: '型号',
  101. minWidth: 130
  102. },
  103. {
  104. prop: 'measuringUnit',
  105. label: '计量单位',
  106. width: 80
  107. },
  108. {
  109. prop: 'weightUnit',
  110. label: '重量单位',
  111. width: 80
  112. },
  113. {
  114. prop: 'roughWeight',
  115. label: '毛重',
  116. width: 100
  117. },
  118. {
  119. prop: 'netWeight',
  120. label: '净重',
  121. width: 100
  122. },
  123. {
  124. prop: 'packingUnit',
  125. label: '包装单位',
  126. width: 80
  127. },
  128. {
  129. action: 'action',
  130. slot: 'action',
  131. label: '操作'
  132. }
  133. ],
  134. categoryLevelId: '4'
  135. };
  136. },
  137. methods: {
  138. /* 新建物品 */
  139. add() {
  140. this.$refs.dialogItemRef.open();
  141. },
  142. /* 表格数据源 */
  143. datasource({ page, where, limit }) {
  144. return getList({
  145. ...where,
  146. pageNum: page,
  147. size: limit,
  148. isProduct: false,
  149. categoryLevelId: this.categoryLevelId,
  150. rootCategoryLevelId: 4
  151. });
  152. },
  153. handleNodeClick(data) {
  154. this.categoryLevelId = data.id;
  155. this.reload();
  156. },
  157. /* 刷新表格 */
  158. reload(where) {
  159. this.$refs.table.reload({ where });
  160. },
  161. handleEdit({ id }) {
  162. this.$router.push({
  163. path: '/material/product/detail',
  164. query: {
  165. id
  166. }
  167. });
  168. }
  169. }
  170. };
  171. </script>
  172. <style lang="scss" scoped></style>