fix/refactor: handle submit properties
This commit is contained in:
parent
221f421991
commit
9b96d22480
1 changed files with 46 additions and 3 deletions
|
|
@ -480,6 +480,8 @@ const filterStat = ref<('group' | 'service' | 'product')[]>([]);
|
|||
const refAddServiceWork = ref();
|
||||
const refEditServiceWork = ref();
|
||||
|
||||
const tempWorkItems = ref<WorkItems[]>([]);
|
||||
|
||||
// แบ่งหน้า
|
||||
const currentPageGroup = ref<number>(1);
|
||||
const maxPageGroup = ref<number>(1);
|
||||
|
|
@ -886,6 +888,9 @@ async function assignFormDataProductService(id: string) {
|
|||
|
||||
currentService.value = JSON.parse(JSON.stringify(res));
|
||||
|
||||
const workflowRet = await getWorkflowTemplate(res.attributes.workflowId);
|
||||
if (workflowRet) currWorkflow.value = workflowRet;
|
||||
|
||||
prevService.value = {
|
||||
code: res.code,
|
||||
name: res.name,
|
||||
|
|
@ -1035,6 +1040,7 @@ function clearFormService() {
|
|||
status: undefined,
|
||||
productGroupId: '',
|
||||
};
|
||||
tempWorkItems.value = [];
|
||||
splitPay.value = 0;
|
||||
workItems.value = [];
|
||||
selectProduct.value = [];
|
||||
|
|
@ -1580,7 +1586,9 @@ function handleChangeWorkflowId(workflowId: string) {
|
|||
currWorkflow.value.step.map((step) => ({
|
||||
name: step.name,
|
||||
attributes: step.attributes,
|
||||
productsId: [],
|
||||
productsId: workItems.value[currentWorkIndex.value].product.map(
|
||||
(p) => p.id,
|
||||
),
|
||||
})),
|
||||
),
|
||||
)
|
||||
|
|
@ -1589,10 +1597,24 @@ function handleChangeWorkflowId(workflowId: string) {
|
|||
}
|
||||
}
|
||||
|
||||
function handleSubmitSameWorkflow() {
|
||||
const tempStep = JSON.parse(
|
||||
JSON.stringify(
|
||||
tempWorkItems.value[currentWorkIndex.value].attributes.workflowStep,
|
||||
),
|
||||
);
|
||||
|
||||
workItems.value[currentWorkIndex.value].attributes.workflowStep.forEach(
|
||||
(step, i) => {
|
||||
step.productsId = tempStep[i].productsId;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => formDataProductService.value.attributes.workflowId,
|
||||
async (a, b) => {
|
||||
if (a && a !== b) {
|
||||
if (a && b && a !== b) {
|
||||
handleChangeWorkflowId(a);
|
||||
}
|
||||
},
|
||||
|
|
@ -4113,9 +4135,30 @@ watch(
|
|||
v-model:data-step="workItems[currentWorkIndex].attributes.workflowStep"
|
||||
v-model:workflow-id="formDataProductService.attributes.workflowId"
|
||||
v-model="propertiesDialog"
|
||||
@show="
|
||||
() => {
|
||||
tempWorkItems[currentWorkIndex] = JSON.parse(
|
||||
JSON.stringify(workItems[currentWorkIndex]),
|
||||
);
|
||||
}
|
||||
"
|
||||
@submit="
|
||||
(v) => {
|
||||
currWorkflow = v;
|
||||
if (dialogService) {
|
||||
workItems[currentWorkIndex].attributes.workflowId = v.id;
|
||||
workItems[currentWorkIndex].attributes.workflowStep.forEach(
|
||||
(step) => {
|
||||
step.productsId = workItems[currentWorkIndex].product.map(
|
||||
(p) => p.id,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
if (v.id === currWorkflow?.id) {
|
||||
handleSubmitSameWorkflow();
|
||||
} else {
|
||||
currWorkflow = v;
|
||||
}
|
||||
}
|
||||
"
|
||||
></DialogProperties>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue