fix: แก้ไขลูก ไม่ไป
This commit is contained in:
parent
3e1ccb5d0f
commit
7fad5e81d8
1 changed files with 27 additions and 5 deletions
|
|
@ -271,9 +271,11 @@ function triggerCreate(type: string, id?: string, code?: string) {
|
|||
openDialog();
|
||||
}
|
||||
|
||||
function triggerEdit(type: string, id: string, code?: string) {
|
||||
fetchBranchById(id);
|
||||
async function triggerEdit(type: string, id: string, code?: string) {
|
||||
await fetchBranchById(id);
|
||||
|
||||
if (id && code && type === 'headOffice') {
|
||||
formTypeBranch.value = 'headOffice';
|
||||
codeHq.value = {
|
||||
id: id,
|
||||
code: code,
|
||||
|
|
@ -281,8 +283,22 @@ function triggerEdit(type: string, id: string, code?: string) {
|
|||
}
|
||||
if (type === 'subBranch' && id && code) {
|
||||
formTypeBranch.value = 'subBranch';
|
||||
} else {
|
||||
formTypeBranch.value = 'headOffice';
|
||||
codeHq.value = {
|
||||
id: id,
|
||||
code: code,
|
||||
};
|
||||
}
|
||||
|
||||
const currentRecord = branchData.value.result.find((x) => x.id === id);
|
||||
|
||||
if (!currentRecord) return;
|
||||
|
||||
const currentRecordHead = branchData.value.result.find(
|
||||
(x) => x.id === currentRecord.headOfficeId,
|
||||
);
|
||||
|
||||
if (currentRecordHead) {
|
||||
codeHq.value.code = currentRecordHead.code;
|
||||
}
|
||||
|
||||
formType.value = 'edit';
|
||||
|
|
@ -333,9 +349,13 @@ async function onSubmit() {
|
|||
cancel: () => {},
|
||||
});
|
||||
} else {
|
||||
const { status, ...payload } = formData.value;
|
||||
|
||||
await branchStore.editById(
|
||||
codeHq.value.id,
|
||||
formData.value,
|
||||
{
|
||||
...payload,
|
||||
},
|
||||
profileFile.value,
|
||||
profileFileImg.value,
|
||||
);
|
||||
|
|
@ -628,6 +648,8 @@ watch(locale, () => {
|
|||
"
|
||||
@click="
|
||||
async () => {
|
||||
console.log('dddgdfg');
|
||||
|
||||
const res = await branchStore.editById(
|
||||
node.id,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue