index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div
  3. class="operator-app-container"
  4. :style="{
  5. '--op-border-color': '#d9d9d9',
  6. '--op-text-color-fff': '#fff',
  7. }"
  8. >
  9. <a-layout class="operator-large-layout">
  10. <a-layout-header class="operator-header cover">
  11. <div class="change-shift print-billet-card">
  12. <a-button
  13. type="primary"
  14. style="margin-right: 20px"
  15. size="large"
  16. @click="() => openPrintOriginalRecordsModal(true, { ccmNo, queryType: '1', shiftText, curShiftInfo })"
  17. >
  18. 原始记录
  19. </a-button>
  20. <a-button type="primary" size="large" @click="() => openModal(true, { ccmNo, queryType: '1', shiftText, curShiftInfo })"> 送样卡 </a-button>
  21. </div>
  22. <div class="shift-wrapper"> {{ shiftText }} </div>
  23. <div class="change-shift">
  24. <a-button type="primary" size="large" danger @click="() => (openJiaobanModal = true)"> 交班 </a-button>
  25. </div>
  26. <div class="clock-wrapper">
  27. <div class="date">{{ clockObj.date }}</div>
  28. <div class="week">{{ clockObj.week }}</div>
  29. <div class="time">{{ clockObj.time }}</div>
  30. </div>
  31. </a-layout-header>
  32. <a-layout-content class="operator-content">
  33. <head-top @onShiftChange="curShiftChange" ref="headTopRef" @lengthChange="(v, auto) => ((lengthList = v), (cuttolength = auto))" />
  34. <div class="operator-content-wrapper flex">
  35. <div class="operator-content-left">
  36. <heat-list
  37. ref="heatListRef"
  38. v-if="curShiftInfo.shift && curShiftInfo.shiftGroup"
  39. :ccmNo="ccmNo"
  40. :carRef="carRef"
  41. :lengthList="lengthList"
  42. :cuttolength="cuttolength"
  43. @changeLengthSuccess="() => headTopRef && headTopRef.reload()"
  44. :curShiftInfo="curShiftInfo"
  45. />
  46. </div>
  47. <div class="operator-content-right">
  48. <car :ccmNo="ccmNo" ref="carRef" />
  49. </div>
  50. </div>
  51. </a-layout-content>
  52. </a-layout>
  53. <!-- 打印钢坯送样卡 -->
  54. <print-billet-sample-card @register="registerPrintModal" />
  55. <!-- 打印原始数据 -->
  56. <printOriginalRecords @register="registerPrintOriginalRecordsModal" />
  57. <!-- 交班 -->
  58. <a-modal
  59. v-model:open="openJiaobanModal"
  60. title="切换牌号"
  61. centered
  62. width="400px"
  63. ok-text="确认"
  64. :okButtonProps="{ loading: okLoading }"
  65. cancel-text="取消"
  66. @ok="confirmChangeShift"
  67. @cancel="
  68. () => {
  69. openJiaobanModal = false;
  70. newShiftGroup = '';
  71. }
  72. "
  73. >
  74. <div class="flex justify-center items-center" style="margin: 20px 0">
  75. <div>选择班组:</div>
  76. <JSearchSelect type="list" style="width: 277px" v-model:value="newShiftGroup" dict="lg_bz" placeholder="请选择" allowClear />
  77. </div>
  78. </a-modal>
  79. </div>
  80. </template>
  81. <script setup lang="ts" name="OperatorRoom">
  82. import { onMounted, onUnmounted, ref } from 'vue';
  83. import { getDateTimeWeek } from '/@/utils/dateUtil';
  84. import { useTimeoutFn } from '/@/hooks/core/useTimeout';
  85. import headTop from './components/headTop.vue';
  86. import car from './components/car.vue';
  87. import heatList from './components/heatList.vue';
  88. import { getMachineNum, getMachineDict } from '../hotDelivery/common.data';
  89. import { changeShift } from '../hotDelivery/hotDelivery.api';
  90. import { useMessage } from '/@/hooks/web/useMessage';
  91. import { useModal } from '/@/components/Modal';
  92. import printBilletSampleCard from './components/printBilletSampleCard.vue';
  93. import printOriginalRecords from './components/printOriginalRecords.vue';
  94. import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
  95. const { createConfirm, createMessage } = useMessage();
  96. // 注册打印送样卡modal
  97. const [registerPrintModal, { openModal }] = useModal();
  98. // 注册打印原始记录modal
  99. const [registerPrintOriginalRecordsModal, { openModal: openPrintOriginalRecordsModal }] = useModal();
  100. const ccmNo = getMachineNum();
  101. const carRef = ref();
  102. const headTopRef = ref();
  103. const heatListRef = ref();
  104. // 班次信息
  105. const shiftText = ref('');
  106. const curShiftInfo = ref({
  107. shift: undefined,
  108. shiftGroup: undefined,
  109. });
  110. // 时钟
  111. const clockObj = ref({
  112. date: '',
  113. week: '',
  114. time: '',
  115. });
  116. const lengthList = ref('');
  117. const cuttolength = ref(2); // 1 手动定尺, 2 自动定尺
  118. const clock = () => {
  119. try {
  120. const dateStr = getDateTimeWeek().split(' ');
  121. clockObj.value = {
  122. date: dateStr[0],
  123. time: dateStr[1],
  124. week: dateStr[2],
  125. };
  126. start();
  127. } catch (error) {}
  128. };
  129. const { start, stop } = useTimeoutFn(clock, 1000);
  130. // 获取班次信息
  131. const curShiftChange = (shiftInfo) => {
  132. if (shiftInfo) {
  133. const { shift, shiftGroup } = shiftInfo;
  134. shiftText.value = `${getMachineDict(shift, 'lg_bb')} - ${getMachineDict(shiftGroup, 'lg_bz')}`;
  135. }
  136. curShiftInfo.value = shiftInfo;
  137. };
  138. // 交班
  139. const newShiftGroup = ref('');
  140. const openJiaobanModal = ref(false);
  141. const okLoading = ref(false);
  142. const confirmChangeShift = () => {
  143. if (!newShiftGroup.value) {
  144. createMessage.error('请选择班组');
  145. return;
  146. }
  147. createConfirm({
  148. iconType: 'warning',
  149. title: '交班确认',
  150. content: '确定要交班吗?',
  151. onOk: () => {
  152. return changeShift({
  153. ccmNo,
  154. shiftGroup: newShiftGroup.value,
  155. }).then(() => {
  156. headTopRef && headTopRef.value.reload();
  157. carRef && carRef.value.refreshCarList();
  158. heatListRef && heatListRef.value.reload();
  159. openJiaobanModal.value = false;
  160. });
  161. },
  162. });
  163. };
  164. onMounted(() => {
  165. start();
  166. });
  167. onUnmounted(() => {
  168. stop();
  169. });
  170. </script>
  171. <style lang="less" scoped>
  172. @import '/@/assets/less/font.less';
  173. @import './index.less';
  174. </style>