|
@@ -4,12 +4,12 @@
|
|
|
<view class="name">周转车</view>
|
|
<view class="name">周转车</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
- <view v-for="(item, index) in newList" :key='index'>
|
|
|
|
|
|
|
+ <view class="turnover-item" v-for="(item, index) in newList" :key="item.id || item.instanceId || item.code || index">
|
|
|
<view class="title_box rx-bc" v-if='!isDetails'>
|
|
<view class="title_box rx-bc" v-if='!isDetails'>
|
|
|
<view class="left rx-ss" >
|
|
<view class="left rx-ss" >
|
|
|
<uni-icons @click="getDelete(index)" custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
|
|
<uni-icons @click="getDelete(index)" custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
|
|
|
|
|
|
|
|
- <view class="des" @click="handContract()">{{ isContract ? '收缩' : '展开'}}</view>
|
|
|
|
|
|
|
+ <view class="des" @click="handContract(index)">{{ isExpanded(index) ? '收缩' : '展开'}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
@@ -62,24 +62,24 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="table">
|
|
<view class="table">
|
|
|
- <u-list @scrolltolower="scrolltolower" class="z_list">
|
|
|
|
|
|
|
+ <view class="z_list">
|
|
|
<view v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
|
|
<view v-for="(it, idx) in item.extInfo.positionList" :key='idx'>
|
|
|
- <view class="tr row rx-sc" v-if=" isContract || ( it.workOrderCode != '' && it.workOrderCode != null)">
|
|
|
|
|
|
|
+ <view class="tr row rx-sc" v-if="shouldShowPosition(item, it, idx, index)">
|
|
|
<view class="item ww10">{{it.code}}</view>
|
|
<view class="item ww10">{{it.code}}</view>
|
|
|
- <view class="item ww35" :class="{'color157': it.workOrderCode === wordItem.code}">
|
|
|
|
|
- {{ it.workOrderCode }}
|
|
|
|
|
|
|
+ <view class="item ww35" :class="{'color157': getWorkOrderCode(item, it, idx) === wordItem.code}">
|
|
|
|
|
+ {{ getWorkOrderCode(item, it, idx) }}
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="item ww35" :class="{'color157': it.categoryCode === wordItem.productCode}">
|
|
|
|
|
- {{it.categoryCode}}
|
|
|
|
|
|
|
+ <view class="item ww35" :class="{'color157': getCategoryCode(item, it, idx) === wordItem.productCode}">
|
|
|
|
|
+ {{ getCategoryCode(item, it, idx) }}
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="item ww20 " :class="{'content_num' : (pattern == 'job') }" v-if='!isDetails'>
|
|
<view class="item ww20 " :class="{'content_num' : (pattern == 'job') }" v-if='!isDetails'>
|
|
|
<!-- // it.workOrderCode!==itemValue.code 就是工单编号和 周转车编号相同就可以修改 it.isOccupy===0 是-->
|
|
<!-- // it.workOrderCode!==itemValue.code 就是工单编号和 周转车编号相同就可以修改 it.isOccupy===0 是-->
|
|
|
|
|
|
|
|
- <input class="uni-input" v-if='it.isFull == 0' @input="quantInt(index, idx, it)"
|
|
|
|
|
- :class="{'content_num_box': it.categoryCode !== wordItem.productCode}"
|
|
|
|
|
|
|
+ <input class="uni-input" v-if="canEditQuantity(item, it, idx)" @input="quantInt(index, idx, it)"
|
|
|
|
|
+ :class="{'content_num_box': getCategoryCode(item, it, idx) !== wordItem.productCode}"
|
|
|
v-model="it.quantity" type="digit"
|
|
v-model="it.quantity" type="digit"
|
|
|
- :disabled="(!Object.prototype.hasOwnProperty.call(it, 'isOccupy') && it.isOccupy) || pattern != 'job' || isDisabled(it)"></input>
|
|
|
|
|
|
|
+ :disabled="pattern != 'job' || isDisabled(it)"></input>
|
|
|
<text v-else>{{it.quantity}}</text>
|
|
<text v-else>{{it.quantity}}</text>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
@@ -90,7 +90,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- </u-list>
|
|
|
|
|
|
|
+ </view>
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -152,20 +152,61 @@
|
|
|
|
|
|
|
|
totalCount: 0,
|
|
totalCount: 0,
|
|
|
|
|
|
|
|
- isContract: false
|
|
|
|
|
|
|
+ expandedIndexes: []
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ isExpanded(index) {
|
|
|
|
|
+ return this.expandedIndexes.includes(index)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ isAvailablePosition(it) {
|
|
|
|
|
+ return !it.workOrderCode && Number(it.isOccupy || 0) === 0 && Number(it.isFull || 0) !== 1
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ getDefaultPositionIndex(item) {
|
|
|
|
|
+ const positionList = item && item.extInfo && Array.isArray(item.extInfo.positionList)
|
|
|
|
|
+ ? item.extInfo.positionList
|
|
|
|
|
+ : []
|
|
|
|
|
+ return positionList.findIndex(it => this.isAvailablePosition(it))
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ hasCurrentWorkOrder(item) {
|
|
|
|
|
+ const positionList = item && item.extInfo && Array.isArray(item.extInfo.positionList)
|
|
|
|
|
+ ? item.extInfo.positionList
|
|
|
|
|
+ : []
|
|
|
|
|
+ return positionList.some(it => it.workOrderCode === this.wordItem.code)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ isDefaultPosition(item, it, idx) {
|
|
|
|
|
+ return !this.hasCurrentWorkOrder(item) && this.isAvailablePosition(it) && this.getDefaultPositionIndex(item) === idx
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ shouldShowPosition(item, it, idx, turnoverIndex) {
|
|
|
|
|
+ return this.isExpanded(turnoverIndex) || !!it.workOrderCode || this.isDefaultPosition(item, it, idx)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ getWorkOrderCode(item, it, idx) {
|
|
|
|
|
+ return it.workOrderCode || (this.isDefaultPosition(item, it, idx) ? this.wordItem.code : '')
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ getCategoryCode(item, it, idx) {
|
|
|
|
|
+ return it.categoryCode || (this.isDefaultPosition(item, it, idx) ? this.wordItem.productCode : '')
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ canEditQuantity(item, it, idx) {
|
|
|
|
|
+ return it.isFull == 0 || it.workOrderCode === this.wordItem.code || this.isDefaultPosition(item, it, idx)
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
//条件判断
|
|
//条件判断
|
|
|
isDisabled(it) {
|
|
isDisabled(it) {
|
|
|
if(it.workOrderCode === this.itemValue.code){
|
|
if(it.workOrderCode === this.itemValue.code){
|
|
|
return false
|
|
return false
|
|
|
}else{
|
|
}else{
|
|
|
- if(it.isOccupy){
|
|
|
|
|
|
|
+ if(Number(it.isOccupy || 0) !== 0){
|
|
|
return true
|
|
return true
|
|
|
}else{
|
|
}else{
|
|
|
return false
|
|
return false
|
|
@@ -179,8 +220,14 @@
|
|
|
if (it.quantity >= 1) {
|
|
if (it.quantity >= 1) {
|
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'workOrderCode', this.wordItem.code)
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'workOrderCode', this.wordItem.code)
|
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'categoryCode', this.wordItem.productCode)
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'categoryCode', this.wordItem.productCode)
|
|
|
- if(it.quantity > this.itemValue.product[0].feedQuantity) {
|
|
|
|
|
|
|
+ const maxQuantity = Number(this.itemValue.product && this.itemValue.product[0]
|
|
|
|
|
+ ? this.itemValue.product[0].feedQuantity
|
|
|
|
|
+ : 0)
|
|
|
|
|
+ const currentTotal = this.getCurrentTotal(index, idx)
|
|
|
|
|
+ if(maxQuantity > 0 && currentTotal > maxQuantity) {
|
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'quantity', 0)
|
|
this.$set(this.newList[index].extInfo.positionList[idx], 'quantity', 0)
|
|
|
|
|
+ this.$set(this.newList[index].extInfo.positionList[idx], 'workOrderCode', '')
|
|
|
|
|
+ this.$set(this.newList[index].extInfo.positionList[idx], 'categoryCode', '')
|
|
|
return uni.showToast({
|
|
return uni.showToast({
|
|
|
icon: 'none',
|
|
icon: 'none',
|
|
|
title: `超出投料数量`
|
|
title: `超出投料数量`
|
|
@@ -218,6 +265,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ getCurrentTotal(excludeTurnoverIndex, excludePositionIndex) {
|
|
|
|
|
+ return this.newList.reduce((total, turnover, turnoverIndex) => {
|
|
|
|
|
+ const positionList = turnover && turnover.extInfo && Array.isArray(turnover.extInfo.positionList)
|
|
|
|
|
+ ? turnover.extInfo.positionList
|
|
|
|
|
+ : []
|
|
|
|
|
+ return positionList.reduce((positionTotal, position, positionIndex) => {
|
|
|
|
|
+ if (turnoverIndex === excludeTurnoverIndex && positionIndex === excludePositionIndex) {
|
|
|
|
|
+ return positionTotal + Number(position.quantity || 0)
|
|
|
|
|
+ }
|
|
|
|
|
+ return position.workOrderCode === this.wordItem.code
|
|
|
|
|
+ ? positionTotal + Number(position.quantity || 0)
|
|
|
|
|
+ : positionTotal
|
|
|
|
|
+ }, total)
|
|
|
|
|
+ }, 0)
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
handleScan(index) {
|
|
handleScan(index) {
|
|
@@ -226,13 +289,19 @@
|
|
|
|
|
|
|
|
getDelete(index) {
|
|
getDelete(index) {
|
|
|
this.list.splice(index, 1)
|
|
this.list.splice(index, 1)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+ this.expandedIndexes = this.expandedIndexes
|
|
|
|
|
+ .filter(itemIndex => itemIndex !== index)
|
|
|
|
|
+ .map(itemIndex => itemIndex > index ? itemIndex - 1 : itemIndex)
|
|
|
},
|
|
},
|
|
|
scrolltolower() {},
|
|
scrolltolower() {},
|
|
|
|
|
|
|
|
- handContract() {
|
|
|
|
|
- this.isContract = !this.isContract
|
|
|
|
|
|
|
+ handContract(index) {
|
|
|
|
|
+ const expandedIndex = this.expandedIndexes.indexOf(index)
|
|
|
|
|
+ if (expandedIndex === -1) {
|
|
|
|
|
+ this.expandedIndexes.push(index)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.expandedIndexes.splice(expandedIndex, 1)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -450,6 +519,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
.z_list {
|
|
.z_list {
|
|
|
- max-height: 500rpx;
|
|
|
|
|
|
|
+ height: auto;
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|