| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <template>
- <view class="content-box">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
- color="#000" @clickLeft="back" right-icon="scan" @clickRight="HandlScanCode"></uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view v-for="(item,index) in List" :key="index" class="card_box">
- <workOrderBom :item='item' @handleScan='handleWordScan'></workOrderBom>
- <turnoverBom v-if='item.turnover.length != 0' :list='item.turnover' :wordItem='item'
- :newTurnover='item.newTurnover' @handleScan='handleScan' @refreshList='getList'></turnoverBom>
- </view>
- </u-list>
- </view>
- </view>
- </template>
- <script>
- import workOrderBom from '../../feeding/components/workOrderBom.vue'
- import turnoverBom from '../components/turnoverBom.vue'
- import {
- getVehicle,
- scanLedger
- } from '@/api/pda/workOrder.js'
- export default {
- components: {
- workOrderBom,
- turnoverBom
- },
- data() {
- return {
- title: '',
- workOrderId: null,
- List: [],
- taskId: null,
- }
- },
- onLoad(options) {
- this.title = options.taskName ? options.taskName + '-更换周转车' : '更换周转车'
- this.workOrderId = options.workOrderId;
- this.taskId = options.taskId
- this.taskName = options.taskName
- this.getList()
- },
- methods: {
- scrolltolower() {},
- getList() {
- getVehicle({
- workOrderId: this.workOrderId,
- taskId: this.taskId
- }).then(res => {
- this.List = []
- if (res.turnover && res.turnover.length) {
- res.newTurnover = []
- res.turnover.forEach(e => {
- e.extInfo.positionList.length && e.extInfo.positionList.forEach(o => {
- o['check'] = false
- o['isend'] = false
- o['newQuantity'] = o.quantity
- })
- })
- }
- this.List.push(res)
- })
- },
- handleWordScan(id, type) {
- uni.showToast({
- icon: 'none',
- title: '不支持更换工单'
- })
- },
- handleScan(id, type) {
- uni.scanCode({
- success: (res) => {
- this.scanData(res.result, type, id)
- }
- })
- },
- // 相机扫码
- HandlScanCode() {
- uni.scanCode({
- success: (res) => {
- this.scanItAllData(res.result)
- }
- })
- },
- scanItAllData(result) {
- scanLedger(result).then(res => {
- if (res[0].rootCategoryLevelId == 7) { // 周转车
- // let isFals = this.List[0].turnover.some(m => m.code == result)
- // if (isFals) {
- // uni.showToast({
- // title: '周转车已存在',
- // icon: 'none'
- // })
- // return false
- // }
- this.List[0].turnover = []
- let _List = JSON.parse(JSON.stringify(this.List))
- _List[0]['newTurnover'] = []
- res[0].isOld = 1
- res[0].extInfo.positionList.length && res[0].extInfo.positionList.forEach(o => {
- o['check'] = false
- o['isend'] = false
- o['newQuantity'] = o.quantity
- })
- _List[0].turnover = res
- this.List = _List
- console.log(this.List)
- this.$forceUpdate()
- }
- })
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- .content-box {
- height: 100vh;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- }
- .list_box {
- flex: 1;
- overflow: hidden;
- padding: 4rpx 0;
- .u-list {
- height: 100% !important;
- }
- .card_box {
- padding: 16rpx;
- }
- }
- .operate_box {
- padding: 10rpx 160rpx;
- /deep/ .u-button {
- width: 160rpx;
- }
- }
- </style>
|