change(mes/baseRoute): 优化工艺路线组成信息操作

- 添加自动递增的 processOrder 功能
- 修改删除操作,采用重新排列 processOrder 的方式
- 更新选中数据的处理方式,使用 processId 替代索引
master
zch 2 weeks ago
parent 6de0820811
commit 3ba0763927

@ -407,7 +407,7 @@ const routeProcessUpdate = async (row: BaseRouteVO) => {
dialog.title = '维护工艺路线步骤';
};
// rowProdBaseRouteProcessIndex
/** 修改rowProdBaseRouteProcessIndex方法返回类名字符串 */
const rowProdBaseRouteProcessIndex = ({ row, rowIndex }: {
row: ProdBaseRouteProcess;
rowIndex: number
@ -422,11 +422,20 @@ const rowProdBaseRouteProcessIndex = ({ row, rowIndex }: {
//
return '';
};
/** 工艺路线组成信息添加按钮操作 */
const handleAddProdBaseRouteProcess = () => {
// routeProcessBoList processOrder
const maxProcessOrder = routeProcessBoList.value.reduce((max, item) => {
return Math.max(max, item.processOrder || 0);
}, 0);
// processOrder maxProcessOrder + 10
const newProcessOrder = maxProcessOrder + 10;
routeProcessBoList.value.push({
processId: '',
processOrder: '',
processId: '', // ID
processOrder: newProcessOrder,
remark: '',
createBy: '',
createTime: '',
@ -435,6 +444,7 @@ const handleAddProdBaseRouteProcess = () => {
});
};
/** 工艺路线组成信息删除按钮操作 */
const handleDeleteProdBaseRouteProcess = () => {
// 线
@ -443,15 +453,23 @@ const handleDeleteProdBaseRouteProcess = () => {
} else {
// 线
routeProcessBoList.value = routeProcessBoList.value.filter(
item => !checkedProdBaseRouteProcess.value.includes(item.index)
item => !checkedProdBaseRouteProcess.value.includes(item.processId)
);
// processOrder
routeProcessBoList.value.forEach((item, index) => {
item.processOrder = (index + 1) * 10;
});
//
checkedProdBaseRouteProcess.value = [];
}
};
/** 复选框选中数据 */
const handleProdBaseRouteProcessSelectionChange = (selection: any[]) => {
// checkedProdBaseRouteProcess.value
checkedProdBaseRouteProcess.value = selection.map(item => item.index);
// processId checkedProdBaseRouteProcess.value
checkedProdBaseRouteProcess.value = selection.map(item => item.processId);
};
const getProcessList = async () => {

Loading…
Cancel
Save