From 17efddc6a667670dca682bf36b51a43e99615e6d Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 16 十月 2024 15:59:38 +0800
Subject: [PATCH] 代码初始化

---
 admin/src/views/business/deviceRole.vue |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/admin/src/views/business/deviceRole.vue b/admin/src/views/business/deviceRole.vue
index 221feb0..97d0395 100644
--- a/admin/src/views/business/deviceRole.vue
+++ b/admin/src/views/business/deviceRole.vue
@@ -1,9 +1,9 @@
 <template>
     <TableLayout :permissions="['business:devicerole:query']">
         <!-- 鎼滅储琛ㄥ崟 -->
-        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
-            <el-form-item label="闂ㄧ缁勫悕绉�" prop="name">
-                <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ラ棬绂佺粍鍚嶇О" @keypress.enter.native="search"></el-input>
+        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="110px" inline>
+            <el-form-item title="闂ㄧ鐐瑰垎缁勫悕绉�" prop="name">
+                <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ラ棬绂佺偣鍒嗙粍鍚嶇О" @keypress.enter.native="search"></el-input>
             </el-form-item>
             <section>
                 <el-button type="primary" @click="search">鎼滅储</el-button>
@@ -13,7 +13,7 @@
         <!-- 琛ㄦ牸鍜屽垎椤� -->
         <template v-slot:table-wrap>
             <ul class="toolbar" v-permissions="['business:devicerole:create', 'business:devicerole:delete']">
-                <li><el-button type="primary" @click="$refs.operaDeviceRoleWindow.open('鏂板缓闂ㄧ瑙掕壊')" icon="el-icon-plus" v-permissions="['business:devicerole:create']">鏂板缓</el-button></li>
+                <li><el-button type="primary" @click="$refs.operaDeviceRoleWindow.open('鏂板缓闂ㄧ鐐瑰垎缁�')" icon="el-icon-plus" v-permissions="['business:devicerole:create']">鏂板缓</el-button></li>
                 <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:devicerole:delete']">鍒犻櫎</el-button></li>
             </ul>
             <el-table
@@ -23,12 +23,12 @@
                 @selection-change="handleSelectionChange"
             >
                 <el-table-column type="selection" width="55"></el-table-column>
-                <el-table-column prop="name" label="闂ㄧ缁勫悕绉�" min-width="100px"></el-table-column>
+                <el-table-column prop="name" label="闂ㄧ鐐瑰垎缁�" min-width="100px"></el-table-column>
                 <el-table-column prop="memberNum" label="浣跨敤浜烘暟" min-width="100px"></el-table-column>
                 <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"
@@ -83,16 +83,16 @@
   },
   created () {
     this.config({
-      module: '闂ㄧ瑙掕壊',
+      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,13 +100,15 @@
     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 = []
       }
-      this.$refs.operaDeviceRoleWindow.open('缂栬緫闂ㄧ瑙掕壊', row)
+      this.$refs.operaDeviceRoleWindow.open('缂栬緫闂ㄧ鐐瑰垎缁�', row)
     }
   }
 }

--
Gitblit v1.9.3