headTop.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <a-row class="head-top">
  3. <a-col :span="3" class="head-no bg flex items-center justify-center"
  4. ><a-badge status="processing" /> 浇铸炉号:{{ info.billetHotsendChangeShift.heatNo }}
  5. </a-col>
  6. <a-col :span="1" class="amount-no bg flex items-center justify-center">
  7. <a-statistic title="支数" :value="info.currentCastingFurnaceAmount || 0" />
  8. </a-col>
  9. <a-col :span="2" class="amount-no bg flex items-center justify-center">
  10. <a-statistic title="重量/t" :value="info.currentCastingFurnace ? info.currentCastingFurnace.toFixed(3) : 0" />
  11. </a-col>
  12. <a-col :span="1" class="flex items-center justify-center">
  13. <a-button type="primary" class="change-heat" @click="switchHeatNo" :loading="changeHeatLoading">换炉</a-button>
  14. </a-col>
  15. <a-col :span="1" class="current-shift flex items-center justify-center">当班统计:</a-col>
  16. <a-col :span="1" class="flex items-center justify-center">
  17. <a-statistic title="总支数" :value="info.billetHotsendChangeShift.shiftSum" />
  18. </a-col>
  19. <a-col :span="2" class="flex items-center justify-center">
  20. <a-statistic title="总重量/t" :value="info.billetHotsendChangeShift.shiftProduct ? info.billetHotsendChangeShift.shiftProduct.toFixed(3) : 0" />
  21. </a-col>
  22. <a-col :span="3" class="flex flex-col" v-for="item of typeList">
  23. <div class="type-item">
  24. <span class="type-title" :style="{ color: item.titleColor }">{{ item.title }}:</span> {{ item.amount }}支 / {{ item.weight }}t
  25. </div>
  26. <div class="type-item" v-for="ele of item.dtlList">
  27. <div class="type-item-dtl">
  28. <span class="type-title">{{ Number(ele.size) / 1000 }}:</span> {{ ele.amount }}支 / {{ ele.weight }}t
  29. </div>
  30. </div>
  31. </a-col>
  32. <a-col :span="2" class="paihao flex items-center justify-center">当前牌号:<component :is="renderDictTag(info.brandNum, 'billet_spec')" /></a-col>
  33. <a-col :span="2" class="current-shift flex items-center justify-center">
  34. <a-button type="primary" danger @click="openPaihaoModal = true">切换牌号</a-button>
  35. </a-col>
  36. </a-row>
  37. <a-modal
  38. v-model:open="openPaihaoModal"
  39. title="切换牌号"
  40. centered
  41. width="400px"
  42. ok-text="确认"
  43. :okButtonProps="{ loading: okLoading }"
  44. cancel-text="取消"
  45. @ok="switchSteelOne"
  46. @cancel="
  47. () => {
  48. openPaihaoModal = false;
  49. newBrandNum = '';
  50. }
  51. "
  52. >
  53. <div class="flex justify-center items-center" style="margin: 20px 0">
  54. <div>选择牌号:</div>
  55. <JSearchSelect type="list" style="width: 277px" v-model:value="newBrandNum" dict="billet_spec" placeholder="请选择" allowClear />
  56. </div>
  57. </a-modal>
  58. <!-- 切换炉号确认 -->
  59. <changeHeatModal @register="registerChangeHeatModal" @ok="() => {}" />
  60. </template>
  61. <script setup lang="ts">
  62. import { ref, onMounted, onUnmounted } from 'vue';
  63. import AStatistic from 'ant-design-vue/lib/statistic/Statistic';
  64. import { getOnDutyInfo, getTeamShift, getOnDutyDetail } from '../../Dashboard/dashboard.api';
  65. import { useTimeoutFn } from '/@/hooks/core/useTimeout';
  66. import { switchSteel, returnFurnaceChange } from '../operator.api';
  67. import { useMessage } from '/@/hooks/web/useMessage';
  68. import JSearchSelect from '/@/components/Form/src/jeecg/components/JSearchSelect.vue';
  69. import { render } from '/@/utils/common/renderUtils';
  70. import changeHeatModal from './changeHeatModal.vue';
  71. import { useModal } from '/@/components/Modal';
  72. const { createMessage } = useMessage();
  73. // 注册打印modal
  74. const [registerChangeHeatModal, { openModal: openChangeHeatModal }] = useModal();
  75. const emits = defineEmits(['shiftChange', 'lengthChange']);
  76. const props = defineProps({
  77. ccmNo: {
  78. type: String,
  79. default: '5',
  80. },
  81. });
  82. const info = ref<any>({
  83. brandNum: '',
  84. billetHotsendChangeShift: {
  85. heatNo: '',
  86. shiftGroup: '',
  87. shift: '',
  88. wasteAmount: 0,
  89. shiftProduct: 0,
  90. shiftSum: 0,
  91. wasteBlankOutput: 0,
  92. },
  93. currentCastingFurnaceAmount: null,
  94. currentCastingFurnace: null,
  95. });
  96. // typeList
  97. const typeList = ref<any>([
  98. { title: '棒一', titleColor: '#f50', amount: 0, weight: 0, dtlList: [] },
  99. { title: '热装', titleColor: '#f50', amount: 0, weight: 0, dtlList: [] },
  100. { title: '堆垛', titleColor: '#b8ceff', amount: 0, weight: 0, dtlList: [] },
  101. ]);
  102. // 渲染字典标签
  103. const renderDictTag = (value: string, dictCode: string) => {
  104. return render.renderDict(value, dictCode);
  105. };
  106. // 获取班组班别
  107. const getShiftInfo = () => {
  108. emits('shiftChange', getTeamShift(info.value.billetHotsendChangeShift.shift, info.value.billetHotsendChangeShift.shiftGroup), {
  109. shift: info.value.billetHotsendChangeShift.shift,
  110. shiftGroup: info.value.billetHotsendChangeShift.shiftGroup,
  111. });
  112. };
  113. // 获取当前班次信息
  114. const getInfo = async () => {
  115. try {
  116. const infoRes = await getOnDutyInfo({ ccmNo: props.ccmNo });
  117. if (infoRes) {
  118. info.value = infoRes;
  119. try {
  120. let standObj = {};
  121. (JSON.parse(infoRes.standNoSize) || []).forEach((item) => {
  122. standObj[item.strandNo] = item.length;
  123. });
  124. emits('lengthChange', standObj);
  125. } catch (error) {
  126. console.log(error);
  127. }
  128. }
  129. // 获取明细
  130. const dtlRes = await getOnDutyDetail({ ccmNo: props.ccmNo });
  131. if (dtlRes) {
  132. const {
  133. hotSendSum,
  134. hotChargeSum,
  135. stackingSum,
  136. hotSendTotalWeight,
  137. hotChargeTotalWeight,
  138. stackingTotalWeight,
  139. hotSendDetailStatisticsList,
  140. hotChargeDetailStatisticsList,
  141. stackingDetailStatisticsList,
  142. } = dtlRes;
  143. let hotsendData: any = [],
  144. hotchargeData: any = [],
  145. stackingData: any = [];
  146. if (Array.isArray(hotSendDetailStatisticsList)) {
  147. hotsendData = hotSendDetailStatisticsList.map((item) => {
  148. return { size: item.size, amount: item.amountTotal || 0, weight: item.blankOutput || 0 };
  149. });
  150. }
  151. if (Array.isArray(hotChargeDetailStatisticsList)) {
  152. hotchargeData = hotChargeDetailStatisticsList.map((item) => {
  153. return { size: item.size, amount: item.amountTotal || 0, weight: item.blankOutput || 0 };
  154. });
  155. }
  156. if (Array.isArray(stackingDetailStatisticsList)) {
  157. stackingData = stackingDetailStatisticsList.map((item) => {
  158. return { size: item.size, amount: item.amountTotal || 0, weight: item.blankOutput || 0 };
  159. });
  160. }
  161. typeList.value = [
  162. { title: '棒一', titleColor: '#f50', amount: hotSendSum || 0, weight: hotSendTotalWeight || 0, dtlList: hotsendData },
  163. { title: '热装', titleColor: '#f50', amount: hotChargeSum || 0, weight: hotChargeTotalWeight || 0, dtlList: hotchargeData },
  164. { title: '堆垛', titleColor: '#b8ceff', amount: stackingSum || 0, weight: stackingTotalWeight || 0, dtlList: stackingData },
  165. ];
  166. getShiftInfo();
  167. }
  168. } catch (error) {
  169. } finally {
  170. start();
  171. }
  172. };
  173. const { start, stop } = useTimeoutFn(getInfo, 5000);
  174. // 换炉
  175. const changeHeatLoading = ref(false);
  176. const switchHeatNo = async () => {
  177. try {
  178. if (!info.value.billetHotsendChangeShift.heatNo) return;
  179. changeHeatLoading.value = true;
  180. const heatInfo = await returnFurnaceChange({
  181. heatNo: Number(info.value.billetHotsendChangeShift.heatNo) + 1,
  182. });
  183. if (heatInfo) {
  184. openChangeHeatModal(true, {
  185. record: { ...heatInfo, ccmNo: heatInfo.ccmNo || props.ccmNo },
  186. });
  187. }
  188. changeHeatLoading.value = false;
  189. } catch (error) {
  190. changeHeatLoading.value = false;
  191. }
  192. };
  193. // 切换牌号
  194. const openPaihaoModal = ref(false);
  195. const newBrandNum = ref('');
  196. const okLoading = ref(false);
  197. const switchSteelOne = async () => {
  198. try {
  199. if (newBrandNum.value == '') {
  200. createMessage.error('请选择牌号');
  201. return;
  202. }
  203. okLoading.value = true;
  204. await switchSteel({
  205. ccmNo: props.ccmNo,
  206. brandNum: newBrandNum.value,
  207. });
  208. getInfo();
  209. openPaihaoModal.value = false;
  210. newBrandNum.value = '';
  211. okLoading.value = false;
  212. } catch (error) {
  213. okLoading.value = false;
  214. }
  215. };
  216. onMounted(() => {
  217. getInfo();
  218. });
  219. onUnmounted(() => {
  220. stop();
  221. });
  222. defineExpose({
  223. reload: () => {
  224. stop();
  225. getInfo();
  226. },
  227. });
  228. </script>
  229. <style lang="less" scoped>
  230. .head-top {
  231. height: 130px;
  232. font-size: 16px;
  233. color: var(--op-text-color-fff);
  234. border: 1px solid var(--op-border-color);
  235. border-radius: 6px;
  236. background-color: #01396c;
  237. overflow: hidden;
  238. .ant-col {
  239. height: 130px;
  240. border-right: 1px solid var(--op-border-color);
  241. overflow: hidden auto;
  242. padding: 10px;
  243. font-size: 16px;
  244. &:last-child {
  245. border-right: none;
  246. }
  247. }
  248. .head-no {
  249. height: 130px;
  250. font-size: 24px;
  251. font-family: 'Kingsoft_Cloud_Font';
  252. }
  253. .bg {
  254. background: #0085ff;
  255. }
  256. .ant-statistic {
  257. :deep(.ant-statistic-title),
  258. :deep(.ant-statistic-content-value-int),
  259. :deep(.ant-statistic-content-value-decimal) {
  260. color: var(--op-text-color-fff);
  261. text-align: center;
  262. font-size: 16px;
  263. }
  264. :deep(.ant-statistic-content-value-int),
  265. :deep(.ant-statistic-content-value-decimal) {
  266. font-size: 30px;
  267. }
  268. :deep(.ant-statistic-content) {
  269. text-align: center;
  270. }
  271. }
  272. .ant-btn {
  273. height: 80px;
  274. font-size: 18px;
  275. padding: 4px 10px;
  276. }
  277. .paihao {
  278. color: #f50;
  279. font-size: 16px;
  280. }
  281. .type-item {
  282. font-size: 16px;
  283. }
  284. .change-heat.is-disabled {
  285. background: #d9d9d9;
  286. color: #8a8a8a;
  287. }
  288. .ant-badge {
  289. width: 12px;
  290. height: 12px;
  291. line-height: 12px;
  292. margin-right: 8px;
  293. margin-top: -7px;
  294. :deep(.ant-badge-status-dot) {
  295. width: 12px;
  296. height: 12px;
  297. color: #00fb6f;
  298. background-color: #00fb6f;
  299. }
  300. }
  301. @keyframes antStatusProcessing {
  302. 0% {
  303. transform: scale(0.8);
  304. opacity: 0.8;
  305. }
  306. 100% {
  307. transform: scale(2.4);
  308. opacity: 0.2;
  309. }
  310. }
  311. }
  312. </style>