refactor: package => step count
This commit is contained in:
parent
e1a27aa8d4
commit
4a6f192d5f
2 changed files with 21 additions and 5 deletions
|
|
@ -5,7 +5,6 @@ import { onMounted } from 'vue';
|
|||
import { storeToRefs } from 'pinia';
|
||||
import { useQuasar, type QTableProps } from 'quasar';
|
||||
|
||||
import SelectFlow from 'src/components/shared/select/SelectFlow.vue';
|
||||
import DialogProperties from 'src/components/dialog/DialogProperties.vue';
|
||||
import ProductCardComponent from 'components/04_product-service/ProductCardComponent.vue';
|
||||
import StatCard from 'components/StatCardComponent.vue';
|
||||
|
|
@ -926,6 +925,7 @@ async function assignFormDataProductService(id: string) {
|
|||
product: item.productOnWork.map((productOnWorkItem) => ({
|
||||
id: productOnWorkItem.product.id,
|
||||
installmentNo: productOnWorkItem.installmentNo,
|
||||
stepCount: productOnWorkItem.stepCount,
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
|
@ -1075,10 +1075,23 @@ function assignFormDataProductServiceCreate() {
|
|||
id: item.id,
|
||||
name: item.name,
|
||||
attributes: item.attributes,
|
||||
product: item.product.map((productItem) => ({
|
||||
id: productItem.id,
|
||||
installmentNo: productItem.installmentNo,
|
||||
})),
|
||||
product: item.product.map((productItem) => {
|
||||
const stepCount = item.attributes.workflowStep.reduce((count, step) => {
|
||||
if (
|
||||
step.attributes?.properties?.length > 0 &&
|
||||
step.productsId.includes(productItem.id)
|
||||
) {
|
||||
return count + 1;
|
||||
}
|
||||
return count;
|
||||
}, 0);
|
||||
|
||||
return {
|
||||
id: productItem.id,
|
||||
installmentNo: productItem.installmentNo,
|
||||
stepCount: stepCount,
|
||||
};
|
||||
}),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -1089,6 +1102,7 @@ async function submitService(notClose = false) {
|
|||
|
||||
if (profileFileImg.value)
|
||||
formDataProductService.value.image = profileFileImg.value;
|
||||
|
||||
if (dialogService.value) {
|
||||
formDataProductService.value.productGroupId = currentIdGroup.value;
|
||||
formDataProductService.value.work.forEach((s) => (s.id = undefined));
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ export interface ServiceCreate {
|
|||
product: {
|
||||
id: string;
|
||||
installmentNo?: number;
|
||||
stepCount: number;
|
||||
}[];
|
||||
name: string;
|
||||
}[];
|
||||
|
|
@ -136,6 +137,7 @@ export interface ProductOnWork {
|
|||
workId: string;
|
||||
order: number;
|
||||
installmentNo: number;
|
||||
stepCount: number;
|
||||
}
|
||||
|
||||
export interface WorkItems {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue