index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. :title="title"
  8. background-color="#F7F9FA"
  9. color="#000"
  10. @clickLeft="back"
  11. ></uni-nav-bar>
  12. <view class="list_box" v-for="(item, idx) in dataList" :key="idx">
  13. <view class="card_box cx-sc">
  14. <view class="content_table">
  15. <view class="item">
  16. <view class="lable rx-cc" style="color: #157a2c">领料单号</view>
  17. <view class="content rx-bc" style="color: #157a2c">
  18. {{ item.code }}
  19. </view>
  20. </view>
  21. <view class="item">
  22. <view class="lable rx-cc" style="color: #157a2c">领料时间</view>
  23. <view class="content rx-bc" style="color: #157a2c">
  24. {{ item.createTime }}
  25. </view>
  26. </view>
  27. <view class="item">
  28. <view class="lable rx-cc" style="color: #157a2c">领料人</view>
  29. <view class="content rx-bc" style="color: #157a2c">
  30. {{ item.executorName }}
  31. </view>
  32. </view>
  33. <view class="item">
  34. <view class="lable rx-cc" style="color: #157a2c">类型</view>
  35. <view
  36. class="content rx-bc"
  37. style="color: #157a2c"
  38. v-if="item.type == 1"
  39. >
  40. 自建领料
  41. </view>
  42. <view
  43. class="content rx-bc"
  44. style="color: #157a2c"
  45. v-if="item.type == 2"
  46. >
  47. 工单领料
  48. </view>
  49. <view
  50. class="content rx-bc"
  51. style="color: #157a2c"
  52. v-if="item.type == 3"
  53. >
  54. 委外领料
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <u-list
  60. @scrolltolower="scrolltolower"
  61. key="dataList-catch"
  62. v-if="status == 1"
  63. height="auto"
  64. style="padding-bottom: 10rpx"
  65. >
  66. <view v-if="item.type == 2">
  67. <view
  68. class="card_box cx-sc"
  69. v-for="(it, index) in orderInfoListSafe(item)"
  70. :key="index"
  71. >
  72. <instanceBom :item="it" :isDetails="true"></instanceBom>
  73. </view>
  74. <u-list-item
  75. v-if="orderInfoListSafe(item).length == 0"
  76. style="margin-top: 20vh"
  77. >
  78. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  79. </u-list-item>
  80. </view>
  81. <view v-if="item.type == 1">
  82. <view
  83. class="card_box cx-sc"
  84. v-for="(it, index) in detailListSafe(item)"
  85. :key="index"
  86. >
  87. <instanceBomTwo :item="it" :isDetails="true"></instanceBomTwo>
  88. </view>
  89. <u-list-item
  90. v-if="detailListSafe(item).length == 0"
  91. style="margin-top: 20vh"
  92. >
  93. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  94. </u-list-item>
  95. </view>
  96. </u-list>
  97. <u-list
  98. @scrolltolower="scrolltolower"
  99. key="dataList2"
  100. v-if="status == 2"
  101. height="auto"
  102. style="padding-bottom: 10rpx"
  103. >
  104. <view v-if="item.type == 1">
  105. <view
  106. class="card_box cx-sc"
  107. v-for="(it, index) in detailListSafe(item)"
  108. :key="index"
  109. >
  110. <outInstanceBom :item="it" :isDetails="true"></outInstanceBom>
  111. </view>
  112. <u-list-item
  113. v-if="detailListSafe(item).length == 0"
  114. style="margin-top: 20vh"
  115. >
  116. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  117. </u-list-item>
  118. </view>
  119. <view v-if="item.type == 2">
  120. <view
  121. class="card_box cx-sc"
  122. v-for="(it, index) in orderInfoListSafe(item)"
  123. :key="index"
  124. >
  125. <outInstanceBom :item="it" :isDetails="true"></outInstanceBom>
  126. </view>
  127. <u-list-item
  128. v-if="orderInfoListSafe(item).length == 0"
  129. style="margin-top: 20vh"
  130. >
  131. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  132. </u-list-item>
  133. </view>
  134. <!-- <view class="card_box cx-sc">
  135. <outInstanceBom :list="dataList" :isDetails="true"></outInstanceBom>
  136. </view>
  137. <u-list-item v-if="dataList.length === 0" style="margin-top: 20vh">
  138. <u-empty iconSize="150" textSize="32" text="暂无数据"> </u-empty>
  139. </u-list-item> -->
  140. </u-list>
  141. </view>
  142. <view class="bottom-wrapper">
  143. <!-- <view class="btn_box" @click="save">一键报工</view> -->
  144. </view>
  145. </view>
  146. </template>
  147. <script>
  148. import { tableHeader } from "../../common.js";
  149. import { workorderPage } from "@/api/pda/workOrder.js";
  150. import {
  151. pickDetails,
  152. pickOutInOrder,
  153. queryOutWordDetail,
  154. } from "@/api/pda/picking.js";
  155. import instanceBom from "./components/instanceBom.vue";
  156. import instanceBomTwo from "../../selfBuiltPickOrder/components/instanceBom.vue";
  157. import outInstanceBom from "./components/outInstanceBom.vue";
  158. export default {
  159. components: {
  160. instanceBom,
  161. instanceBomTwo,
  162. outInstanceBom,
  163. },
  164. data() {
  165. return {
  166. ids: [],
  167. dataList: [],
  168. title: null,
  169. status: 1,
  170. item: null,
  171. };
  172. },
  173. onLoad(option) {
  174. this.status = option.status || 1;
  175. console.log(option.id, "optionoptionoption");
  176. if (option.item) {
  177. this.title =
  178. option.status == 1 ? "领料详情" : option.status == 2 ? " 出库详情" : "";
  179. const parsed = JSON.parse(option.item);
  180. this.dataList = Array.isArray(parsed)
  181. ? parsed.filter(Boolean)
  182. : parsed
  183. ? [parsed]
  184. : [];
  185. } else {
  186. this.ids = [option.id];
  187. this.getList();
  188. }
  189. },
  190. methods: {
  191. async getList() {
  192. let list = [];
  193. if (this.status == 1) {
  194. const res = await pickDetails(this.ids);
  195. list = res;
  196. // list.forEach((m) => {
  197. // if (m.orderInfoList.length > 0) {
  198. // m.orderInfoList.forEach((o) => {
  199. // let _arr = [];
  200. // _arr = [...o.bomDetailDTOS, ...o.instanceList];
  201. // _arr = _arr.sort(
  202. // (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId,
  203. // );
  204. // o["arr"] = _arr;
  205. // });
  206. // }
  207. // });
  208. list.forEach((m) => {
  209. if (Array.isArray(m.orderInfoList) && m.orderInfoList.length > 0) {
  210. m.orderInfoList.forEach((o) => {
  211. let _arr = [];
  212. _arr = [
  213. ...(Array.isArray(o.bomDetailDTOS) ? o.bomDetailDTOS : []),
  214. ...(Array.isArray(o.instanceList) ? o.instanceList : []),
  215. ];
  216. _arr.sort(
  217. (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId,
  218. );
  219. o.arr = _arr;
  220. });
  221. }
  222. });
  223. this.dataList = list;
  224. } else if (this.status == 2) {
  225. console.log(this.ids.join(","));
  226. const res = await queryOutWordDetail({
  227. pickOrderId: this.ids.join(","),
  228. });
  229. console.log(res, "11111");
  230. // const res = await pickOutInOrder({
  231. // workOrderIds: this.ids,
  232. // });
  233. // this.dataList = res;
  234. }
  235. },
  236. orderInfoListSafe(item) {
  237. console.log(item, "itemitemitem");
  238. return Array.isArray(item?.orderInfoList) ? item.orderInfoList : [];
  239. },
  240. detailListSafe(item) {
  241. console.log(item, "itemitemitem");
  242. return Array.isArray(item?.detailList) ? item.detailList : [];
  243. },
  244. scrolltolower() {},
  245. tableH(type) {
  246. return tableHeader(type);
  247. },
  248. save() {},
  249. },
  250. };
  251. </script>
  252. <style lang="scss" scoped>
  253. .content-box {
  254. /* 让页面按内容自然撑开,避免内部列表被压缩 */
  255. min-height: 100vh;
  256. display: flex;
  257. flex-direction: column;
  258. }
  259. .list_box {
  260. /* 不再参与 flex 等分高度,每个单据块按内容自适应 */
  261. padding: 16rpx 0;
  262. }
  263. .bottom-wrapper {
  264. .btn_box {
  265. width: 750rpx;
  266. height: 88rpx;
  267. line-height: 88rpx;
  268. background: $theme-color;
  269. text-align: center;
  270. font-size: 36rpx;
  271. font-style: normal;
  272. font-weight: 400;
  273. color: #fff;
  274. }
  275. }
  276. .card_box {
  277. margin-top: 10rpx;
  278. .word_order {
  279. height: 64rpx;
  280. width: 706rpx;
  281. background: $theme-color;
  282. font-size: 28rpx;
  283. color: #fff;
  284. line-height: 64rpx;
  285. padding-left: 40rpx;
  286. box-sizing: border-box;
  287. }
  288. .content_table {
  289. margin-top: 10rpx;
  290. width: 702rpx;
  291. border: 2rpx solid $border-color;
  292. .item {
  293. display: flex;
  294. border-bottom: 2rpx solid $border-color;
  295. .lable {
  296. width: 132rpx;
  297. text-align: center;
  298. background-color: #f7f9fa;
  299. font-size: 26rpx;
  300. border-right: 2rpx solid $border-color;
  301. flex-shrink: 0;
  302. }
  303. .ww80 {
  304. width: 80rpx;
  305. }
  306. .content {
  307. width: 518rpx;
  308. min-height: 64rpx;
  309. font-size: 28rpx;
  310. line-height: 28rpx;
  311. font-style: normal;
  312. font-weight: 400;
  313. padding: 18rpx 8rpx;
  314. box-sizing: border-box;
  315. word-wrap: break-word;
  316. flex-grow: 1 !important;
  317. }
  318. .content_num {
  319. display: flex;
  320. align-items: center;
  321. padding: 0 4rpx;
  322. /deep/ .uni-input-input {
  323. width: 480rpx;
  324. border: 2rpx solid #f0f8f2;
  325. background: #f0f8f2;
  326. color: $theme-color;
  327. }
  328. .unit {
  329. padding: 0 4rpx;
  330. font-size: 24rpx;
  331. color: #404446;
  332. }
  333. }
  334. .pd4 {
  335. padding: 4rpx 8rpx;
  336. }
  337. &:last-child {
  338. border-bottom: none;
  339. }
  340. }
  341. .ww55 {
  342. width: 55%;
  343. }
  344. .ww45 {
  345. width: 45%;
  346. }
  347. }
  348. }
  349. </style>