index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <div class="stacking-manage-wrapper">
  3. <div class="stacking-manage-left">
  4. <template v-if="machineConfig['5'][MachineConfigType.STACKING].length">
  5. <!-- <div class="nb-stack-num">5#</div> -->
  6. <a-card
  7. :class="item.id === selectedStack ? 'selected-card' : ''"
  8. v-for="item in machineConfig['5'][MachineConfigType.STACKING]"
  9. :key="item.id"
  10. hoverable
  11. :bordered="false"
  12. style="width: 120px; background: transparent"
  13. @click="getStackInfoList(item.id)"
  14. :body-style="{ padding: 0 }"
  15. >
  16. <div class="nb-stack"> </div>
  17. <div class="nb-txt">{{ item.typeName }}</div>
  18. <template #actions>
  19. <a-button size="small" type="primary" @click="startStack(item)">起垛</a-button>
  20. <a-button size="small" type="primary" danger @click="handleWastes(item)">判废</a-button>
  21. </template>
  22. </a-card>
  23. </template>
  24. <template v-if="machineConfig['6'][MachineConfigType.STACKING].length">
  25. <!-- <div class="nb-stack-num">6#</div> -->
  26. <a-card
  27. :class="item.id === selectedStack ? 'selected-card' : ''"
  28. v-for="item in machineConfig['6'][MachineConfigType.STACKING]"
  29. :key="item.id"
  30. hoverable
  31. :bordered="false"
  32. style="width: 120px; background: transparent"
  33. @click="getStackInfoList(item.id)"
  34. :body-style="{ padding: 0 }"
  35. >
  36. <div class="nb-stack"> </div>
  37. <div class="nb-txt">{{ item.typeName }}</div>
  38. <template #actions>
  39. <a-button size="small" type="primary" @click="startStack(item)">起垛</a-button>
  40. <a-button size="small" type="primary" danger @click="handleWastes(item)">判废</a-button>
  41. </template>
  42. </a-card>
  43. </template>
  44. </div>
  45. <div class="stacking-manage-center selected-divider">
  46. <a-spin :spinning="isSpinning" wrapperClassName="table-spin">
  47. <a-row class="selected-divider-row" :id="`stackLayer${pitem.value}`" :gutter="[30, 20]" v-for="pitem in stackingList" :key="pitem.value">
  48. <a-divider orientation="left" class="stacking-list-divider">{{ pitem.label }}</a-divider>
  49. <a-col :span="3" v-for="item in stackingObj[pitem.value]" class="p-stack-col">
  50. <a-tooltip
  51. placement="left"
  52. :title="
  53. item.billetNos
  54. ? `${item.steelBillet[0]}、${item.steelBillet[1]},${item.steelBillet[2]}、${item.steelBillet[3]}`.replace(/,/, '\r\n')
  55. : ''
  56. "
  57. >
  58. <a-dropdown :trigger="['contextmenu']">
  59. <a-row
  60. justify="start"
  61. :class="{ 'selected-row': selectedAddress === item.id }"
  62. class="stacking-list-row"
  63. @click="handleStackClick(item)"
  64. >
  65. <a-col class="stack-col" :class="{ 'hemp-texture': !!item.steelBillet[0] }" :span="6">{{ item.steelBillet[0] }}</a-col>
  66. <a-col class="stack-col" :class="{ 'hemp-texture': !!item.steelBillet[1] }" :span="6">{{ item.steelBillet[1] }}</a-col>
  67. <a-col class="stack-col" :class="{ 'hemp-texture': !!item.steelBillet[2] }" :span="6">{{ item.steelBillet[2] }}</a-col>
  68. <a-col class="stack-col" :class="{ 'hemp-texture': !!item.steelBillet[3] }" :span="6">{{ item.steelBillet[3] }}</a-col>
  69. </a-row>
  70. <template #overlay v-if="item.billetNos">
  71. <a-menu @click="menuClick($event, item)" style="min-width: 100px">
  72. <a-menu-item key="1" style="background-color: #f56c6c; color: #fff; text-align: center">判废</a-menu-item>
  73. <a-menu-item key="2" style="background-color: #b7eb8f; color: #000; text-align: center; margin-top: 8px">更换位置</a-menu-item>
  74. </a-menu>
  75. </template>
  76. </a-dropdown>
  77. </a-tooltip>
  78. </a-col>
  79. </a-row>
  80. </a-spin>
  81. </div>
  82. <stackDrawer ref="stackDrawerRef" />
  83. <!-- 新增堆垛 -->
  84. <stacking @register="registerStackingModal" :machine="machine" @success="handleSuccess" :machineConfigType="MachineConfigType.STACKING" />
  85. <!-- 堆垛判废 -->
  86. <wastes @register="registerWastesModal" :machine="machine" @success="handleSuccess" />
  87. <!-- 堆垛位置更换 -->
  88. <changePosition @register="registerChangePositionModal" :machine="machine" @success="handleSuccess" />
  89. </div>
  90. </template>
  91. <script setup lang="ts" name="stackManage">
  92. import { ref, onMounted, nextTick } from 'vue';
  93. import { queryBilletNameList, getStackInfo, deleteJunk } from '../hotDelivery/hotDelivery.api';
  94. import { MachineConfigType, getMachineNum } from '../hotDelivery/common.data';
  95. import stackDrawer from './stackDrawer.vue';
  96. import { useMessage } from '/@/hooks/web/useMessage';
  97. import { useModal } from '/@/components/Modal';
  98. import stacking from './components/stacking.vue';
  99. import wastes from './components/wastes.vue';
  100. import changePosition from './components/changePosition.vue';
  101. const { createConfirm } = useMessage();
  102. const machineConfig = ref<any>({
  103. 5: {
  104. [MachineConfigType.STACKING]: [],
  105. },
  106. 6: {
  107. [MachineConfigType.STACKING]: [],
  108. },
  109. });
  110. const selectedStack = ref<string>('');
  111. const selectedAddress = ref<string>('');
  112. const machine = getMachineNum();
  113. // 堆垛
  114. const [registerStackingModal, { openModal: openStackingModal }] = useModal();
  115. // 堆垛判废
  116. const [registerWastesModal, { openModal: openWastesModal }] = useModal();
  117. // 堆垛位置更换
  118. const [registerChangePositionModal, { openModal: openChangePositionModal }] = useModal();
  119. // 根据铸机号获取配置信息
  120. const getMachineConfig = async (machineNum) => {
  121. if (!machineNum || machineConfig.value[machineNum][MachineConfigType.STACKING].length) {
  122. return;
  123. }
  124. try {
  125. const res = await queryBilletNameList({ ccmNo: machineNum });
  126. if (!machineConfig.value[machineNum]) {
  127. machineConfig.value[machineNum] = {};
  128. }
  129. if (res.length) {
  130. let configNameList = {
  131. [MachineConfigType.RODLINE]: [],
  132. [MachineConfigType.STACKING]: [],
  133. };
  134. res.forEach((item) => {
  135. configNameList[item.belongType].push(item);
  136. });
  137. machineConfig.value[machineNum] = configNameList;
  138. }
  139. selectedStack.value = machineConfig.value[machineNum][MachineConfigType.STACKING][0].id;
  140. getStackInfoList(machineConfig.value[machineNum][MachineConfigType.STACKING][0].id);
  141. } catch (error) {
  142. console.error('Error fetching data:', error);
  143. }
  144. };
  145. // 获取堆垛信息
  146. const stackingObj = ref<any>({});
  147. const stackingList = ref<any[]>([]);
  148. const isSpinning = ref(true);
  149. // 获取当前堆垛信息
  150. const getStackInfoList = async (typeConfigId) => {
  151. selectedStack.value = typeConfigId;
  152. isSpinning.value = true;
  153. const stackingInfo = await getStackInfo({ typeConfigId });
  154. let layerObj = {};
  155. if (stackingInfo.length) {
  156. stackingInfo.forEach((item) => {
  157. if (!layerObj[item.layer]) layerObj[item.layer] = [];
  158. layerObj[item.layer].push({ ...item, steelBillet: item.billetNos ? item.billetNos.split(',') : [] });
  159. });
  160. }
  161. stackingObj.value = layerObj;
  162. stackingList.value = Object.keys(layerObj)
  163. .sort((a, b) => Number(b) - Number(a))
  164. .map((item) => ({ label: `第${item}层`, value: item }));
  165. nextTick(() => {
  166. const element = document.getElementById(`stackLayer1`);
  167. if (element) {
  168. element.scrollIntoView({
  169. behavior: 'smooth',
  170. block: 'center',
  171. inline: 'center',
  172. });
  173. }
  174. });
  175. isSpinning.value = false;
  176. };
  177. const stackDrawerRef = ref<any>(null);
  178. const handleStackClick = (item) => {
  179. selectedAddress.value = item.id;
  180. stackDrawerRef.value && stackDrawerRef.value.openIt(item);
  181. };
  182. const menuClick = (e, info) => {
  183. if (e.key === '1') {
  184. const params = {
  185. belongTable: 'stacking_and_loading_vehicles',
  186. billetHotsendTypeConfigId: selectedStack.value,
  187. stackingAndLoadingVehiclesList: [info],
  188. billetHotsend: {
  189. ccmNo: '6',
  190. },
  191. };
  192. createConfirm({
  193. iconType: 'error',
  194. title: '确认判废',
  195. content: `确认判废${info.layer}层${info.address}位置,钢坯${info.billetNos} ?`,
  196. okText: '确认',
  197. cancelText: '取消',
  198. onOk: async () => {
  199. await deleteJunk(params);
  200. getStackInfoList(selectedStack.value);
  201. },
  202. });
  203. return;
  204. }
  205. if (e.key === '2') {
  206. openChangePositionModal(true, {
  207. basicInfo: info,
  208. });
  209. return;
  210. }
  211. };
  212. const handleSuccess = () => {
  213. getStackInfoList(selectedStack.value);
  214. };
  215. const startStack = (item) => {
  216. console.log('startStack', item);
  217. openStackingModal(true, {
  218. stacking: item,
  219. basicInfo: { ccmNo: machine },
  220. });
  221. };
  222. // 堆垛判废
  223. const handleWastes = (item) => {
  224. // 弹框
  225. openWastesModal(true, {
  226. basicInfo: { ccmNo: machine },
  227. machineConfig: item,
  228. });
  229. };
  230. // 获取堆垛
  231. onMounted(() => {
  232. getMachineConfig(machine);
  233. });
  234. </script>
  235. <style lang="less" scoped>
  236. @import '/@/assets/less/font.less';
  237. @import '../hotDelivery/components/metal.less';
  238. .stacking-manage-wrapper {
  239. position: absolute;
  240. left: 0;
  241. right: 0;
  242. bottom: 0;
  243. top: 0;
  244. margin: 10px;
  245. display: flex;
  246. flex-direction: column;
  247. background: #fff;
  248. padding: 10px;
  249. .table-spin {
  250. height: 100%;
  251. :deep(.ant-spin-container) {
  252. height: 100%;
  253. overflow: hidden auto;
  254. padding: 20px 10px 50px 0;
  255. }
  256. }
  257. .stacking-manage-left {
  258. display: flex;
  259. gap: 20px;
  260. padding: 10px;
  261. margin-right: 10px;
  262. background: #ececec;
  263. .selected-card {
  264. box-shadow:
  265. 0 4px 4px var(--vxe-primary-color),
  266. 0 6px 6px var(--vxe-primary-color);
  267. }
  268. .nb-stack {
  269. width: 100px;
  270. height: 100px;
  271. background-image: url(/@/assets/images/billetHome/stacking.png);
  272. margin: 5px auto;
  273. background-size: cover;
  274. background-repeat: no-repeat;
  275. }
  276. .nb-txt {
  277. font-family: 'Kingsoft_Cloud_Font';
  278. text-align: center;
  279. margin-top: 10px;
  280. }
  281. .nb-stack-num {
  282. width: 100px;
  283. height: 43px;
  284. background-image: url(/@/assets/images/billetHome/stacking-desc.png);
  285. font-family: 'Kingsoft_Cloud_Font';
  286. text-align: center;
  287. background-size: cover;
  288. background-repeat: no-repeat;
  289. color: #fff;
  290. line-height: 43px;
  291. margin-left: 30px;
  292. }
  293. :deep(.ant-card-actions) {
  294. & > li {
  295. margin: 5px 0;
  296. }
  297. }
  298. }
  299. .stacking-manage-center {
  300. overflow: hidden;
  301. padding: 0;
  302. margin-top: 10px;
  303. .stacking-list-row {
  304. cursor: pointer;
  305. }
  306. .selected-divider-row {
  307. row-gap: 10px !important;
  308. margin-top: 10px;
  309. }
  310. .stacking-list-divider {
  311. margin: 0;
  312. color: var(--vxe-danger-color, #f56c6c);
  313. }
  314. .stack-col {
  315. overflow: hidden;
  316. }
  317. .p-stack-col {
  318. padding-right: 0 !important;
  319. max-width: 11%;
  320. }
  321. }
  322. }
  323. </style>