index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
  5. <el-tab-pane label="待备料" name="first">
  6. <byTable
  7. :hidePagination="true"
  8. :source="sourceList.data"
  9. :pagination="sourceList.pagination"
  10. :config="config"
  11. :loading="loading"
  12. :searchConfig="searchConfig"
  13. highlight-current-row
  14. :table-events="{
  15. select: selectRow,
  16. }"
  17. :action-list="[
  18. {
  19. text: '完成备料',
  20. action: () => clickAccomplish(),
  21. },
  22. ]"
  23. @get-list="getList"
  24. @clickReset="clickReset">
  25. <template #blueprint="{ item }">
  26. <div>
  27. <img
  28. v-if="item.blueprint"
  29. style="margin-top: 3px; width: 40px; height: 40px; cursor: pointer; object-fit: contain; vertical-align: middle"
  30. v-lazy="item.blueprint"
  31. @click="openFile(item.blueprint)" />
  32. </div>
  33. </template>
  34. <template #size="{ item }">
  35. <div>{{ item.length }} * {{ item.width }} * {{ item.height }}</div>
  36. </template>
  37. </byTable>
  38. </el-tab-pane>
  39. <el-tab-pane label="已备料" name="second">
  40. <byTable
  41. :source="sourceListTwo.data"
  42. :pagination="sourceListTwo.pagination"
  43. :config="configTwo"
  44. :loading="loading"
  45. :searchConfig="searchConfig"
  46. highlight-current-row
  47. @get-list="getListTwo"
  48. @clickReset="clickResetTwo">
  49. <template #blueprint="{ item }">
  50. <div>
  51. <img
  52. v-if="item.blueprint"
  53. style="margin-top: 3px; width: 40px; height: 40px; cursor: pointer; object-fit: contain; vertical-align: middle"
  54. v-lazy="item.blueprint"
  55. @click="openFile(item.blueprint)" />
  56. </div>
  57. </template>
  58. <template #size="{ item }">
  59. <div>{{ item.length }} * {{ item.width }} * {{ item.height }}</div>
  60. </template>
  61. </byTable>
  62. </el-tab-pane>
  63. </el-tabs>
  64. </el-card>
  65. </div>
  66. </template>
  67. <script setup>
  68. import byTable from "@/components/byTable/index";
  69. import { ElMessage } from "element-plus";
  70. const { proxy } = getCurrentInstance();
  71. const activeName = ref("first");
  72. const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
  73. const sourceList = ref({
  74. data: [],
  75. pagination: {
  76. orderCode: "",
  77. orderWlnCode: "",
  78. bomSpecCode: "",
  79. bomSpecName: "",
  80. skuSpecCode: "",
  81. skuSpecName: "",
  82. departmentId: "",
  83. warehouseName: "",
  84. width: "",
  85. },
  86. });
  87. const sourceListTwo = ref({
  88. data: [],
  89. pagination: {
  90. total: 0,
  91. pageNum: 1,
  92. pageSize: 10,
  93. type: "1",
  94. orderCode: "",
  95. orderWlnCode: "",
  96. bomSpecCode: "",
  97. bomSpecName: "",
  98. skuSpecCode: "",
  99. skuSpecName: "",
  100. departmentId: "",
  101. warehouseName: "",
  102. width: "",
  103. },
  104. });
  105. const loading = ref(false);
  106. const searchConfig = computed(() => {
  107. return [
  108. {
  109. type: "input",
  110. prop: "orderCode",
  111. label: "订单号",
  112. },
  113. {
  114. type: "input",
  115. prop: "orderWlnCode",
  116. label: "万里牛单号",
  117. },
  118. {
  119. type: "input",
  120. prop: "bomSpecCode",
  121. label: "BOM品号",
  122. },
  123. {
  124. type: "input",
  125. prop: "bomSpecName",
  126. label: "BOM品名",
  127. },
  128. {
  129. type: "input",
  130. prop: "skuSpecCode",
  131. label: "SKU品号",
  132. },
  133. {
  134. type: "input",
  135. prop: "skuSpecName",
  136. label: "SKU品名",
  137. },
  138. {
  139. type: "select",
  140. prop: "departmentId",
  141. data: departmentList.value,
  142. label: "事业部",
  143. },
  144. {
  145. type: "input",
  146. prop: "width",
  147. label: "幅宽(cm)",
  148. },
  149. ];
  150. });
  151. const config = computed(() => {
  152. return [
  153. {
  154. type: "selection",
  155. attrs: {
  156. checkAtt: "isCheck",
  157. },
  158. },
  159. {
  160. attrs: {
  161. label: "设计图",
  162. slot: "blueprint",
  163. width: 80,
  164. },
  165. },
  166. {
  167. attrs: {
  168. label: "事业部",
  169. prop: "departmentName",
  170. width: 120,
  171. },
  172. },
  173. {
  174. attrs: {
  175. label: "BOM品号",
  176. prop: "bomSpecCode",
  177. width: 160,
  178. },
  179. },
  180. {
  181. attrs: {
  182. label: "BOM品名",
  183. prop: "bomSpecName",
  184. "min-width": 280,
  185. },
  186. },
  187. {
  188. attrs: {
  189. label: "SKU品号",
  190. prop: "skuSpecCode",
  191. width: 160,
  192. },
  193. },
  194. {
  195. attrs: {
  196. label: "SKU品名",
  197. prop: "skuSpecName",
  198. "min-width": 200,
  199. },
  200. },
  201. {
  202. attrs: {
  203. label: "尺寸(长宽高,cm)",
  204. slot: "size",
  205. width: 160,
  206. },
  207. },
  208. {
  209. attrs: {
  210. label: "数量",
  211. prop: "quantity",
  212. width: 100,
  213. },
  214. },
  215. {
  216. attrs: {
  217. label: "投产时间",
  218. prop: "createTime",
  219. width: 160,
  220. align: "center",
  221. },
  222. },
  223. {
  224. attrs: {
  225. label: "订单号",
  226. prop: "orderCode",
  227. width: 170,
  228. },
  229. },
  230. {
  231. attrs: {
  232. label: "万里牛单号",
  233. prop: "orderWlnCode",
  234. width: 150,
  235. },
  236. },
  237. ];
  238. });
  239. const configTwo = computed(() => {
  240. return [
  241. {
  242. attrs: {
  243. label: "设计图",
  244. slot: "blueprint",
  245. width: 80,
  246. },
  247. },
  248. {
  249. attrs: {
  250. label: "事业部",
  251. prop: "departmentName",
  252. width: 160,
  253. },
  254. },
  255. {
  256. attrs: {
  257. label: "BOM品号",
  258. prop: "bomSpecCode",
  259. width: 160,
  260. },
  261. },
  262. {
  263. attrs: {
  264. label: "BOM品名",
  265. prop: "bomSpecName",
  266. "min-width": 240,
  267. },
  268. },
  269. {
  270. attrs: {
  271. label: "SKU品号",
  272. prop: "skuSpecCode",
  273. width: 160,
  274. },
  275. },
  276. {
  277. attrs: {
  278. label: "SKU品名",
  279. prop: "skuSpecName",
  280. "min-width": 200,
  281. },
  282. },
  283. {
  284. attrs: {
  285. label: "尺寸(长宽高,cm)",
  286. slot: "size",
  287. width: 160,
  288. },
  289. },
  290. {
  291. attrs: {
  292. label: "数量",
  293. prop: "quantity",
  294. width: 100,
  295. },
  296. },
  297. {
  298. attrs: {
  299. label: "投产时间",
  300. prop: "createTime",
  301. width: 160,
  302. align: "center",
  303. },
  304. },
  305. {
  306. attrs: {
  307. label: "订单号",
  308. prop: "orderCode",
  309. width: 160,
  310. },
  311. },
  312. {
  313. attrs: {
  314. label: "万里牛单号",
  315. prop: "orderWlnCode",
  316. width: 160,
  317. },
  318. },
  319. ];
  320. });
  321. const getList = async (req) => {
  322. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  323. loading.value = true;
  324. proxy.post("/stockPreparation/uncompletedList", sourceList.value.pagination).then((res) => {
  325. if (res && res.length > 0) {
  326. sourceList.value.data = res
  327. .filter((item, index) => index < 10)
  328. .map((item) => {
  329. return {
  330. ...item,
  331. isCheck: true,
  332. };
  333. });
  334. } else {
  335. sourceList.value.data = res;
  336. }
  337. setTimeout(() => {
  338. loading.value = false;
  339. }, 200);
  340. });
  341. };
  342. getList();
  343. const clickReset = () => {
  344. getList("");
  345. };
  346. const getListTwo = async (req, status) => {
  347. if (status) {
  348. sourceListTwo.value.pagination = {
  349. pageNum: sourceListTwo.value.pagination.pageNum,
  350. pageSize: sourceListTwo.value.pagination.pageSize,
  351. };
  352. } else {
  353. sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
  354. }
  355. loading.value = true;
  356. proxy.post("/stockPreparation/completedPage", sourceListTwo.value.pagination).then((res) => {
  357. sourceListTwo.value.data = res.rows;
  358. sourceListTwo.value.pagination.total = res.total;
  359. setTimeout(() => {
  360. loading.value = false;
  361. }, 200);
  362. });
  363. };
  364. const clickResetTwo = () => {
  365. getListTwo("", true);
  366. };
  367. const changeActiveName = (val) => {
  368. if (val === "first") {
  369. getList();
  370. } else {
  371. getListTwo();
  372. }
  373. };
  374. const getDemandData = () => {
  375. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  376. if (res.rows && res.rows.length > 0) {
  377. departmentList.value = departmentList.value.concat(
  378. res.rows.map((item) => {
  379. return {
  380. dictKey: item.id,
  381. dictValue: item.name,
  382. };
  383. })
  384. );
  385. }
  386. });
  387. };
  388. getDemandData();
  389. const selectData = ref([]);
  390. const selectRow = (data) => {
  391. selectData.value = data;
  392. };
  393. const openFile = (path) => {
  394. window.open(path);
  395. };
  396. const clickAccomplish = () => {
  397. if (selectData.value && selectData.value.length > 0) {
  398. proxy
  399. .post(
  400. "/stockPreparation/submit",
  401. selectData.value.map((item) => item.orderSkuId)
  402. )
  403. .then(() => {
  404. ElMessage({ message: "提交完成", type: "success" });
  405. getList();
  406. });
  407. } else {
  408. return ElMessage("请选择操作的数据");
  409. }
  410. };
  411. watch(selectData, (newVal) => {
  412. if (newVal.length === 0) {
  413. sourceList.value.data.forEach((x) => {
  414. x.isCheck = true;
  415. });
  416. } else {
  417. sourceList.value.data.forEach((x) => {
  418. if (x.orderId !== newVal[0].orderId) {
  419. x.isCheck = false;
  420. }
  421. });
  422. }
  423. });
  424. </script>
  425. <style lang="scss" scoped>
  426. ::v-deep(.el-input-number .el-input__inner) {
  427. text-align: left;
  428. }
  429. :deep(.el-table__header-wrapper .el-checkbox) {
  430. display: none;
  431. }
  432. </style>