details.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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.bomDetailDTOS">
  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.measuringUnit}}</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.instanceList'></instanceBom>
  60. <modelBom v-if='item.modelList.length != 0' :workOrderId='item.workOrderId'
  61. :list='item.modelList'>
  62. </modelBom>
  63. </view>
  64. </view>
  65. </u-list>
  66. </view>
  67. <view class="bottom-wrapper">
  68. <view class="btn_box" @click="save">提交</view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import instanceBom from './components/instanceBom.vue'
  74. import modelBom from '../feeding/components/modelBom.vue'
  75. import {
  76. workorderList
  77. } from '@/api/pda/workOrder.js'
  78. import {
  79. batchSave
  80. } from '@/api/pda/picking.js'
  81. export default {
  82. components: {
  83. instanceBom,
  84. modelBom
  85. },
  86. data() {
  87. return {
  88. idsList: [],
  89. List: [],
  90. classificationList: [], //分类数据
  91. taskId: null
  92. }
  93. },
  94. onLoad(options) {
  95. let queryArray = decodeURIComponent(options.arr);
  96. this.idsList = JSON.parse(queryArray);
  97. this.taskId = options.taskId
  98. this.getList()
  99. },
  100. onShow() {
  101. uni.$off("setSelectList");
  102. uni.$on("setSelectList", (selectList, id) => {
  103. this.List.forEach(m => {
  104. if (m.workOrderId == id) {
  105. let instanceList = [] // 投料
  106. let modelList = [] // 模具
  107. selectList.forEach(f => {
  108. if (f.rootCategoryLevelId == 1) {
  109. instanceList = instanceList.concat(f)
  110. } else if (f.rootCategoryLevelId == 5) {
  111. modelList = modelList.concat(f)
  112. }
  113. })
  114. this.$set(m, 'instanceList', instanceList)
  115. this.$set(m, 'modelList', modelList)
  116. }
  117. })
  118. });
  119. },
  120. methods: {
  121. scrolltolower() {},
  122. save() {
  123. let _arr = []
  124. _arr = this.List.map(m => {
  125. if (m.bomDetailDTOS.length > 0) {
  126. m.bomDetailDTOS = m.bomDetailDTOS.filter(f => f.checked)
  127. }
  128. return {
  129. ...m
  130. }
  131. })
  132. batchSave(_arr).then(res => {
  133. uni.navigateTo({
  134. url: `/pages/pda/picking/index/index?pickStatus=1`,
  135. });
  136. })
  137. },
  138. getList() {
  139. workorderList({
  140. ids: this.idsList,
  141. taskId: this.taskId
  142. }).then(res => {
  143. this.List = res.map(m => {
  144. m.workOrderId = m.id
  145. if (!m.hasOwnProperty('modelList')) {
  146. m.modelList = [] // 模具
  147. }
  148. delete m.id
  149. return {
  150. ...m
  151. }
  152. })
  153. })
  154. },
  155. addPicking(id, item) {
  156. const storageKey = Date.now() + "";
  157. let arr = [...item.instanceList, ...item.modelList]
  158. uni.setStorageSync(storageKey, arr);
  159. uni.navigateTo({
  160. url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=pick`
  161. })
  162. },
  163. },
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .content-box {
  168. height: 100vh;
  169. overflow: hidden;
  170. display: flex;
  171. flex-direction: column;
  172. }
  173. .list_box {
  174. flex: 1;
  175. overflow: hidden;
  176. padding: 4rpx 0;
  177. .u-list {
  178. height: 100% !important;
  179. }
  180. .card_box {
  181. padding: 16rpx 24rpx;
  182. }
  183. .title_box {
  184. .round {
  185. width: 32rpx;
  186. height: 32rpx;
  187. line-height: 32rpx;
  188. border-radius: 50%;
  189. background: $theme-color;
  190. color: #fff;
  191. text-align: center;
  192. font-size: 20rpx;
  193. }
  194. .code {
  195. margin-left: 16rpx;
  196. font-family: PingFang SC;
  197. font-size: 28rpx;
  198. font-style: normal;
  199. font-weight: 400;
  200. color: $theme-color;
  201. }
  202. }
  203. .right_box {}
  204. .material {
  205. margin-top: 10rpx;
  206. .left {
  207. width: 40rpx;
  208. }
  209. .zdy_check {
  210. width: 30rpx;
  211. height: 30rpx;
  212. border: 2rpx solid #c8c9cc;
  213. border-radius: 4rpx;
  214. }
  215. .check_active {
  216. background: $theme-color;
  217. border: 2rpx solid $theme-color;
  218. /deep/ .u-icon__icon {
  219. color: #fff !important;
  220. }
  221. }
  222. .content_table {
  223. width: 652rpx;
  224. border: 2rpx solid $border-color;
  225. .item {
  226. display: flex;
  227. border-bottom: 2rpx solid $border-color;
  228. .lable {
  229. width: 132rpx;
  230. text-align: center;
  231. background-color: #F7F9FA;
  232. font-size: 26rpx;
  233. border-right: 2rpx solid $border-color;
  234. flex-shrink: 0;
  235. }
  236. .ww80 {
  237. width: 80rpx;
  238. }
  239. .content {
  240. width: 518rpx;
  241. min-height: 64rpx;
  242. font-size: 28rpx;
  243. line-height: 28rpx;
  244. font-style: normal;
  245. font-weight: 400;
  246. padding: 18rpx 8rpx;
  247. box-sizing: border-box;
  248. word-wrap: break-word;
  249. flex-grow: 1 !important;
  250. }
  251. .content_num {
  252. display: flex;
  253. align-items: center;
  254. padding: 0 4rpx;
  255. /deep/ .uni-input-input {
  256. border: 2rpx solid #F0F8F2;
  257. background: #F0F8F2;
  258. color: $theme-color;
  259. }
  260. .unit {
  261. padding: 0 4rpx;
  262. font-size: 24rpx;
  263. color: #404446;
  264. }
  265. }
  266. .pd4 {
  267. padding: 4rpx 8rpx;
  268. }
  269. &:last-child {
  270. border-bottom: none;
  271. }
  272. }
  273. .ww55 {
  274. width: 55%;
  275. }
  276. .ww45 {
  277. width: 45%;
  278. }
  279. }
  280. }
  281. }
  282. .bottom-wrapper {
  283. .btn_box {
  284. width: 750rpx;
  285. height: 88rpx;
  286. line-height: 88rpx;
  287. background: $theme-color;
  288. text-align: center;
  289. font-size: 36rpx;
  290. font-style: normal;
  291. font-weight: 400;
  292. color: #fff;
  293. }
  294. }
  295. </style>