songshankun
2023-11-02 7e7424b2662e5b27dcc1c0d37f43e909e0b15ee1
src/views/dashboard/index.vue
@@ -38,8 +38,8 @@
      </div>
    </template>
    <template #rightBlock2>
      <DeviceStatusInfo :device="device" :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :device="device" :type="2"></DeviceStatusInfo>
      <DeviceStatusInfo :plc="plcStore.plcInfo" :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :device="deviceStore.deviceInfo" :type="2"></DeviceStatusInfo>
      <DeviceNumberInfo></DeviceNumberInfo>
    </template>
    <template #rightBlock3>
@@ -50,7 +50,7 @@
  </DashboardLayout>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed, ref, watch, onUnmounted } from 'vue'
import ChannelCollapse from '@/views/dashboard/components/ChannelCollapse.vue'
import type { Worker, Order, Task } from '@/api/task'
import type { PLCResponse } from '@/api/plc'
@@ -70,6 +70,8 @@
import TaskControl from '@/views/dashboard/components/TaskControl.vue'
import SubTitle from '@/views/dashboard/components/SubTitle.vue'
import DashboardTitle from '@/views/dashboard/components/DashboardTitle.vue'
import { usePLCStore } from '@/stores/plc'
import { useDevicesStore } from '@/stores/devices'
defineOptions({
  name: 'DashboardView'
@@ -126,6 +128,13 @@
function reloadAllData(task: Task) {
  tasksStore.reload(task.Channel)
}
const plcStore = usePLCStore()
// 启动plc 轮询
plcStore.startPollingPLC()
const deviceStore = useDevicesStore()
deviceStore.startPollingDevice()
</script>
<style scoped lang="scss">