Commit 93e86700 authored by 刘帅's avatar 刘帅

1.结算付款确认增加数据权限校验

2.物料入库,选择物料优化
parent 263041c0
...@@ -60,6 +60,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS ...@@ -60,6 +60,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
private final YinLianPayApi yinLianPayApi; private final YinLianPayApi yinLianPayApi;
private final SysDeptMapper sysDeptMapper; private final SysDeptMapper sysDeptMapper;
private final ISysPayLogService sysPayLogService; private final ISysPayLogService sysPayLogService;
private final SysDeptMapper deptMapper;
@Value("${pay.merchantCode}") @Value("${pay.merchantCode}")
private String merchantCode; private String merchantCode;
...@@ -91,6 +92,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS ...@@ -91,6 +92,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
} }
private LambdaQueryWrapper<ErpSettlementMaintain> buildQueryWrapper(ErpSettlementMaintainBo bo) { private LambdaQueryWrapper<ErpSettlementMaintain> buildQueryWrapper(ErpSettlementMaintainBo bo) {
List<SysDept> sysDeptList = deptMapper.selectChildrenDeptById(LoginHelper.getDeptId(), null);
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ErpSettlementMaintain> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<ErpSettlementMaintain> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getSettlementNumber()), ErpSettlementMaintain::getSettlementNumber, bo.getSettlementNumber()); lqw.like(StringUtils.isNotBlank(bo.getSettlementNumber()), ErpSettlementMaintain::getSettlementNumber, bo.getSettlementNumber());
...@@ -101,7 +103,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS ...@@ -101,7 +103,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
lqw.eq(bo.getClientCertificateType() != null, ErpSettlementMaintain::getClientCertificateType, bo.getClientCertificateType()); lqw.eq(bo.getClientCertificateType() != null, ErpSettlementMaintain::getClientCertificateType, bo.getClientCertificateType());
lqw.eq(StringUtils.isNotBlank(bo.getClientCertificateNumber()), ErpSettlementMaintain::getClientCertificateNumber, bo.getClientCertificateNumber()); lqw.eq(StringUtils.isNotBlank(bo.getClientCertificateNumber()), ErpSettlementMaintain::getClientCertificateNumber, bo.getClientCertificateNumber());
lqw.eq(bo.getState() != null, ErpSettlementMaintain::getState, bo.getState()); lqw.eq(bo.getState() != null, ErpSettlementMaintain::getState, bo.getState());
lqw.eq(bo.getCreateDeptId() != null, ErpSettlementMaintain::getCreateDeptId, bo.getCreateDeptId()); lqw.in(ErpSettlementMaintain::getCreateDeptId, sysDeptList.stream().map(SysDept::getDeptId).collect(Collectors.toList()));
lqw.orderByDesc(ErpSettlementMaintain::getCreateTime); lqw.orderByDesc(ErpSettlementMaintain::getCreateTime);
return lqw; return lqw;
} }
......
...@@ -325,8 +325,8 @@ ...@@ -325,8 +325,8 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange"> <el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" row-key="id" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />--> <!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />--> <!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" width="120px" show-overflow-tooltip /> <el-table-column label="供应商" align="center" prop="vendorName" width="120px" show-overflow-tooltip />
...@@ -431,6 +431,7 @@ export default { ...@@ -431,6 +431,7 @@ export default {
total: 0, total: 0,
// 物料入库表格数据 // 物料入库表格数据
materialPutawayList: [], materialPutawayList: [],
selectedMaterialMap: new Map(),
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
...@@ -528,23 +529,6 @@ export default { ...@@ -528,23 +529,6 @@ export default {
vendorChange(id, item) { vendorChange(id, item) {
let vendor = this.materialVendorList.find(v => v.id === id); let vendor = this.materialVendorList.find(v => v.id === id);
item.vendorName = vendor.vendorName; item.vendorName = vendor.vendorName;
},
/**
* 物资类型弃用
*/
getTreeTree(){
typeTree().then(response => {
this.typeOptions = response.data
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
}, },
/** 查询仓库列表 */ /** 查询仓库列表 */
getWarehouseList() { getWarehouseList() {
...@@ -561,18 +545,22 @@ export default { ...@@ -561,18 +545,22 @@ export default {
/** 打开物料列表 */ /** 打开物料列表 */
openMaterialModel() { openMaterialModel() {
this.open1 = true this.open1 = true
// 打开对话框时初始化已选数据
this.initializeSelectedMaterials()
this.getMaterialList() this.getMaterialList()
}, },
/** 搜索按钮操作 */ /** 初始化已选物料数据 */
handleMaterialQuery() { initializeSelectedMaterials() {
this.queryMaterialParams.pageNum = 1; // 将当前入库明细列表中的物料添加到已选Map中
this.getMaterialList(); this.selectedMaterialMap.clear()
}, this.form.putawayInfoList.forEach(item => {
/** 重置按钮操作 */ const materialId = item.materialId || item.id
resetMaterialQuery() { if (materialId) {
this.resetForm("queryMaterialForm"); this.selectedMaterialMap.set(materialId, item)
this.handleMaterialQuery(); }
})
}, },
/** 查询物资列表 */ /** 查询物资列表 */
getMaterialList() { getMaterialList() {
this.materialLoading = true; this.materialLoading = true;
...@@ -580,41 +568,102 @@ export default { ...@@ -580,41 +568,102 @@ export default {
this.materialList = response.rows; this.materialList = response.rows;
this.materialTotal = response.total; this.materialTotal = response.total;
this.materialLoading = false; this.materialLoading = false;
}).then(() =>{ }).then(() => {
this.$nextTick(() => { this.$nextTick(() => {
// 清空临时勾选 // 清空临时勾选
this.tempSelection = []; this.tempSelection = [];
// 手动设置勾选(匹配外部已选数据) // 恢复选择状态
this.materialList.forEach(row => { this.restoreMaterialSelection();
const isSelected = this.form.putawayInfoList.some(item => item.id === row.id || item.materialId === row.id);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
}); });
}) })
}, },
/** 恢复物料选择状态 */
restoreMaterialSelection() {
if (this.$refs.selectionTable) {
this.materialList.forEach(row => {
const isSelected = this.selectedMaterialMap.has(row.id);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
}
},
// 多选框选中数据 // 多选框选中数据
handleMaterialSelectionChange(selection) { handleMaterialSelectionChange(selection) {
this.tempSelection = selection this.tempSelection = selection;
// 更新已选数据的Map
const currentPageIds = new Set(this.materialList.map(row => row.id));
// 移除当前页中取消选择的行
for (let id of this.selectedMaterialMap.keys()) {
if (currentPageIds.has(id) && !selection.some(row => row.id === id)) {
this.selectedMaterialMap.delete(id);
}
}
// 添加当前页中新选择的行
selection.forEach(row => {
// 如果物料已经在入库明细中,保留原有数据
if (this.selectedMaterialMap.has(row.id)) {
const existingItem = this.selectedMaterialMap.get(row.id);
// 保留入库数量、单价等编辑过的数据
this.selectedMaterialMap.set(row.id, {
...row,
putawayNumber: existingItem.putawayNumber || 0,
putawayPrice: existingItem.putawayPrice || 0,
putawayMoney: existingItem.putawayMoney || 0,
vendorId: existingItem.vendorId,
vendorName: existingItem.vendorName
});
} else {
// 新选择的物料,设置默认值
this.selectedMaterialMap.set(row.id, {
...row,
materialId: row.id,
putawayNumber: 0,
putawayPrice: 0,
putawayMoney: 0,
vendorId: row.vendorId,
vendorName: row.vendorName
});
}
});
}, },
// 将选中物料添加至入库明细列表 // 将选中物料添加至入库明细列表
confirmSelection() { confirmSelection() {
// 删除 a 中多余数据 用 filter() + some() 保留 a 中与 b 的 id 匹配的项。 // 使用Map中的数据更新入库明细列表
// 添加 b 中新增数据 用 filter() 找出 b 中 id 不在 a 中的项。 this.form.putawayInfoList = Array.from(this.selectedMaterialMap.values());
// 合并结果使用展开运算符 ... 合并两个数组。 this.open1 = false;
this.form.putawayInfoList = [ this.resetMaterialQuery()
...this.form.putawayInfoList.filter(itemA => this.tempSelection.some(itemB => itemB.id === itemA.id || itemA.materialId === itemB.id)), // 重新计算总金额
...this.tempSelection.filter(itemB => !this.form.putawayInfoList.some(itemA => itemA.id === itemB.id || itemA.materialId === itemB.id)) this.putawayChange();
] },
this.open1 = false /** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
this.getMaterialList();
},
/** 重置按钮操作 */
resetMaterialQuery() {
this.resetForm("queryMaterialForm");
this.handleMaterialQuery();
}, },
// 入库明细删除 // 入库明细删除
handleRowDelete(row) { handleRowDelete(row) {
this.form.putawayInfoList = this.form.putawayInfoList.filter(item => item.id !== row.id); const materialId = row.materialId || row.id;
this.putawayChange() // 从Map中移除
this.selectedMaterialMap.delete(materialId);
// 更新入库明细列表
this.form.putawayInfoList = this.form.putawayInfoList.filter(item => {
const itemMaterialId = item.materialId || item.id;
return itemMaterialId !== materialId;
});
this.putawayChange();
}, },
// 取消按钮 // 取消物料选择
cancelMaterial() { cancelMaterial() {
this.open1 = false; this.open1 = false;
// 可选:清空临时选择,但保留已确认的选择
this.tempSelection = [];
this.resetMaterialQuery()
}, },
// 入库数量变动 // 入库数量变动
putawayChange() { putawayChange() {
...@@ -652,6 +701,7 @@ export default { ...@@ -652,6 +701,7 @@ export default {
createTime: formatDate(new Date().getTime()), createTime: formatDate(new Date().getTime()),
putawayInfoList: [] putawayInfoList: []
}; };
this.selectedMaterialMap.clear();
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
...@@ -699,6 +749,8 @@ export default { ...@@ -699,6 +749,8 @@ export default {
this.title = "修改物料入库"; this.title = "修改物料入库";
this.getWarehouseList() this.getWarehouseList()
this.getVendorList() this.getVendorList()
// 初始化已选物料数据
this.initializeSelectedMaterials();
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -780,7 +832,6 @@ export default { ...@@ -780,7 +832,6 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
console.log('this.queryParams', this.queryParams);
this.download('business/materialPutawayInfo/export', { this.download('business/materialPutawayInfo/export', {
...this.queryParams ...this.queryParams
}, `入库单明细_${new Date().getTime()}.xlsx`) }, `入库单明细_${new Date().getTime()}.xlsx`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment