refactor: edit createBranch

This commit is contained in:
Net 2024-09-23 13:04:04 +07:00
parent a3f923d857
commit 0794bd4448

View file

@ -650,8 +650,6 @@ async function triggerDelete(id: string) {
action: async () => {
const res = await branchStore.deleteById(id);
console.log(res);
if (res) {
await fetchList({ tree: true, pageSize: 99999 });
modalDrawer.value = false;
@ -785,11 +783,6 @@ async function onSubmit(submitSelectedItem?: boolean) {
}
if (formType.value === 'create') {
if (formData.value.headOfficeId !== undefined) {
formData.value.code = formData.value?.code?.slice(0, -5);
formData.value.codeHeadOffice = formData.value?.codeHeadOffice?.slice(-5);
}
const createBranch = async () => {
const res = await branchStore.create(
{
@ -816,7 +809,10 @@ async function onSubmit(submitSelectedItem?: boolean) {
await fetchList({ tree: true, pageSize: 99999 });
};
if (formTypeBranch.value === 'subBranch') {
if (
formTypeBranch.value === 'subBranch' ||
formTypeBranch.value === 'branchVirtual'
) {
const currentRecord = branchData.value.result.find(
(x) => x.id === formData.value.headOfficeId,
);