| | |
| | | <el-tag type="danger" v-if="scope.row.status == 2">暂停</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="告警级别" align="center" prop="alertLevel"> |
| | | <el-table-column label="告警级别" align="center" prop="alertLevel" width="120"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.iot_alert_level" :value="scope.row.alertLevel" /> |
| | | </template> |
| | |
| | | placeholder="选择执行时间" @change="timeChange" |
| | | :disabled="item.isAdvance == 1"></el-time-picker> |
| | | </el-col> |
| | | <el-col :span="2" :offset="item.source == 1 ? 17 : 1" v-if="index != 0"><a style="color:#F56C6C" |
| | | @click="removeTriggerItem(index)">删除</a></el-col> |
| | | <el-tag style="float: right;" type="success" :span="2" @click="removeTriggerItem(index)" :offset="item.source == 1 ? 17 : 1" v-if="index != 0"><i style="color:#F56C6C" class="el-icon-delete"></i><a style="color:#F56C6C" |
| | | >删除</a></el-tag> |
| | | </el-row> |
| | | |
| | | <!--定时--> |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="4" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <el-select v-model="item.id" placeholder="请选择" size="small" @change="changevalue"> |
| | | <el-col :span="5" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <el-select v-model="item.id" placeholder="请选择" size="small" @change="changevalue(index,item.id)"> |
| | | <el-option v-for="subItem in item.modelType1Data" :key="subItem.id" |
| | | :label="subItem.name" :value="subItem.id"> |
| | | </el-option> |
| | |
| | | <el-form-item label="执行动作"> |
| | | <el-row v-for="(item, index) in form.actions" :key="index" style="margin-bottom:10px;"> |
| | | <el-col :span="4"> |
| | | <el-select v-model="item.type" placeholder="请选择" @change="changeModelType2(index, item.type)"> |
| | | <el-option v-for="subItem in modelTypes" :key="subItem.value" :label="subItem.label" |
| | | <el-select v-model="item.type" placeholder="请选择" @change="changeModelType2(index, item.type)" size="small"> |
| | | <el-option v-for="subItem in modelTypes2" :key="subItem.value" :label="subItem.label" |
| | | :value="subItem.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="4" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <el-select v-model="item.id" placeholder="请选择" @change="changevalue2"> |
| | | <el-col :span="5" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <el-select v-model="item.id" placeholder="请选择" @change="changevalue2(index,item.id)"> |
| | | <el-option v-for="subItem in item.modelType2Data" :key="subItem.id" :label="subItem.name" |
| | | :value="subItem.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-col> |
| | | <el-col :span="11" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <el-col :span="10" :offset="1" v-if="item.modelType != 4 && item.modelType != 5"> |
| | | <!-- <el-input v-model="item.value" placeholder="值" /> --> |
| | | <el-input placeholder="值" v-model="item.value" |
| | | <el-input placeholder="值" v-model="item.value" size="small" |
| | | v-if="(item.dataValue.type == 'integer' || item.dataValue.type == 'decimal') && !item.dataValue.enumList" |
| | | :max="item.dataValue.max" :min="item.dataValue.min" :step="item.dataValue.step"> |
| | | <!-- <template> |
| | |
| | | :inactive-value="0" /> |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="2" :offset="1" v-if="index != 0"><a style="color:#F56C6C" |
| | | @click="removeActionItem(index)">删除</a></el-col> |
| | | <!-- v-if="index != 0" --> |
| | | <el-tag type="success" style="margin-left: 10px;" @click="removeActionItem(index)" :span="2" :offset="1" ><i class="el-icon-delete"></i> <a style="color:#F56C6C" |
| | | >删除</a></el-tag> |
| | | </el-row> |
| | | <div>+ <a style="color:#409EFF" @click="addActionItem()">添加执行动作</a></div> |
| | | </el-form-item> |
| | |
| | | value: 5, |
| | | label: '设备下线' |
| | | }], |
| | | modelTypes2: [{ |
| | | value: 1, |
| | | label: '属性' |
| | | }, { |
| | | value: 2, |
| | | label: '功能' |
| | | }], |
| | | // 触发器条件 |
| | | triggerConditions: [{ |
| | | value: "all", |
| | |
| | | } else if (e == 3) { |
| | | this.form.triggers[index].modelType1Data = this.thingsModel.events |
| | | } |
| | | this.form.triggers[index].id = this.form.triggers[index].modelType1Data[0].id |
| | | this.form.triggers[index].dataValue=this.form.triggers[index].modelType1Data[0].datatype |
| | | |
| | | }, |
| | | editTriggers(index, e) { |
| | | this.selectIndex1 = index |
| | |
| | | |
| | | |
| | | }, |
| | | changevalue(e) { |
| | | |
| | | changevalue(index,e) { |
| | | this.selectIndex1=index |
| | | this.form.triggers[this.selectIndex1].dataValue = {} |
| | | for (let i = 0; i < this.form.triggers[this.selectIndex1].modelType1Data.length; i++) { |
| | | if (e == this.form.triggers[this.selectIndex1].modelType1Data[i].id) { |
| | |
| | | this.form.triggers[this.selectIndex1].id = e |
| | | this.form.triggers[this.selectIndex1].dataValue = this.form.triggers[this.selectIndex1].modelType1Data[i].datatype |
| | | this.form.triggers[this.selectIndex1].name = this.form.triggers[this.selectIndex1].modelType1Data[i].name |
| | | this.form.triggers[this.selectIndex1].value = '' |
| | | } |
| | | } |
| | | }, |
| | | changeModelType2(index, e) { |
| | | this.selectIndex2 = index |
| | | |
| | | this.form.actions[index].id = '' |
| | | // this.form.actions[index].id = '' |
| | | this.form.actions[index].value = '' |
| | | this.form.actions[index].type = e |
| | | this.form.actions[index].dataValue = {} |
| | | if (e == 1) { |
| | | this.form.actions[index].modelType2Data = this.thingsModel.properties |
| | | |
| | | } else if (e == 2) { |
| | | this.form.actions[index].modelType2Data = this.thingsModel.functions |
| | | } else if (e == 3) { |
| | | this.form.actions[index].modelType2Data = this.thingsModel.events |
| | | } |
| | | this.form.actions[index].id = this.form.actions[index].modelType2Data[0].id |
| | | this.form.actions[index].dataValue=this.form.actions[index].modelType2Data[0].datatype |
| | | |
| | | |
| | | }, |
| | | editactions(index, e) { |
| | |
| | | } |
| | | } |
| | | }, |
| | | changevalue2(e) { |
| | | changevalue2(index,e) { |
| | | this.selectIndex2=index |
| | | this.form.actions[this.selectIndex2].dataValue = {} |
| | | for (let i = 0; i < this.form.actions[this.selectIndex2].modelType2Data.length; i++) { |
| | | if (e == this.form.actions[this.selectIndex2].modelType2Data[i].id) { |
| | | this.form.actions[this.selectIndex1].id = e |
| | | this.form.actions[this.selectIndex2].id = e |
| | | this.form.actions[this.selectIndex2].dataValue = this.form.actions[this.selectIndex2].modelType2Data[i].datatype |
| | | this.form.actions[this.selectIndex1].name = this.form.actions[this.selectIndex2].modelType2Data[i].name |
| | | this.form.actions[this.selectIndex2].name = this.form.actions[this.selectIndex2].modelType2Data[i].name |
| | | this.form.actions[this.selectIndex2].value = '' |
| | | } |
| | | } |
| | | }, |
| | |
| | | for (let i = 0; i < this.form.triggers.length; i++) { |
| | | this.editTriggers(i, this.form.triggers[i].type) |
| | | this.selectIndex1 = i |
| | | this.changevalue(this.form.triggers[i].id) |
| | | this.changevalue(i,this.form.triggers[i].id) |
| | | } |
| | | this.form.actions = JSON.parse(this.form.actions) |
| | | for (let i = 0; i < this.form.actions.length; i++) { |
| | | this.editactions(i, this.form.actions[i].type) |
| | | this.selectIndex2 = i |
| | | this.changevalue2(this.form.actions[i].id) |
| | | this.changevalue2(i,this.form.actions[i].id) |
| | | } |
| | | this.open = true; |
| | | this.title = "修改设备告警"; |
| | |
| | | productName: this.productInfo.productName, |
| | | type: 1 |
| | | }) |
| | | this.changeModelType2(this.form.actions.length-1, 1) |
| | | }, |
| | | /** 删除动作 */ |
| | | removeActionItem(index) { |
| | |
| | | type: 1, |
| | | operator: '=' |
| | | }) |
| | | |
| | | this.changeModelType1(this.form.triggers.length-1, 1) |
| | | }, |
| | | /** 删除触发器 */ |
| | | removeTriggerItem(index) { |