yangfeng
2024-03-29 82e27d0cadbddfc73e8b978e778b802dc8e51fa1
src/views/dashboard/components/ChannelCollapse.vue
@@ -45,6 +45,9 @@
import { useTasksStore } from '@/stores/tasks'
import { ArrowDownBold, ArrowUpBold } from '@element-plus/icons-vue'
import { isNumber } from 'lodash-es'
import { getTaskInfo } from '@/api'
import type { TaskInfoParams } from '@/api'
import { storeToRefs } from 'pinia'
export interface ChannelCollapseProps {
  channels: TasksGroupByChannel
@@ -54,6 +57,7 @@
const activeChannel = ref<string[]>([])
const tasksStore = useTasksStore()
const { activeTask } = storeToRefs(tasksStore)
watchEffect(() => {
  // 通道数据变化后
@@ -67,11 +71,26 @@
}
function selectTask(task: Task | undefined) {
  tasksStore.setActiveTask(task)
  let channel = tasksStore?.activeTask?.Channel
  if (isNumber(channel)) {
    tasksStore.setActiveChannel(channel)
  console.log(task, 'iiiiiii')
  const params: TaskInfoParams = {
    deviceID: localStorage.getItem('currentDeviceID') || '',
    procedureID: Number(task?.Procedure.ID)
  }
  return getTaskInfo(params)
    .then((res) => {
      tasksStore.setActiveTask(res.data)
      let channel = tasksStore?.activeTask?.Channel
      if (isNumber(channel)) {
        tasksStore.setActiveChannel(channel)
      }
      // taskStore.activeTask?.value = res.data
    })
    .catch((err) => {
      console.error(err)
    })
    .finally(() => {})
  // tasksStore.setActiveTask(task)
}
</script>
@@ -89,7 +108,7 @@
:deep(.el-collapse-item__header) {
  color: #fff;
  background-color: transparent;
  font-size: 19px;
  font-size: 18px;
  font-weight: 600;
  border: none;
}