Browse Source

设备管理公共方法和属性

DESKTOP-O04BTUJ\muzen 3 years atrás
parent
commit
ab9369c8b2
1 changed files with 20 additions and 60 deletions
  1. 20 60
      src/views/device/mixin/index.js

+ 20 - 60
src/views/device/mixin/index.js

@@ -1,39 +1,18 @@
-// 设备类型
-const typeMixin = {
-  data() {
-    return {
-      typeOptions: [{
-          value: 1,
-          label: "蓝牙",
-        },
-        {
-          value: 2,
-          label: "WiFi",
-        },
-        {
-          value: 3,
-          label: "传统蓝牙",
-        },
-        {
-          value: 4,
-          label: "4G",
-        },
-      ]
-    }
-  }
-}
-
-// 设备型号
 import {
   getClientTypeList
 } from '@/api/device/version'
-const clientTypeMixin = {
+import {
+  categoryList
+} from "@/api/device/category";
+
+const clientType = {
   data() {
     return {
       clientTypeOptions: [],
     }
   },
   created() {
+    // 设备型号
     getClientTypeList().then(res => {
       if (res.code === 0) {
         let index = 1
@@ -49,44 +28,25 @@ const clientTypeMixin = {
   }
 }
 
-// 使用分类
-const deviceTypeMixin = {
+const category = {
   data() {
     return {
-      deviceTypeOptions: [{
-        value: 0,
-        label: '音响'
-      }, {
-        value: 1,
-        label: '耳机'
-      }, {
-        value: 3,
-        label: '穿戴'
-      }],
-    }
-  }
-}
-
-// 升级方式
-const upgradeTypeMixin = {
-  data() {
-    return {
-      upgradeTypeOptions: [{
-          value: 1,
-          label: "强制",
-        },
-        {
-          value: 2,
-          label: "指定",
-        },
-      ],
+      categoryOptions: []
     }
+  },
+  created() {
+    // 设备类型
+    categoryList({
+      status: 1,
+    }).then((res) => {
+      if (res.data.code === 0) {
+        this.categoryOptions = res.data.data;
+      }
+    });
   }
 }
 
 export {
-  typeMixin,
-  clientTypeMixin,
-  deviceTypeMixin,
-  upgradeTypeMixin
+  clientType,
+  category
 }