wuliaocaiji.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <div class="scanCode">
  3. <ScanCodeInput v-model="scanCode" @keyup.enter="enterfnc" />
  4. </div>
  5. <div class="materialInfoBody">
  6. <el-scrollbar @click.stop style="height: calc(100vh - 360px)">
  7. <el-table
  8. :data="tableData"
  9. border
  10. style="width: 100%; height: calc(100vh - 360px)"
  11. >
  12. <el-table-column label="序号" type="index" width="120" align="center" />
  13. <el-table-column prop="materialModel" label="物料规格" align="center" />
  14. <el-table-column prop="materialName" label="物料名称" align="center" />
  15. <el-table-column prop="needNum" label="需求数量" align="center" />
  16. <el-table-column prop="scanNum" label="扫码确认数量" align="center" />
  17. <el-table-column prop="materialArray" label="物料编号" width="400">
  18. <template #default="scope">
  19. <el-tag
  20. v-for="(tag, index) in scope.row.materialArray"
  21. :key="tag.label"
  22. closable
  23. style="margin-right: 5px"
  24. @close="handleClose(scope.$index, index)"
  25. >
  26. {{ tag.label }}&nbsp;{{ tag.num }}
  27. </el-tag>
  28. </template>
  29. </el-table-column>
  30. </el-table>
  31. </el-scrollbar>
  32. <div class="btns">
  33. <el-button type="primary">提交</el-button>
  34. </div>
  35. </div>
  36. </template>
  37. <script setup>
  38. defineOptions({
  39. name: "Wuliaocaiji",
  40. });
  41. import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
  42. import {
  43. getInfo,
  44. itemRecordAdd,
  45. recordList,
  46. searchMaterial,
  47. } from "@/api/prosteps/wuliaocaiji";
  48. import { useProcessStore } from "@/store";
  49. const handleClose = (index1, index2) => {
  50. tableData.value[index1].materialArray.splice(index2, 1);
  51. };
  52. const tableData = ref([
  53. {
  54. materialModel: "SG-8",
  55. materialName: "盖片",
  56. needNum: 20,
  57. scanNum: 13,
  58. materialArray: [
  59. {
  60. label: "SN001",
  61. num: 12,
  62. },
  63. {
  64. label: "SN002",
  65. num: 8,
  66. },
  67. {
  68. label: "SN001",
  69. num: 12,
  70. },
  71. {
  72. label: "SN002",
  73. num: 8,
  74. },
  75. {
  76. label: "SN001",
  77. num: 12,
  78. },
  79. {
  80. label: "SN002",
  81. num: 8,
  82. },
  83. {
  84. label: "SN001",
  85. num: 12,
  86. },
  87. {
  88. label: "SN002",
  89. num: 8,
  90. },
  91. {
  92. label: "SN001",
  93. num: 12,
  94. },
  95. {
  96. label: "SN002",
  97. num: 8,
  98. },
  99. {
  100. label: "SN001",
  101. num: 12,
  102. },
  103. {
  104. label: "SN002",
  105. num: 8,
  106. },
  107. {
  108. label: "SN001",
  109. num: 12,
  110. },
  111. {
  112. label: "SN002",
  113. num: 8,
  114. },
  115. {
  116. label: "SN001",
  117. num: 12,
  118. },
  119. {
  120. label: "SN002",
  121. num: 8,
  122. },
  123. {
  124. label: "SN001",
  125. num: 12,
  126. },
  127. {
  128. label: "SN002",
  129. num: 8,
  130. },
  131. {
  132. label: "SN001",
  133. num: 12,
  134. },
  135. {
  136. label: "SN002",
  137. num: 8,
  138. },
  139. {
  140. label: "SN001",
  141. num: 12,
  142. },
  143. {
  144. label: "SN002",
  145. num: 8,
  146. },
  147. ],
  148. },
  149. {
  150. materialModel: "SG-8",
  151. materialName: "盖片",
  152. needNum: 20,
  153. scanNum: 13,
  154. materialArray: [
  155. {
  156. label: "SN001",
  157. num: 12,
  158. },
  159. {
  160. label: "SN002",
  161. num: 8,
  162. },
  163. ],
  164. },
  165. {
  166. materialModel: "SG-8",
  167. materialName: "盖片",
  168. needNum: 20,
  169. scanNum: 13,
  170. materialArray: [
  171. {
  172. label: "SN001",
  173. num: 12,
  174. },
  175. {
  176. label: "SN002",
  177. num: 8,
  178. },
  179. ],
  180. },
  181. {
  182. materialModel: "SG-8",
  183. materialName: "盖片",
  184. needNum: 20,
  185. scanNum: 13,
  186. materialArray: [
  187. {
  188. label: "SN001",
  189. num: 12,
  190. },
  191. {
  192. label: "SN002",
  193. num: 8,
  194. },
  195. ],
  196. },
  197. {
  198. materialModel: "SG-8",
  199. materialName: "盖片",
  200. needNum: 20,
  201. scanNum: 13,
  202. materialArray: [
  203. {
  204. label: "SN001",
  205. num: 12,
  206. },
  207. {
  208. label: "SN002",
  209. num: 8,
  210. },
  211. ],
  212. },
  213. ]);
  214. const caijiRef = ref(null);
  215. const store = useProcessStore();
  216. const scanCode = ref("");
  217. const scanCodeCopyValue = ref("");
  218. const showXQ = ref(false);
  219. const showCJ = ref(false);
  220. //详情展示数据
  221. const showInfoData = ref([]);
  222. const showInfo = ref({});
  223. //详情展示数据 ↑
  224. const scanData = ref([]);
  225. provide("scanData", scanData);
  226. const enterfnc = async () => {
  227. let str = scanCode.value;
  228. scanCodeCopyValue.value = str;
  229. scanCode.value = "";
  230. const { code, data } = await searchMaterial({
  231. operationId: store.odersData.operationId,
  232. processId: store.scanInfo.id,
  233. seqNo: store.scanInfo.seqNo,
  234. scanCode: str,
  235. workOrderCode: store.odersData.workOrderCode,
  236. });
  237. if (code == "200") {
  238. data[0].itemSeq = scanCodeCopyValue.value;
  239. scanData.value = data;
  240. showCJ.value = true;
  241. }
  242. };
  243. const opCompentDataList = ref([]);
  244. provide("opCompentDataList", opCompentDataList);
  245. //通过id获取详情
  246. const getInfoById = async (item) => {
  247. const { data } = await getInfo({
  248. itemCode: item.itemCode,
  249. opId: store.odersData.operationId,
  250. processId: store.scanInfo.id,
  251. });
  252. showInfoData.value = data;
  253. showInfo.value = item;
  254. };
  255. const toXQPop = async (itemName) => {
  256. await getInfoById(itemName);
  257. showXQ.value = true;
  258. };
  259. //提交录入信息
  260. const submitRecordAdd = async () => {
  261. let array = JSON.parse(JSON.stringify(scanData.value));
  262. array.forEach((element) => {
  263. element.operationId = store.odersData.operationId;
  264. element.processId = store.scanInfo.id;
  265. element.seqNo = store.scanInfo.seqNo;
  266. element.trackBy = "S";
  267. element.workOrderCode = store.odersData.workOrderCode;
  268. });
  269. const { code, data } = await itemRecordAdd(array);
  270. if (code == "200") {
  271. showCJ.value = false;
  272. ElMessage.success("录入成功");
  273. getOpCompentData();
  274. }
  275. };
  276. const submit = () => {
  277. let selectIndex = caijiRef.value.selectIndex;
  278. submitRecordAdd(selectIndex);
  279. };
  280. //获取tag列表数据
  281. const getOpCompentData = async () => {
  282. const { data } = await recordList({
  283. operationId: store.odersData.operationId,
  284. workOrderCode: store.odersData.workOrderCode,
  285. seqNo: store.scanInfo.seqNo,
  286. processId: store.scanInfo.id,
  287. pageNo: 1,
  288. pageSize: 9999,
  289. });
  290. opCompentDataList.value = data;
  291. };
  292. const input = ref("");
  293. onMounted(() => {
  294. getOpCompentData();
  295. });
  296. </script>
  297. <style lang="scss" scoped>
  298. .scanCode {
  299. width: 400px;
  300. margin-top: $p5;
  301. border-radius: 25px;
  302. overflow: hidden;
  303. }
  304. .materialInfoBody {
  305. width: 100%;
  306. height: calc(100vh - 360px);
  307. margin-top: 10px;
  308. .btns {
  309. height: 50px;
  310. display: flex;
  311. align-items: center;
  312. justify-content: end;
  313. }
  314. }
  315. :deep(.el-input__wrapper) {
  316. background-color: #000;
  317. }
  318. .showCodeBody {
  319. width: calc((100vw / 6 * 5) - 50px);
  320. height: calc((100vh - 240px));
  321. @include flex;
  322. .codeBox {
  323. width: 180px;
  324. display: flex;
  325. flex-direction: column;
  326. img {
  327. margin: 0 auto;
  328. }
  329. .codeText {
  330. text-align: center;
  331. font-size: $f20;
  332. color: #00000030;
  333. }
  334. }
  335. }
  336. </style>