fix: service work product attributes (workflow)
This commit is contained in:
parent
8dcc753b0f
commit
c0b89478b9
1 changed files with 38 additions and 24 deletions
|
|
@ -1201,6 +1201,43 @@ async function submitGroup() {
|
|||
flowStore.rotate();
|
||||
}
|
||||
|
||||
function submitAddWorkProduct() {
|
||||
selectProduct.value.forEach((i) => {
|
||||
const productExists = workItems.value[currentWorkIndex.value].product.some(
|
||||
(product) => product.id === i.id,
|
||||
);
|
||||
// add not exists product
|
||||
if (!productExists) {
|
||||
workItems.value[currentWorkIndex.value].product.push({
|
||||
...i,
|
||||
nameEn: '',
|
||||
});
|
||||
workItems.value[currentWorkIndex.value].attributes.stepProperties.forEach(
|
||||
(s) => {
|
||||
s.productsId.push(i.id);
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// filter remain product
|
||||
workItems.value[currentWorkIndex.value].attributes.stepProperties.forEach(
|
||||
(s) => {
|
||||
s.productsId = s.productsId.filter((pid) =>
|
||||
selectProduct.value.some((i) => i.id === pid),
|
||||
);
|
||||
},
|
||||
);
|
||||
workItems.value[currentWorkIndex.value].product = workItems.value[
|
||||
currentWorkIndex.value
|
||||
].product.filter((product) =>
|
||||
selectProduct.value.some((i) => i.id === product.id),
|
||||
);
|
||||
|
||||
dialogTotalProduct.value = false;
|
||||
selectProduct.value = [];
|
||||
}
|
||||
|
||||
function confirmDeleteWork(id: string, noDialog?: boolean) {
|
||||
if (noDialog) {
|
||||
deleteWork(id);
|
||||
|
|
@ -3266,30 +3303,7 @@ watch(
|
|||
no-appBox
|
||||
:title="$t('productService.product.allProduct')"
|
||||
:save-amount="selectProduct.length"
|
||||
:submit="
|
||||
() => {
|
||||
selectProduct.forEach((i) => {
|
||||
const productExists = workItems[currentWorkIndex].product.some(
|
||||
(product) => product.id === i.id,
|
||||
);
|
||||
if (!productExists) {
|
||||
workItems[currentWorkIndex].product.push({
|
||||
...i,
|
||||
nameEn: '',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
workItems[currentWorkIndex].product = workItems[
|
||||
currentWorkIndex
|
||||
].product.filter((product) =>
|
||||
selectProduct.some((i) => i.id === product.id),
|
||||
);
|
||||
|
||||
dialogTotalProduct = false;
|
||||
selectProduct = [];
|
||||
}
|
||||
"
|
||||
:submit="() => submitAddWorkProduct()"
|
||||
:close="
|
||||
() => {
|
||||
dialogTotalProduct = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue