<template>
<div>

    <common @asynCallBack="asynCallBack"></common>
    <top-header :pageTitle="pageTitle" :routeName="routeName"></top-header>
    <div class="mui-content">
        <div class="mui-content-padded vongi-qingjiadt vongi-editme">
            <form class="mui-input-group">
                <div class="mui-input-row">
                    <label>设备名称</label>
                    <span>{{detail.name}}</span>
                </div>
                <div class="mui-input-row">
                    <label>设备序列号</label>
                    <span>{{detail.onId}}</span>
                </div>
            </form>
        </div>
        <div class="mui-content-padded vongi-qingjiadt vongi-editme">
            <form class="mui-input-group">
                <div class="mui-input-row">
                    <label>分配人员ID<i class="colorfe616c">*</i></label>
                    <input type="text" class="mui-input-clear" v-model="detail.personId" placeholder="输入人员ID">
                </div>
            </form>
        </div>
        <div class="vongi-btn vongi-login-btn">
            <button class="mui-btn mui-btn-primary" @click="submit()">保 存</button>
        </div>
    </div>
</div>
</template>

<script>
import * as API_Device from "@/apis/Common/device";
import Common from '$project/components/Common.vue'
import Loading from '$project/components/Loading.vue'
import TopHeader from '$project/components/TopHeader.vue'
import {
    mapGetters,
    mapMutations
} from 'vuex'
export default {
    name: 'CommonDeviceLiveBindInfo',
    components: {
        Common,
        Loading,
        TopHeader
    },
    data() {
        return {
            pageTitle: '关联新设备',
            routeName: "CommonDeviceLiveBindList",

            isLoading: false,
            detail: {},

        }
    },
    created() {
        this.detail = this.$route.query;
        this.routeName = this.$route.query.routeName;
    },
    methods: {
        //获取详情
        submit() {

            this.isLoading = true;
            if (!this.detail.personId) {
                this.detail.personId = "0"
            }
            API_Device.liveUpdate(this.detail).then(response => {

                this.isLoading = false;
                mui.toast("操作成功");
                //跳转首页
                this.$router.push({
                    name: this.routeName,
                    query: {}
                })
            }).catch(error => {
                this.isLoading = false;
                mui.toast(error);
            })
        },

        asynCallBack() {

        },
    },
    mounted() {
        //获取详情

    },
    destroyed() {},
    computed: {
        ...mapGetters({
            openId: 'wx_openid',
            token: 'token',
        })
    },
}
</script>

<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style>
</style>
