feat: set amount on select worker / product
This commit is contained in:
parent
03c923b3ee
commit
41765b1a48
1 changed files with 16 additions and 1 deletions
|
|
@ -268,11 +268,26 @@ function convertToTable(nodes: Node[]) {
|
|||
if (v.checked) return v;
|
||||
return [];
|
||||
};
|
||||
const list = nodes.flatMap(_recursive).map((v) => v.value);
|
||||
|
||||
list.forEach((v) => {
|
||||
v.amount = Math.max(selectedWorker.value.length, 1);
|
||||
});
|
||||
|
||||
productServiceList.value = list;
|
||||
|
||||
pageState.productServiceModal = false;
|
||||
productServiceList.value = nodes.flatMap(_recursive).map((v) => v.value);
|
||||
}
|
||||
|
||||
function convertEmployeeToTable() {
|
||||
productServiceList.value.map((v) => {
|
||||
if (selectedWorker.value.length === 0 && v.amount === 1) v.amount -= 1;
|
||||
v.amount = Math.max(
|
||||
v.amount + preSelectedWorker.value.length - selectedWorker.value.length,
|
||||
1,
|
||||
);
|
||||
return v;
|
||||
});
|
||||
refSelectZoneEmployee.value?.assignSelect(
|
||||
selectedWorker.value,
|
||||
preSelectedWorker.value,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue