diff --git a/src/App.vue b/src/App.vue index 2963f0c..18e23cb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -7,6 +7,7 @@ import { getConfig, getContainerList } from "./services/sysConfig/sysConfig"; import { useSettingStore } from "./stores/setting"; import { getLiquidList } from "./services/liquid/liquidManage"; import { useStatusStore } from "./stores/status"; +import { useCraftStore } from "./stores/craft"; import { ElMessage } from "element-plus"; import { getUserList } from "./services/user/userManager"; import { useUserStore } from "./stores/user"; @@ -15,6 +16,7 @@ const router = useRouter(); const settingStore = useSettingStore(); const statusStore = useStatusStore(); const userStore = useUserStore(); +const craftStore = useCraftStore() const wsClient = createWebSocket(sharedWsUrl); wsClient.dataOb.subscribe(data => { @@ -27,6 +29,7 @@ wsClient.dataOb.subscribe(data => { }); } else if (data.type === "crafts") { console.log("crafts:", data); + craftStore.setCraftInfo(data.data); } else if (data.type === "container") { settingStore.setContainerConf(data.data.containerList); } diff --git a/src/assets/executing.svg b/src/assets/executing.svg new file mode 100644 index 0000000..ac58c36 --- /dev/null +++ b/src/assets/executing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/ready.svg b/src/assets/ready.svg new file mode 100644 index 0000000..a26eeaf --- /dev/null +++ b/src/assets/ready.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/OverlayModal.vue b/src/components/OverlayModal.vue index 0063206..864097a 100644 --- a/src/components/OverlayModal.vue +++ b/src/components/OverlayModal.vue @@ -21,7 +21,7 @@ position: absolute; top: 0px; left: 0px; - z-index: 999 + z-index: 112 } .overlay_modal{ display: flex; diff --git a/src/services/globalCmd/globalCmd.ts b/src/services/globalCmd/globalCmd.ts index ef7d62c..c19985c 100644 --- a/src/services/globalCmd/globalCmd.ts +++ b/src/services/globalCmd/globalCmd.ts @@ -118,6 +118,7 @@ export const CmdDescMap: { [k in OperationCmd]: string } = { moveTube: "移动试管", openDoor: "开门", closeDoor: "关门", + }; export type OperationCmd = diff --git a/src/services/ore/oreManage.ts b/src/services/ore/oreManage.ts index ea8fb34..92186d0 100644 --- a/src/services/ore/oreManage.ts +++ b/src/services/ore/oreManage.ts @@ -41,3 +41,7 @@ export function getCraftList(ids: string) { export function craftStart(params:any) { return httpRequest({ url: `/api/crafts/start`, method: "POST", params }); } + +export function craftStop(params:any) { + return httpRequest({ url: `/api/crafts/stop`, method: "POST", params }); +} \ No newline at end of file diff --git a/src/services/socket.ts b/src/services/socket.ts index 8811a08..cfadabd 100644 --- a/src/services/socket.ts +++ b/src/services/socket.ts @@ -116,6 +116,15 @@ export type StatusDatagram = { }; }; +export type CraftState = { + type: "crafts" + data: { + heatId: string | number + methodIndex: string| number + status: string| number + } +} + export type ContainerDatagram = { type: "container", data: { diff --git a/src/services/task/task.ts b/src/services/task/task.ts index 5014a7f..e4cc377 100644 --- a/src/services/task/task.ts +++ b/src/services/task/task.ts @@ -1,5 +1,5 @@ import httpRequest, { type BaseResponse } from "../httpRequest"; -import { addTxnRecord } from "../txn"; +import { addTxnRecord, injectFluidsRecord } from "../txn"; import type { OperationCmd } from "../globalCmd/globalCmd"; @@ -21,5 +21,11 @@ export function getIngTask() { //批量加热 export function startHeat(params: { command: OperationCmd; params: [] }) { const commandId = addTxnRecord({ ...params, category: "task" }); - return httpRequest>({ url: "/api/cmd/startHeat", params, method: "POST" }); + return httpRequest>({ url: "/api/cmd/startHeat", params: { ...params, commandId }, method: "POST" }); +} + +//批量加液 +export function injectFluid(params:any) { + const commandId = injectFluidsRecord({ injectFluids:params.injectFluids, command:'', category: "task" }); + return httpRequest>({ url: "/api/cmd/injectFluid", params: { ...params, commandId }, method: "POST" }); } \ No newline at end of file diff --git a/src/services/txn.ts b/src/services/txn.ts index 868bd5f..cd315ce 100644 --- a/src/services/txn.ts +++ b/src/services/txn.ts @@ -24,11 +24,17 @@ type DebugCmdRecord = { type TaskCmdRecord = { category: "task"; - command: OperationCmd; + command: OperationCmd | null; params: Record; } -type TxnRecord = DebugCmdRecord | TaskCmdRecord +type TaskCmdInjectFluidsRecord = { + category: "task"; + command: '', + injectFluids: []; +} + +type TxnRecord = DebugCmdRecord | TaskCmdRecord | TaskCmdInjectFluidsRecord const txnCmdMap: Record = {}; @@ -38,6 +44,12 @@ export function addTxnRecord(val: TxnRecord) { return txn; } +export function injectFluidsRecord(val: TaskCmdInjectFluidsRecord){ + const txn = generateTxnNo().toString(); + txnCmdMap[txn] = val; + return txn; +} + export function getTxnRecord(txn: string, category: TxnRecord["category"]) { const record = txnCmdMap[txn]; // 只有属于指定category时,才返回,且返回后删除记录,节约内存 diff --git a/src/stores/craft.ts b/src/stores/craft.ts new file mode 100644 index 0000000..d58d941 --- /dev/null +++ b/src/stores/craft.ts @@ -0,0 +1,15 @@ +import { ref, computed } from "vue"; +import { defineStore } from "pinia"; +import * as R from "ramda"; +import type { CraftState } from "@/services/socket"; + +export const useCraftStore = defineStore("craft", () => { + const craftInfo = ref(); + const setCraftInfo = (data: CraftState["data"]) => { + if (!R.equals(craftInfo.value, data)) { + craftInfo.value = data; + } + }; + + return { craftInfo, setCraftInfo }; +}); diff --git a/src/views/graphite/components/AddLiquid.vue b/src/views/graphite/components/AddLiquid.vue index 065203f..bb14ea3 100644 --- a/src/views/graphite/components/AddLiquid.vue +++ b/src/views/graphite/components/AddLiquid.vue @@ -1,22 +1,29 @@ 添加溶液 - - + 请选择加液试管 - - + + + + - 已选择{{ selectedTubeList.length }}个试管 + + + 试管{{ item.tubeNum }}-{{ item.name }}添加{{ item.volume }}ml + X + + + @@ -49,12 +56,6 @@ - - - + + - + + - {{ trayInfo.craftInfo.name }} - 工艺执行中 + {{ trayInfo.craftInfo.name }} + {{ !trayInfo.executing_craft ? '工艺等待执行' : '工艺执行完毕'}} @@ -47,7 +49,7 @@ {{ trayInfo.heatAearStatus.temperature }} 选择 @@ -103,7 +105,9 @@ import { ref, watch, onMounted, getCurrentInstance } from "vue"; import OverlayModal from "@/components/OverlayModal.vue"; import CraftList from "./CraftList.vue"; -import LoadingSvg from "@/assets/loading.svg"; +import ReadySvg from "@/assets/ready.svg"; +import ExecutingSvg from "@/assets/executing.svg"; + const tubeList = ref([]); const props = defineProps({ heatInfo: Object, @@ -111,6 +115,8 @@ const props = defineProps({ }); const emits = defineEmits(["onSelectedTray", "onSetHeatAreaTemp", 'onSelectCraft']); const selectedBackgroundColor = '#189952' +const readyColor = '#EE8223' +const executingColor = '#14A656' onMounted(() => { for(let i = 0 ; i<16; i++){ tubeList.value.push({ @@ -181,6 +187,7 @@ const onConfirm = () => { //试管操作 const onHandleTube = (tubeInfo: any, index:number) => { + if(!trayInfo.value.heatAearStatus.trayStatus)return; //设置UI选中颜色 if(trayInfo.value.heatAearStatus.trayStatus && tubeInfo.isSelected){ tubeInfo.backgroudColor = '' @@ -238,34 +245,7 @@ const onHandleSelectedCraft = (craftData:any) => { padding-top: 0.5rem; border-radius: 0.5rem; - .craft_executing_modal { - position: relative; - width: 10rem; - height: 18rem; - background: rgba(2, 86, 255, 0.12); - opacity: 0.5; - z-index: 9999; - margin-top: -11rem; - .loading { - margin-top: 4rem; - display: flex; - justify-content: center; - } - .tray_craft { - font-size: 1rem; - margin-top: 0.5rem; - margin-left: 3rem; - font-weight: bold; - color: #4d6882; - } - - .tray_exce { - font-size: 1.2rem; - margin-left: 1.8rem; - font-weight: bold; - color: #4d6882; - } - } + } .inner-circle { border-radius: 50%; @@ -376,4 +356,41 @@ const onHandleSelectedCraft = (craftData:any) => { margin-top: -10px; } } +.text_choose{ + position: relative; + z-index: 111; + background: #6893ff; + color: #ffffff; +} +.craft_executing_modal { + position: relative; + width: 11.2rem; + height: 17.8rem; + padding-top: 0.5rem; + border-radius: 0.5rem; + opacity: 0.8; + z-index: 99; + margin-top: -11.5rem; + .loading { + margin-top: 4rem; + display: flex; + justify-content: center; + } + .tray_craft { + font-size: .75rem; + margin-top: 0.5rem; + font-weight: bold; + display: flex; + justify-content: center; + color: #EE8223; + } + + .tray_exce { + font-size: 1rem; + font-weight: bold; + color: #EE8223; + display: flex; + justify-content: center; + } + } diff --git a/src/views/graphite/index.vue b/src/views/graphite/index.vue index d8d0622..95630e8 100644 --- a/src/views/graphite/index.vue +++ b/src/views/graphite/index.vue @@ -46,10 +46,10 @@ size="large" class="btn_size op_select_craft" @click="onChooseCaft" - >选择工艺{{ craftName }} - 执行工艺{{ exeCraftName }} 请输入实验名称 - @@ -124,14 +123,14 @@