diff --git a/psdc-ui/src/api/bigview/bigview.js b/psdc-ui/src/api/bigview/bigview.js index 968f708..44d0c7c 100644 --- a/psdc-ui/src/api/bigview/bigview.js +++ b/psdc-ui/src/api/bigview/bigview.js @@ -2,13 +2,13 @@ import request from '@/utils/request' /** 8个温度传感器接口*/ export function getTemperature(data) { - return request.get('/indexLook/8wd/'+data) + return request.post('/indexLook/8wd?modelTypeName='+data) } /**运行设备工作信息查询接口*/ export function getDevicesInfo() { return request.get('/indexLook/devicesInfo') } /**总电表接口*/ -export function getZdb() { - return request.get('/indexLook/zdb') +export function getZdb(data) { + return request.get('/indexLook/zdb/'+data) } \ No newline at end of file diff --git a/psdc-ui/src/api/emonitor/api.js b/psdc-ui/src/api/emonitor/api.js index 672ab00..7b18cd3 100644 --- a/psdc-ui/src/api/emonitor/api.js +++ b/psdc-ui/src/api/emonitor/api.js @@ -36,7 +36,7 @@ export function getFrld(data) { } //温度传感器 export function getWdcgq(data) { - return request.get('/monitor/wdcgq/index/sel1/'+data) + return request.post('/monitor/wdcgq/index/sel1?modelTypeName='+data) } //沙盘 export function getSp(data) { @@ -61,4 +61,23 @@ export function postDel(data) { //获取用户设备列表 export function getSb() { return request.get('/monitor/db/index/selMydevices') +} +//设备管理 +export function getYh() { + return request.get('system/device/index/selusers') +} +export function getSbTab(data) { + return request.post('system/device/index/devicesList',data) +} +export function getMx() { + return request.get('system/device/index/selmodels') +} +export function postNew1(data) { + return request.post('system/device/index',data) +} +export function postXg1(data) { + return request.put('system/device/index',data) +} +export function postDel1(data) { + return request.post('system/device/index/del',data) } \ No newline at end of file diff --git a/psdc-ui/src/assets/images/shapan.png b/psdc-ui/src/assets/images/shapan.png new file mode 100644 index 0000000..85c3e31 Binary files /dev/null and b/psdc-ui/src/assets/images/shapan.png differ diff --git a/psdc-ui/src/views/bigview/index.vue b/psdc-ui/src/views/bigview/index.vue index 43c11b7..14cec98 100644 --- a/psdc-ui/src/views/bigview/index.vue +++ b/psdc-ui/src/views/bigview/index.vue @@ -131,7 +131,7 @@ onMounted(()=>{ /** 8个温度传感器数据*/ const wdcgqArr = ref([]) function getWenduFun(){ - getTemperature(16).then((res)=>{ + getTemperature("温度传感器").then((res)=>{ wdcgqArr.value = res.data }) } @@ -612,7 +612,7 @@ const nowPower = ref() const nowEle = ref() const todayUsePowersArr = []; function getZdbFun(){ - getZdb().then((res)=>{ + getZdb(13).then((res)=>{ console.log(res.data) nowPower.value = res.data.totp; nowEle.value = res.data.totwh; diff --git a/psdc-ui/src/views/emonitor/db/index.vue b/psdc-ui/src/views/emonitor/db/index.vue index 5c533fd..105b70b 100644 --- a/psdc-ui/src/views/emonitor/db/index.vue +++ b/psdc-ui/src/views/emonitor/db/index.vue @@ -181,7 +181,7 @@ export default { onMounted(() => {//需要获取到element,所以是onMounted的Hook getData(13).then((res)=>{ console.log(res) - if(res.data){ + if(res.data!=null){ data.totp=res.data.totp data.totwh=res.data.totwh data.eday=res.data.eday diff --git a/psdc-ui/src/views/emonitor/drgl/index.vue b/psdc-ui/src/views/emonitor/drgl/index.vue index 8e170f0..2f35688 100644 --- a/psdc-ui/src/views/emonitor/drgl/index.vue +++ b/psdc-ui/src/views/emonitor/drgl/index.vue @@ -422,7 +422,7 @@ export default { }) getDrgl(1).then((res)=>{ console.log('1',res) - if(res.data){ + if(res.data!=null){ data.tempIn=res.data.tempIn data.tempOut=res.data.tempOut data.totp = res.data.totp diff --git a/psdc-ui/src/views/emonitor/frdl/index.vue b/psdc-ui/src/views/emonitor/frdl/index.vue index c4bbe16..c127043 100644 --- a/psdc-ui/src/views/emonitor/frdl/index.vue +++ b/psdc-ui/src/views/emonitor/frdl/index.vue @@ -399,21 +399,24 @@ export default { }) getFrdl(4).then((res)=>{ console.log('1',res) - data.tempIn=res.data.tempIn - data.tempOut=res.data.tempOut - data.totp = res.data.totp - data.totwh = res.data.totwh - if(res.data.runStatus==1){ - data.runStatus = '开启' - }else if (res.data.runStatus==2){ - data.runStatus = '关闭' + if(res.data!=null){ + data.tempIn=res.data.tempIn + data.tempOut=res.data.tempOut + data.totp = res.data.totp + data.totwh = res.data.totwh + if(res.data.runStatus==1){ + data.runStatus = '开启' + }else if (res.data.runStatus==2){ + data.runStatus = '关闭' + } + //gl + delete res.data.todayUsePowers.deviceId + delete res.data.todayUsePowers.samDate + delete res.data.todayUsePowers.userId + let arr = Object.values(res.data.todayUsePowers) + data.glData=arr } - //gl - delete res.data.todayUsePowers.deviceId - delete res.data.todayUsePowers.samDate - delete res.data.todayUsePowers.userId - let arr = Object.values(res.data.todayUsePowers) - data.glData=arr + let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3")); if (myChart3){ myChart3.dispose() diff --git a/psdc-ui/src/views/emonitor/kqyrb/index.vue b/psdc-ui/src/views/emonitor/kqyrb/index.vue index 9d403d1..00b8b77 100644 --- a/psdc-ui/src/views/emonitor/kqyrb/index.vue +++ b/psdc-ui/src/views/emonitor/kqyrb/index.vue @@ -419,21 +419,23 @@ export default { }) getKqryb(3).then((res)=>{ console.log('1',res) - data.tempIn=res.data.tempIn - data.tempOut=res.data.tempOut - data.totp = res.data.totp - data.totwh = res.data.totwh - if(res.data.runStatus==1){ - data.runStatus = '开启' - }else if (res.data.runStatus==2){ - data.runStatus = '关闭' + if(res.data!=null) { + data.tempIn = res.data.tempIn + data.tempOut = res.data.tempOut + data.totp = res.data.totp + data.totwh = res.data.totwh + if (res.data.runStatus == 1) { + data.runStatus = '开启' + } else if (res.data.runStatus == 2) { + data.runStatus = '关闭' + } + //gl + delete res.data.todayUsePowers.deviceId + delete res.data.todayUsePowers.samDate + delete res.data.todayUsePowers.userId + let arr = Object.values(res.data.todayUsePowers) + data.glData = arr } - //gl - delete res.data.todayUsePowers.deviceId - delete res.data.todayUsePowers.samDate - delete res.data.todayUsePowers.userId - let arr = Object.values(res.data.todayUsePowers) - data.glData=arr let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3")); if (myChart3){ myChart3.dispose() diff --git a/psdc-ui/src/views/emonitor/sp/index.vue b/psdc-ui/src/views/emonitor/sp/index.vue index 30fd137..5c021da 100644 --- a/psdc-ui/src/views/emonitor/sp/index.vue +++ b/psdc-ui/src/views/emonitor/sp/index.vue @@ -2,6 +2,7 @@ <div class="app-container home"> <h1>{{data.name}}</h1> <h1>运行状态:{{data.status}}</h1> + <img src="../../../assets/images/shapan.png" class="img"> </div> </template> @@ -17,11 +18,13 @@ export default { onMounted(()=>{ getSp(14).then((res)=>{ console.log(res) - data.name=res.data.deviceName - if(res.data.deviceRunstatus==true){ - data.status='开启' - }else{ - data.status='关闭' + if(res.data!=null) { + data.name = res.data.deviceName + if (res.data.deviceRunstatus == true) { + data.status = '开启' + } else { + data.status = '关闭' + } } }) }) @@ -36,6 +39,9 @@ export default { </script> <style scoped lang="scss"> - +.img{ + margin-left: 250px; + margin-top: 100px; +} </style> diff --git a/psdc-ui/src/views/emonitor/wdcgq/index.vue b/psdc-ui/src/views/emonitor/wdcgq/index.vue index 46abd72..907d71d 100644 --- a/psdc-ui/src/views/emonitor/wdcgq/index.vue +++ b/psdc-ui/src/views/emonitor/wdcgq/index.vue @@ -52,21 +52,27 @@ export default { }) onMounted(() => {//需要获取到element,所以是onMounted的Hook //温度传感器1-8 id 5-12 - getWdcgq(16).then((res)=>{ + getWdcgq("温度传感器").then((res)=>{ console.log(res) - let arr = [] - let brr = [] - let crr = [] - for (let i in res.data){ - arr.push({name:res.data[i].deviceName,temp:res.data[i].deviceTemp}) - brr.push({name:res.data[i].deviceName,type: "line",data:res.data[i].temps,itemStyle:{color:'#2F8EE0'}}) - crr.push(res.data[i].times) + if(res.data!=null) { + let arr = [] + let brr = [] + let crr = [] + for (let i in res.data) { + arr.push({name: res.data[i].deviceName, temp: res.data[i].deviceTemp}) + brr.push({ + name: res.data[i].deviceName, + type: "line", + data: res.data[i].temps, + itemStyle: {color: '#2F8EE0'} + }) + crr.push(res.data[i].times) + } + console.log(crr) + data.info = arr + data.infos = brr + data.xinfo = crr } - console.log(crr) - data.info=arr - data.infos=brr - data.xinfo=crr - let myChart = echarts.getInstanceByDom(document.getElementById("myEcharts")); if (myChart){ myChart.dispose() diff --git a/psdc-ui/src/views/emonitor/xrgl/index.vue b/psdc-ui/src/views/emonitor/xrgl/index.vue index 86fb278..8afa1c2 100644 --- a/psdc-ui/src/views/emonitor/xrgl/index.vue +++ b/psdc-ui/src/views/emonitor/xrgl/index.vue @@ -223,21 +223,23 @@ export default { onMounted(() => {//需要获取到element,所以是onMounted的Hook getXrgl(2).then((res)=>{ console.log('1',res) - data.tempIn=res.data.tempIn - data.tempOut=res.data.tempOut - data.totp = res.data.totp - data.totwh = res.data.totwh - if(res.data.runStatus==1){ - data.runStatus = '开启' - }else if (res.data.runStatus==2){ - data.runStatus = '关闭' + if(res.data!=null) { + data.tempIn = res.data.tempIn + data.tempOut = res.data.tempOut + data.totp = res.data.totp + data.totwh = res.data.totwh + if (res.data.runStatus == 1) { + data.runStatus = '开启' + } else if (res.data.runStatus == 2) { + data.runStatus = '关闭' + } + //gl + delete res.data.todayUsePowers.deviceId + delete res.data.todayUsePowers.samDate + delete res.data.todayUsePowers.userId + let arr = Object.values(res.data.todayUsePowers) + data.glData = arr } - //gl - delete res.data.todayUsePowers.deviceId - delete res.data.todayUsePowers.samDate - delete res.data.todayUsePowers.userId - let arr = Object.values(res.data.todayUsePowers) - data.glData=arr let myChart3 = echarts.getInstanceByDom(document.getElementById("myEcharts3")); if (myChart3){ myChart3.dispose() diff --git a/psdc-ui/src/views/system/cl/index.vue b/psdc-ui/src/views/system/cl/index.vue index 2968389..c645517 100644 --- a/psdc-ui/src/views/system/cl/index.vue +++ b/psdc-ui/src/views/system/cl/index.vue @@ -61,37 +61,42 @@ <el-input v-model="timingForm.sceneName" placeholder="请输入策略名称" /> </el-form-item> </el-col> - <el-col :span="12"> - <el-form-item label="策略列表:" > - <el-select v-model="timingForm.sceneCode" placeholder="策略列表"> - <el-option v-for="item in data.queryParams" :key="item.sceneCode" :label="item.label" :value="item.sceneCode"> - </el-option> - </el-select> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="设备列表:" > - <el-select v-model="timingForm.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="timingForm.intemp" placeholder="进水温度" /> - </el-form-item> - </el-col> - <el-col :span="12"> - <el-form-item label="出水温度:" prop="outtemp" > - <el-input v-model="timingForm.outtemp" placeholder="出水温度" /> - </el-form-item> - </el-col> - <el-col :span="24"> - <el-form-item label="温度:" prop="temp"> - <el-input v-model="timingForm.temp" placeholder="温度" maxlength="11" /> - </el-form-item> - </el-col> + <el-checkbox :indeterminate="data.isIndeterminate" v-model="data.checkAll" @change="handleCheckAllChange">全选</el-checkbox> + <div style="margin: 15px 0;"></div> + <el-checkbox-group v-model="data.checkedSblb" @change="handleCheckedCitiesChange"> + <el-checkbox v-for="item in data.sblb" :label="item.deviceId" :key="item.deviceId" >{{item.deviceName}}</el-checkbox> + </el-checkbox-group> +<!-- <el-col :span="12">--> +<!-- <el-form-item label="策略列表:" >--> +<!-- <el-select v-model="timingForm.sceneCode" placeholder="策略列表">--> +<!-- <el-option v-for="item in data.queryParams" :key="item.sceneCode" :label="item.label" :value="item.sceneCode">--> +<!-- </el-option>--> +<!-- </el-select>--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- <el-col :span="12">--> +<!-- <el-form-item label="设备列表:" >--> +<!-- <el-select v-model="timingForm.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="timingForm.intemp" placeholder="进水温度" />--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- <el-col :span="12">--> +<!-- <el-form-item label="出水温度:" prop="outtemp" >--> +<!-- <el-input v-model="timingForm.outtemp" placeholder="出水温度" />--> +<!-- </el-form-item>--> +<!-- </el-col>--> +<!-- <el-col :span="24">--> +<!-- <el-form-item label="温度:" prop="temp">--> +<!-- <el-input v-model="timingForm.temp" placeholder="温度" maxlength="11" />--> +<!-- </el-form-item>--> +<!-- </el-col>--> </el-row> </el-form> <template #footer> @@ -158,6 +163,12 @@ onMounted(()=>{ } console.log('sblb',arr) data.sblb=arr + var brr = [] + for(let a in arr){ + brr.push(arr[a].deviceId) + } + data.AllName=brr + console.log(brr) }) getXl().then((res)=>{ console.log(res) @@ -180,7 +191,11 @@ onMounted(()=>{ }) /** 筛选处理 */ const data = reactive({ - sblb:[], + checkAll: false, + checkedSblb: [], + sblb: [], + AllName:[], + isIndeterminate: false, total:'', timingList:[], queryParams: '', @@ -222,8 +237,18 @@ function resetQuery(){ data.total=res.total }) } +function handleCheckAllChange(val) { + data.checkedSblb = val ? data.AllName : []; + data.isIndeterminate = false; + console.log(data.checkedSblb) +} - +function handleCheckedCitiesChange(value) { + let checkedCount = value.length; + data.checkAll = checkedCount === data.sblb.length; + data.isIndeterminate = checkedCount > 0 && checkedCount < data.sblb.length; + console.log(data.checkedSblb) +} /** 数据表格处理 */ const currentPage = ref(1) @@ -366,7 +391,7 @@ function cancel1() { timingForm1.temp='' }; function handleDel(sceneId) { - ElMessageBox.confirm("是否确认删除此电站?", "提示",{ + ElMessageBox.confirm("是否确认删除此策略?", "提示",{ confirmButtonText: "确认", cancelButtonText: "取消", type: "warning" diff --git a/psdc-ui/src/views/system/config/index.vue b/psdc-ui/src/views/system/config/index.vue index 1a55e17..37d41ab 100644 --- a/psdc-ui/src/views/system/config/index.vue +++ b/psdc-ui/src/views/system/config/index.vue @@ -1,6 +1,6 @@ <template> <div> - +111 </div> </template> diff --git a/psdc-ui/src/views/system/device/index.vue b/psdc-ui/src/views/system/device/index.vue new file mode 100644 index 0000000..346fc51 --- /dev/null +++ b/psdc-ui/src/views/system/device/index.vue @@ -0,0 +1,514 @@ +<template> + <div class="app-container home"> + <el-row :gutter="20"> + <el-col :span="24" :xs="24"> + <el-form :model="queryParams" ref="queryRef" :inline="true" label-width="88px"> + <el-form-item label="模型名称:" prop="name"> + <el-select v-model="data.sceneCode" placeholder="请选择" style="width: 240px" @change="changeSl"> + <el-option label='所有' value='' /> + <el-option :label='item.label' :value='item.value' :key="item.value" v-for="item in queryParams"/> + </el-select> + </el-form-item> + <el-form-item> + <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> + <el-button icon="Refresh" @click="resetQuery">重置</el-button> + </el-form-item> + </el-form> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button> + </el-col> + </el-row> + <div class="dev_control_table"> + <el-table :data="data.timingList" height="500px"> + <el-table-column label="序号" align="center" prop="deviceId" width="50"/> + <el-table-column label="设备名称" align="center" prop="deviceName"/> + <el-table-column label="是否可控" align="center" prop="isControl" /> + <el-table-column label="设备位置" align="center" prop="deviceAddress"/> + <el-table-column label="设备状态" align="center" prop="devStatus"/> + <el-table-column label="设备Sn" align="center" prop="deviceSn"/> + <el-table-column label="当前功率" align="center" prop="totp"/> + <el-table-column label="总用电量" align="center" prop="totWh"/> + <el-table-column label="温度" align="center" prop="temp"/> + <el-table-column label="进水温度" align="center" prop="tempIn"/> + <el-table-column label="出水温度" align="center" prop="tempOut"/> + <el-table-column label="操作" align="center" prop="handle" width="200"> + <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.deviceId)">删除</el-button> + </template> + </el-table-column> + </el-table> + <el-pagination + v-model:current-page="currentPage" + v-model:page-size="pageSize" + :page-sizes="[5, 10, 20, 50]" + :small="small" + :disabled="disabled" + :background="background" + layout="total, sizes, prev, pager, next, jumper" + :total="data.total" + @size-change="handleSizeChange" + @current-change="handleCurrentChange"/> + </div> + </el-col> + </el-row> + + + + <!-- 新增对话框 --> + <el-dialog :title="title" v-model="open" width="600px" append-to-body> + <el-form :model="timingForm" ref="userRef" label-width="88px"> + <el-row> + <el-col :span="24"> + <el-form-item label="设备名称:" prop="deviceName" > + <el-input v-model="timingForm.deviceName" placeholder="请输入设备名称" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="模型列表:" > + <el-select v-model="timingForm.deviceModel" placeholder="模型列表"> + <el-option v-for="item in data.queryParams" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="是否可控:" > + <el-select v-model="timingForm.isControl" placeholder="是否可控"> + <el-option label="可控" :value=2></el-option> + <el-option label="不可控" :value=1></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="设备Sn:" prop="deviceSn" > + <el-input v-model="timingForm.deviceSn" placeholder="请输入设备Sn" /> + </el-form-item> + </el-col> +<!-- <el-col :span="24">--> +<!-- <el-form-item label="开始时间:" prop="startTime" >--> +<!-- <el-input v-model="timingForm.startTime" placeholder="示例:2023-05-11 10:40:29" />--> +<!-- </el-form-item>--> +<!-- </el-col>--> + <el-col :span="24"> + <el-form-item label="设备地址:" prop="deviceAddress"> + <el-input v-model="timingForm.deviceAddress" placeholder="请输入设备地址" /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button @click="cancel">取 消</el-button> + </div> + </template> + </el-dialog> + <!-- 修改对话框 --> + <el-dialog :title="title1" v-model="open1" width="600px" append-to-body> + <el-form :model="timingForm1" ref="userRef" label-width="88px"> + <el-row> + <el-col :span="24"> + <el-form-item label="设备名称:" prop="deviceName" > + <el-input v-model="timingForm1.deviceName" placeholder="请输入设备名称" /> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="模型列表:" > + <el-select v-model="timingForm1.deviceModel" placeholder="模型列表"> + <el-option v-for="item in data.queryParams" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="12"> + <el-form-item label="是否可控:" > + <el-select v-model="timingForm1.isControl" placeholder="是否可控"> + <el-option label="可控" :value=2></el-option> + <el-option label="不可控" :value=1></el-option> + </el-select> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="设备Sn:" prop="deviceSn" > + <el-input v-model="timingForm1.deviceSn" placeholder="请输入设备Sn" /> + </el-form-item> + </el-col> + <!-- <el-col :span="24">--> + <!-- <el-form-item label="开始时间:" prop="startTime" >--> + <!-- <el-input v-model="timingForm.startTime" placeholder="示例:2023-05-11 10:40:29" />--> + <!-- </el-form-item>--> + <!-- </el-col>--> + <el-col :span="24"> + <el-form-item label="设备地址:" prop="deviceAddress"> + <el-input v-model="timingForm1.deviceAddress" placeholder="请输入设备地址" /> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button type="primary" @click="submitForm1">确 定</el-button> + <el-button @click="cancel1">取 消</el-button> + </div> + </template> + </el-dialog> + </div> +</template> + +<script setup name="Index"> +import {ElMessage,ElMessageBox} from 'element-plus' +import {Delete} from '@element-plus/icons-vue' +import {ref,reactive,watch,onMounted} from "vue"; +import {getXl, getSbTab, postNew1, getSb, postXg1, postDel1, getYh, getMx,} from '../../../api/emonitor/api' +onMounted(()=>{ + // getSb().then((res)=>{ + // var arr = [] + // for(var i in res.data){ + // arr=arr.concat(res.data[i].children) + // } + // console.log('sblb',arr) + // data.sblb=arr + // }) + getMx().then((res)=>{ + console.log(res) + data.queryParams=res.data + }) + // getYh().then((res)=>{ + // console.log(res) + // data.queryParams=res.data + // }) + getSbTab({ + "deviceId":0, + + "deviceModel":data.sceneCode, + + "pageNum": currentPage.value, + + "pageSize": pageSize.value + }).then((res)=>{ + console.log(res) + data.timingList=res.rows + data.total=res.total + for(let i in res.rows){ + if(res.rows[i].isControl==2){ + res.rows[i].isControl='可控' + }else if(res.rows[i].isControl==1){ + res.rows[i].isControl='不可控' + } + } + }) + // postNew().then((res)=>{ + // console.log(res) + // }) +}) +/** 筛选处理 */ +const data = reactive({ + MxList:[], + sblb:[], + total:'', + timingList:[], + queryParams: '', + sceneCode:'', + dateRange:[], +}); +//改变 +function changeSl(){ + console.log(data.sceneCode) +} +//搜索按钮 +function handleQuery(){ + getSbTab({ + "deviceId":0, + + "deviceModel":data.sceneCode, + + "pageNum": currentPage.value, + + "pageSize": pageSize.value + }).then((res)=>{ + console.log(res) + data.timingList=res.rows + data.total=res.total + for(let i in res.rows){ + if(res.rows[i].isControl==2){ + res.rows[i].isControl='可控' + }else if(res.rows[i].isControl==1){ + res.rows[i].isControl='不可控' + } + } + }) +} +//重置按钮 +function resetQuery(){ + data.sceneCode=0 + currentPage.value=1 + pageSize.value=10 + getSbTab({ + "deviceId":0, + + "deviceModel":'', + + "pageNum": currentPage.value, + + "pageSize": pageSize.value + }).then((res)=>{ + console.log(res) + data.timingList=res.rows + data.total=res.total + for(let i in res.rows){ + if(res.rows[i].isControl==2){ + res.rows[i].isControl='可控' + }else if(res.rows[i].isControl==1){ + res.rows[i].isControl='不可控' + } + } + }) +} + + +/** 数据表格处理 */ + +const currentPage = ref(1) +const pageSize = ref(10) +const small = ref(false) +const background = ref(false) +const disabled = ref(false) +const handleSizeChange = (val) => { + console.log(`${val}`) + getSbTab({ + "deviceId":0, + + "deviceModel":data.sceneCode, + + "pageNum": currentPage.value, + + "pageSize": pageSize.value + }).then((res)=>{ + console.log(res) + data.timingList=res.rows + data.total=res.total + for(let i in res.rows){ + if(res.rows[i].isControl==2){ + res.rows[i].isControl='可控' + }else if(res.rows[i].isControl==1){ + res.rows[i].isControl='不可控' + } + } + }) +} +const handleCurrentChange = (val) => { + console.log(`${val}`) + getSbTab({ + "deviceId":0, + + "deviceModel":data.sceneCode, + + "pageNum": currentPage.value, + + "pageSize": pageSize.value + }).then((res)=>{ + console.log(res) + data.timingList=res.rows + data.total=res.total + for(let i in res.rows){ + if(res.rows[i].isControl==2){ + res.rows[i].isControl='可控' + }else if(res.rows[i].isControl==1){ + res.rows[i].isControl='不可控' + } + } + }) +} + + +/** 新增策略处理 */ +const open = ref(false); +const title = ref(); +const open1 = ref(false); +const title1= ref(); +const activeName = ref('1') +const timingForm = reactive({ + "parentId": 0, + "userId": 1, + "isControl":'', + "deviceType": 2, + "deviceSn": "", + "deviceName": "", + "hardVersion": "2.23", + "softVersion": "2.24", + "deviceAddress": '', + "startTime": null, + "deviceModel": "", + "photoUrl": null +}) +const timingForm1 = reactive({ + "deviceId":'', + "parentId": 0, + "userId": 1, + "isControl": '', + "deviceType": 2, + "deviceSn": "", + "deviceName": "", + "hardVersion": "2.23", + "softVersion": "2.24", + "deviceAddress": '', + "startTime": null, + "deviceModel": "", + "photoUrl": null + +}) + +// const watchTime = watch(()=> timingForm.executeTime, (val) => { +// // console.log(val.toLocaleString()) +// let date = new Date(val) +// let hours = date.getHours() +// let minutes = date.getMinutes() +// let seconds = date.getSeconds() +// console.log(`${hours}:${minutes}:${seconds}`) +// }) + + + +function handleAdd() { + open.value = true; + title.value = "新增设备"; +}; +function submitForm() { + open.value = false; + console.log(timingForm) + postNew1(timingForm).then((res)=>{ + console.log(res) + ElMessage({type:"success",message:'新增成功!'}) + handleQuery() + timingForm.isControl='', + timingForm.deviceSn='', + timingForm.deviceName='', + timingForm.deviceAddress='', + timingForm.deviceModel='' + }) + +}; +function cancel() { + open.value = false; + timingForm.isControl='', + timingForm.deviceSn='', + timingForm.deviceName='', + timingForm.deviceAddress='', + timingForm.deviceModel='' +}; +function handleXg(data) { + open1.value = true; + title1.value = "修改设备"; + console.log(data) + timingForm1.isControl=data.isControl + timingForm1.deviceSn=data.deviceSn + timingForm1.deviceName=data.deviceName + timingForm1.deviceAddress=data.deviceAddress + timingForm1.deviceModel=data.deviceModel + timingForm1.deviceId = data.deviceId + // if(sceneContext=='出水温度'){ + // timingForm1.outtemp=sceneValue + // }else if (sceneContext=='进水温度'){ + // timingForm1.intemp=sceneValue + // }else{ + // timingForm1.temp=sceneValue + // } +}; +function submitForm1() { + open1.value = false; + if(timingForm1.isControl=='可控'){ + timingForm1.isControl=2 + }else if (timingForm1.isControl=='不可控'){ + timingForm1.isControl=1 + } + console.log(timingForm1) + postXg1({ + "deviceId": timingForm1.deviceId, + "parentId": 1, + "userId": 1, + "deviceType": 3, + "deviceSn": timingForm1.deviceSn, + "deviceModel": timingForm1.deviceModel, + "deviceName": timingForm1.deviceName, + "deviceAddress": timingForm1.deviceAddress, + "isControl":timingForm1.isControl, + "photoUrl": null, + "createBy": null, + "createTime": null, + }).then((res)=>{ + console.log(res) + ElMessage({type:"success",message:'修改成功!'}) + handleQuery() + timingForm1.isControl='' + timingForm1.deviceSn='' + timingForm1.deviceName='' + timingForm1.deviceAddress='' + timingForm1.deviceModel='' + timingForm1.deviceId='' + }) +}; +function cancel1() { + open1.value = false; + timingForm1.isControl='' + timingForm1.deviceSn='' + timingForm1.deviceName='' + timingForm1.deviceAddress='' + timingForm1.deviceModel='' + timingForm1.deviceId='' +}; +function handleDel(data) { + ElMessageBox.confirm("是否确认删除此设备?", "提示",{ + confirmButtonText: "确认", + cancelButtonText: "取消", + type: "warning" + }).then(() => { + console.log(data) + postDel1([data]).then((res) => { + console.log(res) + ElMessage({type:"success",message:'删除成功!'}) + handleQuery() + }); + }) +} + + + + +const { queryParams } = toRefs(data); +</script> + +<style scoped lang="scss"> +.dev_control_table{ + position: relative; + width: 100%; + min-height: 745px; + background-color: #2F3D8A; +} + +::v-deep .el-button{ + border-radius: 2px; +} +::v-deep .el-pagination{ + position: absolute; + bottom: 10px; + left: 50%; + transform: translateX(-50%); +} +::v-deep .el-pagination__total{ + color: #f3ffff; +} +::v-deep .el-pagination__jump{ + color: #f3ffff; +} +::v-deep .el-pager{ + margin: 0 5px; +} +::v-deep .el-table .el-table__body-wrapper{ + background-color: #2F3D8A; +} +::v-deep .el-form-item__content{ + //display: flex; +} +</style> \ No newline at end of file