แก้ api insignia

This commit is contained in:
AnandaTon 2023-06-19 10:55:14 +07:00
parent 8576f3c387
commit 20d33a0cb0
2 changed files with 37 additions and 24 deletions

View file

@ -579,8 +579,21 @@ const fetchData = async (load: boolean = false) => {
const result = await getInsignia(false, load);
version.value = result.version; // published= draft=
idVersion.value = result.idversion; // id mongodb
rows.value = result.data;
rows.value.sort(
(
firstItem: RequestItemsHistoryObject,
secondItem: RequestItemsHistoryObject
) => firstItem.level - secondItem.level
);
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);
// showLoader();
// await http
@ -624,26 +637,26 @@ const fetchData = async (load: boolean = false) => {
/**
* รายการลำดบเครองราชฯ
*/
const fetchinsigniaType = async () => {
showLoader();
await http
.get(config.API.insigniaType)
.then((res) => {
const data = res.data.result;
let option: DataOption[] = [];
data.map((r: RequestItemsHistoryObject) => {
option.push({ id: r.id.toString(), name: r.name.toString() });
});
insigniaTypeOption.value = option;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
updateData.value = false;
hideLoader();
});
};
// const fetchinsigniaType = async () => {
// showLoader();
// await http
// .get(config.API.insigniaType)
// .then((res) => {
// const data = res.data.result;
// let option: DataOption[] = [];
// data.map((r: RequestItemsHistoryObject) => {
// option.push({ id: r.id.toString(), name: r.name.toString() });
// });
// insigniaTypeOption.value = option;
// })
// .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
// };
/**
* งชนดอมลประวแกไขขอมลทงหมด
@ -701,7 +714,7 @@ const clearPublishedData = async () => {
})
.finally(async () => {
await fetchHistory();
await fetchData();
await fetchData(true);
});
};
@ -720,7 +733,7 @@ const publishedData = async () => {
messageError($q, e);
})
.finally(async () => {
await fetchData();
await fetchData(true);
});
};

View file

@ -205,7 +205,7 @@ const { loaderPage } = dataStore;
const mixin = useCounterMixin();
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
const store = useManageDataStore();
const { manageData, changeManageColumns, getGender, dataGenders } = store;
const { manageData, changeManageColumns, getGender, dataGender } = store;
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history