refactor:header registered branch

This commit is contained in:
Thanaphon Frappet 2024-09-30 10:55:48 +07:00
parent c76dd473bb
commit 2fbf4edf36
3 changed files with 25 additions and 3 deletions

View file

@ -95,7 +95,7 @@ const {
} = productServiceStore;
const { workNameItems } = storeToRefs(productServiceStore);
const readOnlybranchOption = ref<boolean>(false);
const allStat = ref<{ mode: string; count: number }[]>([]);
const stat = ref<
{
@ -847,6 +847,7 @@ function undoProductGroup() {
registeredBranchId: previousValue.value.registeredBranchId,
};
isEdit.value = false;
readOnlybranchOption.value = false;
flowStore.rotate();
}
@ -863,6 +864,22 @@ async function assignFormDataGroup(data: ProductGroup) {
code: data.code,
registeredBranchId: data.registeredBranchId,
};
const tempValue = branchOption.value.find(
(v) => v.id === data.registeredBranchId,
);
if (tempValue !== undefined) {
readOnlybranchOption.value = false;
} else {
readOnlybranchOption.value = true;
branchOption.value = [
{
id: data.registeredBranch.id,
name: data.registeredBranch.name,
},
];
}
}
const prevService = ref<ServiceCreate>({
@ -3175,10 +3192,12 @@ watch(
style="overflow-y: auto"
>
<!-- :isType="productMode === 'type'" -->
<BasicInformation
id="info-group"
dense
:readonly="!isEdit"
:readOnlybranchOption="!readOnlybranchOption"
v-model:options-branch="branchOption"
v-model:registered-branch-id="formDataGroup.registeredBranchId"
v-model:remark="formDataGroup.remark"