@@ -27,16 +27,16 @@
/ >
< / el-select >
< / el-form-item >
< el-form-item :label = "$t('stockManagement.cargoSpaceStockStatus')" prop = "cargoSpaceStockStatus" > <!-- 货位状态 -- >
< el-select v-model = "queryParams.cargoSpaceStockStatus" :placeholder="$t('stockManagement.cargoSpaceStockStatus')" clearable >
< el-option
v- for= "dict in dict.type.cargo_space_status"
: key= "dict.value"
: label= "dict.label"
: value= "dict.value"
/ >
< / el-select >
< / el-form-item >
<!-- < el-form-item :label = "$t('stockManagement.cargoSpaceStockStatus')" prop = "cargoSpaceStockStatus" > & lt ; ! & ndash ; 货位状态 & ndash ; & gt ; -- >
<!-- < el-select v-model = "queryParams.cargoSpaceStockStatus" :placeholder="$t('stockManagement.cargoSpaceStockStatus')" clearable > -- >
<!-- < el-option-- >
<!-- v - for= "dict in dict.type.cargo_space_status"-- >
<!-- : key= "dict.value"-- >
<!-- : label= "dict.label"-- >
<!-- : value= "dict.value"-- >
<!-- /> - - >
<!-- < / el-select > -- >
<!-- < / el-form-item > -- >
< el-form-item :label = "$t('stockManagement.productStatus')" prop = "productStatus" > <!-- 物料状态 -- >
< el-select v-model = "queryParams.productStatus" :placeholder="$t('stockManagement.selectProductStatus')" clearable >
< el-option
@@ -202,6 +202,26 @@
< el-button @click ="cancel" > {{ $ t ( ' stockManagement.cancel ' ) }} < ! - - 取消 - - > < / el-button >
< / div >
< / el-dialog >
<!-- 出口选择弹窗 -- >
< el-dialog :title = "$t('stockManagement.selectExitTitle')" :visible.sync = "exitDialogVisible" width = "400px" append -to -body >
< el-form ref = "exitForm" :model = "exitForm" :rules = "exitRules" label -width = " 80px " >
< el-form-item :label = "$t('stockManagement.selectExit')" prop = "exitId" >
< el-select v-model = "exitForm.exitId" :placeholder="$t('stockManagement.pleaseSelectExit')" clearable >
< el-option
v-for = "item in exitOptions"
:key = "item.exitId"
:label = "item.exitName"
:value = "item.exitId"
/ >
< / el-select >
< / el-form-item >
< / el-form >
< div slot = "footer" class = "dialog-footer" >
< el-button type = "primary" @click ="submitPointOut" > {{ $ t ( ' stockManagement.confirmExit ' ) }} < / el -button >
< el-button @click ="cancelExit" > {{ $ t ( ' stockManagement.cancelExit ' ) }} < / el -button >
< / div >
< / el-dialog >
< / div >
< / template >
@@ -239,6 +259,7 @@ export default {
pageNum : 1 ,
pageSize : 10 ,
stockId : null ,
cargoSpaceStockStatus : '2' ,
cargoSpaceId : null ,
stockStatus : null ,
productStatus : null ,
@@ -270,7 +291,41 @@ export default {
/*stockId: [
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
]*/
}
} ,
// 出口选择弹窗显示状态
exitDialogVisible : false ,
// 出口表单数据
exitForm : {
exitId : null
} ,
// 出口表单验证规则
exitRules : {
exitId : [
{ required : true , message : this . $t ( 'stockManagement.pleaseSelectExit' ) , trigger : 'change' }
]
} ,
// 出口选项
exitOptions : [ ] ,
// 所有出口数据( 按仓库ID分组)
allExitOptions : {
'02' : [
{ exitId : "G1004" , exitName : 'G1004' } ,
{ exitId : 'G1010' , exitName : 'G1010' } ,
{ exitId : 'fluent1' , exitName : 'fluent1' } ,
{ exitId : 'fluent2' , exitName : 'fluent2' } ,
] ,
'13' : [
{ exitId : 'G2001' , exitName : 'G2001' } ,
{ exitId : 'G3001' , exitName : 'G3001' } ,
{ exitId : 'G3010' , exitName : 'G3010' } ,
{ exitId : 'G4001' , exitName : 'G4001' } ,
{ exitId : 'G4010' , exitName : 'G4010' } ,
{ exitId : 'G5001' , exitName : 'G5001' } ,
{ exitId : 'G5010' , exitName : 'G5010' } ,
]
} ,
// 选中的库存数据
selectedStockData : [ ]
}
} ,
created ( ) {
@@ -396,23 +451,73 @@ export default {
this . $modal . msgError ( this . $t ( 'stockManagement.selectAtLeastOneRow' ) ) ; // 请至少选择一行数据
return ;
}
const stockIds = this . ids ;
// 这里调用API将stockIds数组传给后端
// 示例: pointOutApi(stockIds).then(response => {
// this.$modal.msgSuccess("出库成功");
// this.getList();
// });
console . log ( 'Selected stockIds:' , stockIds ) ;
this . $modal . confirm ( this . $t ( 'stockManagement.confirmPointOut' ) ) . then ( ( ) => {
// 实际API调用需要根据后端接口进行调整
pointOut ( stockIds ) . then ( response => {
this . $modal . msgSuccess ( response . msg ) ;
this . getList ( ) ;
} ) ;
// 获取选中的完整数据
const selectedData = this . managementList . filter ( item => this . ids . includes ( item . stockId ) ) ;
this . selectedStockData = selectedData ;
// this.$modal.msgSuccess(this.$t('stockManagement.pointOutSuccess')); // 出库成功
} ) . catch ( ( ) => { } ) ;
// 根据选中数据的仓库ID设置出口选项
this . setExitOptionsByWarehouse ( selectedData ) ;
// 显示出口选择弹窗
this . exitDialogVisible = true ;
this . exitForm . exitId = null ;
} ,
/** 根据仓库ID设置出口选项 */
setExitOptionsByWarehouse ( selectedData ) {
try {
// 获取选中数据的仓库ID集合, 过滤掉空值和无效值
const warehouseIds = [ ... new Set (
selectedData
. map ( row => row . warehouseId )
. filter ( id => id !== null && id !== undefined && id !== '' )
) ] ;
// 如果没有有效的仓库ID, 清空出口选项
if ( warehouseIds . length === 0 ) {
this . exitOptions = [ ]
return
}
if ( warehouseIds . length === 1 ) {
// 如果所有选中数据都是同一个仓库,显示该仓库的出口
const warehouseId = warehouseIds [ 0 ]
this . exitOptions = this . allExitOptions [ warehouseId ] || [ ]
}
// 如果最终没有可用的出口选项,给出默认选项
if ( this . exitOptions . length === 0 ) {
this . exitOptions = [ { exitId : '0' , exitName : '人工出口' } ]
}
} catch ( error ) {
console . error ( '设置出口选项时发生错误:' , error )
// 发生错误时,设置为空数组,确保不会影响用户操作
this . exitOptions = [ ]
}
} ,
/** 提交指定货位出库 */
submitPointOut ( ) {
this . $refs [ "exitForm" ] . validate ( valid => {
if ( valid ) {
const stockIds = this . ids ;
// 调用API将stockIds数组和出口信息传给后端
console . log ( "指定货位出库:" , stockIds , this . exitForm . exitId )
pointOut ( stockIds , this . exitForm . exitId ) . then ( response => {
this . $modal . msgSuccess ( response . msg ) ;
this . getList ( ) ;
this . exitDialogVisible = false ;
} ) ;
}
} )
} ,
/** 取消出口选择 */
cancelExit ( ) {
this . exitDialogVisible = false ;
this . exitForm . exitId = null ;
} ,
/** 导出按钮操作 */
handleExport ( ) {