|
|
@@ -16,6 +16,10 @@
|
|
|
:ratio="ratio"
|
|
|
@choosen="onChoosen"
|
|
|
/>
|
|
|
+ <bind-device-dialog
|
|
|
+ ref="bindDeviceDialog"
|
|
|
+ @choosen="onBindDeviceChoosen"
|
|
|
+ />
|
|
|
</wrapper>
|
|
|
</template>
|
|
|
|
|
|
@@ -28,6 +32,7 @@ import {
|
|
|
getProducts
|
|
|
} from '@/api/device'
|
|
|
import { publish } from '@/api/platform'
|
|
|
+import { bind as bindDevice } from '@/api/external'
|
|
|
import {
|
|
|
Access,
|
|
|
EventPriority,
|
|
|
@@ -97,7 +102,8 @@ export default {
|
|
|
: '未激活'
|
|
|
}
|
|
|
}, on: this.onTagClick },
|
|
|
- { type: 'invoke', width: canEdit ? 160 : 120, render: [
|
|
|
+ { type: 'invoke', width: canEdit ? 160 + 40 : 120 + 40, render: [
|
|
|
+ { label: '绑定设备', render ({ empty }) { return !empty }, on: this.onBindDevice },
|
|
|
{ label: '查看', render ({ empty }) { return !empty }, on: this.onViewDevice },
|
|
|
canEdit ? { label: '默认播放', render ({ isMaster, activate }) { return isMaster && activate }, on: this.onSetDefaultProgram } : null
|
|
|
].filter(val => val) }
|
|
|
@@ -195,6 +201,23 @@ export default {
|
|
|
}
|
|
|
this.$refs.eventTargetDialog.show()
|
|
|
},
|
|
|
+ onBindDevice (device) {
|
|
|
+ this.$device = {
|
|
|
+ id: device.id,
|
|
|
+ name: device.name
|
|
|
+ }
|
|
|
+ this.$refs.bindDeviceDialog.show()
|
|
|
+ },
|
|
|
+ onBindDeviceChoosen ({ value, done }) {
|
|
|
+ console.log(bindDevice)
|
|
|
+ this.$confirm(
|
|
|
+ `确定绑定设备 ?`,
|
|
|
+ { type: 'warning' }
|
|
|
+ ).then(() => {
|
|
|
+ console.log(bindDevice)
|
|
|
+ bindDevice(this.$device.id, value.deviceType, value.id).then(done)
|
|
|
+ })
|
|
|
+ },
|
|
|
onChoosen ({ value, done }) {
|
|
|
this.$confirm(
|
|
|
`将设备 ${this.$device.name} 的默认播放设置为 ${value.name} ?`,
|