turnoverBom.vue 9.4 KB

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