| | |
| | | startDisinfect: 0x38, // 启动空调消毒 |
| | | stopDisinfect: 0x3A, // 停止空调消毒 |
| | | |
| | | startExhaustFan: 0x3C, // 启动空调排风机启动 |
| | | startExhaustFan: 0x3C, // 启动空调排风机 |
| | | stopExhaustFan: 0x3E // 停止空调排风机 |
| | | } |
| | | } |
New file |
| | |
| | | export default { |
| | | lockStatus: [ |
| | | { |
| | | key: 0, |
| | | label: "正常关" |
| | | }, |
| | | { |
| | | key: 1, |
| | | label: "正常开" |
| | | }, |
| | | { |
| | | key: 2, |
| | | label: "短路报警" |
| | | }, |
| | | { |
| | | key: 3, |
| | | label: "断路报警" |
| | | }, |
| | | { |
| | | key: 4, |
| | | label: "异常报警" |
| | | }, |
| | | ] |
| | | } |
New file |
| | |
| | | /** |
| | | * 根据key值,获取label值 |
| | | * @param key |
| | | * @param list |
| | | * @param defaultLabel |
| | | * @return label |
| | | */ |
| | | function getLabelByKey(key, list, defaultLabel) { |
| | | let label = defaultLabel===undefined?"":defaultLabel; |
| | | for(let i=0; i<list.length; i++) { |
| | | let item = list[i]; |
| | | if(item.key === key) { |
| | | label = item.label; |
| | | break; |
| | | } |
| | | } |
| | | return label; |
| | | } |
| | | export default getLabelByKey; |
| | |
| | | <script setup> |
| | | import FlexBox from "@/components/FlexBox.vue"; |
| | | import {reactive} from "vue"; |
| | | const nums = reactive([]); |
| | | for(let i=0; i<10; i++) { |
| | | nums.push(i); |
| | | } |
| | | import doorInfoModule from "@/views/accessControl/js/doorInfoModule"; |
| | | const {doorInfos} = doorInfoModule(); |
| | | |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <div class="flex-layout-absolute"> |
| | | <div class="access-control-list"> |
| | | <el-row> |
| | | <el-col :span="4" v-for="item in nums" :key="item"> |
| | | <el-col :span="4" v-for="item in doorInfos" :key="item"> |
| | | <div class="access-control-item"> |
| | | <flex-box> |
| | | <div class="access-control-img"> |
| | | <img src="./images/menJin.png" alt=""> |
| | | </div> |
| | | <div class="access-control-text update-time"> |
| | | 2023-06-29 00:00:00 |
| | | </div> |
| | | <div class="access-control-text home-number">401</div> |
| | | <div class="access-control-text state">关闭状态</div> |
| | | <!-- <div class="access-control-text update-time">--> |
| | | <!-- 2023-06-29 00:00:00--> |
| | | <!-- </div>--> |
| | | <div class="access-control-text home-number">{{ item.ip }}</div> |
| | | <div class="access-control-text state">门锁状态:{{ item.status }}</div> |
| | | </flex-box> |
| | | </div> |
| | | </el-col> |
New file |
| | |
| | | import createWs from "@/assets/js/tools/websocket/createWs"; |
| | | import {onMounted, reactive} from "vue"; |
| | | import door from "@/assets/js/const/door"; |
| | | import getLabelByKey from "@/assets/js/tools/getLabelByKey"; |
| | | const lockStatusList = door.lockStatus; |
| | | const doorInfoModule = ()=>{ |
| | | const { |
| | | SOCKET |
| | | } = createWs("carCameraSocket"); |
| | | |
| | | const doorInfos = reactive([ |
| | | { |
| | | ip: "192.168.10.19", |
| | | passWord: "a1234567.", |
| | | port: 8000, |
| | | userName: "admin", |
| | | status: "未知" |
| | | }, |
| | | { |
| | | ip: "192.168.10.18", |
| | | passWord: "a1234567.", |
| | | port: 8000, |
| | | userName: "admin", |
| | | status: "未知" |
| | | }, |
| | | { |
| | | ip: "192.168.10.44", |
| | | passWord: "a1234567.", |
| | | port: 8000, |
| | | userName: "admin", |
| | | status: "未知" |
| | | }, |
| | | ]); |
| | | |
| | | const handleOpen = ()=>{ |
| | | SOCKET.value.send(JSON.stringify(doorInfos)); |
| | | } |
| | | |
| | | const handleMessage = (res)=>{ |
| | | let rs = JSON.parse(res.data); |
| | | let data = rs.data; |
| | | doorInfos.map(item=>{ |
| | | let doorInfo = data[item.ip]; |
| | | console.log(doorInfo); |
| | | item.status = getLabelByKey(doorInfo.data2.lockStatus, lockStatusList, "未知"); |
| | | }); |
| | | } |
| | | |
| | | onMounted(()=>{ |
| | | SOCKET.value.addEventListener("open", handleOpen, false); |
| | | SOCKET.value.addEventListener("message", handleMessage, false); |
| | | }); |
| | | |
| | | return {doorInfos}; |
| | | } |
| | | |
| | | export default doorInfoModule; |
| | |
| | | <script setup> |
| | | import FlexBox from "@/components/FlexBox.vue"; |
| | | import {DArrowRight, CaretTop} from "@element-plus/icons-vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import HdwLight from "@/components/HdwLight.vue"; |
| | | import {ref, watch} from "vue"; |
| | | |
| | |
| | | |
| | | import setAirParam from "@/views/airConditioning/components/setAirParam.vue"; |
| | | |
| | | import air from "@/assets/js/const/air"; |
| | | const airCmd = ref(air.cmd); |
| | | |
| | | import airControlModule from "@/views/airConditioning/js/airControlModule"; |
| | | |
| | | const {startAir} = airControlModule(); |
| | | |
| | | const setParamVisible = ref(false); |
| | | |
| | | const showSetParamDialog = ()=>{ |
| | |
| | | const setParamClose = ()=>{ |
| | | setParamVisible.value = false; |
| | | }; |
| | | |
| | | const startAirByCmd = (opCmd)=>{ |
| | | ElMessageBox.confirm( |
| | | "确认进行控制", |
| | | "系统提示", |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'info', |
| | | draggable: true, |
| | | } |
| | | ).then(()=>{ |
| | | startAir(opCmd); |
| | | }).catch(()=>{}); |
| | | |
| | | } |
| | | |
| | | watch(monitorData, (data)=>{ |
| | | setRunMonitorData(data); |
| | |
| | | </div> |
| | | <div class="tools-btn-list"> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="primary">启动空调值班</el-button> |
| | | <el-button type="primary" @click="startAirByCmd(airCmd.startWork)">启动空调工作</el-button> |
| | | </div> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="warning">停止空调值班</el-button> |
| | | <el-button type="warning" @click="startAirByCmd(airCmd.stopWork)">停止空调工作</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="tools-btn-list"> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="primary">启动空调消毒</el-button> |
| | | <el-button type="primary" @click="startAirByCmd(airCmd.startOnDuty)">启动空调值班</el-button> |
| | | </div> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="warning">停止空调消毒</el-button> |
| | | <el-button type="warning" @click="startAirByCmd(airCmd.stopOnDuty)">停止空调值班</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="tools-btn-list"> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="primary">启动空调排风</el-button> |
| | | <el-button type="primary" @click="startAirByCmd(airCmd.startDisinfect)">启动空调消毒</el-button> |
| | | </div> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="warning">停止空调排风</el-button> |
| | | <el-button type="warning" @click="startAirByCmd(airCmd.stopDisinfect)">停止空调消毒</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="tools-btn-list"> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="primary" @click="startAirByCmd(airCmd.startExhaustFan)">启动空调排风</el-button> |
| | | </div> |
| | | <div class="tools-btn-item"> |
| | | <el-button type="warning" @click="startAirByCmd(airCmd.stopExhaustFan)">停止空调排风</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | const setAirParam = async ()=>{ |
| | | const isSuccess = await setParam(); |
| | | console.log(isSuccess); |
| | | if(isSuccess) { |
| | | emits('close', false); |
| | | } |
| | | } |
| | | |
| | | // onMounted(()=>{ |
| | | // getParam(); |
| | | // }); |
| | | onMounted(()=>{ |
| | | getParam(); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | <div class="el-dialog-footer"> |
| | | <el-button type="primary" @click="getParam">读取</el-button> |
| | | <el-button type="success" :disabled="!isCanSet" @click="setAirParam">设置</el-button> |
| | | <el-button type="success" @click="setAirParam">设置</el-button> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | import {reactive, ref} from "vue"; |
| | | import air from "@/assets/js/const/air"; |
| | | import {getAirParam, setAirParam} from "@/views/airConditioning/js/api"; |
| | | import {controlAir, getAirParam, setAirParam} from "@/views/airConditioning/js/api"; |
| | | import {ElLoading, ElMessage} from "element-plus"; |
| | | |
| | | const airControlModule = ()=>{ |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 设置参数 |
| | | * @return {Promise<Awaited<boolean>>} |
| | | */ |
| | | const setParam = async ()=>{ |
| | | const loading = ElLoading.service({ |
| | | lock: false, |
| | |
| | | } |
| | | } |
| | | |
| | | const startAir = async (opCmd)=>{ |
| | | const loading = ElLoading.service({ |
| | | lock: false, |
| | | text: '执行中...', |
| | | background: 'rgba(0, 0, 0, 0.3)', |
| | | }); |
| | | let msg = ""; |
| | | switch (opCmd) { |
| | | case 0x30: |
| | | msg = "启动空调工作"; |
| | | break; |
| | | case 0x32: |
| | | msg = "停止空调工作"; |
| | | break; |
| | | case 0x34: |
| | | msg = "启动空调值班"; |
| | | break; |
| | | case 0x36: |
| | | msg = "停止空调值班"; |
| | | break; |
| | | case 0x38: |
| | | msg = "启动空调消毒"; |
| | | break; |
| | | case 0x3A: |
| | | msg = "停止空调消毒"; |
| | | break; |
| | | case 0x3C: |
| | | msg = "启动空调排风机"; |
| | | break; |
| | | case 0x3E: |
| | | msg = "启动空调排风机"; |
| | | break; |
| | | } |
| | | try { |
| | | const res = await controlAir(210000001, opCmd); |
| | | loading.close(); |
| | | let rs = res.data; |
| | | if(rs.code === 1 && rs.data) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: msg+'成功', |
| | | type: 'success', |
| | | }); |
| | | }else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: msg+'失败', |
| | | type: 'error', |
| | | }); |
| | | } |
| | | }catch (error) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: msg+'失败', |
| | | type: 'error', |
| | | }); |
| | | loading.close(); |
| | | console.log(error); |
| | | } |
| | | |
| | | } |
| | | |
| | | return { |
| | | isCanSet, |
| | | airParam, |
| | | getParam, |
| | | setParam, |
| | | startAir |
| | | }; |
| | | } |
| | | export default airControlModule; |
| | |
| | | data, |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 控制空调 |
| | | * @param devId 设备ID |
| | | * @param opCmd 控制命令 |
| | | * @return {Promise<axios.AxiosResponse<any>> | *} |
| | | */ |
| | | export const controlAir = (devId, opCmd)=>{ |
| | | return axios({ |
| | | method: "POST", |
| | | url: "/envirParam/updateAirStartTest", |
| | | params: { |
| | | devId, |
| | | opCmd |
| | | }, |
| | | }); |
| | | } |