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 activeId = ref<string>(); // id โครงสร้างปัจจุบัน
|
||||||
const draftId = ref<string>(); // id แบบร่างโครงสร้าง
|
const draftId = ref<string>(); // id แบบร่างโครงสร้าง
|
||||||
const historyId = ref<string>(); // id ประวัติโครงสร้าง
|
const historyId = ref<string>(); // id ประวัติโครงสร้าง
|
||||||
const historyDnaOrgId = ref<string>(); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
const historyDnaOrgId = ref<string>(""); // id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||||
const isPublic = ref<boolean>(false); // การเผยแพร่
|
const isPublic = ref<boolean>(false); // การเผยแพร่
|
||||||
const treeId = ref<string>(); // id โหนด
|
const treeId = ref<string>(); // id โหนด
|
||||||
const level = ref<number>(); // ระดับโหนด
|
const level = ref<number>(); // ระดับโหนด
|
||||||
|
|
|
||||||
|
|
@ -94,16 +94,18 @@ async function fetchHistory() {
|
||||||
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
(e: OrgRevision) => !e.orgRevisionIsDraft && !e.orgRevisionIsCurrent
|
||||||
);
|
);
|
||||||
|
|
||||||
itemHistory.value = filterData.map((e: OrgRevision) => ({
|
itemHistory.value =
|
||||||
id: e.orgRevisionId,
|
filterData.map((e: OrgRevision) => ({
|
||||||
name: e.orgRevisionName,
|
id: e.orgRevisionId,
|
||||||
orgRevisionCreatedAt: e.orgRevisionCreatedAt
|
name: e.orgRevisionName,
|
||||||
? date2Thai(e.orgRevisionCreatedAt)
|
orgRevisionCreatedAt: e.orgRevisionCreatedAt
|
||||||
: "",
|
? date2Thai(e.orgRevisionCreatedAt)
|
||||||
}));
|
: "",
|
||||||
|
})) || [];
|
||||||
|
|
||||||
// id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
// id ของโครงสร้างสำหรับใช้ในเมนูสืบทอดตำแหน่ง
|
||||||
store.historyDnaOrgId = itemHistory.value[0].id;
|
store.historyDnaOrgId =
|
||||||
|
itemHistory.value.length > 0 ? itemHistory.value[0].id : "";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue