Explorar el Código

优化了设备管理模块的交互 逻辑

linan-0110 hace 5 años
padre
commit
4187645c59

+ 5 - 1
src/module.js

@@ -1,6 +1,9 @@
 import Logo from './components/Logo.vue'
 import routes from './router/routes'
 import storeModule from './store/store-module'
+
+import DeviceType from './views/deviceManagement/DeviceType.vue'
+import DeviceInfo from './views/deviceManagement/DeviceInfo.vue'
 export default function(Vue) {
   Vue.config.productionTip = false
   this.$router.addRoutes(routes)
@@ -8,5 +11,6 @@ export default function(Vue) {
   this.$eventBus.on('visitedAbout', () => {
     alert('用户访问了about页面99。')
   })
-  this.$dynamicComponent.create(Logo)
+  this.$dynamicComponent.create(DeviceType)
+  this.$dynamicComponent.create(DeviceInfo)
 }

+ 1 - 3
src/views/Home/Home.vue

@@ -83,9 +83,7 @@
                 </div>
                 <div class="col2">
                     <div class="warp">
-                        <keep-alive>
-                            <router-view />
-                        </keep-alive>
+                        <router-view />
                     </div>
                 </div>
             </div>

+ 2 - 6
src/views/deviceManagement/DeviceInfo.vue

@@ -159,7 +159,7 @@ export default {
     },
     created() {
         this.loadTypeList();
-        this.doSearch()
+        this.doSearch();
     },
     methods: {
         ...mapActions(["fetch"]),
@@ -177,7 +177,6 @@ export default {
                     keywords: this.searchParams.keywords
                 }, //目前只有一个组织,其他参数调整钟
                 success: res => {
-                    console.log(res);
                     this.deviceList = res;
                 },
                 fail: err => {
@@ -207,7 +206,6 @@ export default {
                 method: "GET",
                 data: { parentId: pid }, // 动态加载
                 success: res => {
-                    console.log(res);
                     if (pid < 0) {
                         this.typeList = res;
                         this.typeTree.push(this.typeList);
@@ -272,10 +270,8 @@ export default {
         },
         // 子设备管理
         subDeviceAdmin(row) {
-            console.log(row);
-            // SubDeviceAdmin
             this.$router.push({
-                name: "subDeviceAdmin",
+                path: "/subDeviceAdmin",
                 query: row
             });
         },

+ 7 - 7
src/views/deviceManagement/SubDeviceAdmin.vue

@@ -16,7 +16,7 @@
             <el-table-column prop="communicationId" label="通讯ID"></el-table-column>
             <el-table-column prop="deviceNo" label="MAC/SN"></el-table-column>
             <el-table-column prop="channelNo" label="通道"></el-table-column>
-            <el-table-column label="是否可用(0-不可用 1-可用)">
+            <el-table-column label="是否可用">
                 <template slot-scope="scope">
                     <span>{{ scope.row.enable==1?"可用":scope.row.enable==0?"不可用":scope.row.enable }}</span>
                 </template>
@@ -79,11 +79,8 @@ export default {
             editParmas: {} // 保存编辑的 请求参数
         };
     },
-    created() {
+    created() { 
         this.mainDeviceInfo = this.$route.query;
-        console.log(this.$route.query);
-    },
-    mounted() {
         // 获取子设备信息列表
         this.doSubDeviceList();
     },
@@ -192,7 +189,11 @@ export default {
                         channelNo: "",
                         enable: 1
                     };
-                    this.$message.success(this.isAdd?"添加子设备信息成功!":"编辑子设备信息成功!");
+                    this.$message.success(
+                        this.isAdd
+                            ? "添加子设备信息成功!"
+                            : "编辑子设备信息成功!"
+                    );
                 },
                 fail: err => {
                     console.log(err);
@@ -213,5 +214,4 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-
 </style>

+ 2 - 3
vue.config.js

@@ -2,7 +2,7 @@ module.exports = {
   publicPath: './', // 这个值被设置为空字符串 ('') 或是相对路径 ('./'),这样所有的资源都会被链接为相对路径,这样打出来的包可以被部署在任意路径。
   configureWebpack: {
     resolve: {
-      symlinks: false
+      symlinks: true
     }
   },
   pluginOptions: {
@@ -14,6 +14,7 @@ module.exports = {
     }
   },
   devServer: {
+    disableHostCheck: true
     // proxy: {
     //   '/api': {                //这里最好有一个 /
     //     target: 'http://115.238.57.190:8010',         // 服务器端接口地址
@@ -23,9 +24,7 @@ module.exports = {
     //     pathRewrite: {
     //       '^/api': ''
     //     }
-
     //   }
     // }
-
   }
 }