Browse Source

将重复逻辑剔除

DESKTOP-2S67K1S\31396 2 năm trước cách đây
mục cha
commit
0ec8fd29a2

+ 25 - 5
src/views/device/list/detail.vue

@@ -109,13 +109,15 @@
 </template>
 
 <script>
+import { categoryList } from "@/api/device/category";
+import { functionList } from "@/api/device/function";
 import { Add, Detail, Edit } from "@/api/device/list";
-import { category, functions, devType } from "../mixin/index";
+import { devTypeMixin } from "@/mixin/index";
 import Upload from "@/components/Upload/index";
 import Editor from "@/components/Editor/index";
 
 export default {
-  mixins: [category, functions, devType],
+  mixins: [devTypeMixin],
   components: {
     Upload,
     Editor
@@ -181,12 +183,30 @@ export default {
       }, {
         value: 'QiXinWei',
         label: 'QiXinWei'
-      }]
+      }],
+      functionOptions: [],
+      categoryOptions: []
     };
   },
   mounted() {
-    this.disabled = this.$route.query.key === "查看" ? true : false;
-    this.getList();
+    this.disabled = this.$route.query.key === "查看" ? true : false
+    this.getList()
+    // 权限列表
+    functionList({
+      isDelete: 0
+    }).then((res) => {
+      if (res.code === 0) {
+        this.functionOptions = res.data;
+      }
+    });
+    // 设备类型
+    categoryList({
+      status: 1,
+    }).then((res) => {
+      if (res.code === 0) {
+        this.categoryOptions = res.data;
+      }
+    });
   },
   methods: {
     // 详情

+ 2 - 3
src/views/device/version/detail.vue

@@ -65,10 +65,9 @@
 <script>
 import { getDetailInfo, updateEdit, getVersionAdd } from "@/api/device/version";
 import Upload from "@/components/Upload/index";
-import { devMixin } from '@/mixin/index'
-import { devType } from '../mixin/index'
+import { devMixin, devTypeMixin } from '@/mixin/index'
 export default {
-  mixins: [devMixin, devType],
+  mixins: [devMixin, devTypeMixin],
   components: {
     Upload,
   },

+ 2 - 3
src/views/device/version/index.vue

@@ -53,10 +53,9 @@
 
 <script>
 import { getPageList, getVersionDelete } from '@/api/device/version'
-import { devMixin } from '@/mixin/index'
-import { devType } from '../mixin/index'
+import { devMixin, devTypeMixin } from '@/mixin/index'
 export default {
-  mixins: [devMixin, devType],
+  mixins: [devMixin, devTypeMixin],
   data() {
     return {
       // 遮罩层

+ 2 - 2
src/views/device/yxw/index.vue

@@ -64,9 +64,9 @@
 
 <script>
 import { getYxwPage, getYxwAdd } from "@/api/device/yxw";
-import { devType } from '../mixin/index'
+import { devTypeMixin } from '@/mixin/index'
 export default {
-  mixins: [devType],
+  mixins: [devTypeMixin],
   data() {
     return {
       // 遮罩层