| | |
| | | <template #leftBlock2> |
| | | <ChannelCollapse :channels="channels"></ChannelCollapse> |
| | | </template> |
| | | <template #middleBlock1>标题</template> |
| | | <template #middleBlock1> |
| | | <DashboardTitle @should-reload="reloadAllData"></DashboardTitle> |
| | | </template> |
| | | <template #middleBlock2> |
| | | <el-tabs v-model="activeMainTabName" class="main-info-tabs"> |
| | | <el-tab-pane label="加工信息" name="加工信息"> |
| | | <ProcessingInfo style="margin-top: 6px" :task="activeTask"></ProcessingInfo> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="工艺信息" name="工艺信息">Config</el-tab-pane> |
| | | <el-tab-pane label="物料清单" name="物料清单">Role</el-tab-pane> |
| | | <el-tab-pane label="工艺信息" name="工艺信息"> |
| | | <div style="height: 300px"> |
| | | <el-scrollbar always class="scroller" style="height: 100%"> |
| | | <div |
| | | v-infinite-scroll="craftModelStore.loadMore" |
| | | infinite-scroll-delay="500" |
| | | infinite-scroll-distance="40" |
| | | style="display: flex; align-items: center; flex-wrap: wrap" |
| | | > |
| | | <ProcessInfo |
| | | v-for="item in craftModelStore.craftModelList" |
| | | :key="item.ID" |
| | | :task="activeTask" |
| | | :active-arr="activeArr" |
| | | :craft-model="item" |
| | | @detail="openCraftModelDetailModal" |
| | | @update="updateCraft" |
| | | ></ProcessInfo> |
| | | </div> |
| | | <div class="craft-loaded-tip"> |
| | | <el-icon v-if="craftModelStore.loading" class="is-loading" size="30"> |
| | | <Loading /> |
| | | </el-icon> |
| | | |
| | | <div v-if="!craftModelStore.hasMore && craftModelStore.craftModelList.length > 6">加载完成</div> |
| | | </div> |
| | | </el-scrollbar> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="物料清单" name="物料清单"> |
| | | <InputMaterialsList |
| | | :material-list="activeTask?.Procedure?.procedure?.inputMaterials" |
| | | @detail-click="showMaterialDetailModal" |
| | | ></InputMaterialsList> |
| | | <OutputMaterialsList |
| | | :material-list="activeTask?.Procedure?.procedure?.outputMaterials" |
| | | @detail-click="showMaterialDetailModal" |
| | | ></OutputMaterialsList> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </template> |
| | | <template #middleBlock3> |
| | | <SubTitle>任务详情</SubTitle> |
| | | <div class="task-detail"> |
| | | <TaskControl :task="activeTask"></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> |
| | | </template> |
| | | <template #middleBlock4> |
| | | <SubTitle>人员信息</SubTitle> |
| | | <PersonInfo :person="person"></PersonInfo> |
| | | <PersonInfo v-for="worker in workers" :key="worker.workerId" :person="worker"></PersonInfo> |
| | | </template> |
| | | <template #rightBlock1> |
| | | <div class="date-time"> |
| | | <CurrentDateTime></CurrentDateTime> |
| | | </div> |
| | | </template> |
| | | <template #rightBlock2>状态面板</template> |
| | | <template #rightBlock2> |
| | | <DeviceStatusInfo :type="1"></DeviceStatusInfo> |
| | | <DeviceStatusInfo :device="deviceStore.deviceInfo" :type="2"></DeviceStatusInfo> |
| | | <DeviceNumberInfo></DeviceNumberInfo> </template |
| | | >当前任务: |
| | | <template #rightBlock3> |
| | | <SubTitle>知识库</SubTitle> |
| | | <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> |
| | | <CraftDetailModal |
| | | v-model="showCraftModelDetail" |
| | | :active-arr="activeArr" |
| | | :craft-model="currentCraftModelInfo" |
| | | @renew="updateCraft" |
| | | @close="showCraftModelDetail = false" |
| | | ></CraftDetailModal> |
| | | <MaterialDetails v-model="showMaterialDetail" :material="currentMaterialInfo"></MaterialDetails> |
| | | </template> |
| | | <script setup lang="ts"> |
| | | import { computed, ref } from 'vue' |
| | | import ChannelCollapse from '@/views/dashboard/components/ChannelCollapse.vue' |
| | | import type { Worker } from '@/api/task' |
| | | |
| | | import type { Task, Material } from '@/api/task' |
| | | import type { CraftModel } from '@/api/craftModel' |
| | | import PersonInfo from '@/views/dashboard/components/PersonInfo.vue' |
| | | import ProcessInfo from '@/views/dashboard/components/ProcessInfo.vue' |
| | | import ColorInfo from '@/views/dashboard/components/ColorInfo.vue' |
| | | import DeviceStatusInfo from '@/views/dashboard/components/DeviceStatusInfo.vue' |
| | | import DeviceNumberInfo from '@/views/dashboard/components/DeviceNumberInfo.vue' |
| | | import KnowledgeInfo from '@/views/dashboard/components/KnowledgeInfo.vue' |
| | | import InputMaterialsList from '@/views/dashboard/components/InputMaterialsList.vue' |
| | | import OutputMaterialsList from '@/views/dashboard/components/OutputMaterialsList.vue' |
| | | import BigButton from '@/views/dashboard/components/BigButton.vue' |
| | | import type { LabelValue } from '@/views/dashboard/components/TaskTabs.vue' |
| | | import TaskTabs from '@/views/dashboard/components/TaskTabs.vue' |
| | | import CurrentDateTime from '@/views/dashboard/components/CurrentDateTime.vue' |
| | |
| | | import ProcessingInfo from '@/views/dashboard/components/ProcessingInfo.vue' |
| | | 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' |
| | | import { useCraftModelStore } from '@/stores/craftModel' |
| | | import CraftDetailModal from '@/views/dashboard/components/CraftDetailModal.vue' |
| | | import MaterialDetails from '@/views/dashboard/components/MaterialDetails.vue' |
| | | |
| | | 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' |
| | | }) |
| | | |
| | | const person = computed(() => { |
| | | return { |
| | | workerName: '姓名', |
| | | phone: '111' |
| | | } as unknown as Worker |
| | | // 获取当前高亮任务的值班人信息 |
| | | const taskStore = useTasksStore() |
| | | const workers = computed(() => { |
| | | return taskStore.activeTask?.Procedure?.procedure?.workers ?? [] |
| | | }) |
| | | |
| | | const taskTabsList = [ |
| | | { |
| | | label: '未完成', |
| | |
| | | |
| | | const tasksStore = useTasksStore() |
| | | const { activeTask, channels } = storeToRefs(tasksStore) |
| | | tasksStore.getChannels(1) |
| | | tasksStore.getChannels(1, true) |
| | | |
| | | function changeTab(tab: LabelValue) { |
| | | tasksStore.getChannels(tab.value) |
| | | } |
| | | |
| | | /** |
| | | * 完成任务或者下发参数成功后要刷新通道数据 |
| | | * @param task |
| | | */ |
| | | function reloadChannel(task: Task) { |
| | | 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 deviceStore = useDevicesStore() |
| | | deviceStore.startPollingDevice() |
| | | // console.log(deviceStore, '1111') |
| | | // localStorage.setItem('currentDeviceID', deviceStore.deviceInfo.currentDeviceID) |
| | | |
| | | // 切换任务时获取对应任务的工艺模型信息 |
| | | const craftModelStore = useCraftModelStore() |
| | | craftModelStore.getCraftModelList() |
| | | |
| | | const showCraftModelDetail = ref(false) |
| | | // 当前要展示的工艺详情 |
| | | const currentCraftModelInfo = ref<CraftModel>() |
| | | const activeArr = ref<string[]>([]) |
| | | function openCraftModelDetailModal(craftModel: CraftModel) { |
| | | currentCraftModelInfo.value = craftModel |
| | | showCraftModelDetail.value = true |
| | | } |
| | | // 更新工艺 |
| | | function updateCraft(craftModel: CraftModel) { |
| | | if (activeTask?.value?.Procedure?.ID) { |
| | | activeArr.value.push(craftModel.number) |
| | | updateCraftParams({ procedureId: activeTask!.value.Procedure.ID }).then( |
| | | (res) => { |
| | | if (res.code == 200) { |
| | | editActive(craftModel) |
| | | ElMessage({ |
| | | message: '更新成功!', |
| | | type: 'success' |
| | | }) |
| | | craftModelStore.getCraftModelList() |
| | | } |
| | | }, |
| | | (err) => { |
| | | console.error(err, '----err') |
| | | setTimeout(() => { |
| | | editActive(craftModel) |
| | | }, 300) |
| | | } |
| | | ) |
| | | } |
| | | } |
| | | function editActive(craftModel: CraftModel) { |
| | | for (let i in activeArr.value) { |
| | | if (activeArr.value[i] == craftModel.number) { |
| | | activeArr.value.splice(Number(i), 1) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 是否展示物料详情弹窗 |
| | | const showMaterialDetail = ref(false) |
| | | // 当前要展示的物料详情 |
| | | const currentMaterialInfo = ref<Material>() |
| | | |
| | | /** |
| | | * 显示物料详情弹窗 |
| | | * @param material |
| | | */ |
| | | function showMaterialDetailModal(material: Material) { |
| | | currentMaterialInfo.value = material |
| | | showMaterialDetail.value = true |
| | | } |
| | | |
| | | const currentWorkers = computed(() => { |
| | | const channel = activeTask.value?.Channel |
| | | if (isNumber(channel)) { |
| | | console.log(activeTask.value?.Procedure?.procedure?.workers, '99999') |
| | | // return [] |
| | | return activeTask.value?.Procedure?.procedure?.workers ?? [] |
| | | } else { |
| | | return [] |
| | | } |
| | | }) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding-top: 12px; |
| | | padding-top: 22px; |
| | | } |
| | | |
| | | :deep(.el-tabs) { |
| | | height: 100%; |
| | | } |
| | | :deep(.el-tab-pane) { |
| | | height: 100%; |
| | | } |
| | | :deep(.el-tabs__content) { |
| | | height: calc(100% - 56px); |
| | | } |
| | | :deep(.el-tabs__item) { |
| | | color: #fff; |
| | | font-size: 20px; |
| | |
| | | :deep(.el-tabs__nav-wrap::after) { |
| | | height: 1px; |
| | | } |
| | | .btn { |
| | | width: 100%; |
| | | font-size: 20px; |
| | | } |
| | | .craft-loaded-tip { |
| | | height: 40px; |
| | | text-align: center; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | .scroller { |
| | | 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> |