| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- <template>
- <view class="content-box">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" :title="title" background-color="#F7F9FA"
- color="#000" @clickLeft="back"></uni-nav-bar>
- <view class="list_box">
- <u-list @scrolltolower="scrolltolower">
- <view class="card_box">
- <workOrderBom :item='objData' @handleScan='handleWordScan'></workOrderBom>
- <qualityTurnoverBom v-if='objData.turnover && objData.turnover.length != 0' :list='objData.turnover'
- :wordItem='objData' :newTurnover='objData.newTurnover' @refreshList='getList'>
- </qualityTurnoverBom>
- <view class="operate_box rx-sc">
- <u-button size="small" class="u-reset-button" type="success"
- @click="handAdd(objData.id)">手动添加</u-button>
- <u-button size="small" class="u-reset-button" type="success"
- @click="scanIt(objData.id)">扫一扫</u-button>
- </view>
- </view>
- </u-list>
- </view>
- </view>
- </template>
- <script>
- import workOrderBom from '../../feeding/components/workOrderBom.vue'
- import qualityTurnoverBom from '../components/qualityTurnoverBom.vue'
- import {
- getVehicle,
- scanLedger
- } from '@/api/pda/workOrder.js'
- export default {
- components: {
- workOrderBom,
- qualityTurnoverBom
- },
- data() {
- return {
- title: '',
- workOrderId: null,
- objData: {},
- taskId: null
- }
- },
- onShow() {
- uni.$off("setSelectList");
- uni.$on("setSelectList", (selectList, id) => {
- let turnover = []
- selectList.forEach(f => {
- if (f.rootCategoryLevelId == 7) { // 周转车
- f.extInfo.positionList.length && f.extInfo.positionList.forEach(o => {
- o['check'] = false
- o['isend'] = false
- })
- turnover = turnover.concat(f)
- }
- })
- this.$set(this.objData, 'turnover', turnover)
- this.$forceUpdate()
- });
- },
- 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 => {
- if (!res.hasOwnProperty('turnover')) {
- res['turnover'] = []
- }
- this.objData = res
- })
- },
- handleWordScan(id, type) {
- uni.showToast({
- icon: 'none',
- title: '不支持更换工单'
- })
- },
- scanIt(id) {
-
- // this.scanItData('w0300000002579001', id)
- // return false
- uni.scanCode({
- success: (res) => {
- this.scanItData(res.result, id)
- }
- })
- },
- scanItData(result, id) {
- scanLedger(result).then(res => {
- let _arr = []
- if (res.length == 1 && res[0].rootCategoryLevelId == 7) { // 设备
- this.objData.turnover = res
- this.$forceUpdate()
- }
- })
- },
- handAdd(id) {
- const storageKey = Date.now() + "";
- uni.setStorageSync(storageKey, this.objData);
- uni.navigateTo({
- url: `/pages/pda/workOrder/search/index?id=${id}&storageKey=${storageKey}&isType=job&taskId=${this.taskId}`
- })
- },
- },
- }
- </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>
|