基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
5.2 KiB

6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <main class="h-full flex justify-center items-center">
  3. <div class="h-[70%] w-[90%] grid grid-cols-3 grid-rows-2 gap-6 text-white">
  4. <div
  5. class="row-span-2 relative bg-[url(@/assets/entry/entry_bg1.svg)] bg-cover bg-center bg-no-repeat rounded-[16px]"
  6. @click="onSprayEntryClick">
  7. <p class="text-[32px] font-semibold absolute left-6 bottom-6">喷涂设置</p>
  8. <img src="@/assets/entry/entry_icon_1.svg" alt="icon" class="w-[90px] absolute right-6 top-6" />
  9. </div>
  10. <div
  11. class="relative bg-[url(@/assets/entry/entry_bg2.svg)] bg-cover bg-center bg-no-repeat rounded-[16px]"
  12. @click="onHistoryEntryClick">
  13. <p class="text-[32px] font-semibold absolute left-6 bottom-6">历史喷涂</p>
  14. <img src="@/assets/entry/entry_icon_2.svg" alt="icon" class="w-[50px] absolute right-6 top-6" />
  15. </div>
  16. <div
  17. class="relative bg-[url(@/assets/entry/entry_bg3.svg)] bg-cover bg-center bg-no-repeat rounded-[16px]"
  18. @click="onCraftEntryClick">
  19. <p class="text-[32px] font-semibold absolute left-6 bottom-6">工艺管理</p>
  20. <img src="@/assets/entry/entry_icon_3.svg" alt="icon" class="w-[55px] absolute right-6 top-6" />
  21. </div>
  22. <div
  23. class="relative bg-[url(@/assets/entry/entry_bg4.svg)] bg-cover bg-center bg-no-repeat rounded-[16px]"
  24. @click="onWashEntryClick">
  25. <p class="text-[32px] font-semibold absolute left-6 bottom-6">清洗管道</p>
  26. <img src="@/assets/entry/entry_icon_4.svg" alt="icon" class="w-[50px] absolute right-6 top-6" />
  27. </div>
  28. <div
  29. class="relative bg-[url(@/assets/entry/entry_bg5.svg)] bg-cover bg-center bg-no-repeat rounded-[16px]"
  30. @click="onInjectorEntryClick">
  31. <p class="text-[32px] font-semibold absolute left-6 bottom-6">基质管理</p>
  32. <img src="@/assets/entry/entry_icon_5.svg" alt="icon" class="w-[80px] absolute right-4 top-4" />
  33. </div>
  34. </div>
  35. <van-overlay v-if="showWashDialog" :show="true">
  36. <div class="flex justify-center items-center h-full">
  37. <div class="min-w-[480px] max-w-[540px] text-primary bg-white rounded-lg">
  38. <h1 class="my-8 text-lg font-medium text-center px-8">提示</h1>
  39. <div class="text-lg px-4 text-center">
  40. {{ statusStore.workStatus === "washing" ? "设备正在清洗中,是否停止清洗" : "请选择清洗类型:" }}
  41. </div>
  42. <footer v-if="statusStore.workStatus === 'washing'" class="flex justify-center items-center gap-6 py-10">
  43. <button class="btn-dark px-8 py-2 text-lg min-w-[120px]" @click="onStopWash">停止清洗</button>
  44. <button class="btn-light px-8 py-2 text-lg min-w-[120px]" @click="showWashDialog = false">取消</button>
  45. </footer>
  46. <footer v-else class="flex flex-col justify-center items-center gap-6 py-10">
  47. <button class="btn-dark px-8 py-2 text-lg min-w-[120px]" @click="onStartWash('injector')">
  48. 清洗注射器管路
  49. </button>
  50. <button class="btn-dark px-8 py-2 text-lg min-w-[120px]" @click="onStartWash('nozzle')">
  51. 清洗喷涂部分
  52. </button>
  53. <button class="btn-light px-8 py-2 text-lg min-w-[120px]" @click="showWashDialog = false">取消</button>
  54. </footer>
  55. </div>
  56. </div>
  57. </van-overlay>
  58. <van-overlay v-if="showDialog" :show="true">
  59. <div class="flex justify-center items-center h-full">
  60. <Dialog
  61. :title="dialogContent.title"
  62. :desc="dialogContent.desc"
  63. :type="dialogContent.type"
  64. :ok-text="dialogContent.okText"
  65. :cancel-text="dialogContent.cancelText"
  66. @on-ok="onOk"
  67. @on-cancel="showDialog = false"></Dialog>
  68. </div>
  69. </van-overlay>
  70. </main>
  71. </template>
  72. <script setup lang="ts">
  73. import type { DialogParam } from "@/components/Dialog.vue";
  74. import { startWash, stopWash, type WashType } from "@/services/globalCmd/globalCmd";
  75. import { ElMessage } from "element-plus";
  76. import { ref } from "vue";
  77. import { useRouter } from "vue-router";
  78. import Dialog from "@/components/Dialog.vue";
  79. import { useEquipmentStatusStore } from "@/stores/equipmentStatus";
  80. const router = useRouter();
  81. const statusStore = useEquipmentStatusStore();
  82. const dialogContent = ref<DialogParam>({
  83. title: "提示",
  84. desc: "确定清洗管道?",
  85. type: "confirm",
  86. okText: "清洗",
  87. cancelText: "关闭",
  88. _brand: "wash",
  89. });
  90. const showDialog = ref(false);
  91. const showWashDialog = ref(false);
  92. function onEnvironmentEntryClick() {
  93. router.push("/environment");
  94. }
  95. function onHistoryEntryClick() {
  96. router.push("/history");
  97. }
  98. function onSprayEntryClick() {
  99. router.push("/preSpray");
  100. }
  101. function onCraftEntryClick() {
  102. router.push("/matrixCraft");
  103. }
  104. function onInjectorEntryClick() {
  105. router.push("/matrixManage");
  106. }
  107. function onPrintEntryClick() {
  108. router.push("/print");
  109. }
  110. function onWashEntryClick() {
  111. if (statusStore.workStatus === "idle" || statusStore.workStatus === "washing") {
  112. showWashDialog.value = true;
  113. } else {
  114. ElMessage.warning("设备正在工作中,请稍候清洗");
  115. }
  116. }
  117. function onOk() {
  118. showDialog.value = false;
  119. }
  120. function onStartWash(type: WashType) {
  121. showWashDialog.value = false;
  122. startWash({ type }).then(res => {
  123. if (res.success) {
  124. } else {
  125. ElMessage.error(res.msg);
  126. }
  127. });
  128. }
  129. function onStopWash() {
  130. showWashDialog.value = false;
  131. stopWash({}).then(res => {
  132. if (res.success) {
  133. } else {
  134. ElMessage.error(res.msg);
  135. }
  136. });
  137. }
  138. </script>