แก้ api insignia
This commit is contained in:
parent
8576f3c387
commit
20d33a0cb0
2 changed files with 37 additions and 24 deletions
|
|
@ -579,8 +579,21 @@ const fetchData = async (load: boolean = false) => {
|
||||||
const result = await getInsignia(false, load);
|
const result = await getInsignia(false, load);
|
||||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||||
rows.value = result.data;
|
rows.value.sort(
|
||||||
|
(
|
||||||
|
firstItem: RequestItemsHistoryObject,
|
||||||
|
secondItem: RequestItemsHistoryObject
|
||||||
|
) => firstItem.level - secondItem.level
|
||||||
|
);
|
||||||
updateData.value = false;
|
updateData.value = false;
|
||||||
|
rows.value = result.data;
|
||||||
|
const data = rows.value;
|
||||||
|
let option: DataOption[] = [];
|
||||||
|
data.map((r: RequestItemsHistoryObject) => {
|
||||||
|
option.push({ id: r.id.toString(), name: r.name.toString() });
|
||||||
|
});
|
||||||
|
insigniaTypeOption.value = option;
|
||||||
|
updateData.value = true;
|
||||||
// rows.value.splice(0);
|
// rows.value.splice(0);
|
||||||
// showLoader();
|
// showLoader();
|
||||||
// await http
|
// await http
|
||||||
|
|
@ -624,26 +637,26 @@ const fetchData = async (load: boolean = false) => {
|
||||||
/**
|
/**
|
||||||
* รายการลำดับเครื่องราชฯ
|
* รายการลำดับเครื่องราชฯ
|
||||||
*/
|
*/
|
||||||
const fetchinsigniaType = async () => {
|
// const fetchinsigniaType = async () => {
|
||||||
showLoader();
|
// showLoader();
|
||||||
await http
|
// await http
|
||||||
.get(config.API.insigniaType)
|
// .get(config.API.insigniaType)
|
||||||
.then((res) => {
|
// .then((res) => {
|
||||||
const data = res.data.result;
|
// const data = res.data.result;
|
||||||
let option: DataOption[] = [];
|
// let option: DataOption[] = [];
|
||||||
data.map((r: RequestItemsHistoryObject) => {
|
// data.map((r: RequestItemsHistoryObject) => {
|
||||||
option.push({ id: r.id.toString(), name: r.name.toString() });
|
// option.push({ id: r.id.toString(), name: r.name.toString() });
|
||||||
});
|
// });
|
||||||
insigniaTypeOption.value = option;
|
// insigniaTypeOption.value = option;
|
||||||
})
|
// })
|
||||||
.catch((e) => {
|
// .catch((e) => {
|
||||||
messageError($q, e);
|
// messageError($q, e);
|
||||||
})
|
// })
|
||||||
.finally(() => {
|
// .finally(() => {
|
||||||
updateData.value = false;
|
// updateData.value = false;
|
||||||
hideLoader();
|
// hideLoader();
|
||||||
});
|
// });
|
||||||
};
|
// };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลทั้งหมด
|
* ฟังชั้นดูข้อมูลประวัติแก้ไขข้อมูลทั้งหมด
|
||||||
|
|
@ -701,7 +714,7 @@ const clearPublishedData = async () => {
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
await fetchHistory();
|
await fetchHistory();
|
||||||
await fetchData();
|
await fetchData(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -720,7 +733,7 @@ const publishedData = async () => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
})
|
})
|
||||||
.finally(async () => {
|
.finally(async () => {
|
||||||
await fetchData();
|
await fetchData(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ const { loaderPage } = dataStore;
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||||
const store = useManageDataStore();
|
const store = useManageDataStore();
|
||||||
const { manageData, changeManageColumns, getGender, dataGenders } = store;
|
const { manageData, changeManageColumns, getGender, dataGender } = store;
|
||||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue