diff --git a/src/components.d.ts b/src/components.d.ts index 2bf71f2..00c002b 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -24,6 +24,7 @@ declare module 'vue' { ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] ElTimePicker: typeof import('element-plus/es')['ElTimePicker'] + Linechart: typeof import('./components/Linechart.vue')['default'] Pagination: typeof import('./components/Pagination/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/components/Linechart.vue b/src/components/Linechart.vue new file mode 100644 index 0000000..6f91310 --- /dev/null +++ b/src/components/Linechart.vue @@ -0,0 +1,87 @@ + + + + + \ No newline at end of file diff --git a/src/layout/components/aside.vue b/src/layout/components/aside.vue deleted file mode 100644 index 17a5349..0000000 --- a/src/layout/components/aside.vue +++ /dev/null @@ -1,79 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/AlarmInformation/index.vue b/src/views/AlarmInformation/index.vue index a9bab2b..cb2fa52 100644 --- a/src/views/AlarmInformation/index.vue +++ b/src/views/AlarmInformation/index.vue @@ -17,12 +17,18 @@
- - - - + + + + + + + + - +
@@ -39,7 +45,7 @@ -->
- + @@ -60,21 +66,58 @@ import { ref, onMounted, onUnmounted } from 'vue' import { useRouter } from 'vue-router' import RPC from '@/utils/rpc'; +import dayjs from 'dayjs'; const router = useRouter() const currentTime = ref('') const systemRuntime = ref('38分钟') const commit_uid = localStorage.getItem('central_control_comm_uid') -const total = ref(100) -const pageSize = ref(10) +const loading = ref(false) +const total = ref(0) +const pageSize = ref(9) const currentPage = ref(1) const handleSizeChange = () => { - console.log('handleSizeChange') currentPage.value = 1 + getData() } const handleCurrentChange = () => { - console.log('handleCurrentChange') + getData() +} + +const tableData = ref([]) + +const getData = () => { + const params = { + "limit": pageSize.value, + "page": currentPage.value, + "and": { + "comm_uid": [ + commit_uid + ] + }, + "like": {}, + "orderby": [ + { + "id": "desc", + "fault_time": "desc" + } + ] + } + loading.value = true + tableData.value = [] + RPC.post('/m9z/fault/list', params).then(res => { + total.value = res.count || 0 + tableData.value = res.rows || [] + }).finally(() => { + loading.value = false + }) +} +getData() + +const reflesh = () => { + currentPage.value = 1 + getData() } @@ -100,28 +143,6 @@ const restartSystem = () => { }) } -const tableData = [ - { - date: '2016-05-03', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-02', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-04', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, - { - date: '2016-05-01', - name: 'Tom', - address: 'No. 189, Grove St, Los Angeles', - }, -] diff --git a/src/views/HandleControl/index.vue b/src/views/HandleControl/index.vue index 50091e3..32c7151 100644 --- a/src/views/HandleControl/index.vue +++ b/src/views/HandleControl/index.vue @@ -278,6 +278,8 @@ const energyParams = ref({ powerFactor: '0' }) +const isInitData = ref(true) + // 回路控制数据 const circuits = ref([ { id: 1, name: '回路1', status: '关闭' }, @@ -382,12 +384,15 @@ const getInfo = () => { setTimeout(() => { isSync.value = false }, 1000); + }).finally(() => { + isInitData.value = false }) } getInfo() const oldInfo = ref('') watch(info, () => { + if (isInitData.value) return if (oldInfo.value === JSON.stringify(info.value)) return RPC.post('/m9z/setDeviceManualInfo', { comm_uid: commit_uid, ...info.value }).finally(() => { if (!isSync.value) { diff --git a/src/views/Monitoring/index.vue b/src/views/Monitoring/index.vue index ea0ff00..a818008 100644 --- a/src/views/Monitoring/index.vue +++ b/src/views/Monitoring/index.vue @@ -73,44 +73,56 @@ 当前模式
- {{ info.disable ? '手动' : '自动' }} + {{ info.Mode ? '手动' : '自动' }}
-
+
回路{{ index + 1 }}:{{ circuit.is_open ? '打开' : '关闭' }}
-
+ +
+
直流电流: {{ circuit.A }}A
+
+
电源: {{ circuit.V }}V
+
功率: {{ circuit.Kw }}kw
+
-
+
回路{{ index + 6 }}:{{ circuit.is_open ? '打开' : '关闭' }}
-
+ +
+
直流电流: {{ circuit.A }}A
+
+
电源: {{ circuit.V }}V
+
功率: {{ circuit.Kw }}kw
+
- -
-
+
调光通道{{ index + 1 }}
{{ channel.pwm }}% @@ -120,7 +132,7 @@
-
+
调光通道{{ index + 6 }}
{{ channel.pwm }}% @@ -128,7 +140,9 @@
- +
@@ -184,6 +198,7 @@ import { ref, onMounted, onUnmounted, watch } from 'vue' import { useRouter } from 'vue-router' import RPC from '@/utils/rpc' import dayjs from 'dayjs' +// import Linechart from '@/components/Linechart.vue'; const commit_uid = localStorage.getItem('central_control_comm_uid') @@ -231,77 +246,107 @@ const energyParams = ref({ const info = ref({ - "disable": false, + "Mode": 0, "backup_byte1": 0, - "loops": [ + "Loops": [ { "index": 0, "name": "#1", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 1, "name": "#2", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 2, "name": "#3", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 3, "name": "#4", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 4, "name": "#5", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 5, "name": "#6", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 6, "name": "#7", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 7, "name": "#8", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 8, "name": "#9", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, }, { "index": 9, "name": "#10", "is_open": false, - "pwm": 0 + "pwm": 0, + A: 0, + V: 0, + Kw: 0, } ], "backup_byte4": 0 }) const getInfo = () => { - RPC.post('/m9z/getDeviceManualInfo', { comm_uid: commit_uid }).then(res => { - info.value = res - }) + // RPC.post('/m9z/getDeviceManualInfo', { comm_uid: commit_uid }).then(res => { + // info.value = res + // }) RPC.post('/adl400/readPhaseData', { comm_uid: commit_uid }).then(res => { powerPhases.value[0].voltage = res.aVoltage + 'V' powerPhases.value[0].current = res.aElectricCurrent + 'A' @@ -321,6 +366,10 @@ const getInfo = () => { energyParams.value.activeEnergy = res.activeEnergy + 'A' energyParams.value.powerFactor = res.powerFactor }) + RPC.post('/m9z/getDeviceStatus2', { comm_uid: commit_uid }).then((res) => { + // 直流电流、电源、功率 + info.value = res + }) // RPC.post('/m9z/getDeviceSunRiseTime', { comm_uid: commit_uid }).then(res => { // sunriseTime.value = res.Sunrise ? dayjs(res.Sunrise).format('HH:mm:ss') : '' @@ -329,6 +378,15 @@ const getInfo = () => { } getInfo() +const timer = setInterval(() => { + console.log('setInterval') + getInfo() +}, 30000) + +onUnmounted(() => { + clearInterval(timer) +}) + const oldInfo = ref('') // watch(info, () => { // if (oldInfo.value === JSON.stringify(info.value)) return @@ -578,20 +636,41 @@ onUnmounted(() => { .circuit-section { display: flex; flex-direction: column; - gap: 20px; + gap: 10px; } .circuit-row { display: flex; justify-content: space-between; font-size: 12px; + + .circuitStatus { + color: #fff; + width: 100%; + + .line { + width: 100%; + display: flex; + margin-top: 10px; + display: flex; + justify-content: space-between; + + .line_item { + width: 45%; + // flex: 1; + flex-shrink: 0; + display: flex; + justify-content: space-between; + } + } + } } .circuit-item { display: flex; flex-direction: column; align-items: center; - gap: 10px; + // gap: 10px; width: 18%; } @@ -867,4 +946,9 @@ onUnmounted(() => { gap: 20px; padding-top: 20px; } + +.chart { + width: 100%; + height: 400px; +}