details.vue 7.3 KB

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