|
|
|
@ -116,6 +116,7 @@ |
|
|
|
v-for="(detail, index) in detailList" |
|
|
|
:key="index" |
|
|
|
class="table-row" |
|
|
|
@click="handleRowDblClick(detail, index)" |
|
|
|
> |
|
|
|
<div class="col-position">{{ detail.position }}</div> |
|
|
|
<div class="col-layer">{{ detail.layer }}</div> |
|
|
|
@ -196,6 +197,71 @@ |
|
|
|
<button class="action-btn secondary" style="margin-left: 10px;" @click="closeScanModal">取消</button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 修改位置模态框 --> |
|
|
|
<el-dialog |
|
|
|
title="修改标签位置" |
|
|
|
:visible.sync="editPositionModalVisible" |
|
|
|
width="90%" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:show-close="false" |
|
|
|
:modal="true" |
|
|
|
:modal-append-to-body="true" |
|
|
|
:append-to-body="true" |
|
|
|
> |
|
|
|
<div class="edit-modal-content"> |
|
|
|
<!-- 标签号(只读) --> |
|
|
|
<div class="input-group"> |
|
|
|
<label class="input-label">标签号</label> |
|
|
|
<el-input |
|
|
|
v-model="editSerialNo" |
|
|
|
placeholder="标签号" |
|
|
|
class="form-input" |
|
|
|
readonly |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 位置选择 --> |
|
|
|
<div class="input-group"> |
|
|
|
<label class="input-label">位置</label> |
|
|
|
<el-select |
|
|
|
v-model="editPosition" |
|
|
|
placeholder="请选择位置" |
|
|
|
style="width: 100%;" |
|
|
|
@change="handleEditPositionChange" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="position in positionOptions" |
|
|
|
:key="position" |
|
|
|
:label="position" |
|
|
|
:value="position" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 层数选择 --> |
|
|
|
<div class="input-group"> |
|
|
|
<label class="input-label">层数</label> |
|
|
|
<el-select |
|
|
|
v-model="editLayer" |
|
|
|
placeholder="请选择层数" |
|
|
|
style="width: 100%;" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="layer in editLayerOptions" |
|
|
|
:key="layer" |
|
|
|
:label="`第${layer}层`" |
|
|
|
:value="layer" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<button class="action-btn primary" @click="confirmEditPosition">确定</button> |
|
|
|
<button class="action-btn secondary" style="margin-left: 10px;" @click="closeEditPositionModal">取消</button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -207,7 +273,9 @@ import { |
|
|
|
getLayersByPosition, |
|
|
|
validateLabel, |
|
|
|
savePalletDetail, |
|
|
|
deletePalletDetail |
|
|
|
deletePalletDetail, |
|
|
|
getLayersForEdit, |
|
|
|
updatePalletDetailPosition |
|
|
|
} from '../../../api/automatedWarehouse/palletPacking' |
|
|
|
|
|
|
|
export default { |
|
|
|
@ -234,6 +302,15 @@ export default { |
|
|
|
|
|
|
|
// 栈板明细 |
|
|
|
detailList: [], |
|
|
|
|
|
|
|
// 修改位置模态框 |
|
|
|
editPositionModalVisible: false, |
|
|
|
editSerialNo: '', |
|
|
|
editPosition: '', |
|
|
|
editLayer: '', |
|
|
|
editLayerOptions: [], |
|
|
|
editOriginalPosition: '', |
|
|
|
editOriginalLayer: '', |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
@ -326,7 +403,6 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭扫码模态框 |
|
|
|
closeScanModal() { |
|
|
|
this.scanModalVisible = false; |
|
|
|
@ -420,6 +496,95 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 双击行事件 - 修改位置 |
|
|
|
handleRowDblClick(detail, index) { |
|
|
|
|
|
|
|
this.editSerialNo = detail.serialNo; |
|
|
|
this.editPosition = detail.position; |
|
|
|
this.editLayer = detail.layer; |
|
|
|
this.editOriginalPosition = detail.position; |
|
|
|
this.editOriginalLayer = detail.layer; |
|
|
|
|
|
|
|
// 获取当前位置的层数选项(排除自己) |
|
|
|
this.handleEditPositionChange(); |
|
|
|
|
|
|
|
this.editPositionModalVisible = true; |
|
|
|
}, |
|
|
|
|
|
|
|
// 编辑位置选择变化 |
|
|
|
handleEditPositionChange() { |
|
|
|
if (this.editPosition) { |
|
|
|
getLayersForEdit({ |
|
|
|
site: this.site, |
|
|
|
palletId: this.palletCode, |
|
|
|
position: this.editPosition, |
|
|
|
excludeSerialNo: this.editSerialNo |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.editLayerOptions = data.layers || []; |
|
|
|
// 如果当前选择的层数不在新的选项中,清空选择 |
|
|
|
// if (!this.editLayerOptions.includes(this.editLayer)) { |
|
|
|
// this.editLayer = ''; |
|
|
|
// } |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('获取层数失败:', error); |
|
|
|
this.editLayerOptions = []; |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.editLayerOptions = []; |
|
|
|
this.editLayer = ''; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 确定修改位置 |
|
|
|
confirmEditPosition() { |
|
|
|
if (!this.editPosition) { |
|
|
|
this.$message.error('请选择位置'); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!this.editLayer) { |
|
|
|
this.$message.error('请选择层数'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有变化 |
|
|
|
if (this.editPosition === this.editOriginalPosition && this.editLayer === this.editOriginalLayer) { |
|
|
|
this.$message.warning('位置没有变化'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
updatePalletDetailPosition({ |
|
|
|
site: this.site, |
|
|
|
palletId: this.palletCode, |
|
|
|
serialNo: this.editSerialNo, |
|
|
|
newPosition: this.editPosition, |
|
|
|
newLayer: this.editLayer |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.$message.success('位置修改成功'); |
|
|
|
this.closeEditPositionModal(); |
|
|
|
this.refreshTable(); |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '位置修改失败'); |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.error('位置修改失败:', error); |
|
|
|
this.$message.error('位置修改失败'); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
// 关闭修改位置模态框 |
|
|
|
closeEditPositionModal() { |
|
|
|
this.editPositionModalVisible = false; |
|
|
|
this.editSerialNo = ''; |
|
|
|
this.editPosition = ''; |
|
|
|
this.editLayer = ''; |
|
|
|
this.editLayerOptions = []; |
|
|
|
this.editOriginalPosition = ''; |
|
|
|
this.editOriginalLayer = ''; |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.$nextTick(() => { |
|
|
|
|