|
@@ -0,0 +1,67 @@
|
|
|
|
|
+<script setup>
|
|
|
|
|
+import {clientGet} from "@/utils/apiClient.js";
|
|
|
|
|
+import {ElLoading, ElMessage} from "element-plus";
|
|
|
|
|
+
|
|
|
|
|
+const props = defineProps({
|
|
|
|
|
+ deviceNumber:{
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const brightness = ref('');
|
|
|
|
|
+const poleInfo = ref({
|
|
|
|
|
+ light_num: '', //灯杆编号
|
|
|
|
|
+ brightness: '', //灯杆当前亮度
|
|
|
|
|
+ flag: 0, //0是关 1是开 (灯杆当前状态)
|
|
|
|
|
+ voltage: '', //电压
|
|
|
|
|
+ current: '', //电流
|
|
|
|
|
+ power: '', //功率
|
|
|
|
|
+ power_quantity: '', //电量
|
|
|
|
|
+ light_total_time: '',//累计开的时间
|
|
|
|
|
+ onlineStatus: 0//0离线 1在线 在线状态
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const controlPole = async (brightness) => {
|
|
|
|
|
+ const loadingInstance = ElLoading.service({
|
|
|
|
|
+ target: '.slider-container',
|
|
|
|
|
+ text: 'Loading',
|
|
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await clientGet("/pole/instruct/issued/reportEnvironmentalData", {
|
|
|
|
|
+ params: {
|
|
|
|
|
+ cmd: '6011',
|
|
|
|
|
+ brightness: brightness?.toString(),
|
|
|
|
|
+ packageId: '1050',
|
|
|
|
|
+ lightNums: props.deviceNumber,
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (res.code !== 200) {
|
|
|
|
|
+ ElMessage.error(res.msg);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ ElMessage.error('An error occurred');
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ loadingInstance.close();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const control = () => {
|
|
|
|
|
+ controlPole(brightness.value);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+
|
|
|
|
|
+})
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<template>
|
|
|
|
|
+ <el-slider v-model="brightness" :step="10" :max="100" :min="0" @change="control"/>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
|
|
+
|
|
|
|
|
+</style>
|