huang_an hace 2 años
padre
commit
22ff8586b0

+ 18 - 3
src/components/AssetTree/index.vue

@@ -55,11 +55,15 @@
       nodeKey: {
         type: String,
         default: 'id'
-      }
+      },
       // appendRoot: {
       //   type: Boolean,
       //   default: false
       // },
+      eqDevice: {
+        type: String,
+        default: ''
+      }
     },
     data() {
       return {
@@ -87,8 +91,19 @@
           const res = await getTreeByPid(id ? id : this.id);
           this.treeLoading = false;
           if (res?.code === '0') {
-            this.treeList = res.data;
-            this.$emit('setRootId', res.data[0].id);
+            if (this.eqDevice == 'sb') {
+              const arr = res.data.filter(
+                (item) => item.id == '4' || item.id == '1747157638286274562'
+              );
+              this.treeList = arr;
+            } else {
+              this.treeList = res.data;
+            }
+
+            this.$emit(
+              'setRootId',
+              this.eqDevice == 'sb' ? '4' : res.data[0].id
+            );
             if (this.treeFormate) {
               this.treeList = this.treeFormate(this.treeList);
             }

+ 2 - 1
src/views/ledgerAssets/equipment/index.vue

@@ -11,9 +11,10 @@
             <AssetTree
               @handleNodeClick="handleNodeClick"
               @setRootId="setRootId"
-              id="4"
+              id="0"
               :paramsType="'type'"
               ref="treeList"
+              eqDevice="sb"
             />
           </div>
         </div>

+ 5 - 4
src/views/ledgerAssets/meter/index.vue

@@ -11,9 +11,10 @@
             <AssetTree
               @handleNodeClick="handleNodeClick"
               @setRootId="setRootId"
-              id="1738160749383847938"
+              id="15"
               ref="treeList"
             />
+            <!-- 1738160749383847938 -->
           </div>
         </div>
         <template v-slot:content>
@@ -37,7 +38,7 @@
       AssetTree,
       DataList
     },
-    data () {
+    data() {
       return {
         // 加载状态
         loading: false,
@@ -49,11 +50,11 @@
     },
     computed: {},
     methods: {
-      handleNodeClick (info) {
+      handleNodeClick(info) {
         this.current = info;
       },
       // 获取根节点id
-      setRootId (id) {
+      setRootId(id) {
         this.rootId = id;
       }
     }

+ 5 - 4
src/views/ledgerAssets/office/index.vue

@@ -11,9 +11,10 @@
             <AssetTree
               @handleNodeClick="handleNodeClick"
               @setRootId="setRootId"
-              id="1738398598494519297"
+              id="16"
               ref="treeList"
             />
+            <!-- 1738398598494519297 -->
           </div>
         </div>
         <template v-slot:content>
@@ -37,7 +38,7 @@
       AssetTree,
       DataList
     },
-    data () {
+    data() {
       return {
         // 加载状态
         loading: false,
@@ -49,11 +50,11 @@
     },
     computed: {},
     methods: {
-      handleNodeClick (info) {
+      handleNodeClick(info) {
         this.current = info;
       },
       // 获取根节点id
-      setRootId (id) {
+      setRootId(id) {
         this.rootId = id;
       }
     }

+ 2 - 1
vue.config.js

@@ -32,9 +32,10 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://192.168.3.51:18086', // 测试环境
-        target: 'http://124.71.68.31:50001',
+        // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.139:18086', // 粟
         // target: 'http://192.168.1.132:18086', // 徐
+        target: 'http://192.168.1.114:18086', //本
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''