index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <ele-split-layout
  5. width="256px"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div>
  10. <!-- 操作按钮 -->
  11. <ele-toolbar class="ele-toolbar-actions">
  12. <div style="margin: 5px 0">
  13. <el-button
  14. size="small"
  15. type="primary"
  16. icon="el-icon-plus"
  17. class="ele-btn-icon"
  18. @click="openEdit()"
  19. >
  20. 新建物品
  21. </el-button>
  22. </div>
  23. </ele-toolbar>
  24. <div class="ele-border-lighter sys-organization-list">
  25. <asset-tree
  26. @handleNodeClick="onNodeClick"
  27. ref="commonTree"
  28. :treeFormate="
  29. (list) => {
  30. return [
  31. {
  32. children: list,
  33. id: '0',
  34. level: 0,
  35. name: '物品信息表',
  36. originId: null,
  37. originType: {},
  38. parentId: null,
  39. type: '',
  40. weight: 0
  41. }
  42. ];
  43. }
  44. "
  45. />
  46. </div>
  47. </div>
  48. <template v-slot:content>
  49. <item-list :current="current" />
  50. </template>
  51. </ele-split-layout>
  52. </el-card>
  53. </div>
  54. </template>
  55. <script>
  56. import itemList from './components/item-list';
  57. import AssetTree from '@/components/AssetTree';
  58. export default {
  59. components: { itemList, AssetTree },
  60. data () {
  61. return {
  62. treeData: [],
  63. current: {}
  64. };
  65. },
  66. created () {},
  67. methods: {
  68. onNodeClick (data, node) {
  69. this.current = node;
  70. },
  71. openEdit () {
  72. const data = this.$refs.commonTree.getSelectList();
  73. if (data?.id) {
  74. let node = this.$refs.commonTree.getInstance().getNode(data.id);
  75. const urlIdList = [data.id];
  76. while (node.parent?.data?.id) {
  77. urlIdList.unshift(node.parent?.data?.id);
  78. node = node.parent;
  79. }
  80. data.urlIdList = urlIdList;
  81. }
  82. this.$router.push({
  83. path: '/classifyManage/itemInformation/add',
  84. query: {
  85. pageTitle: '新建物品',
  86. selectNode: JSON.stringify(data)
  87. }
  88. });
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .sys-organization-list {
  95. height: calc(100vh - 264px);
  96. box-sizing: border-box;
  97. border-width: 1px;
  98. border-style: solid;
  99. overflow: auto;
  100. }
  101. .sys-organization-list :deep(.el-tree-node__content) {
  102. height: 40px;
  103. & > .el-tree-node__expand-icon {
  104. margin-left: 10px;
  105. }
  106. }
  107. </style>