details.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. <template>
  2. <view class="content-box">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="领料" background-color="#F7F9FA"
  4. color="#404446" @clickLeft="back"></uni-nav-bar>
  5. <view class="list_box">
  6. <u-list @scrolltolower="scrolltolower">
  7. <view v-for="(item,index) in List" :key="index" class="card_box">
  8. <view class="title_box rx-bc">
  9. <view class="left rx-sc">
  10. <view class="round">{{index + 1}}</view>
  11. <view class="code">工单编号:{{item.code}}</view>
  12. </view>
  13. <view class="right_box rx-ec">
  14. <u-button type="success" size="small" class="u-reset-button"
  15. @click="addPicking(item.workOrderId, item)" text="添加物料"></u-button>
  16. </view>
  17. </view>
  18. <view class="material rx-ss" v-for="(mate, idx) in item.bomList">
  19. <view class="left rx-ss" @click="mate.checked = ! mate.checked">
  20. <view class="zdy_check rx-cc" :class="{ check_active : mate.checked }">
  21. <u-icon size="28" v-if='mate.checked' name='checkbox-mark'></u-icon>
  22. </view>
  23. </view>
  24. <view class="content_table">
  25. <view class="item">
  26. <view class="lable rx-cc">物料编码</view>
  27. <view class="content">
  28. {{mate.categoryCode}}
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="lable rx-cc">名称</view>
  33. <view class="content">{{mate.categoryName}}</view>
  34. </view>
  35. <view class="item rx-sc">
  36. <view class="rx ww55 ">
  37. <view class="lable rx-cc">牌号</view>
  38. <view class="content ">{{mate.brandNum}}</view>
  39. </view>
  40. <view class="rx ww45">
  41. <view class="lable rx-cc ww80">数量</view>
  42. <view class="content content_num">
  43. <input class="uni-input" v-model="mate.demandQuantity" type="digit"></input>
  44. <view class="unit">{{mate.unit}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="item">
  49. <view class="lable rx-cc">领料仓库</view>
  50. <view class="content pd4">
  51. <zxz-uni-data-select :localdata="mate.warehouseList" v-model="mate.warehouseId"
  52. dataValue='id' format='{name}' dataKey="name" filterable
  53. :clear='false'></zxz-uni-data-select>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view>
  59. <instanceBom :list='item.instanceList2'></instanceBom>
  60. <modelBom :workOrderId='item.workOrderId' :modelList='item.modelList'
  61. :modelList2='item.modelList2' :code='item.code' @hendDel='hendDel'>
  62. </modelBom>
  63. <boatBom :palletList='item.palletList' :palletList2='item.palletList2' :code='item.code'
  64. @hendDel='hendDel'>
  65. </boatBom>
  66. </view>
  67. </view>
  68. </u-list>
  69. </view>
  70. <view class="bottom-wrapper">
  71. <view class="btn_box" @click="save">提交</view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import instanceBom from './components/instanceBom.vue'
  77. import modelBom from './components/modelBom.vue'
  78. import boatBom from './components/boatBom.vue'
  79. import {
  80. workorderList
  81. } from '@/api/pda/workOrder.js'
  82. import {
  83. batchSave
  84. } from '@/api/pda/picking.js'
  85. export default {
  86. components: {
  87. instanceBom,
  88. modelBom,
  89. boatBom
  90. },
  91. data() {
  92. return {
  93. idsList: [],
  94. List: [],
  95. classificationList: [], //分类数据
  96. taskId: null,
  97. }
  98. },
  99. onLoad(options) {
  100. let queryArray = decodeURIComponent(options.arr);
  101. this.idsList = JSON.parse(queryArray);
  102. this.taskId = options.taskId
  103. this.getList()
  104. },
  105. onShow() {
  106. uni.$off("setSelectList");
  107. uni.$on("setSelectList", (selectList, id) => {
  108. this.List.forEach(m => {
  109. if (m.workOrderId == id) {
  110. let instanceList2 = [] // 投料
  111. let modelList2 = [] // 模具
  112. let palletList2 = []
  113. selectList.forEach(f => {
  114. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8 ) { // 投料
  115. f.automatic = 1
  116. instanceList2 = instanceList2.concat(f)
  117. } else if (f.rootCategoryLevelId == 5) { // 模具
  118. f.automatic = 1
  119. modelList2 = modelList2.concat(f)
  120. } else if (f.rootCategoryLevelId == 8) { // 舟皿
  121. f.automatic = 1
  122. palletList2 = palletList2.concat(f)
  123. }
  124. })
  125. this.$set(m, 'instanceList2', instanceList2)
  126. this.$set(m, 'modelList2', modelList2)
  127. this.$set(m, 'palletList2', palletList2)
  128. }
  129. })
  130. });
  131. },
  132. methods: {
  133. scrolltolower() {},
  134. save() {
  135. let _arr = []
  136. _arr = this.List.map(m => {
  137. if (m.bomList.length > 0) {
  138. let bomList = m.bomList.filter(f => f.checked)
  139. m['bomDetailDTOSList'] = [...bomList, ...m.modelList, ...m.palletList]
  140. }
  141. m.instanceList = [...m.instanceList2, ...m.modelList2, ...m.palletList2]
  142. return {
  143. ...m
  144. }
  145. })
  146. batchSave(_arr).then(res => {
  147. uni.navigateTo({
  148. url: `/pages/pda/picking/index/index?pickStatus=1`,
  149. });
  150. })
  151. },
  152. getList() {
  153. workorderList({
  154. ids: this.idsList,
  155. taskId: this.taskId
  156. }).then(res => {
  157. this.List = res.map(m => {
  158. m.workOrderId = m.id
  159. let modelList = []
  160. let palletList = []
  161. let bomList = []
  162. m.bomDetailDTOS.forEach((f, i) => {
  163. if (f.rootCategoryLevelId == 5) {
  164. f.automatic = 2
  165. modelList = modelList.concat(f)
  166. }
  167. if (f.rootCategoryLevelId == 8) {
  168. f.automatic = 2
  169. palletList = palletList.concat(f)
  170. }
  171. if (f.rootCategoryLevelId != 5 && f.rootCategoryLevelId != 8) {
  172. f.automatic = 2
  173. bomList = bomList.concat(f)
  174. }
  175. })
  176. m['modelList'] = modelList
  177. m['palletList'] = palletList
  178. m['bomList'] = bomList
  179. m['instanceList2'] = []
  180. m['palletList2'] = []
  181. m['modelList2'] = []
  182. delete m.id
  183. return {
  184. ...m
  185. }
  186. })
  187. })
  188. },
  189. hendDel(type, code, list) {
  190. if (type == 'modelBom') {
  191. console.log(list.length)
  192. if (list.length == 0) {
  193. }
  194. this.List.forEach(f => {
  195. if (f.code == code) {
  196. if (list.length == 0) {
  197. f.modelList2 = []
  198. f.modelList = []
  199. return false
  200. }
  201. f.modelList2 = list.filter(t => t.automatic == 1)
  202. f.modelList = list.filter(t => t.automatic == 2)
  203. }
  204. })
  205. }
  206. if (type == 'boatBom') {
  207. this.List.forEach(f => {
  208. if (f.code == code) {
  209. if (list.length == 0) {
  210. f.palletList2 = []
  211. f.palletList = []
  212. return false
  213. }
  214. f.palletList2 = list.filter(t => t.automatic == 1)
  215. f.palletList = list.filter(t => t.automatic == 2)
  216. }
  217. })
  218. }
  219. this.$forceUpdate()
  220. },
  221. addPicking(id, item) {
  222. const storageKey = Date.now() + "";
  223. console.log(item)
  224. let arr = [...item.instanceList2, ...item.modelList2, ...item.palletList2]
  225. uni.setStorageSync(storageKey, arr);
  226. uni.navigateTo({
  227. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick&taskId=${this.taskId}`
  228. })
  229. },
  230. },
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .content-box {
  235. height: 100vh;
  236. overflow: hidden;
  237. display: flex;
  238. flex-direction: column;
  239. }
  240. .list_box {
  241. flex: 1;
  242. overflow: hidden;
  243. padding: 4rpx 0;
  244. .u-list {
  245. height: 100% !important;
  246. }
  247. .card_box {
  248. padding: 16rpx 24rpx;
  249. }
  250. .title_box {
  251. .round {
  252. width: 32rpx;
  253. height: 32rpx;
  254. line-height: 32rpx;
  255. border-radius: 50%;
  256. background: $theme-color;
  257. color: #fff;
  258. text-align: center;
  259. font-size: 20rpx;
  260. }
  261. .code {
  262. margin-left: 16rpx;
  263. font-family: PingFang SC;
  264. font-size: 28rpx;
  265. font-style: normal;
  266. font-weight: 400;
  267. color: $theme-color;
  268. }
  269. }
  270. .right_box {}
  271. .material {
  272. margin-top: 10rpx;
  273. .left {
  274. width: 40rpx;
  275. }
  276. .zdy_check {
  277. width: 30rpx;
  278. height: 30rpx;
  279. border: 2rpx solid #c8c9cc;
  280. border-radius: 4rpx;
  281. }
  282. .check_active {
  283. background: $theme-color;
  284. border: 2rpx solid $theme-color;
  285. /deep/ .u-icon__icon {
  286. color: #fff !important;
  287. }
  288. }
  289. .content_table {
  290. width: 652rpx;
  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. border: 2rpx solid #F0F8F2;
  324. background: #F0F8F2;
  325. color: $theme-color;
  326. }
  327. .unit {
  328. width: 90rpx;
  329. text-align: center;
  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. }
  350. .bottom-wrapper {
  351. .btn_box {
  352. width: 750rpx;
  353. height: 88rpx;
  354. line-height: 88rpx;
  355. background: $theme-color;
  356. text-align: center;
  357. font-size: 36rpx;
  358. font-style: normal;
  359. font-weight: 400;
  360. color: #fff;
  361. }
  362. }
  363. </style>