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

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

2.物料入库,选择物料优化
parent 263041c0
......@@ -60,6 +60,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
private final YinLianPayApi yinLianPayApi;
private final SysDeptMapper sysDeptMapper;
private final ISysPayLogService sysPayLogService;
private final SysDeptMapper deptMapper;
@Value("${pay.merchantCode}")
private String merchantCode;
......@@ -91,6 +92,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
}
private LambdaQueryWrapper<ErpSettlementMaintain> buildQueryWrapper(ErpSettlementMaintainBo bo) {
List<SysDept> sysDeptList = deptMapper.selectChildrenDeptById(LoginHelper.getDeptId(), null);
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<ErpSettlementMaintain> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getSettlementNumber()), ErpSettlementMaintain::getSettlementNumber, bo.getSettlementNumber());
......@@ -101,7 +103,7 @@ public class ErpSettlementMaintainServiceImpl implements IErpSettlementMaintainS
lqw.eq(bo.getClientCertificateType() != null, ErpSettlementMaintain::getClientCertificateType, bo.getClientCertificateType());
lqw.eq(StringUtils.isNotBlank(bo.getClientCertificateNumber()), ErpSettlementMaintain::getClientCertificateNumber, bo.getClientCertificateNumber());
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);
return lqw;
}
......
......@@ -325,8 +325,8 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetMaterialQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="materialLoading" :data="materialList" ref="selectionTable" max-height="450" @selection-change="handleMaterialSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<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" :reserve-selection="true" />
<!-- <el-table-column label="分类名称" align="center" prop="materialTypeName" />-->
<!-- <el-table-column label="货位类型" align="center" prop="warehouseLocationType" />-->
<el-table-column label="供应商" align="center" prop="vendorName" width="120px" show-overflow-tooltip />
......@@ -431,6 +431,7 @@ export default {
total: 0,
// 物料入库表格数据
materialPutawayList: [],
selectedMaterialMap: new Map(),
// 弹出层标题
title: "",
// 是否显示弹出层
......@@ -528,23 +529,6 @@ export default {
vendorChange(id, item) {
let vendor = this.materialVendorList.find(v => v.id === id);
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() {
......@@ -561,18 +545,22 @@ export default {
/** 打开物料列表 */
openMaterialModel() {
this.open1 = true
// 打开对话框时初始化已选数据
this.initializeSelectedMaterials()
this.getMaterialList()
},
/** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
this.getMaterialList();
},
/** 重置按钮操作 */
resetMaterialQuery() {
this.resetForm("queryMaterialForm");
this.handleMaterialQuery();
/** 初始化已选物料数据 */
initializeSelectedMaterials() {
// 将当前入库明细列表中的物料添加到已选Map中
this.selectedMaterialMap.clear()
this.form.putawayInfoList.forEach(item => {
const materialId = item.materialId || item.id
if (materialId) {
this.selectedMaterialMap.set(materialId, item)
}
})
},
/** 查询物资列表 */
getMaterialList() {
this.materialLoading = true;
......@@ -580,41 +568,102 @@ export default {
this.materialList = response.rows;
this.materialTotal = response.total;
this.materialLoading = false;
}).then(() =>{
}).then(() => {
this.$nextTick(() => {
// 清空临时勾选
this.tempSelection = [];
// 手动设置勾选(匹配外部已选数据)
this.materialList.forEach(row => {
const isSelected = this.form.putawayInfoList.some(item => item.id === row.id || item.materialId === row.id);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
// 恢复选择状态
this.restoreMaterialSelection();
});
})
},
/** 恢复物料选择状态 */
restoreMaterialSelection() {
if (this.$refs.selectionTable) {
this.materialList.forEach(row => {
const isSelected = this.selectedMaterialMap.has(row.id);
this.$refs.selectionTable.toggleRowSelection(row, isSelected);
});
}
},
// 多选框选中数据
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() {
// 删除 a 中多余数据 用 filter() + some() 保留 a 中与 b 的 id 匹配的项。
// 添加 b 中新增数据 用 filter() 找出 b 中 id 不在 a 中的项。
// 合并结果使用展开运算符 ... 合并两个数组。
this.form.putawayInfoList = [
...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.open1 = false
// 使用Map中的数据更新入库明细列表
this.form.putawayInfoList = Array.from(this.selectedMaterialMap.values());
this.open1 = false;
this.resetMaterialQuery()
// 重新计算总金额
this.putawayChange();
},
/** 搜索按钮操作 */
handleMaterialQuery() {
this.queryMaterialParams.pageNum = 1;
this.getMaterialList();
},
/** 重置按钮操作 */
resetMaterialQuery() {
this.resetForm("queryMaterialForm");
this.handleMaterialQuery();
},
// 入库明细删除
handleRowDelete(row) {
this.form.putawayInfoList = this.form.putawayInfoList.filter(item => item.id !== row.id);
this.putawayChange()
const materialId = row.materialId || row.id;
// 从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() {
this.open1 = false;
// 可选:清空临时选择,但保留已确认的选择
this.tempSelection = [];
this.resetMaterialQuery()
},
// 入库数量变动
putawayChange() {
......@@ -652,6 +701,7 @@ export default {
createTime: formatDate(new Date().getTime()),
putawayInfoList: []
};
this.selectedMaterialMap.clear();
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -699,6 +749,8 @@ export default {
this.title = "修改物料入库";
this.getWarehouseList()
this.getVendorList()
// 初始化已选物料数据
this.initializeSelectedMaterials();
});
},
/** 提交按钮 */
......@@ -780,7 +832,6 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
console.log('this.queryParams', this.queryParams);
this.download('business/materialPutawayInfo/export', {
...this.queryParams
}, `入库单明细_${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