fix: Unable to create service point
This commit is contained in:
parent
883f79cf66
commit
f4474c2624
1 changed files with 13 additions and 9 deletions
|
|
@ -366,7 +366,9 @@ const defaultFormData = {
|
||||||
const formDialogRef = ref();
|
const formDialogRef = ref();
|
||||||
|
|
||||||
const formType = ref<'create' | 'edit' | 'delete' | 'view'>('create');
|
const formType = ref<'create' | 'edit' | 'delete' | 'view'>('create');
|
||||||
const formTypeBranch = ref<'headOffice' | 'subBranch'>('headOffice');
|
const formTypeBranch = ref<'headOffice' | 'subBranch' | 'branchVirtual'>(
|
||||||
|
'headOffice',
|
||||||
|
);
|
||||||
const currentHq = ref<{ id: string; code: string }>({
|
const currentHq = ref<{ id: string; code: string }>({
|
||||||
id: '',
|
id: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -520,13 +522,13 @@ watch(modalDrawer, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function triggerCreate(
|
function triggerCreate(
|
||||||
type: 'headOffice' | 'subBranch',
|
type: 'headOffice' | 'subBranch' | 'branchVirtual',
|
||||||
id?: string,
|
id?: string,
|
||||||
code?: string,
|
code?: string,
|
||||||
) {
|
) {
|
||||||
formTypeBranch.value = type;
|
formTypeBranch.value = type;
|
||||||
|
|
||||||
if (type === 'subBranch' && id && code) {
|
if ((type === 'subBranch' || type === 'branchVirtual') && id && code) {
|
||||||
isSubCreate.value = true;
|
isSubCreate.value = true;
|
||||||
formData.value.headOfficeId = id;
|
formData.value.headOfficeId = id;
|
||||||
formData.value.code = code;
|
formData.value.code = code;
|
||||||
|
|
@ -845,12 +847,14 @@ async function onSubmit(submitSelectedItem?: boolean) {
|
||||||
|
|
||||||
function changeTitle(
|
function changeTitle(
|
||||||
formType: 'edit' | 'create' | 'delete' | 'view',
|
formType: 'edit' | 'create' | 'delete' | 'view',
|
||||||
typeBranch: 'headOffice' | 'subBranch',
|
typeBranch: 'headOffice' | 'subBranch' | 'branchVirtual',
|
||||||
) {
|
) {
|
||||||
const _type =
|
const _type =
|
||||||
typeBranch === 'headOffice'
|
{
|
||||||
? 'branch.card.branchHQLabel'
|
headOffice: 'branch.card.branchHQLabel',
|
||||||
: 'branch.card.branchLabel';
|
subBranch: 'branch.card.branchLabel',
|
||||||
|
branchVirtual: 'branch.card.branchVirtual',
|
||||||
|
}[typeBranch] || '';
|
||||||
|
|
||||||
return formType === 'create'
|
return formType === 'create'
|
||||||
? t('form.title.create', { name: t(_type) })
|
? t('form.title.create', { name: t(_type) })
|
||||||
|
|
@ -2652,14 +2656,14 @@ watch(currentHq, () => {
|
||||||
() => {
|
() => {
|
||||||
modelCreateTypeBranch = false;
|
modelCreateTypeBranch = false;
|
||||||
|
|
||||||
if (value.text === $t('branch.card.branchVirtual')) {
|
if (value.text === 'branch.card.branchVirtual') {
|
||||||
formData.virtual = true;
|
formData.virtual = true;
|
||||||
} else {
|
} else {
|
||||||
formData.virtual = false;
|
formData.virtual = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerCreate(
|
triggerCreate(
|
||||||
'subBranch',
|
formData.virtual ? 'branchVirtual' : 'subBranch',
|
||||||
currentEdit.id || currentHq.id,
|
currentEdit.id || currentHq.id,
|
||||||
currentEdit.code || currentHq.code,
|
currentEdit.code || currentHq.code,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue