|
|
|
@ -30,7 +30,7 @@ |
|
|
|
|
<el-table-column label="操作" align="center" prop="handle"> |
|
|
|
|
<template v-slot="scope"> |
|
|
|
|
<el-button type="primary" size="small" icon="Edit" v-hasPermi="['system:cl:edit']" @click="handleXg(scope.row)">修改</el-button> |
|
|
|
|
<el-button type="danger" size="small" :icon="Delete" @click="handleDel(scope.row.sceneCode)">删除</el-button> |
|
|
|
|
<el-button type="danger" size="small" :icon="Delete" @click="handleDel(scope.row.strategyCode)">删除</el-button> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -69,7 +69,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-collapse v-model="activeNames" accordion> |
|
|
|
|
<el-collapse-item v-for="item in items" :key="item.id" :title="item.title" :name="item.id"> |
|
|
|
|
<el-collapse-item v-for="item in data.items" :key="item.id" :title="item.title" :name="item.id"> |
|
|
|
|
<span style="width: 50px; margin-left: 20px;margin-bottom: 50px ">步骤名称:</span> |
|
|
|
|
<el-input v-model="item.sceneName" placeholder="请输入步骤名称" style="width: 950px;margin-bottom: 10px "/> |
|
|
|
|
<span style="width: 50px; margin-left: 20px ">步骤描述:</span> |
|
|
|
@ -96,11 +96,11 @@ |
|
|
|
|
</el-collapse-item> |
|
|
|
|
</el-collapse> |
|
|
|
|
|
|
|
|
|
<el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange">全选</el-checkbox> |
|
|
|
|
<el-checkbox-group v-model="item.checkedSblb" @change="handleCheckedCitiesChange" style="white-space: normal;display: inline-block"> |
|
|
|
|
<el-checkbox v-for="item in data.sblb" :label="item.deviceId" :key="item.deviceId" style="margin-bottom: 10px;width: 560px;"> |
|
|
|
|
<span style="width: 160px;display: inline-block">{{item.deviceName}}</span> |
|
|
|
|
<span v-for="control in item.controlKey" style="margin-left: 20px"> |
|
|
|
|
<!-- <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange">全选</el-checkbox>--> |
|
|
|
|
<el-checkbox-group :max="1" v-model="item.checkedSblb" @change="handleCheckedCitiesChange" style="white-space: normal;display: inline-block"> |
|
|
|
|
<el-checkbox v-for="it in item.sblb" :label="it.deviceId" :key="it.deviceId" style="margin-bottom: 10px;width: 560px;"> |
|
|
|
|
<span style="width: 160px;display: inline-block">{{it.deviceName}}</span> |
|
|
|
|
<span v-for="control in it.controlKey" style="margin-left: 20px"> |
|
|
|
|
<span style="width: 80px;display: inline-block">{{control.label}}</span> |
|
|
|
|
<template v-if="control.label === '控制启停'"> |
|
|
|
|
<el-radio-group v-model="control.value"> |
|
|
|
@ -132,46 +132,54 @@ |
|
|
|
|
</template> |
|
|
|
|
</el-dialog> |
|
|
|
|
<!-- 修改对话框 --> |
|
|
|
|
<el-dialog :title="title1" v-model="open1" width="1000px" append-to-body> |
|
|
|
|
<el-dialog :title="title1" v-model="open1" width="1100px" append-to-body> |
|
|
|
|
<el-form :model="timingForm1" ref="userRef" label-width="88px"> |
|
|
|
|
<el-row> |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-form-item label="策略名称:" prop="sceneName"> |
|
|
|
|
<el-input v-model="timingForm1.sceneName" placeholder="请输入策略名称" maxlength="11" /> |
|
|
|
|
<el-input v-model="addForm1.strategyName" placeholder="请输入策略名称" maxlength="11" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="24"> |
|
|
|
|
<el-form-item label="策略描述:" prop="sceneRemark" > |
|
|
|
|
<el-input v-model="timingForm1.sceneRemark" placeholder="请输入策略描述" /> |
|
|
|
|
<el-input v-model="addForm1.strategyInfo" placeholder="请输入策略描述" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<span style="width: 120px;display: inline-block ;margin: 20px">是否有限制条件</span> |
|
|
|
|
<el-radio-group v-model="timingForm1.isJudge"> |
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
<el-radio :label="2">否</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<el-collapse v-model="timingForm1.isJudge" style="width: 1000px"> |
|
|
|
|
<el-collapse-item title="限制条件" :name="1"> |
|
|
|
|
<span>限制设备:</span> |
|
|
|
|
<el-select v-model="timingForm1.judgeDevice" placeholder="请选择" style="width: 240px"> |
|
|
|
|
<el-option :label='item.deviceName' :value='item.deviceId' :key="item.deviceId" v-for="item in data.allsblb"/> |
|
|
|
|
</el-select> |
|
|
|
|
<span style="width: 70px;display: inline-block ;margin: 20px">限制属性:</span> |
|
|
|
|
<el-radio-group v-model="timingForm1.judgeElement"> |
|
|
|
|
<el-radio label="thermometer_value">温度</el-radio> |
|
|
|
|
<el-radio label="thermometer_value_in">进水温度</el-radio> |
|
|
|
|
<el-radio label="thermometer_value_out">出水温度</el-radio> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-collapse v-model="activeNames1" accordion> |
|
|
|
|
<el-collapse-item v-for="item in data.items1" :key="item.id" :title="item.title" :name="item.id"> |
|
|
|
|
<span style="width: 50px; margin-left: 20px;margin-bottom: 50px ">步骤名称:</span> |
|
|
|
|
<el-input v-model="item.sceneName" placeholder="请输入步骤名称" style="width: 950px;margin-bottom: 10px "/> |
|
|
|
|
<span style="width: 50px; margin-left: 20px ">步骤描述:</span> |
|
|
|
|
<el-input v-model="item.sceneRemark" placeholder="请输入步骤描述" style="width: 950px"/> |
|
|
|
|
<span style="width: 120px;display: inline-block ;margin: 20px">是否有限制条件</span> |
|
|
|
|
<el-radio-group v-model="item.isJudge"> |
|
|
|
|
<el-radio :label="1">是</el-radio> |
|
|
|
|
<el-radio :label="2">否</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<span style="width: 70px;display: inline-block ;margin-left: 50px">温度数值:</span> |
|
|
|
|
<el-input type="number" v-model="timingForm1.judgeData" placeholder="请输入" style="width: 80px ; height: 25px" /> |
|
|
|
|
</el-collapse-item> |
|
|
|
|
</el-collapse> |
|
|
|
|
<el-checkbox :indeterminate="data.isIndeterminate1" v-model="data.checkAll1" @change="handleCheckAllChange1">全选</el-checkbox> |
|
|
|
|
<!-- <div class="taber"><span>进水温度</span><span>出水温度</span><span>温度</span></div>--> |
|
|
|
|
<el-checkbox-group v-model="data.checkedSblb1" @change="handleCheckedCitiesChange1"> |
|
|
|
|
<el-checkbox v-for="item in data.sblb" :label="item.deviceId" :key="item.deviceId" style="margin-bottom: 10px;width: 560px;"> |
|
|
|
|
<span style="width: 160px;display: inline-block">{{item.deviceName}}</span> |
|
|
|
|
<span v-for="control in item.controlKey" style="margin-left: 20px"> |
|
|
|
|
<el-collapse v-model="item.isJudge" style="width: 1000px"> |
|
|
|
|
<el-collapse-item title="限制条件" :name="1"> |
|
|
|
|
<span>限制设备:</span> |
|
|
|
|
<el-select v-model="item.judgeDevice" placeholder="请选择" style="width: 240px"> |
|
|
|
|
<el-option :label='item.deviceName' :value='item.deviceId' :key="item.deviceId" v-for="item in data.allsblb"/> |
|
|
|
|
</el-select> |
|
|
|
|
<span style="width: 70px;display: inline-block ;margin: 20px">限制属性:</span> |
|
|
|
|
<el-radio-group v-model="item.judgeElement"> |
|
|
|
|
<el-radio label="thermometer_value">温度</el-radio> |
|
|
|
|
<el-radio label="thermometer_value_in">进水温度</el-radio> |
|
|
|
|
<el-radio label="thermometer_value_out">出水温度</el-radio> |
|
|
|
|
</el-radio-group> |
|
|
|
|
<span style="width: 70px;display: inline-block ;margin-left: 50px">限制值:</span> |
|
|
|
|
<el-input type="number" v-model="item.judgeData" placeholder="请输入" style="width: 80px ; height: 25px" /> |
|
|
|
|
</el-collapse-item> |
|
|
|
|
</el-collapse> |
|
|
|
|
|
|
|
|
|
<!-- <el-checkbox :indeterminate="item.isIndeterminate" v-model="item.checkAll" @change="handleCheckAllChange">全选</el-checkbox>--> |
|
|
|
|
<el-checkbox-group :max="1" v-model="item.checkedSblb" @change="handleCheckedCitiesChange" style="white-space: normal;display: inline-block"> |
|
|
|
|
<el-checkbox v-for="it in item.sblb" :label="it.deviceId" :key="it.deviceId" style="margin-bottom: 10px;width: 560px;"> |
|
|
|
|
<span style="width: 160px;display: inline-block">{{it.deviceName}}</span> |
|
|
|
|
<span v-for="control in it.controlKey" style="margin-left: 20px"> |
|
|
|
|
<span style="width: 80px;display: inline-block">{{control.label}}</span> |
|
|
|
|
<template v-if="control.label === '控制启停'"> |
|
|
|
|
<el-radio-group v-model="control.value"> |
|
|
|
@ -183,31 +191,15 @@ |
|
|
|
|
<el-input type="number" v-model="control.value" style="width: 120px ;margin: 10px;height: 25px"/> |
|
|
|
|
</template> |
|
|
|
|
</span> |
|
|
|
|
</el-checkbox> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
<!-- <el-col :span="24">--> |
|
|
|
|
<!-- <el-form-item label="设备列表:" >--> |
|
|
|
|
<!-- <el-select v-model="timingForm1.deviceId" placeholder="设备列表">--> |
|
|
|
|
<!-- <el-option v-for="item in data.sblb" :key="item.deviceId" :label="item.deviceName" :value="item.deviceId">--> |
|
|
|
|
<!-- </el-option>--> |
|
|
|
|
<!-- </el-select>--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<!-- </el-col>--> |
|
|
|
|
<!-- <el-col :span="12">--> |
|
|
|
|
<!-- <el-form-item label="进水温度:" prop="intemp" >--> |
|
|
|
|
<!-- <el-input v-model="timingForm1.intemp" placeholder="进水温度" />--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<!-- </el-col>--> |
|
|
|
|
<!-- <el-col :span="12">--> |
|
|
|
|
<!-- <el-form-item label="出水温度:" prop="outtemp" >--> |
|
|
|
|
<!-- <el-input v-model="timingForm1.outtemp" placeholder="出水温度" />--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<!-- </el-col>--> |
|
|
|
|
<!-- <el-col :span="13">--> |
|
|
|
|
<!-- <el-form-item label="温度值:" prop="temp">--> |
|
|
|
|
<!-- <el-input v-model="timingForm1.temp" placeholder="温度" maxlength="11" />--> |
|
|
|
|
<!-- </el-form-item>--> |
|
|
|
|
<!-- </el-col>--> |
|
|
|
|
</el-checkbox> |
|
|
|
|
</el-checkbox-group> |
|
|
|
|
|
|
|
|
|
<el-button type="danger" @click="removeStep1(item.id)">删除</el-button> |
|
|
|
|
</el-collapse-item> |
|
|
|
|
</el-collapse> |
|
|
|
|
<el-button type="primary" @click="addStep1">添加步骤+</el-button> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-row> |
|
|
|
|
</el-form> |
|
|
|
|
<template #footer> |
|
|
|
@ -271,6 +263,21 @@ onMounted(()=>{ |
|
|
|
|
}) |
|
|
|
|
/** 筛选处理 */ |
|
|
|
|
const data = reactive({ |
|
|
|
|
items:[ |
|
|
|
|
{ id: 1, title: '第1步', content: `步骤1的内容`, |
|
|
|
|
sblb:[], |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null } |
|
|
|
|
], |
|
|
|
|
items1:[], |
|
|
|
|
num:1, |
|
|
|
|
activeNames:0, |
|
|
|
|
checkAll: false, |
|
|
|
@ -397,6 +404,12 @@ const addForm = reactive({ |
|
|
|
|
strategyName:'', |
|
|
|
|
scenesList:[] |
|
|
|
|
}) |
|
|
|
|
const addForm1 = reactive({ |
|
|
|
|
strategyCode:'', |
|
|
|
|
strategyInfo:'', |
|
|
|
|
strategyName:'', |
|
|
|
|
scenesList:[] |
|
|
|
|
}) |
|
|
|
|
const timingForm = reactive({ |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
@ -433,26 +446,53 @@ const timingForm1 = reactive({ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleAdd() { |
|
|
|
|
open.value = true; |
|
|
|
|
title.value = "新增策略"; |
|
|
|
|
getSb1().then((res)=>{ |
|
|
|
|
console.log('222',res) |
|
|
|
|
var arr = [] |
|
|
|
|
for(var i in res.data){ |
|
|
|
|
arr=arr.concat(res.data[i].children) |
|
|
|
|
} |
|
|
|
|
console.log('sblb',arr) |
|
|
|
|
data.sblb=arr |
|
|
|
|
addForm.strategyName='' |
|
|
|
|
addForm.strategyInfo='' |
|
|
|
|
data.items=[{ id: 1, title: '第1步', content: `步骤1的内容`, |
|
|
|
|
sblb:data.sblb, |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null }] |
|
|
|
|
open.value = true; |
|
|
|
|
title.value = "新增策略"; |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
function submitForm() { |
|
|
|
|
let tempCheckedSblb = []; |
|
|
|
|
data.checkedSblb.forEach(item => { |
|
|
|
|
let tempItem = { |
|
|
|
|
deviceId: item, |
|
|
|
|
tempList:[] |
|
|
|
|
}; |
|
|
|
|
// 根据 item 从 data.sblb 中找到对应的设备信息 |
|
|
|
|
let deviceInfo = data.sblb.find(sblbItem => sblbItem.deviceId === item); |
|
|
|
|
if (deviceInfo) { |
|
|
|
|
console.log('11111',deviceInfo) |
|
|
|
|
tempItem.tempList = deviceInfo.controlKey |
|
|
|
|
} |
|
|
|
|
tempCheckedSblb.push(tempItem); |
|
|
|
|
// items.scenesList.deviceVos=tempCheckedSblb |
|
|
|
|
}); |
|
|
|
|
addForm.scenesList.push(items) |
|
|
|
|
|
|
|
|
|
for(let i in data.items){ |
|
|
|
|
let tempCheckedSblb = []; |
|
|
|
|
data.items[i].checkedSblb.forEach(item => { |
|
|
|
|
let tempItem = { |
|
|
|
|
deviceId: item, |
|
|
|
|
tempList:[] |
|
|
|
|
}; |
|
|
|
|
// 根据 item 从 data.sblb 中找到对应的设备信息 |
|
|
|
|
let deviceInfo = data.items[i].sblb.find(sblbItem => sblbItem.deviceId === item); |
|
|
|
|
if (deviceInfo) { |
|
|
|
|
console.log('11111',deviceInfo) |
|
|
|
|
tempItem.tempList = deviceInfo.controlKey |
|
|
|
|
} |
|
|
|
|
tempCheckedSblb.push(tempItem); |
|
|
|
|
data.items[i].deviceVos=tempCheckedSblb |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
console.log('??????????',data.items) |
|
|
|
|
addForm.scenesList=data.items |
|
|
|
|
console.log(addForm) |
|
|
|
|
postNew(addForm).then((res)=>{ |
|
|
|
|
console.log(res) |
|
|
|
@ -462,88 +502,65 @@ function submitForm() { |
|
|
|
|
console.log(res) |
|
|
|
|
data.queryParams=res.data |
|
|
|
|
}) |
|
|
|
|
addForm.strategyInfo='', |
|
|
|
|
addForm.strategyName='', |
|
|
|
|
timingForm.sceneName='', |
|
|
|
|
timingForm.sceneRemark='', |
|
|
|
|
timingForm.deviceVos=[], |
|
|
|
|
timingForm.isJudge=2, |
|
|
|
|
timingForm.judgeDevice=null, |
|
|
|
|
timingForm.judgeElement=null, |
|
|
|
|
timingForm.judgeData=null, |
|
|
|
|
data.checkedSblb=[]; |
|
|
|
|
data.isIndeterminate=false |
|
|
|
|
|
|
|
|
|
open.value = false; |
|
|
|
|
data.sblb.map(item => { |
|
|
|
|
item.controlKey.map(temp => { |
|
|
|
|
temp.value = ''; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
function cancel() { |
|
|
|
|
addForm.strategyInfo='', |
|
|
|
|
addForm.strategyName='', |
|
|
|
|
timingForm.sceneName='', |
|
|
|
|
timingForm.sceneRemark='', |
|
|
|
|
timingForm.deviceVos=[]; |
|
|
|
|
timingForm.isJudge=2, |
|
|
|
|
timingForm.judgeDevice=null, |
|
|
|
|
timingForm.judgeElement=null, |
|
|
|
|
timingForm.judgeData=null |
|
|
|
|
data.checkedSblb=[]; |
|
|
|
|
data.isIndeterminate=false |
|
|
|
|
open.value = false; |
|
|
|
|
data.sblb.map(item => { |
|
|
|
|
item.controlKey.map(temp => { |
|
|
|
|
temp.value = ''; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
function handleXg(dat) { |
|
|
|
|
open1.value = true; |
|
|
|
|
title1.value = "修改策略"; |
|
|
|
|
console.log('101111',dat) |
|
|
|
|
var arr = [] |
|
|
|
|
for(let i in dat.deviceVos){ |
|
|
|
|
arr.push(dat.deviceVos[i].deviceId) |
|
|
|
|
} |
|
|
|
|
data.checkedSblb1=arr |
|
|
|
|
for (let i = 0;i < data.sblb.length ;i++ ){ |
|
|
|
|
var deviceId = data.sblb[i].deviceId |
|
|
|
|
for (let j = 0;j < dat.deviceVos.length ;j++ ) { |
|
|
|
|
if ( deviceId === dat.deviceVos[j].deviceId){ |
|
|
|
|
console.log(dat.deviceVos[j].tempValue) |
|
|
|
|
data.sblb[i].controlKey = dat.deviceVos[j].tempValue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
timingForm1.sceneName=dat.sceneName |
|
|
|
|
timingForm1.sceneRemark=dat.sceneRemark |
|
|
|
|
timingForm1.sceneCode = dat.sceneCode |
|
|
|
|
timingForm1.isJudge=dat.isJudge |
|
|
|
|
timingForm1.judgeDevice=dat.judgeDevice |
|
|
|
|
timingForm1.judgeElement=dat.judgeElement |
|
|
|
|
timingForm1.judgeData=dat.judgeData |
|
|
|
|
addForm1.strategyCode=dat.strategyCode |
|
|
|
|
addForm1.strategyName=dat.strategyName |
|
|
|
|
addForm1.strategyInfo=dat.strategyInfo |
|
|
|
|
data.items1=dat.scenesList |
|
|
|
|
console.log(data.items1) |
|
|
|
|
// var arr = [] |
|
|
|
|
// for(let i in dat.deviceVos){ |
|
|
|
|
// arr.push(dat.deviceVos[i].deviceId) |
|
|
|
|
// } |
|
|
|
|
// data.checkedSblb1=arr |
|
|
|
|
// for (let i = 0;i < data.sblb.length ;i++ ){ |
|
|
|
|
// var deviceId = data.sblb[i].deviceId |
|
|
|
|
// for (let j = 0;j < dat.deviceVos.length ;j++ ) { |
|
|
|
|
// if ( deviceId === dat.deviceVos[j].deviceId){ |
|
|
|
|
// console.log(dat.deviceVos[j].tempValue) |
|
|
|
|
// data.sblb[i].controlKey = dat.deviceVos[j].tempValue; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// timingForm1.sceneName=dat.sceneName |
|
|
|
|
// timingForm1.sceneRemark=dat.sceneRemark |
|
|
|
|
// timingForm1.sceneCode = dat.sceneCode |
|
|
|
|
// timingForm1.isJudge=dat.isJudge |
|
|
|
|
// timingForm1.judgeDevice=dat.judgeDevice |
|
|
|
|
// timingForm1.judgeElement=dat.judgeElement |
|
|
|
|
// timingForm1.judgeData=dat.judgeData |
|
|
|
|
}; |
|
|
|
|
function submitForm1() { |
|
|
|
|
let tempCheckedSblb = []; |
|
|
|
|
data.checkedSblb1.forEach(item => { |
|
|
|
|
let tempItem = { |
|
|
|
|
deviceId: item, |
|
|
|
|
tempList:[] |
|
|
|
|
}; |
|
|
|
|
// 根据 item 从 data.sblb 中找到对应的设备信息 |
|
|
|
|
let deviceInfo = data.sblb.find(sblbItem => sblbItem.deviceId === item); |
|
|
|
|
if (deviceInfo) { |
|
|
|
|
tempItem.tempList = deviceInfo.controlKey; |
|
|
|
|
} |
|
|
|
|
tempCheckedSblb.push(tempItem); |
|
|
|
|
timingForm1.deviceVos=tempCheckedSblb |
|
|
|
|
}); |
|
|
|
|
console.log(timingForm1) |
|
|
|
|
postXg(timingForm1).then((res)=>{ |
|
|
|
|
for(let i in data.items1){ |
|
|
|
|
let tempCheckedSblb = []; |
|
|
|
|
data.items1[i].checkedSblb.forEach(item => { |
|
|
|
|
let tempItem = { |
|
|
|
|
deviceId: item, |
|
|
|
|
tempList:[] |
|
|
|
|
}; |
|
|
|
|
// 根据 item 从 data.sblb 中找到对应的设备信息 |
|
|
|
|
let deviceInfo = data.items1[i].sblb.find(sblbItem => sblbItem.deviceId === item); |
|
|
|
|
if (deviceInfo) { |
|
|
|
|
tempItem.tempList = deviceInfo.controlKey |
|
|
|
|
} |
|
|
|
|
tempCheckedSblb.push(tempItem); |
|
|
|
|
data.items1[i].deviceVos=tempCheckedSblb |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
console.log('??????????',data.items1) |
|
|
|
|
addForm1.scenesList=data.items1 |
|
|
|
|
console.log(addForm1) |
|
|
|
|
postXg(addForm1).then((res)=>{ |
|
|
|
|
console.log(res) |
|
|
|
|
ElMessage({type:"success",message:'修改成功!'}) |
|
|
|
|
getXl().then((res)=>{ |
|
|
|
@ -551,48 +568,32 @@ function submitForm1() { |
|
|
|
|
data.queryParams=res.data |
|
|
|
|
}) |
|
|
|
|
handleQuery() |
|
|
|
|
data.sblb.map(item => { |
|
|
|
|
item.controlKey.map(temp => { |
|
|
|
|
temp.value = ''; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
open1.value = false; |
|
|
|
|
// data.sblb.map(item => { |
|
|
|
|
// item.controlKey.map(temp => { |
|
|
|
|
// temp.value = ''; |
|
|
|
|
// }); |
|
|
|
|
// }); |
|
|
|
|
}) |
|
|
|
|
open1.value = false; |
|
|
|
|
timingForm1.sceneName='' |
|
|
|
|
timingForm1.sceneRemark='' |
|
|
|
|
timingForm1.sceneCode='' |
|
|
|
|
timingForm1.deviceVos=[] |
|
|
|
|
timingForm1.isJudge=2, |
|
|
|
|
timingForm1.judgeDevice=null, |
|
|
|
|
timingForm1.judgeElement=null, |
|
|
|
|
timingForm1.judgeData=null |
|
|
|
|
}; |
|
|
|
|
function cancel1() { |
|
|
|
|
open1.value = false; |
|
|
|
|
timingForm1.sceneName='' |
|
|
|
|
timingForm1.sceneRemark='' |
|
|
|
|
timingForm1.sceneCode='' |
|
|
|
|
timingForm1.deviceVos=[] |
|
|
|
|
timingForm1.isJudge=2, |
|
|
|
|
timingForm1.judgeDevice=null, |
|
|
|
|
timingForm1.judgeElement=null, |
|
|
|
|
timingForm1.judgeData=null |
|
|
|
|
handleQuery() |
|
|
|
|
data.sblb.map(item => { |
|
|
|
|
item.controlKey.map(temp => { |
|
|
|
|
temp.value = ''; |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
// handleQuery() |
|
|
|
|
// data.sblb.map(item => { |
|
|
|
|
// item.controlKey.map(temp => { |
|
|
|
|
// temp.value = ''; |
|
|
|
|
// }); |
|
|
|
|
// }) |
|
|
|
|
}; |
|
|
|
|
function handleDel(sceneCode) { |
|
|
|
|
function handleDel(strategyCode) { |
|
|
|
|
ElMessageBox.confirm("是否确认删除此策略?", "提示",{ |
|
|
|
|
confirmButtonText: "确认", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
}).then(() => { |
|
|
|
|
console.log(sceneCode) |
|
|
|
|
console.log(strategyCode) |
|
|
|
|
postDel({ |
|
|
|
|
"sceneCode":sceneCode |
|
|
|
|
"strategyCode":strategyCode |
|
|
|
|
}).then((res) => { |
|
|
|
|
console.log(res) |
|
|
|
|
ElMessage({type:"success",message:'删除成功!'}) |
|
|
|
@ -607,48 +608,79 @@ function handleDel(sceneCode) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加步骤 |
|
|
|
|
const items = reactive([{ id: 1, title: '第1步', content: `步骤1的内容`, |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null }]) |
|
|
|
|
const activeNames =reactive([1]) |
|
|
|
|
const addStep = () => { |
|
|
|
|
const newId = items.length + 1 |
|
|
|
|
items.push({ id: newId, title: `第${newId}步`, content: `步骤${newId}的内容`, |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null}) |
|
|
|
|
activeNames.push(`${newId}`) |
|
|
|
|
console.log(items) |
|
|
|
|
console.log(activeNames) |
|
|
|
|
getSb1().then((res)=>{ |
|
|
|
|
console.log('222',res) |
|
|
|
|
var arr = [] |
|
|
|
|
for(var i in res.data){ |
|
|
|
|
arr=arr.concat(res.data[i].children) |
|
|
|
|
} |
|
|
|
|
console.log('sblb',arr) |
|
|
|
|
data.sblb=arr |
|
|
|
|
const newId = data.items.length + 1 |
|
|
|
|
data.items.push({ id: newId, title: `第${newId}步`, content: `步骤${newId}的内容`, |
|
|
|
|
sblb:data.sblb, |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null}) |
|
|
|
|
activeNames.push(`${newId}`) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
const removeStep = (id) => { |
|
|
|
|
const index = items.findIndex(item => item.id === id) |
|
|
|
|
const index = data.items.findIndex(item => item.id === id) |
|
|
|
|
if (index !== -1) { |
|
|
|
|
items.splice(index, 1) |
|
|
|
|
data.items.splice(index, 1) |
|
|
|
|
activeNames.splice(activeNames.indexOf(`${id}`), 1) |
|
|
|
|
} |
|
|
|
|
console.log(items) |
|
|
|
|
console.log(data.items) |
|
|
|
|
console.log(activeNames) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//修改步骤 |
|
|
|
|
const activeNames1 =reactive([1]) |
|
|
|
|
const addStep1 = () => { |
|
|
|
|
getSb1().then((res)=>{ |
|
|
|
|
console.log('222',res) |
|
|
|
|
var arr = [] |
|
|
|
|
for(var i in res.data){ |
|
|
|
|
arr=arr.concat(res.data[i].children) |
|
|
|
|
} |
|
|
|
|
console.log('sblb',arr) |
|
|
|
|
data.sblb=arr |
|
|
|
|
const newId1 = data.items1.length + 1 |
|
|
|
|
data.items1.push({ id: newId1, title: `第${newId1}步`, content: `步骤${newId1}的内容`, |
|
|
|
|
sblb:data.sblb, |
|
|
|
|
isIndeterminate:false, |
|
|
|
|
checkedSblb: [], |
|
|
|
|
checkAll:false, |
|
|
|
|
sceneName:'', |
|
|
|
|
sceneRemark:'', |
|
|
|
|
deviceVos:[], |
|
|
|
|
isJudge:null, |
|
|
|
|
judgeDevice:null, |
|
|
|
|
judgeElement:null, |
|
|
|
|
judgeData:null}) |
|
|
|
|
activeNames1.push(`${newId1}`) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
const removeStep1 = (id) => { |
|
|
|
|
const index = data.items1.findIndex(item => item.id === id) |
|
|
|
|
if (index !== -1) { |
|
|
|
|
data.items1.splice(index, 1) |
|
|
|
|
activeNames1.splice(activeNames1.indexOf(`${id}`), 1) |
|
|
|
|
} |
|
|
|
|
console.log(data.items1) |
|
|
|
|
console.log(activeNames1) |
|
|
|
|
} |
|
|
|
|
const { queryParams } = toRefs(data); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|