Explorar el Código

feat(transmitter): support transmitter unbinding

Casper Dai hace 3 años
padre
commit
6d952868db
Se han modificado 1 ficheros con 19 adiciones y 12 borrados
  1. 19 12
      src/views/device/detail/components/external/Transmitter/index.vue

+ 19 - 12
src/views/device/detail/components/external/Transmitter/index.vue

@@ -12,14 +12,14 @@
         <div class="c-info large">
           <div class="l-flex--row has-bottom-padding u-bold">
             <span class="c-sibling-item">发送控制设备信息</span>
-            <!-- <span
+            <span
               v-if="canEdit"
               class="c-sibling-item c-info__edit u-pointer"
-              @click="onBind"
+              @click="onUnbind"
             >
               <i class="el-icon-edit" />
-              
-            </span> -->
+              
+            </span>
           </div>
           <div class="l-flex--row c-info__block">
             <div class="l-flex--row l-flex__fill c-info__item">
@@ -86,11 +86,15 @@
 <script>
 import {
   getDeviceSendingCard,
-  // getSendingCardManufacturers,
+  getSendingCardManufacturers,
   getSendingCards,
-  bindSendingCard
+  bindSendingCard,
+  unbind
 } from '@/api/external'
-import { Transmitter } from '@/constant'
+import {
+  Access,
+  Transmitter
+} from '@/constant'
 import { createListOptions } from '@/utils'
 
 export default {
@@ -110,10 +114,10 @@ export default {
       info: null,
       options: createListOptions({ manufacturerKey: void 0 }),
       schema: {
-        // condition: { manufacturerKey: void 0 },
-        // filters: [
-        //   { key: 'manufacturerKey', type: 'select', placeholder: '全部厂家', value: 'manufacturerKey', label: 'manufacturerName', invoke: getSendingCardManufacturers }
-        // ],
+        condition: { manufacturerKey: void 0 },
+        filters: [
+          { key: 'manufacturerKey', type: 'select', placeholder: '全部厂家', value: 'manufacturerKey', label: 'manufacturerName', invoke: getSendingCardManufacturers }
+        ],
         list: getSendingCards,
         cols: [
           { prop: 'manufacturerName', label: '厂商' },
@@ -125,7 +129,7 @@ export default {
   },
   computed: {
     canEdit () {
-      return this.accessSet.has(this.Access.MANAGE_DEVICES)
+      return this.accessSet.has(Access.MANAGE_DEVICES)
     },
     type () {
       return this.info && this.info.flag & Transmitter.IS_ASYNC ? '异步盒' : '非异步盒'
@@ -167,6 +171,9 @@ export default {
         done()
         this.getDeviceSendingCard()
       })
+    },
+    onUnbind () {
+      unbind(this.info.id).then(this.getDeviceSendingCard)
     }
   }
 }