设备添加遥调遥控功能
This commit is contained in:
@ -105,3 +105,12 @@ export function getKeyHistory(data) {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 遥调/遥控
|
||||
export function updateValue(data) {
|
||||
return request({
|
||||
url: '/bluetooth/updateValue',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
@ -71,6 +71,62 @@
|
||||
signalUpdateTime | formatDate
|
||||
}}</span>
|
||||
<el-button
|
||||
v-if="
|
||||
v.key == '01305001' ||
|
||||
v.key == '01303001' ||
|
||||
v.key == '01306001' ||
|
||||
v.key == '01304001'
|
||||
"
|
||||
type="primary"
|
||||
plain
|
||||
size="mini"
|
||||
@click="open(v)"
|
||||
>点击输入</el-button
|
||||
>
|
||||
<el-dropdown
|
||||
v-else-if="
|
||||
v.key == '01308001' ||
|
||||
v.key == '01308102' ||
|
||||
v.key == '01308101'
|
||||
"
|
||||
@command="handleCommand(v, $event)"
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
>
|
||||
<el-button size="mini" type="warning" plain>
|
||||
更多菜单
|
||||
<!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
|
||||
</el-button>
|
||||
<el-dropdown-menu
|
||||
v-if="v.key == '01308001'"
|
||||
slot="dropdown"
|
||||
style="min-width:80px;text-align:center"
|
||||
>
|
||||
<el-dropdown-item command="0">0</el-dropdown-item>
|
||||
<el-dropdown-item command="1">1</el-dropdown-item>
|
||||
<el-dropdown-item command="2">2</el-dropdown-item>
|
||||
<el-dropdown-item command="3">3</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
<el-dropdown-menu
|
||||
v-else
|
||||
slot="dropdown"
|
||||
style="min-width:80px;text-align:center"
|
||||
>
|
||||
<el-dropdown-item command="0">0</el-dropdown-item>
|
||||
<el-dropdown-item command="1">1</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
<el-button
|
||||
v-else-if="v.key == '01301001'"
|
||||
plain
|
||||
type="danger"
|
||||
size="mini"
|
||||
@click="handleCommand(v, 1)"
|
||||
>设备重置</el-button
|
||||
>
|
||||
<el-button
|
||||
v-else
|
||||
plain
|
||||
size="mini"
|
||||
@click="openDialog(info.deviceId, v.key)"
|
||||
>历史性能</el-button
|
||||
@ -104,7 +160,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { info, getKeyHistory } from '@/api/hardware/device';
|
||||
import { info, getKeyHistory, updateValue } from '@/api/hardware/device';
|
||||
import { getProvinceByCode } from '@/api/hardware/province';
|
||||
export default {
|
||||
name: 'DeviceDetail',
|
||||
@ -185,6 +241,60 @@ export default {
|
||||
this.getDetail();
|
||||
},
|
||||
methods: {
|
||||
handleCommand(item, command) {
|
||||
this.$confirm('确认提交?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
item.value = command;
|
||||
let query = this.info;
|
||||
query['signal'] = item;
|
||||
updateValue(query).then(({ code, data, message }) => {
|
||||
if (200 == code) {
|
||||
this.msgSuccess(message);
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.msgError(message);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
// this.$message('click on item ' + command);
|
||||
},
|
||||
open(item) {
|
||||
let keyVla = '';
|
||||
if (item.key == '01305001') {
|
||||
keyVla = '数值20-3600';
|
||||
} else if (item.key == '01306001') {
|
||||
keyVla = '字符串';
|
||||
} else {
|
||||
keyVla = '数值20-600';
|
||||
}
|
||||
this.$prompt(`请输入${keyVla}`, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPattern: /^[1-9]\d*$/,
|
||||
inputErrorMessage: '校验失败'
|
||||
})
|
||||
.then(({ value }) => {
|
||||
item.value = value;
|
||||
let query = this.info;
|
||||
query['signal'] = item;
|
||||
updateValue(query).then(({ code, data, message }) => {
|
||||
if (200 == code) {
|
||||
this.msgSuccess(message);
|
||||
this.getDetail();
|
||||
} else {
|
||||
this.msgError(message);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
// this.msgInfo('取消输入');
|
||||
});
|
||||
},
|
||||
getDetail() {
|
||||
info(this.id).then(async ({ code, msg, info }) => {
|
||||
if (200 == code) {
|
||||
|
Reference in New Issue
Block a user