opt:中鼎同步
This commit is contained in:
@@ -52,17 +52,17 @@
|
||||
物料:<strong>{{ currentDemand.skuCode }} {{ currentDemand.skuName }}</strong> |
|
||||
需求数量:<strong style="color:#E6A23C;">{{ currentDemand.qty }} {{ currentDemand.unit }}</strong>
|
||||
</div>
|
||||
<el-table ref="allocateTable" :data="inventoryList" size="small" border v-loading="inventoryLoading" @selection-change="handleInventorySelection">
|
||||
<el-table ref="allocateTable" v-loading="inventoryLoading" :data="inventoryList" size="small" border @selection-change="handleInventorySelection">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column prop="houseCode" label="仓库编号" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="houseName" label="仓库名称" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="skuCode" label="物料编码" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="qty" label="库存数量" width="110" />
|
||||
<el-table-column label="分配数量" width="160">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number v-model="scope.row.allocQty" :min="0" :max="scope.row.qty" :precision="4" size="mini" style="width:130px;" :disabled="!scope.row._selected" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="分配数量" width="160">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-input-number v-model="scope.row.allocQty" :min="0" :max="scope.row.qty" :precision="4" size="mini" style="width:130px;" :disabled="!scope.row._selected" />-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
|
||||
@@ -88,6 +88,8 @@
|
||||
<el-table-column prop="assignQty" label="已分配数量" width="100" />
|
||||
<el-table-column prop="unit" label="单位" width="80" />
|
||||
<el-table-column prop="targetArea" label="目标库存地点" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="targetHouseCode" label="目标库" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="carrierType" label="托盘类型" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="sn" label="车辆序列号" min-width="140" show-overflow-tooltip />
|
||||
<el-table-column prop="createAt" label="创建时间" min-width="160" show-overflow-tooltip />
|
||||
@@ -118,7 +120,7 @@ export default {
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(createDefaultForm()), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: '需求单', url: 'api/pmDemand', idField: 'id', sort: 'priority,desc', crudMethod: { ...crudDemand }, optShow: { add: true, reset: true } })
|
||||
return CRUD({ title: '需求单', url: 'api/pmDemand', idField: 'id', sort: 'priority,desc', crudMethod: { ...crudDemand }, optShow: { add: true, reset: true }})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -182,11 +184,12 @@ export default {
|
||||
this.allocateVisible = true
|
||||
this.inventoryLoading = true
|
||||
queryInventory(row.skuCode).then(res => {
|
||||
const demandQty = Number(row.qty) || 0
|
||||
// const demandQty = Number(row.qty) || 0
|
||||
this.inventoryList = (res || []).map(item => ({
|
||||
...item,
|
||||
_selected: false,
|
||||
allocQty: Math.min(Number(item.qty) || 0, demandQty)
|
||||
allocQty: row.qty
|
||||
// Math.min(Number(item.qty) || 0, demandQty)
|
||||
}))
|
||||
if (row.inventoryDis) {
|
||||
try {
|
||||
@@ -215,9 +218,32 @@ export default {
|
||||
this.selectedInventory = []
|
||||
},
|
||||
handleInventorySelection(selection) {
|
||||
this.selectedInventory = selection
|
||||
// 如果选中了多个,只保留最后一个
|
||||
if (selection.length > 1) {
|
||||
const lastSelected = selection[selection.length - 1]
|
||||
this.$refs.allocateTable.clearSelection()
|
||||
this.$refs.allocateTable.toggleRowSelection(lastSelected, true)
|
||||
// 更新选中的数据
|
||||
this.selectedInventory = [lastSelected]
|
||||
this.updateSelectedStatus(lastSelected)
|
||||
} else if (selection.length === 1) {
|
||||
// 单选
|
||||
this.selectedInventory = selection
|
||||
this.updateSelectedStatus(selection[0])
|
||||
} else {
|
||||
// 取消选中
|
||||
this.selectedInventory = []
|
||||
this.inventoryList.forEach(item => {
|
||||
item._selected = false
|
||||
})
|
||||
}
|
||||
},
|
||||
updateSelectedStatus(selectedRow) {
|
||||
this.inventoryList.forEach(item => {
|
||||
item._selected = selection.some(s => s.houseCode === item.houseCode)
|
||||
// 根据唯一标识判断是否选中(使用 houseCode + skuCode 或其他唯一组合)
|
||||
item._selected = selectedRow &&
|
||||
item.houseCode === selectedRow.houseCode &&
|
||||
item.skuCode === selectedRow.skuCode
|
||||
})
|
||||
},
|
||||
saveAllocate() {
|
||||
|
||||
Reference in New Issue
Block a user