添加 出库单据出口选择 盘点单据粗口选择功能
This commit is contained in:
@@ -50,6 +50,9 @@ export function getOutStockoutDetail(query) {
|
||||
if (params.newStatus) {
|
||||
searchParams.append('newStatus', params.newStatus);
|
||||
}
|
||||
if (params.exitId) {
|
||||
searchParams.append('exitId', params.exitId);
|
||||
}
|
||||
return request({
|
||||
url: '/out/outStockout/changeStatus?' + searchParams.toString(),
|
||||
method: 'get'
|
||||
|
||||
@@ -267,6 +267,11 @@ export default {
|
||||
inputProductName:'Please input product name',
|
||||
selectStartDate: 'Please input start date',
|
||||
selectFinishDate: 'Please input finish date',
|
||||
auditTitle:'auditTitle',
|
||||
selectExit:'selectExit',
|
||||
pleaseSelectExit:'pleaseSelectExit',
|
||||
confirmExit:'confirm',
|
||||
cancelExit:'cancel',
|
||||
|
||||
},
|
||||
// ***************新建出库单据**************
|
||||
|
||||
@@ -264,6 +264,12 @@ export default {
|
||||
inputProductName:'请输入物资名称',
|
||||
selectStartDate: '请选择创建开始时间',
|
||||
selectFinishDate: '请选择创建结束时间',
|
||||
auditTitle:'单据审核',
|
||||
selectExit:'出口',
|
||||
pleaseSelectExit:'请选择出口',
|
||||
confirmExit:'提交',
|
||||
cancelExit:'取消',
|
||||
|
||||
},
|
||||
productAndStock: {
|
||||
serialNumber: '序号',
|
||||
|
||||
@@ -250,6 +250,26 @@
|
||||
:limit.sync="queryDetailParams.pageSize"
|
||||
@pagination="getDetailList"
|
||||
/>
|
||||
|
||||
<!-- 审核弹窗 -->
|
||||
<el-dialog title="$t('outStockoutManage.auditTitle')" :visible.sync="auditDialogVisible" width="500px" append-to-body>
|
||||
<el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="100px">
|
||||
<el-form-item label="$t('outStockoutManage.selectExit')" prop="exitId">
|
||||
<el-select v-model="auditForm.exitId" placeholder="$t('outStockoutManage.pleaseSelectExit')" clearable style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in exitOptions"
|
||||
:key="item.exitId"
|
||||
:label="item.exitName"
|
||||
:value="item.exitId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelAudit">{{$t('outStockoutManage.confirmExit')}}</el-button>
|
||||
<el-button type="primary" @click="submitAudit">{{$t('outStockoutManage.cancelExit')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -293,6 +313,40 @@ export default {
|
||||
stockCheckDetailList: [],
|
||||
// 选中数据
|
||||
selectedRows: [],
|
||||
// 审核弹窗显示状态
|
||||
auditDialogVisible: false,
|
||||
// 审核表单数据
|
||||
auditForm: {
|
||||
exitId: null
|
||||
},
|
||||
// 审核表单验证规则
|
||||
auditRules: {
|
||||
exitId: [
|
||||
{ required: true, message: '请选择出口', 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' },
|
||||
]
|
||||
},
|
||||
// 当前审核的单据
|
||||
currentAuditStock: null,
|
||||
// 明细查询参数
|
||||
queryDetailParams: {
|
||||
pageNum: 1,
|
||||
@@ -305,7 +359,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
stockCheckId: null,
|
||||
checkType: '1',
|
||||
checkType: null,
|
||||
createDate: null,
|
||||
createManId: null,
|
||||
status: '1',
|
||||
@@ -486,14 +540,13 @@ export default {
|
||||
return
|
||||
}
|
||||
if (stockCheck.status === "1") {
|
||||
let data = {
|
||||
"stockGuid": stockCheck.stockGuid,
|
||||
"status": "2"
|
||||
}
|
||||
updateStockCheck(data).then(response => {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.reviewSuccess'))
|
||||
this.getList()
|
||||
})
|
||||
// 保存当前审核的单据
|
||||
this.currentAuditStock = stockCheck
|
||||
// 根据单据的仓库ID设置出口选项
|
||||
this.setExitOptionsByWarehouse(stockCheck.warehouseId)
|
||||
// 显示审核弹窗
|
||||
this.auditDialogVisible = true
|
||||
this.auditForm.exitId = null
|
||||
} else {
|
||||
this.$modal.msgError(this.$t('checkStockCheck.onlyUnreviewedCanReview'))
|
||||
}
|
||||
@@ -527,6 +580,68 @@ export default {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.autoAllocationSuccess'))
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
|
||||
/** 根据仓库ID设置出口选项 */
|
||||
setExitOptionsByWarehouse(warehouseId) {
|
||||
try {
|
||||
console.log('设置出口选项,仓库ID:', warehouseId)
|
||||
|
||||
// 如果没有有效的仓库ID,清空出口选项
|
||||
if (!warehouseId) {
|
||||
this.exitOptions = []
|
||||
console.warn('没有找到有效的仓库ID,已清空出口选项')
|
||||
return
|
||||
}
|
||||
|
||||
// 根据仓库ID获取对应的出口选项
|
||||
this.exitOptions = this.allExitOptions[warehouseId] || []
|
||||
|
||||
// 如果没有对应key的默认为空数组,并给出提示
|
||||
if (!this.allExitOptions[warehouseId]) {
|
||||
console.warn(`仓库ID ${warehouseId} 没有配置出口选项,已设置为空数组`)
|
||||
}
|
||||
|
||||
console.log('可用出口:', this.exitOptions)
|
||||
|
||||
// 如果最终没有可用的出口选项,给出提示
|
||||
if (this.exitOptions.length === 0) {
|
||||
//console.warn('当前仓库没有可用的出口选项')
|
||||
this.exitOptions=[{exitId: '0', exitName: '人工出口'}]
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('设置出口选项时发生错误:', error)
|
||||
// 发生错误时,设置为空数组,确保不会影响用户操作
|
||||
this.exitOptions = []
|
||||
}
|
||||
},
|
||||
|
||||
/** 提交审核 */
|
||||
submitAudit() {
|
||||
this.$refs["auditForm"].validate(valid => {
|
||||
if (valid) {
|
||||
const data = {
|
||||
"stockGuid": this.currentAuditStock.stockGuid,
|
||||
"status": "2",
|
||||
"spare1": this.auditForm.exitId // 将选择的出口数据放入spare1字段
|
||||
}
|
||||
console.log('审核数据(含出口信息):', data)
|
||||
|
||||
updateStockCheck(data).then(response => {
|
||||
this.$modal.msgSuccess(this.$t('checkStockCheck.reviewSuccess'))
|
||||
this.auditDialogVisible = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 取消审核 */
|
||||
cancelAudit() {
|
||||
this.auditDialogVisible = false
|
||||
this.auditForm.exitId = null
|
||||
this.currentAuditStock = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,26 @@
|
||||
:limit.sync="detailQueryParams.pageSize"
|
||||
@pagination="getDetailList"
|
||||
/>
|
||||
|
||||
<!-- 审核弹窗 -->
|
||||
<el-dialog :title="$t('outStockoutManage.auditTitle')" :visible.sync="auditDialogVisible" width="400px" append-to-body>
|
||||
<el-form ref="auditForm" :model="auditForm" :rules="auditRules" label-width="80px">
|
||||
<el-form-item :label="$t('outStockoutManage.selectExit')" prop="exitId">
|
||||
<el-select v-model="auditForm.exitId" :placeholder="$t('outStockoutManage.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="submitAudit">{{$t('outStockoutManage.confirmExit')}}</el-button>
|
||||
<el-button @click="cancelAudit">{{$t('outStockoutManage.cancelExit')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -222,6 +242,40 @@ export default {
|
||||
outStockDetailList: [],
|
||||
// 选中数据
|
||||
selectedRows: [],
|
||||
// 审核弹窗显示状态
|
||||
auditDialogVisible: false,
|
||||
// 审核表单数据
|
||||
auditForm: {
|
||||
exitId: null
|
||||
},
|
||||
// 审核表单验证规则
|
||||
auditRules: {
|
||||
exitId: [
|
||||
{ required: true, message: '请选择出口', 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' },
|
||||
]
|
||||
},
|
||||
// 当前审核状态
|
||||
currentAuditStatus: null,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -320,6 +374,17 @@ export default {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是审核操作(status=2),显示弹窗选择出口
|
||||
if (status === 2) {
|
||||
this.currentAuditStatus = status
|
||||
// 根据选中单据的仓库ID设置出口选项
|
||||
this.setExitOptionsByWarehouse()
|
||||
this.auditDialogVisible = true
|
||||
this.auditForm.exitId = null
|
||||
return
|
||||
}
|
||||
|
||||
const params = {
|
||||
stockoutIds: this.selectedRows.map(row => row.stockoutId),
|
||||
status: this.selectedRows[0].status,
|
||||
@@ -367,6 +432,79 @@ export default {
|
||||
const stockoutIds = this.selectedRows.map(row => row.stockoutId)
|
||||
// TODO: 调用手动分配接口
|
||||
console.log("手动分配:", stockoutIds)
|
||||
},
|
||||
|
||||
/** 提交审核 */
|
||||
submitAudit() {
|
||||
this.$refs["auditForm"].validate(valid => {
|
||||
if (valid) {
|
||||
const params = {
|
||||
stockoutIds: this.selectedRows.map(row => row.stockoutId),
|
||||
status: this.selectedRows[0].status,
|
||||
newStatus: this.currentAuditStatus,
|
||||
exitId: this.auditForm.exitId
|
||||
}
|
||||
console.log("单据状态修改(含出口信息):", params)
|
||||
|
||||
//调用单据状态改变接口
|
||||
updateOutStockStatus(params).then(response => {
|
||||
this.$modal.msgSuccess(response)
|
||||
this.auditDialogVisible = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/** 取消审核 */
|
||||
cancelAudit() {
|
||||
this.auditDialogVisible = false
|
||||
this.auditForm.exitId = null
|
||||
this.currentAuditStatus = null
|
||||
},
|
||||
|
||||
/** 根据仓库ID设置出口选项 */
|
||||
setExitOptionsByWarehouse() {
|
||||
try {
|
||||
// 获取选中单据的仓库ID集合,过滤掉空值和无效值
|
||||
const warehouseIds = [...new Set(
|
||||
this.selectedRows
|
||||
.map(row => row.warehouseId)
|
||||
.filter(id => id !== null && id !== undefined && id !== '')
|
||||
)]
|
||||
|
||||
console.log("仓库ID集合:", warehouseIds)
|
||||
|
||||
// 如果没有有效的仓库ID,清空出口选项
|
||||
if (warehouseIds.length === 0) {
|
||||
this.exitOptions = []
|
||||
console.warn('没有找到有效的仓库ID,已清空出口选项')
|
||||
return
|
||||
}
|
||||
|
||||
if (warehouseIds.length === 1) {
|
||||
// 如果所有选中单据都是同一个仓库,显示该仓库的出口
|
||||
const warehouseId = warehouseIds[0]
|
||||
this.exitOptions = this.allExitOptions[warehouseId] || []
|
||||
|
||||
// 如果没有对应key的默认为空数组,并给出提示
|
||||
if (!this.allExitOptions[warehouseId]) {
|
||||
console.warn(`仓库ID ${warehouseId} 没有配置出口选项,已设置为空数组`)
|
||||
}
|
||||
}
|
||||
|
||||
console.log('选中仓库ID:', warehouseIds, '可用出口:', this.exitOptions)
|
||||
|
||||
// 如果最终没有可用的出口选项,给出提示
|
||||
if (this.exitOptions.length === 0) {
|
||||
this.exitOptions=[{exitId: '0', exitName: '人工出口'}]
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('设置出口选项时发生错误:', error)
|
||||
// 发生错误时,设置为空数组,确保不会影响用户操作
|
||||
this.exitOptions = []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user