charles
2024-04-29 c7f3fd5215399b37d0511b3bd555150ff1b13507
src/views/dashboard/index.vue
@@ -45,11 +45,11 @@
        </el-tab-pane>
        <el-tab-pane label="物料清单" name="物料清单">
          <InputMaterialsList
            :material-list="activeTask?.Procedure.procedure.inputMaterials"
            :material-list="activeTask?.Procedure?.procedure?.inputMaterials"
            @detail-click="showMaterialDetailModal"
          ></InputMaterialsList>
          <OutputMaterialsList
            :material-list="activeTask?.Procedure.procedure.outputMaterials"
            :material-list="activeTask?.Procedure?.procedure?.outputMaterials"
            @detail-click="showMaterialDetailModal"
          ></OutputMaterialsList>
        </el-tab-pane>
@@ -58,10 +58,12 @@
    <template #middleBlock3>
      <SubTitle>任务详情</SubTitle>
      <div class="task-detail">
        <TaskControl :task="activeTask" :workers="currentWorkers" @should-reload="reloadChannel"></TaskControl>
        <el-scrollbar always class="scroller">
          <TaskControl :task="activeTask" :workers="currentWorkers" @should-reload="reloadChannel"></TaskControl>
          <ColorInfo :type="1"></ColorInfo>
          <ColorInfo :type="2"></ColorInfo>
        </el-scrollbar>
      </div>
      <ColorInfo :type="1"></ColorInfo>
      <ColorInfo :type="2"></ColorInfo>
    </template>
    <template #middleBlock4>
      <SubTitle>人员信息</SubTitle>
@@ -73,13 +75,17 @@
      </div>
    </template>
    <template #rightBlock2>
      <DeviceStatusInfo :plc="plcStore.plcInfo" :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :type="1"></DeviceStatusInfo>
      <DeviceStatusInfo :device="deviceStore.deviceInfo" :type="2"></DeviceStatusInfo>
      <DeviceNumberInfo></DeviceNumberInfo>
    </template>
      <DeviceNumberInfo></DeviceNumberInfo> </template
    >当前任务:
    <template #rightBlock3>
      <SubTitle>知识库</SubTitle>
      <KnowledgeInfo></KnowledgeInfo>
      <div class="task-detail-right-3">
        <el-scrollbar always class="scroller">
          <KnowledgeInfo></KnowledgeInfo>
        </el-scrollbar>
      </div>
      <BigButton class="btn" bg-color="red">红灯呼叫</BigButton>
    </template>
  </DashboardLayout>
@@ -116,7 +122,7 @@
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 { usePLCStore } from '@/stores/plc'
import { useDevicesStore } from '@/stores/devices'
import { useCraftModelStore } from '@/stores/craftModel'
import CraftDetailModal from '@/views/dashboard/components/CraftDetailModal.vue'
@@ -125,6 +131,8 @@
import { updateCraftParams } from '@/api'
import { Loading } from '@element-plus/icons-vue'
import { isNumber } from 'lodash-es'
import { getToken } from '@/common/utils/index'
const token = getToken()
defineOptions({
  name: 'DashboardView'
@@ -166,20 +174,24 @@
 * @param task
 */
function reloadChannel(task: Task) {
  tasksStore.reloadChannel(task.Channel).then(() => {
    plcStore.startPollingPLC()
  })
  if (token !== null || token !== '' || token !== 'undefined') {
    tasksStore.reloadChannel(task.Channel)
    location.reload()
  }
}
function reloadAllData() {
  tasksStore.reloadAllData()
  location.reload()
}
// 启动plc 轮询
const plcStore = usePLCStore()
plcStore.startPollingPLC()
// const plcStore = usePLCStore()
// plcStore.startPollingPLC()
// 启动 设备 轮询
const deviceStore = useDevicesStore()
deviceStore.startPollingDevice()
// console.log(deviceStore, '1111')
// localStorage.setItem('currentDeviceID', deviceStore.deviceInfo.currentDeviceID)
// 切换任务时获取对应任务的工艺模型信息
const craftModelStore = useCraftModelStore()
@@ -242,7 +254,9 @@
const currentWorkers = computed(() => {
  const channel = activeTask.value?.Channel
  if (isNumber(channel)) {
    return channels.value[channel].workers ?? []
    console.log(activeTask.value?.Procedure?.procedure?.workers, '99999')
    // return []
    return activeTask.value?.Procedure?.procedure?.workers ?? []
  } else {
    return []
  }
@@ -304,6 +318,15 @@
  justify-content: center;
}
.scroller {
  padding: 4px 16px;
  padding: 4px 10px;
}
.task-detail {
  width: 100%;
  height: calc(100% - 32px);
  padding-right: 5px;
}
.task-detail-right-3 {
  width: 100%;
  height: calc(100% - 32px - 50px);
}
</style>