优化设备详情操作
This commit is contained in:
parent
da1efc29bf
commit
4595f6373b
|
@ -112,3 +112,11 @@ export function switchDevice(deviceId, open) {
|
|||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 强制解绑设备
|
||||
export function unbind(deviceId) {
|
||||
return request({
|
||||
url: `/system/device/${deviceId}/unbind`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -3,10 +3,29 @@
|
|||
<el-card class="box-card">
|
||||
<el-descriptions title="设备详情">
|
||||
<template slot="extra">
|
||||
<el-button icon="el-icon-switch-button" @click="handleSwitch(true)">强制开启</el-button>
|
||||
<el-button icon="el-icon-switch-button" @click="handleSwitch(false)">强制关闭</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="handleReset">时长归零</el-button>
|
||||
<el-button icon="el-icon-plus" @click="handleAddElectricity">增加时长</el-button>
|
||||
<el-dropdown style="margin-right: 1em">
|
||||
<el-button>
|
||||
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" icon="el-icon-plus" @click="handleAddElectricity">增加时长</el-link>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" icon="el-icon-refresh" @click="handleReset">时长归零</el-link>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" icon="el-icon-switch-button" @click="handleSwitch(true)">强制开启</el-link>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" icon="el-icon-switch-button" @click="handleSwitch(false)">强制关闭</el-link>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item>
|
||||
<el-link :underline="false" icon="el-icon-link" type="danger" @click="handleUnbnd" :disabled="deviceData.userId == null">强制解绑</el-link>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
||||
<el-button icon="el-icon-refresh" @click="refreshIot" style="margin-right: 1em">刷新设备信息</el-button>
|
||||
<el-popover
|
||||
placement="left"
|
||||
|
@ -30,7 +49,7 @@
|
|||
<el-descriptions-item label="型号标签">
|
||||
<dict-tag :options="dict.type.sm_model_tag" :value="deviceData.modelTags" size="mini"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属商户">{{deviceData.userName | defaultValue}}</el-descriptions-item>
|
||||
<el-descriptions-item label="所属用户">{{deviceData.userName | defaultValue}}</el-descriptions-item>
|
||||
<el-descriptions-item label="店铺名称">{{deviceData.storeName | defaultValue}}</el-descriptions-item>
|
||||
<!-- <el-descriptions-item label="断电方式">-->
|
||||
<!-- <dict-tag v-if="deviceData.outageWay != null" :options="dict.type.sm_device_outage_way" :value="deviceData.outageWay" size="mini"/>-->
|
||||
|
@ -91,7 +110,7 @@
|
|||
|
||||
<script>
|
||||
|
||||
import { addTime, getDevice, refreshIot, resetDevice, switchDevice } from '@/api/system/device'
|
||||
import { addTime, getDevice, refreshIot, resetDevice, switchDevice, unbind } from '@/api/system/device'
|
||||
import LineChart from "@/views/dashboard/LineChart.vue";
|
||||
import RechargeRecord from "@/views/system/device/components/rechargeRecord.vue";
|
||||
import {formatDate} from "@/utils";
|
||||
|
@ -145,8 +164,24 @@ export default {
|
|||
clearInterval(this.timer);
|
||||
},
|
||||
methods: {
|
||||
handleUnbnd() {
|
||||
this.$confirm('是否强制解绑该设备?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
unbind(this.deviceData.deviceId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
}
|
||||
}).finally(() => {
|
||||
this.getDevice();
|
||||
})
|
||||
})
|
||||
},
|
||||
handleSwitch(open) {
|
||||
this.$confirm(`是否确认强制${open ? '开启' : '关闭'}设备?`, '提示', {
|
||||
this.$confirm(`是否确认强制${open ? '开启' : '关闭'}设备?`, '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
@ -175,7 +210,7 @@ export default {
|
|||
return ((expireTime - now) / 60000).toFixed(2);
|
||||
},
|
||||
handleReset() {
|
||||
this.$confirm('是否确认归零设备?', '提示', {
|
||||
this.$confirm('是否确认归零设备?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
|
Loading…
Reference in New Issue
Block a user