From 2ae60f81bbef5b2de4a9cc3e90bbedf19e8e4446 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 07 三月 2024 10:24:00 +0800
Subject: [PATCH] mrshi

---
 admin/src/views/business/deviceRole.vue |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/admin/src/views/business/deviceRole.vue b/admin/src/views/business/deviceRole.vue
index 221feb0..776c49d 100644
--- a/admin/src/views/business/deviceRole.vue
+++ b/admin/src/views/business/deviceRole.vue
@@ -28,7 +28,7 @@
                 <el-table-column prop="isDefault" label="鏄惁榛樿" min-width="100px">
                     <template slot-scope="{row}">
                         <el-switch
-                            @change="changeIsDefault"
+                            @change="changeIsDefault($event, row.id)"
                             v-model="row.isDefault"
                             active-color="#13ce66"
                             inactive-color="#ff4949"
@@ -86,13 +86,13 @@
       module: '闂ㄧ瑙掕壊',
       api: '/business/deviceRole',
       'field.id': 'id',
-      'field.main': 'id'
+      'field.main': 'name'
     })
     this.search()
   },
   methods: {
-    changeIsDefault (r) {
-      updateStatusById({ isDefault: r, type: 2 })
+    changeIsDefault (r, id) {
+      updateStatusById({ isDefault: r, type: 2, id })
         .finally(() => {
           this.search()
         })
@@ -100,8 +100,10 @@
     edit (row) {
       if (row.doorIds) {
         row.radio = 1
-        row.doorIds = row.doorIds.split(',')
-        row.doorIds = row.doorIds.map(item => Number(item))
+        if (typeof row.doorIds !== 'object') {
+          row.doorIds = row.doorIds.split(',')
+          row.doorIds = row.doorIds.map(item => Number(item))
+        }
       } else {
         row.radio = 0
         row.doorIds = []

--
Gitblit v1.9.3