details.vue 7.1 KB

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