index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <ele-split-layout
  5. width="260px"
  6. allow-collapse
  7. :right-style="{ overflow: 'hidden' }"
  8. >
  9. <div class="ele-border-lighter sys-organization-list">
  10. <div class="radio_box rx-cc">
  11. <el-radio-group size="small" v-model="treeActive">
  12. <el-radio-button label="1">PBOM</el-radio-button>
  13. <el-radio-button label="2">MBOM</el-radio-button>
  14. </el-radio-group>
  15. </div>
  16. <el-input
  17. size="small"
  18. placeholder="在结构中查找"
  19. v-model="filterText"
  20. >
  21. </el-input>
  22. <el-tree
  23. :data="treeList"
  24. :props="defaultProps"
  25. ref="treeRef"
  26. :default-expanded-keys="current && current.id ? [current.id] : []"
  27. :highlight-current="true"
  28. node-key="id"
  29. @node-click="handleNodeClick"
  30. ></el-tree>
  31. </div>
  32. <template v-slot:content>
  33. <el-tabs type="border-card">
  34. <el-tab-pane label="属性">
  35. <attribute></attribute>
  36. </el-tab-pane>
  37. <el-tab-pane label="文档"></el-tab-pane>
  38. <el-tab-pane label="工艺"></el-tab-pane>
  39. <el-tab-pane label="制造资源"></el-tab-pane>
  40. <el-tab-pane label="材料定额"></el-tab-pane>
  41. <el-tab-pane label="工作中心分配"></el-tab-pane>
  42. <el-tab-pane label="质检"></el-tab-pane>
  43. <el-tab-pane label="质检参数"></el-tab-pane>
  44. </el-tabs>
  45. </template>
  46. </ele-split-layout>
  47. </el-card>
  48. </div>
  49. </template>
  50. <script>
  51. import { getTreeByGroup } from '@/api/classifyManage';
  52. import attribute from './components/attribute.vue'
  53. export default {
  54. name: 'BOMmanage',
  55. components: {
  56. attribute
  57. },
  58. data() {
  59. return {
  60. current: {},
  61. treeList: [],
  62. treeLoading: false,
  63. rootTreeId: null,
  64. defaultProps: {
  65. children: 'children',
  66. label: 'name'
  67. },
  68. loading: false,
  69. filterText: null,
  70. treeActive: 1
  71. };
  72. },
  73. created() {
  74. this.getTreeData();
  75. },
  76. methods: {
  77. async getTreeData() {
  78. try {
  79. this.treeLoading = true;
  80. const res = await getTreeByGroup({ type: 1 });
  81. this.treeLoading = false;
  82. if (res?.code === '0') {
  83. this.treeList = res.data;
  84. this.$nextTick(() => {
  85. // 默认高亮第一级树节点
  86. if (this.treeList[0]) {
  87. this.rootTreeId = this.treeList[0].id;
  88. this.getDetail(this.treeList[0].id);
  89. }
  90. });
  91. return this.treeList;
  92. }
  93. } catch (error) {}
  94. this.treeLoading = false;
  95. },
  96. handleNodeClick(data, node) {
  97. this.curNode = node;
  98. this.pathList = this.findParent([], data, this.treeList);
  99. this.rootTreeId = null;
  100. if (this.pathList.length == 0) {
  101. this.rootTreeId = data.id;
  102. } else {
  103. this.rootTreeId =
  104. this.pathList[this.pathList.length - 1] &&
  105. this.pathList[this.pathList.length - 1].id;
  106. }
  107. console.log(data.id);
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss" scoped>
  113. .sys-organization-list {
  114. height: calc(100vh - 165px);
  115. box-sizing: border-box;
  116. border-width: 1px;
  117. border-style: solid;
  118. overflow: auto;
  119. }
  120. .radio_box {
  121. margin: 12px 0;
  122. }
  123. .sys-organization-list :deep(.el-tree-node__content) {
  124. height: 40px;
  125. & > .el-tree-node__expand-icon {
  126. margin-left: 10px;
  127. }
  128. }
  129. </style>