operatePop.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div
  3. class="midPopUp"
  4. @click="emits('update:modelValue', false)"
  5. v-if="modelValue"
  6. >
  7. <div class="container" @click.stop>
  8. <div
  9. :class="lcDisabled ? 'operatorBox disableOp' : 'operatorBox'"
  10. @click="lastOpCall"
  11. v-loading="map.get('callItems')"
  12. :style="lcRes ? 'background-color: white !important;' : ''"
  13. >
  14. <transition>
  15. <div v-if="!lcRes">
  16. <div class="titleText">流程叫料</div>
  17. <div class="describeText">(向上一流程工序呼叫流程物料)</div>
  18. </div>
  19. <div v-else>
  20. <el-progress type="circle" :percentage="100" status="success">
  21. <template #default>
  22. <div class="percentage-label">叫料成功</div>
  23. <div class="percentage-label">请等待{{ time }}秒后再试</div>
  24. </template>
  25. </el-progress>
  26. </div>
  27. </transition>
  28. </div>
  29. <div
  30. :class="gxDisabled ? 'operatorBox disableOp' : 'operatorBox'"
  31. @click="opeateCall"
  32. >
  33. <div>
  34. <div class="titleText">工序叫料</div>
  35. <div class="describeText">(向本工序呼叫涉及物料)</div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script lang="ts" setup>
  42. import { useProcessStore } from "@/store";
  43. import { emitter, EventsNames } from "@/utils/common";
  44. import { callItems } from "@/api/process";
  45. import { useCommonStoreHook } from "@/store";
  46. const commonS = useCommonStoreHook();
  47. const store = useProcessStore();
  48. const router = useRouter();
  49. const map = commonS.loadingMap;
  50. const lcRes = ref(false);
  51. const time = ref(3);
  52. const emits = defineEmits(["update:modelValue"]);
  53. const modelValue = defineModel<boolean>();
  54. const gxDisabled = ref(true);
  55. const lcDisabled = ref(true);
  56. const callBoxStatus = ref(false);
  57. //工序叫料
  58. const opeateCall = () => {
  59. if (gxDisabled.value) return;
  60. router.push({ name: "call-materiel" });
  61. emits("update:modelValue", false);
  62. };
  63. const scanStatus = inject("scanStatus");
  64. const callLast = async () => {
  65. const { data, code } = await callItems({
  66. operationId: store.odersData.operationId,
  67. workOrderCode: store.odersData.workOrderCode,
  68. });
  69. if (code == "200") {
  70. lcRes.value = true;
  71. const intervalID = setInterval(() => {
  72. if (time.value > 0) {
  73. time.value = time.value - 1;
  74. }
  75. }, 1000);
  76. setTimeout(() => {
  77. clearInterval(intervalID);
  78. lcRes.value = false;
  79. time.value = 3;
  80. }, 3000);
  81. }
  82. };
  83. //流程叫料
  84. const lastOpCall = () => {
  85. if (lcDisabled.value || lcRes.value) return;
  86. callLast();
  87. };
  88. //监听工序index等
  89. emitter.on(EventsNames.PROCESS_STEPOBJ, (data: any) => {
  90. if (data.index == null) {
  91. lcDisabled.value = true;
  92. gxDisabled.value = true;
  93. } else {
  94. if (data.index == 0) {
  95. lcDisabled.value = true;
  96. } else {
  97. lcDisabled.value = false;
  98. }
  99. gxDisabled.value = false;
  100. }
  101. });
  102. </script>
  103. <style lang="scss" scoped>
  104. .titleText {
  105. text-align: center;
  106. }
  107. .container {
  108. height: 50vh;
  109. width: 40vw;
  110. background-color: #ffffff60;
  111. display: flex;
  112. justify-content: space-between;
  113. flex-direction: row;
  114. flex-wrap: nowrap;
  115. padding: 24px;
  116. .disableOp {
  117. opacity: 0.6;
  118. background-color: red !important;
  119. color: white;
  120. cursor: not-allowed !important;
  121. .describeText {
  122. color: white;
  123. }
  124. }
  125. .operatorBox {
  126. width: 50%;
  127. height: 100%;
  128. background-color: #ffffff95;
  129. margin: 0 20px;
  130. border-radius: 16px;
  131. @include flex;
  132. cursor: pointer;
  133. }
  134. .operatorBox:hover {
  135. background-color: #0a59f7;
  136. .titleText {
  137. color: white;
  138. }
  139. .describeText {
  140. color: white;
  141. }
  142. }
  143. }
  144. .active {
  145. background-image: url("@/assets/images/caijiwancheng.png");
  146. background-position: right top;
  147. background-repeat: no-repeat;
  148. }
  149. </style>