设备命令

Former-commit-id: 125452ce5a6a27e148e4105f4dc2ab23ab16c9b3
Former-commit-id: 3d9f27749bd3ffcb63e28523d0a620502ab61d7f
TSXN
wanggang 5 years ago
parent b3727afed3
commit df4c922433

@ -99,7 +99,7 @@ deviceInfo['串口控制器'] = 'iot-serial-port';
function updateSelect(action, id, value) { function updateSelect(action, id, value) {
var select = $('select#' + id); var select = $('select#' + id);
if (select.length) { if (select.length) {
select.find("option[value!=null]").remove(); select.find("option[value!='']").remove();
if (value) { if (value) {
var url = config.baseUrl + '/IoTCenter/Admin/Ajax/' + action + '?parentId='+ value; var url = config.baseUrl + '/IoTCenter/Admin/Ajax/' + action + '?parentId='+ value;
$.getJSON(url, function (data) { $.getJSON(url, function (data) {

@ -100,7 +100,7 @@
<label class="col-sm-2 col-form-label">{{param.description}}:</label> <label class="col-sm-2 col-form-label">{{param.description}}:</label>
<div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);"> <div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);">
<select id="irType" class="form-control" v-model="param.value" @input="change2(index)"> <select id="irType" class="form-control" v-model="param.value" @input="change2(index)">
<option value="null">请选择</option> <option :value="null">请选择</option>
<option v-for="item in getIrTypeList()" :value="item.value">{{item.text}}</option> <option v-for="item in getIrTypeList()" :value="item.value">{{item.text}}</option>
</select> </select>
<div style="height:1em;"> <div style="height:1em;">
@ -109,7 +109,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="form-group row" v-if="param.description==='键值'&&getIrType()!=='请选择'"> <div class="form-group row" v-if="param.description==='键值'&&getIrType()">
<label class="col-sm-2 col-form-label">{{param.description}}:</label> <label class="col-sm-2 col-form-label">{{param.description}}:</label>
<div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);"> <div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);">
<iot-ir-command :type="getIrType()" :value.sync="param.value" :buttons="getIrButtons()" /> <iot-ir-command :type="getIrType()" :value.sync="param.value" :buttons="getIrButtons()" />
@ -126,7 +126,7 @@
<label class="col-sm-2 col-form-label">{{param.description}}:</label> <label class="col-sm-2 col-form-label">{{param.description}}:</label>
<div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);"> <div class="col-sm-6 form-control" style="border-color:transparent;height:auto;min-height:calc(2.25rem + 2px);">
<select class="form-control" v-model="param.value" @input="change2(index)"> <select class="form-control" v-model="param.value" @input="change2(index)">
<option value="'null'">请选择</option> <option :value="null">请选择</option>
<option v-for="item in getSPCommands()" :value="item.name">{{item.name}}</option> <option v-for="item in getSPCommands()" :value="item.name">{{item.name}}</option>
</select> </select>
<div style="height:1em;"> <div style="height:1em;">
@ -340,7 +340,7 @@
}, },
getIrType: function () { getIrType: function () {
var param = Enumerable.from(this.data.model.parameters).firstOrDefault(o => o.name === 'type'); var param = Enumerable.from(this.data.model.parameters).firstOrDefault(o => o.name === 'type');
if (param) { if (param && param.value) {
return Enumerable.from(this.getIrTypeList()).firstOrDefault(o => o.value === param.value).text; return Enumerable.from(this.getIrTypeList()).firstOrDefault(o => o.value === param.value).text;
} }
return null; return null;
@ -402,7 +402,7 @@
watch: { watch: {
'data.model.apiId': function (val, oldVal) { 'data.model.apiId': function (val, oldVal) {
var vm = this; var vm = this;
if ((oldVal === null || oldVal === 'null') && val && val !== 'null' && this.data.model.nodeId && this.data.model.deviceId) { if (oldVal === null && val && val !== 'null' && this.data.model.nodeId && this.data.model.deviceId) {
Vue.set(vm.data.data, vm.data.model.apiId, $('#apiId option:selected').text()); Vue.set(vm.data.data, vm.data.model.apiId, $('#apiId option:selected').text());
vm.errors = []; vm.errors = [];
var url = this.path + 'Api?apiId=' + val + '&deviceId=' + this.data.model.deviceId; var url = this.path + 'Api?apiId=' + val + '&deviceId=' + this.data.model.deviceId;
@ -413,7 +413,7 @@
}); });
} }
else { else {
if (val === 'null') { if (val === null) {
vm.data.model.parameters = []; vm.data.model.parameters = [];
} }
} }

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<select class="form-control" :id="name" :name="currentName" v-model="currentValue"> <select class="form-control" :id="name" :name="currentName" v-model="currentValue">
<option value="null">请选择</option> <option :value="null">请选择</option>
<option v-for="item in list" :value="item.value">{{item.text}}</option> <option v-for="item in list" :value="item.value">{{item.text}}</option>
</select> </select>
</div> </div>

Loading…
Cancel
Save