fix กรณีไม่มีประวัติโครงสร้างเลย
This commit is contained in:
parent
c8d061e43a
commit
ce0906314f
2 changed files with 11 additions and 9 deletions
|
|
@ -24,7 +24,7 @@ export const useOrganizational = defineStore("organizationalStore", () => {
|
|||
const activeId = ref<string>(); // id โครงสร้างปัจจุบัน
|
||||
const draftId = ref<string>(); // id แบบร่างโครงสร้าง
|
||||
const historyId = ref<string>(); // id ประวัติโครงสร้าง
|
||||
const historyDnaOrgId = ref<string>(); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||
const historyDnaOrgId = ref<string>(""); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||
const isPublic = ref<boolean>(false); // การเผยแพร่
|
||||
const treeId = ref<string>(); // id โหนด
|
||||
const level = ref<number>(); // ระดับโหนด
|
||||
|
|
|
|||
|
|
@ -94,16 +94,18 @@ async function fetchHistory() {
|
|||
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
||||
);
|
||||
|
||||
itemHistory.value = filterData.map((e: OrgRevision) => ({
|
||||
id: e.orgRevisionId,
|
||||
name: e.orgRevisionName,
|
||||
orgRevisionCreatedAt: e.orgRevisionCreatedAt
|
||||
? date2Thai(e.orgRevisionCreatedAt)
|
||||
: "",
|
||||
}));
|
||||
itemHistory.value =
|
||||
filterData.map((e: OrgRevision) => ({
|
||||
id: e.orgRevisionId,
|
||||
name: e.orgRevisionName,
|
||||
orgRevisionCreatedAt: e.orgRevisionCreatedAt
|
||||
? date2Thai(e.orgRevisionCreatedAt)
|
||||
: "",
|
||||
})) || [];
|
||||
|
||||
// id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||
store.historyDnaOrgId = itemHistory.value[0].id;
|
||||
store.historyDnaOrgId =
|
||||
itemHistory.value.length > 0 ? itemHistory.value[0].id : "";
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue