- 物料编码:
{{ currentReturn.sku_code }} |
+
+
+ 物料编码:{{ currentReturn.skuCode }} |
+ 物料名称:{{ currentReturn.skuName }} |
需求数量:{{ currentReturn.qty }} {{ currentReturn.unit }}
-
-
-
-
-
+
+
+
+
+
+
+
@@ -178,6 +205,7 @@ import udOperation from '@crud/UD.operation.vue'
import pagination from '@crud/Pagination.vue'
import QRCode from 'qrcode'
import { allocate, upload } from '@/views/wms/pm_manage/pmReturn/pmReturn'
+import { getStor } from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
const createDefaultForm = () => ({
id: '',
@@ -217,12 +245,14 @@ export default {
data() {
return {
viewShow: false,
- inventoryLoading: false,
+ allocateVisible: false,
+ allocateSaving: false,
+ storList: [],
+ storLoading: false,
+ selectedHouseCode: '',
currentRow: {},
currentReturn: {},
multipleSelection: [],
- selectedInventory: '',
- allocateSaving: false,
actionDisabled: true,
printPreviewVisible: false,
permission: {
@@ -237,13 +267,6 @@ export default {
{ value: 20, label: '执行' },
{ value: 80, label: '完成' }
],
- inventoryList: [
- { value: 'R001', label: '中鼎立库' },
- { value: 'R002', label: '装配车间平库' },
- { value: 'R003', label: '装配车间大件库' },
- { value: 'R005', label: '库改车原材料库' },
- { value: 'H005', label: '结构件仓库' },
- ],
deliveryMethodOptions: [
{ value: 1, label: '人工' },
{ value: 2, label: 'AGV' }
@@ -266,6 +289,9 @@ export default {
}
}
},
+ created() {
+ this.loadStorList()
+ },
methods: {
[CRUD.HOOK.beforeRefresh]() {
if (this.query.dateRange) {
@@ -325,45 +351,53 @@ export default {
this.currentRow = { ...row }
this.viewShow = true
},
- openAllocateDialog(row) {
- this.inventoryLoading = true
- this.currentReturn = row
- this.allocateSaving = false
- },
- closeAllocateDialog() {
- this.inventoryLoading = false
- this.currentReturn = {}
- this.selectedInventory = ''
- this.allocateSaving = false
- },
- handleInventorySelection(selection) {
- // 如果选中了多个,只保留最后一个
- if (selection.length > 1) {
- this.selectedInventory = ''
- this.allocateSaving = false
- } else if (selection.length === 1) {
- this.selectedInventory = selection[0].value
- this.allocateSaving = true
- } else {
- this.selectedInventory = ''
- this.allocateSaving = false
- }
- },
- saveAllocate() {
- if (!this.selectedInventory) {
- this.$message.warning('请至少勾选一条库存记录')
+ loadStorList() {
+ if (this.storList.length || this.storLoading) {
return
}
- this.currentReturn.targetHouseCode = this.selectedInventory
- allocate(this.currentReturn).then(res => {
- if (res.code == 400) {
- this.$message.warning('分配失败' + res.message)
+ this.storLoading = true
+ getStor().then(res => {
+ this.storList = (res && res.data) || []
+ }).catch(() => {
+ this.storList = []
+ }).finally(() => {
+ this.storLoading = false
+ })
+ },
+ openAllocateDialog(row) {
+ this.currentReturn = { ...row }
+ // 已分配过的单据回显当前目标仓库,方便只做修改
+ this.selectedHouseCode = row.targetHouseCode || ''
+ this.allocateVisible = true
+ this.loadStorList()
+ },
+ closeAllocateDialog() {
+ this.allocateVisible = false
+ this.currentReturn = {}
+ this.selectedHouseCode = ''
+ this.allocateSaving = false
+ },
+ saveAllocate() {
+ if (!this.selectedHouseCode) {
+ this.$message.warning('请选择目标仓库')
+ return
+ }
+ if (this.allocateSaving) {
+ return
+ }
+ this.allocateSaving = true
+ allocate({ ...this.currentReturn, targetHouseCode: this.selectedHouseCode }).then(res => {
+ if (res && res.code === 400) {
+ this.$message.warning('分配失败:' + res.message)
return
}
this.$message.success('分配成功')
- this.crud.toQuery()
- }).finally(() => {
this.closeAllocateDialog()
+ this.crud.toQuery()
+ }).catch(() => {
+ // 失败提示已由请求拦截器统一处理,保留弹窗便于重新选择仓库
+ }).finally(() => {
+ this.allocateSaving = false
})
},
handleBatchPush() {
@@ -382,7 +416,7 @@ export default {
type: 'warning'
}).then(() => {
upload(this.multipleSelection[0]).then(res => {
- if (res.code == 400) {
+ if (res && res.code === 400) {
this.$message.warning('分配失败' + res.message)
return
}
@@ -409,7 +443,7 @@ export default {
type: 'warning'
}).then(() => {
upload(this.multipleSelection[0]).then(res => {
- if (res.code == 400) {
+ if (res && res.code === 400) {
this.$message.warning('分配失败' + res.message)
return
}