feat(wms): 优化收货功能并重构导入组件

重构收货功能界面,将"确认收货"改为"签收",并调整按钮样式。新增收货弹窗功能,支持选择实际库区和填写备注。

重构导入组件,优化校验逻辑和错误处理,增加防呆机制和loading状态。将枚举和常量提取为模块级变量,提升代码可维护性。添加仓库映射关系,增强数据校验能力。

调整表格按钮的内边距,提升UI一致性
This commit is contained in:
砂糖
2025-12-02 13:56:21 +08:00
parent 40383a73b9
commit 51caea9e41
4 changed files with 538 additions and 292 deletions

View File

@@ -81,6 +81,11 @@
<el-tag v-else type="primary">未收货</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button v-if="scope.row.actionStatus == 0 || scope.row.actionStatus == 1" type="primary" @click="openReceiptModal(scope.row)">签收</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit"
@@ -99,23 +104,51 @@
<!-- 先做导入功能通过一个钢卷的excel文件导入, 全屏弹窗 -->
<el-dialog title="导入收货计划" :visible.sync="importDialogVisible" width="80%" >
<ImportGuide />
<el-dialog v-if="selectedPlan" title="导入收货计划" :visible.sync="importDialogVisible" width="80%" >
<ImportGuide :planId="selectedPlan.planId" />
</el-dialog>
<el-dialog title="确认收货" v-loading="loading" :visible.sync="receiptModalVisible" width="30%">
<el-form :model="coilInfo" ref="receiptFormRef" label-width="120px">
<el-form-item label="钢卷号" prop="currentCoilNo">
<el-input v-model="coilInfo.currentCoilNo" disabled placeholder="请输入钢卷号" />
</el-form-item>
<el-form-item label="净重" prop="netWeight">
<el-input v-model="coilInfo.netWeight" disabled placeholder="请输入净重" />
</el-form-item>
<el-form-item label="毛重" prop="grossWeight">
<el-input v-model="coilInfo.grossWeight" disabled placeholder="请输入毛重" />
</el-form-item>
<el-form-item label="实际库区" prop="actualWarehouseId">
<ActualWarehouseSelect v-model="coilInfo.actualWarehouseId" placeholder="请选择实际库区" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="coilInfo.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<template slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmReceipt" v-loading="buttonLoading">签收</el-button>
<el-button @click="receiptModalVisible = false">取消</el-button>
</template>
</el-dialog>
</div>
</template>
<script>
import { listDeliveryPlan } from "@/api/wms/deliveryPlan"; // 导入收货计划API
import { listPendingAction } from '@/api/wms/pendingAction';
import { updateMaterialCoilSimple, getMaterialCoil } from '@/api/wms/coil'
import { listPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
import { listDeliveryPlan } from '@/api/wms/deliveryPlan'
import MemoInput from "@/components/MemoInput";
import ImportGuide from "@/views/wms/receive/components/ImportGuide.vue";
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
export default {
name: "DeliveryWaybill",
components: {
MemoInput,
ImportGuide
ImportGuide,
ActualWarehouseSelect
},
data() {
return {
@@ -184,6 +217,16 @@ export default {
// 导入弹窗
importDialogVisible: false,
// 确认收货表单参数
receiptModalVisible: false,
receiptForm: {
currentCoilNo: null,
netWeight: null,
grossWeight: null,
actualWarehouseId: null,
remark: null,
},
coilInfo: {},
};
},
created() {
@@ -346,6 +389,46 @@ export default {
...this.queryParams
}, `deliveryWaybill_${new Date().getTime()}.xlsx`)
},
// 打开收货弹窗
openReceiptModal(row) {
this.loading = true
// 打开确认收货弹窗
this.receiptModalVisible = true;
this.receiptForm = row;
// 根据钢卷id查询钢卷信息
getMaterialCoil(row.coilId).then(res => {
this.coilInfo = res.data;
this.loading = false
})
},
// 确认收货
confirmReceipt() {
// 二次确认
this.$modal.confirm("收货后刚钢卷会进入库存并占用所选的实际库区,是否继续?").then(() => {
this.buttonLoading = true;
// 更新操作记录状态 actionStatus: 2
updatePendingAction({
...this.receiptForm,
actionStatus: 2,
}).then(_ => {
this.$message.success("确认收货成功");
this.getList()
}).finally(() => {
this.buttonLoading = false;
});
// 更新钢卷状态为当前钢卷; dataType: 1
updateMaterialCoilSimple({
...this.coilInfo,
dataType: 1,
})
})
},
// 取消操作
cancel() {
this.form = {};
this.$refs.form.resetFields();
this.buttonLoading = false;
}
}
};
</script>