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();
|
openDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerEdit(type: string, id: string, code?: string) {
|
async function triggerEdit(type: string, id: string, code?: string) {
|
||||||
fetchBranchById(id);
|
await fetchBranchById(id);
|
||||||
|
|
||||||
if (id && code && type === 'headOffice') {
|
if (id && code && type === 'headOffice') {
|
||||||
|
formTypeBranch.value = 'headOffice';
|
||||||
codeHq.value = {
|
codeHq.value = {
|
||||||
id: id,
|
id: id,
|
||||||
code: code,
|
code: code,
|
||||||
|
|
@ -281,8 +283,22 @@ function triggerEdit(type: string, id: string, code?: string) {
|
||||||
}
|
}
|
||||||
if (type === 'subBranch' && id && code) {
|
if (type === 'subBranch' && id && code) {
|
||||||
formTypeBranch.value = 'subBranch';
|
formTypeBranch.value = 'subBranch';
|
||||||
} else {
|
codeHq.value = {
|
||||||
formTypeBranch.value = 'headOffice';
|
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';
|
formType.value = 'edit';
|
||||||
|
|
@ -333,9 +349,13 @@ async function onSubmit() {
|
||||||
cancel: () => {},
|
cancel: () => {},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
const { status, ...payload } = formData.value;
|
||||||
|
|
||||||
await branchStore.editById(
|
await branchStore.editById(
|
||||||
codeHq.value.id,
|
codeHq.value.id,
|
||||||
formData.value,
|
{
|
||||||
|
...payload,
|
||||||
|
},
|
||||||
profileFile.value,
|
profileFile.value,
|
||||||
profileFileImg.value,
|
profileFileImg.value,
|
||||||
);
|
);
|
||||||
|
|
@ -628,6 +648,8 @@ watch(locale, () => {
|
||||||
"
|
"
|
||||||
@click="
|
@click="
|
||||||
async () => {
|
async () => {
|
||||||
|
console.log('dddgdfg');
|
||||||
|
|
||||||
const res = await branchStore.editById(
|
const res = await branchStore.editById(
|
||||||
node.id,
|
node.id,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue