ソースを参照

添加调试功能

lincl 1 年間 前
コミット
797adc4d68

+ 9 - 0
mini-pro-web/src/api/api-medicineAbinet.js

@ -753,6 +753,15 @@ let service = {
			data
		});
    },
	//触发设备端更新事件
	systemUpdate: function(data) {
		return request({
			url: `${BASE}/baseDevice/systemUpdate`,
			method: "post",
			data
		});
    },
};
export default service;

+ 9 - 0
mini-pro-web/src/views/device/detail.vue

@ -80,6 +80,12 @@
                    </div>
                    <div>维护/上架</div>
                </div>
                <div v-if="debugDeviceAuth" class='c-t-center' @click='gotoUrl("/device/reboot", {equNum: info.equNum, equName: info.equName})'>
                    <div>
                        <van-image class='ability' :src='require("@/assets/images/shebeichongqi.png")'/>
                    </div>
                    <div>设备调试</div>
                </div>
                <!-- <div class='c-t-center' @click='gotoUrl("/device/temperature/index", {id: $route.query.id})'>
                    <div>
@ -184,6 +190,9 @@ export default {
        putDeviceAuth(){
            return this.hasAuth('putDevice')
        },
        debugDeviceAuth(){
            return this.hasAuth('debugDevice')
        },
    },
    created() {
        this.findById()

+ 77 - 14
mini-pro-web/src/views/device/reboot.vue

@ -1,34 +1,97 @@
<template>
    <div class='deviceReboot'>
        <div class='c-333 c-f14 p15 bgc-fff c-border-b'>
            <div>设置重连时间</div>
            <van-field class='mt10 c-border' v-model="time"  placeholder="请输入重连时间" />
        </div>
        <div class='mt30 plr15'>
            <van-button style='width:100%' class='c-border-r-5' type="info" @click="reboot">立即重启</van-button>
        <div class="plr16 ptb16">
            <van-button block  class='c-border-r-5' type="info" @click="toggleDebug('openDebug')">开启调试</van-button>
            <van-button block class='c-border-r-5' type="info" @click="toggleDebug('closeDebug')">关闭调试</van-button>
            <van-button block class='c-border-r-5' type="danger" @click="systemUpdate()">设备程序更新</van-button>
            <van-button block class='c-border-r-5' type="danger" @click="exeUpdate()">更新药柜程序</van-button>
        </div>
    </div>
</template>
<script>
import medicineAbinetApi from '@/api/api-medicineAbinet'
export default{
    name: 'deviceReboot',
    data(){
        return {
            time: '',
            equNum: this.$route.query.equNum,
            equName: this.$route.query.equName,
        }
    },
    methods:{
        reboot(){
        }
        toggleDebug(event){
            var p = {
                equNum: this.equNum,
                type: event,
                mess: '开启关闭debugger'
            }
            medicineAbinetApi
                .systemUpdate(p)
                .then(res => {
                    this.$toast('操作成功')
                })
                .catch(err=>{
                    console.error(err)
                })
        },
        systemUpdate(){
            var { equName, equNum } = this
            var message = `确认更新${equName}设备?`
            
            this.$dialog.confirm({
                title: '',
                message,
            })
            .then(() => {
                this.$loading('')
                var p = {
                    equNum,
                    type: 'systemUpdate',
                    mess: 'web程序更新'
                }
				medicineAbinetApi
					.systemUpdate(p)
					.then(res => {
                        this.$toast('操作成功')
					})
					.catch(err=>{
						console.error(err)
					})
			})
        },
        exeUpdate(){
            var { equName, equNum } = this
            var message = `确认更新${equName}药柜程序?`
            
            this.$dialog.confirm({
                title: '',
                message,
            })
            .then(() => {
                var p = {
                    equNum,
                    type: 'exeUpdate',
                    mess: 'exe程序更新'
                }
				medicineAbinetApi
					.systemUpdate(p)
					.then(res => {
                        this.$toast('操作成功')
					})
					.catch(err=>{
						console.error(err)
					})
			})
        },
    },
    created(){
        
    }
}
</script>
<style scoped lang='scss'>
.deviceReboot{
    .van-button{
        &+.van-button{
            margin-top: 10px;
        }
    }
}
</style>