turnoverBom.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <view>
  3. <view>
  4. <view class="title_box rx-bc">
  5. <view class="name">周转车</view>
  6. </view>
  7. <view v-for="(item, index) in newList" :key='index'>
  8. <view class="title_box rx-bc">
  9. <view class="btn_box rx-bc" @click="handleTrade(index)" >
  10. 工单换周转车
  11. </view>
  12. </view>
  13. <view class="content_table">
  14. <view class="item rx-sc">
  15. <view class="rx ww50 ">
  16. <view class="lable ww80 rx-cc ">编号</view>
  17. <view class="content rx-sc">
  18. <view>{{item.code}}</view>
  19. </view>
  20. </view>
  21. <view class="rx ww50">
  22. <view class="lable rx-cc ww80">名称</view>
  23. <view class="content rx-sc">
  24. <view>{{item.name}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="content_table2">
  30. <view class="head row rx-sc">
  31. <view class="item ww10">货位</view>
  32. <view class="item ww30">工单编号</view>
  33. <view class="item ww30">产品编码</view>
  34. <view class="item ww15">数量</view>
  35. <view class="item ww15"></view>
  36. </view>
  37. <view class="table">
  38. <view class="tr row rx-sc" v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
  39. <view class="item ww10">{{it.code}}</view>
  40. <view class="item ww30" :class="{'color157': it.workOrderCode === wordItem.code}">
  41. {{ it.workOrderCode }}
  42. </view>
  43. <view class="item ww30" :class="{'color157': it.categoryCode === wordItem.productCode}">
  44. {{it.categoryCode}}
  45. </view>
  46. <view class="item ww15 ">
  47. <text :class="{ 'isend': it.isend }">{{it.newQuantity}}</text>
  48. </view>
  49. <view class="item ww15 rx-cc " v-if='!it.isend ' @click="handleCheck(index, idx, it)">
  50. <image class="check" v-if='it.check' src='@/static/check.png'></image>
  51. <image class="check" v-else src='@/static/check_no.png'></image>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view>
  59. <view class="title_box rx-bc">
  60. <view class="name">更换后周转车</view>
  61. </view>
  62. <view v-for="(item, index) in newTurnover" :key='index'>
  63. <view class="title_box rx-bc">
  64. <view class="left rx-ss" @click="getDelete(index)" >
  65. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  66. </view>
  67. </view>
  68. <view class="content_table">
  69. <view class="item rx-sc">
  70. <view class="rx ww50 ">
  71. <view class="lable ww80 rx-cc ">编号</view>
  72. <view class="content rx-sc">
  73. <view>{{item.code}}</view>
  74. </view>
  75. </view>
  76. <view class="rx ww50">
  77. <view class="lable rx-cc ww80">名称</view>
  78. <view class="content rx-sc">
  79. <view>{{item.name}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. <view class="content_table2">
  85. <view class="head row rx-sc">
  86. <view class="item ww10">货位</view>
  87. <view class="item ww30">工单编号</view>
  88. <view class="item ww35">产品编码</view>
  89. <view class="item ww25">数量</view>
  90. </view>
  91. <view class="table">
  92. <view class="tr row rx-sc" v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
  93. <view class="item ww10">{{it.code}}</view>
  94. <view class="item ww30" :class="{'color157': it.workOrderCode === wordItem.code}">
  95. {{ it.workOrderCode }}
  96. </view>
  97. <view class="item ww35" :class="{'color157': it.categoryCode === wordItem.productCode}">
  98. {{it.categoryCode}}
  99. </view>
  100. <view class="item ww25 content_num">
  101. <input class="uni-input" v-if='it.isFull == 0' @input="quantInt(index, idx, it)"
  102. v-model="it.quantity" type="digit" ></input>
  103. <text v-else>{{it.quantity}}</text>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </template>
  112. <script>
  113. import {
  114. scanLedger,
  115. } from '@/api/pda/workOrder.js'
  116. export default {
  117. props: {
  118. list: {
  119. type: Array,
  120. default: () => []
  121. },
  122. wordItem: {
  123. type: Object,
  124. default: () => {}
  125. },
  126. newTurnover: {
  127. type: Array,
  128. default: () => []
  129. },
  130. },
  131. watch: {
  132. list: {
  133. immediate: true,
  134. deep: true,
  135. handler(newVal) {
  136. this.newList = newVal
  137. }
  138. }
  139. },
  140. data() {
  141. return {
  142. recycleQuantity: '',
  143. newList: [],
  144. wordInfo: {
  145. workOrderCode: null,
  146. categoryCode: null,
  147. }
  148. }
  149. },
  150. methods: {
  151. quantInt(index, idx, it) {
  152. if (it.quantity >= 1) {
  153. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'workOrderCode', this.wordInfo.workOrderCode )
  154. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'categoryCode', this.wordInfo.categoryCode)
  155. } else {
  156. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'workOrderCode', '')
  157. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'categoryCode', '')
  158. this.$set(this.newTurnover[index].extInfo.positionList[idx], 'quantity', 0)
  159. }
  160. },
  161. handleCheck(index, idx, it) {
  162. if (it.quantity <= 0) {
  163. uni.showToast({
  164. icon: 'none',
  165. title: '数量为空不能勾选'
  166. })
  167. return false
  168. }
  169. let arr = this.newList[index].extInfo.positionList.filter(e => {
  170. return e.check && !e.isend
  171. })
  172. let flag = arr.every((i) => {
  173. return i.workOrderCode == it.workOrderCode && i.categoryCode == it.categoryCode
  174. })
  175. if (flag) {
  176. this.$set(this.newList[index].extInfo.positionList[idx], 'check', !it.check)
  177. if(it.check) {
  178. this.$set(this.newList[index].extInfo.positionList[idx], 'quantity', 0)
  179. }
  180. } else {
  181. uni.showToast({
  182. icon: 'none',
  183. title: '一次只能转移同一工单产品'
  184. })
  185. }
  186. },
  187. handleTrade(index) {
  188. let arr = this.newList[index].extInfo.positionList.filter(e => {
  189. return e.check
  190. })
  191. if(arr.length == 0) {
  192. uni.showToast({
  193. icon: 'none',
  194. title: '请先勾选需要转移的工单'
  195. })
  196. return false
  197. }
  198. arr.forEach(f => {
  199. f.isend = true
  200. })
  201. this.wordInfo.workOrderCode = arr[0].workOrderCode
  202. this.wordInfo.categoryCode = arr[0].categoryCode
  203. // 周转车
  204. this.scanData('w0300000004195005')
  205. return false
  206. let _this = this
  207. uni.scanCode({
  208. success: function(res) {
  209. _this.scanData(res.result)
  210. }
  211. })
  212. },
  213. scanData(result) {
  214. let _turnover = [...this.newList, ...this.newTurnover]
  215. let isFals = _turnover.some(m => m.code == result)
  216. if (isFals) {
  217. uni.showToast({
  218. title: '周转车已存在',
  219. icon: 'none'
  220. })
  221. return false
  222. }
  223. scanLedger(result).then(res => {
  224. this.newTurnover.push(res[0])
  225. console.log( this.newTurnover)
  226. })
  227. },
  228. getDelete(index) {
  229. this.newTurnover.splice(index, 1)
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="scss" scoped>
  235. .title_box {
  236. margin-top: 20rpx;
  237. .name {
  238. font-size: 28rpx;
  239. font-style: normal;
  240. font-weight: 400;
  241. color: $theme-color;
  242. padding-left: 20rpx;
  243. position: relative;
  244. &:before {
  245. position: absolute;
  246. content: '';
  247. left: 0rpx;
  248. top: 0rpx;
  249. bottom: 0rpx;
  250. width: 4rpx;
  251. height: 28rpx;
  252. background: $theme-color;
  253. margin: auto;
  254. }
  255. }
  256. .left {
  257. width: 40rpx;
  258. }
  259. .btn_box {
  260. padding: 0 18rpx;
  261. height: 60rpx;
  262. background: $theme-color;
  263. font-size: 26rpx;
  264. font-style: normal;
  265. font-weight: 400;
  266. font-size: 24rpx;
  267. color: #fff;
  268. border-radius: 4rpx;
  269. .scan {
  270. width: 34rpx;
  271. height: 34rpx;
  272. margin-right: 12rpx;
  273. }
  274. }
  275. }
  276. .content_table {
  277. margin-top: 8rpx;
  278. width: 100%;
  279. border: 2rpx solid $border-color;
  280. .item {
  281. display: flex;
  282. border-bottom: 2rpx solid $border-color;
  283. .lable {
  284. width: 132rpx;
  285. text-align: center;
  286. background-color: #F7F9FA;
  287. font-size: 26rpx;
  288. border-right: 2rpx solid $border-color;
  289. flex-shrink: 0;
  290. }
  291. .ww80 {
  292. width: 80rpx;
  293. }
  294. .ww50 {
  295. width: 50%;
  296. }
  297. .content {
  298. width: 518rpx;
  299. min-height: 64rpx;
  300. font-size: 28rpx;
  301. line-height: 28rpx;
  302. font-style: normal;
  303. font-weight: 400;
  304. padding: 2rpx 8rpx;
  305. box-sizing: border-box;
  306. word-wrap: break-word;
  307. flex-grow: 1 !important;
  308. font-size: 24rpx;
  309. }
  310. &:last-child {
  311. border-bottom: none;
  312. }
  313. }
  314. }
  315. .content_table2 {
  316. width: 100%;
  317. .row {
  318. width: 100%;
  319. .item {
  320. color: #404446;
  321. font-size: 28rpx;
  322. padding-left: 12rpx;
  323. }
  324. .color157 {
  325. color: $theme-color;
  326. }
  327. .ww20 {
  328. width: 20%;
  329. }
  330. .ww35 {
  331. width: 35%;
  332. }
  333. .ww15 {
  334. width: 15%;
  335. }
  336. .ww25 {
  337. width: 25%;
  338. }
  339. .ww30 {
  340. width: 30%;
  341. }
  342. .ww15 {
  343. width: 15%;
  344. }
  345. .ww10 {
  346. width: 10%;
  347. }
  348. }
  349. .head {
  350. height: 64rpx;
  351. background: #F7F9FA;
  352. border-top: 2rpx solid #E3E5E5;
  353. border-left: 2rpx solid #E3E5E5;
  354. .item {
  355. height: 64rpx;
  356. line-height: 64rpx;
  357. border-right: 2rpx solid #E3E5E5;
  358. box-sizing: border-box;
  359. }
  360. }
  361. .tr {
  362. border-top: 2rpx solid #E3E5E5;
  363. border-left: 2rpx solid #E3E5E5;
  364. .item {
  365. font-size: 24rpx;
  366. min-height: 64rpx;
  367. display: flex;
  368. align-items: center;
  369. border-right: 2rpx solid #E3E5E5;
  370. box-sizing: border-box;
  371. white-space: normal;
  372. word-break: break-all;
  373. }
  374. &:last-child {
  375. border-bottom: 2rpx solid #E3E5E5;
  376. }
  377. }
  378. }
  379. .content_num {
  380. display: flex;
  381. align-items: center;
  382. padding: 0 4rpx;
  383. /deep/ .uni-input-input {
  384. border: 2rpx solid #F0F8F2;
  385. background: #F0F8F2;
  386. color: $theme-color;
  387. }
  388. }
  389. .check {
  390. width: 40rpx;
  391. height: 40rpx;
  392. }
  393. .isend{
  394. text-decoration:line-through;
  395. }
  396. </style>