no message

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-30 18:00:58 +07:00
parent 06d9b22205
commit 756daf8d68
6 changed files with 124 additions and 181 deletions

View file

@ -34,6 +34,10 @@ const props = defineProps({
type: Object,
require: true,
},
edit: {
type: Function,
require: true,
},
});
const $q = useQuasar();
@ -134,8 +138,6 @@ function onSubmit() {
["org" + type + "Rank"]: formData.orgLevel,
[nameId]: rootId,
};
console.log(body);
if (actionType.value === "ADD") {
await http
.post(config.API.createOrgLevel(type.toLocaleLowerCase()), body)
@ -164,6 +166,7 @@ function onSubmit() {
)
.then((res) => {
console.log(res);
props.edit?.(props.dataNode?.orgTreeId, type, body);
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((err) => {
@ -171,7 +174,7 @@ function onSubmit() {
messageError($q, err);
})
.finally(async () => {
await props.fetchDataTree?.();
// await props.fetchDataTree?.();
await closeClear();
await hideLoader();
}));
@ -211,7 +214,10 @@ watch(
formData.orgPhoneIn = props.dataNode.orgTreePhoneIn;
formData.orgFax = props.dataNode.orgTreeFax;
formData.orgLevel = props.dataNode.orgTreeRank;
orgLevelOption.value = orgLevelOptionMain.value.slice(1, 4);
orgLevelOption.value =
props.dataNode.orgTreeRank === "DEPARTMENT"
? orgLevelOptionMain.value
: orgLevelOptionMain.value.slice(1, 4);
}
}
}
@ -221,18 +227,14 @@ watch(
const tittleName = computed(() => {
let name = "";
if (actionType.value === "ADD") {
if (level.value === 1) {
name = "เพิ่มหน่วยงาน";
} else {
name = "เพิ่มส่วนราชการ";
}
name =
level.value === 0 || level.value === 1
? "เพิ่มหน่วยงาน"
: "เพิ่มส่วนราชการ";
} else {
if (level.value === 0) {
name = "แก้ไขหน่วยงาน";
} else {
name = "แก้ไขเพิ่มส่วนราชการ";
}
name = level.value === 0 ? "แก้ไขหน่วยงาน" : "แก้ไขเพิ่มส่วนราชการ";
}
return name;
});
</script>