Merge branch 'develop' into develop-tee

This commit is contained in:
setthawutttty 2023-06-14 16:55:24 +07:00
commit 5f1dea146e
13 changed files with 1157 additions and 271 deletions

View file

@ -14,6 +14,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeePosition,
listPositionEmployeePositionHistory: `${positionEmployeePosition}history`, listPositionEmployeePositionHistory: `${positionEmployeePosition}history`,
listPositionEmployeePositionHistoryId: (id: string) => listPositionEmployeePositionHistoryId: (id: string) =>
`${positionEmployeePosition}history/${id}`, `${positionEmployeePosition}history/${id}`,
@ -23,6 +24,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeePositionSide,
listPositionEmployeePositionSideHistory: `${positionEmployeePositionSide}history`, listPositionEmployeePositionSideHistory: `${positionEmployeePositionSide}history`,
listPositionEmployeePositionSideHistoryId: (id: string) => listPositionEmployeePositionSideHistoryId: (id: string) =>
`${positionEmployeePositionSide}history/${id}`, `${positionEmployeePositionSide}history/${id}`,
@ -32,6 +34,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeeGroup,
listPositionEmployeeGroupHistory: `${positionEmployeeGroup}history`, listPositionEmployeeGroupHistory: `${positionEmployeeGroup}history`,
listPositionEmployeeGroupHistoryId: (id: string) => listPositionEmployeeGroupHistoryId: (id: string) =>
`${positionEmployeeGroup}history/${id}`, `${positionEmployeeGroup}history/${id}`,
@ -41,6 +44,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeeLine,
listPositionEmployeeLineHistory: `${positionEmployeeLine}history`, listPositionEmployeeLineHistory: `${positionEmployeeLine}history`,
listPositionEmployeeLineHistoryId: (id: string) => listPositionEmployeeLineHistoryId: (id: string) =>
`${positionEmployeeLine}history/${id}`, `${positionEmployeeLine}history/${id}`,
@ -50,6 +54,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeeLevel,
listPositionEmployeeLevelHistory: `${positionEmployeeLevel}history`, listPositionEmployeeLevelHistory: `${positionEmployeeLevel}history`,
listPositionEmployeeLevelHistoryId: (id: string) => listPositionEmployeeLevelHistoryId: (id: string) =>
`${positionEmployeeLevel}history/${id}`, `${positionEmployeeLevel}history/${id}`,
@ -59,6 +64,7 @@ export default {
/** /**
* api * api
*/ */
positionEmployeeStatus,
listPositionEmployeeStatusHistory: `${positionEmployeeStatus}history`, listPositionEmployeeStatusHistory: `${positionEmployeeStatus}history`,
listPositionEmployeeStatusHistoryId: (id: string) => listPositionEmployeeStatusHistoryId: (id: string) =>
`${positionEmployeeStatus}history/${id}`, `${positionEmployeeStatus}history/${id}`,

View file

@ -303,8 +303,8 @@ 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 } = store; const { manageData, changeManageColumns, getInsignia, dataInsignia } = store;
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table const rows = ref<RequestItemsHistoryObject[]>(dataInsignia); //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
const tittleHistory = ref<string>("ประวัติแก้ไขชื่อเครื่องราชฯ"); // const tittleHistory = ref<string>("ประวัติแก้ไขชื่อเครื่องราชฯ"); //
@ -574,46 +574,51 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getInsignia(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listInsigniaHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listInsigniaHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
shortName: e.shortName, // idVersion.value = data.id; // id mongodb
level: e.level, // data.items.map((e: RequestItemsHistoryObject) => {
createdAt: e.createdAt, // rows.value.push({
lastUpdatedAt: e.lastUpdatedAt, // id: e.id,
lastUpdateFullName: e.lastUpdateFullName, // name: e.name,
isActive: e.isActive, // shortName: e.shortName,
createdFullName: e.createdFullName, // level: e.level,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
insigniaType: e.insigniaType, // lastUpdateFullName: e.lastUpdateFullName,
note: e.note, // isActive: e.isActive,
}); // createdFullName: e.createdFullName,
}); // createdUserId: e.createdUserId,
rows.value.sort( // lastUpdateUserId: e.lastUpdateUserId,
( // insigniaType: e.insigniaType,
firstItem: RequestItemsHistoryObject, // note: e.note,
secondItem: RequestItemsHistoryObject // });
) => firstItem.level - secondItem.level // });
); // rows.value.sort(
}) // (
.catch((e) => { // firstItem: RequestItemsHistoryObject,
messageError($q, e); // secondItem: RequestItemsHistoryObject
}) // ) => firstItem.level - secondItem.level
.finally(async () => { // );
await fetchinsigniaType(); // })
}); // .catch((e) => {
// messageError($q, e);
// })
// .finally(async () => {
// await fetchinsigniaType();
// });
}; };
/** /**

View file

@ -204,8 +204,9 @@ 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 } = store; const { manageData, changeManageColumns, getInsigniaType, dataInsigniaType } =
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table store;
const rows = ref<RequestItemsHistoryObject[]>(dataInsigniaType); //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
const tittleHistory = ref<string>("ประวัติแก้ไขลำดับชั้นเครื่องราชฯ"); // const tittleHistory = ref<string>("ประวัติแก้ไขลำดับชั้นเครื่องราชฯ"); //
@ -363,37 +364,42 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getInsigniaType(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listInsigniaTypeHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listInsigniaTypeHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
}); // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}) // createdFullName: e.createdFullName,
.catch((e) => { // createdUserId: e.createdUserId,
messageError($q, e); // lastUpdateUserId: e.lastUpdateUserId,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -204,7 +204,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployeeGroup,
dataPositionEmployeeGroup,
} = 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
@ -363,37 +368,42 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployeeGroup(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeeGroupHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listPositionEmployeeGroupHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
}); // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}) // createdFullName: e.createdFullName,
.catch((e) => { // createdUserId: e.createdUserId,
messageError($q, e); // lastUpdateUserId: e.lastUpdateUserId,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -204,7 +204,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployeeLevel,
dataPositionEmployeeLevel,
} = 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
@ -362,37 +367,43 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployeeLevel(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeeLevelHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result;
version.value = data.version; // published= draft= // rows.value.splice(0);
idVersion.value = data.id; // id mongodb // showLoader();
data.items.map((e: RequestItemsHistoryObject) => { // await http
rows.value.push({ // .get(config.API.listPositionEmployeeLevelHistory)
id: e.id, // .then((res) => {
name: e.name, // let data = res.data.result;
createdAt: e.createdAt, // version.value = data.version; // published= draft=
lastUpdatedAt: e.lastUpdatedAt, // idVersion.value = data.id; // id mongodb
lastUpdateFullName: e.lastUpdateFullName, // data.items.map((e: RequestItemsHistoryObject) => {
isActive: e.isActive, // rows.value.push({
createdFullName: e.createdFullName, // id: e.id,
createdUserId: e.createdUserId, // name: e.name,
lastUpdateUserId: e.lastUpdateUserId, // createdAt: e.createdAt,
}); // lastUpdatedAt: e.lastUpdatedAt,
}); // lastUpdateFullName: e.lastUpdateFullName,
}) // isActive: e.isActive,
.catch((e) => { // createdFullName: e.createdFullName,
messageError($q, e); // createdUserId: e.createdUserId,
}) // lastUpdateUserId: e.lastUpdateUserId,
.finally(() => { // });
updateData.value = false; // });
hideLoader(); // })
}); // .catch((e) => {
// messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -204,7 +204,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployeeLine,
dataPositionEmployeeLine,
} = 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
@ -363,37 +368,42 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployeeLine(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeeLineHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listPositionEmployeeLineHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
}); // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}) // createdFullName: e.createdFullName,
.catch((e) => { // createdUserId: e.createdUserId,
messageError($q, e); // lastUpdateUserId: e.lastUpdateUserId,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -216,7 +216,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployee,
dataPositionEmployee,
} = 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
@ -399,38 +404,43 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployee(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeePositionHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listPositionEmployeePositionHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
note: e.note, // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}); // createdFullName: e.createdFullName,
}) // createdUserId: e.createdUserId,
.catch((e) => { // lastUpdateUserId: e.lastUpdateUserId,
messageError($q, e); // note: e.note,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -216,7 +216,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployeeSide,
dataPositionEmployeeSide,
} = 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
@ -399,38 +404,43 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployeeSide(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeePositionSideHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listPositionEmployeePositionSideHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
note: e.note, // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}); // createdFullName: e.createdFullName,
}) // createdUserId: e.createdUserId,
.catch((e) => { // lastUpdateUserId: e.lastUpdateUserId,
messageError($q, e); // note: e.note,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -204,7 +204,12 @@ 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 } = store; const {
manageData,
changeManageColumns,
getPositionEmployeeStatus,
dataPositionEmployeeStatus,
} = 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
@ -363,37 +368,42 @@ const $q = useQuasar();
/** /**
* งก get data าส * งก get data าส
*/ */
const fetchData = async () => { const fetchData = async (load: boolean = false) => {
await props.fetchDataComponent(); await props.fetchDataComponent();
rows.value.splice(0); const result = await getPositionEmployeeStatus(false, load);
showLoader(); version.value = result.version; // published= draft=
await http idVersion.value = result.idversion; // id mongodb
.get(config.API.listPositionEmployeeStatusHistory) rows.value = result.data;
.then((res) => { updateData.value = false;
let data = res.data.result; // rows.value.splice(0);
version.value = data.version; // published= draft= // showLoader();
idVersion.value = data.id; // id mongodb // await http
data.items.map((e: RequestItemsHistoryObject) => { // .get(config.API.listPositionEmployeeStatusHistory)
rows.value.push({ // .then((res) => {
id: e.id, // let data = res.data.result;
name: e.name, // version.value = data.version; // published= draft=
createdAt: e.createdAt, // idVersion.value = data.id; // id mongodb
lastUpdatedAt: e.lastUpdatedAt, // data.items.map((e: RequestItemsHistoryObject) => {
lastUpdateFullName: e.lastUpdateFullName, // rows.value.push({
isActive: e.isActive, // id: e.id,
createdFullName: e.createdFullName, // name: e.name,
createdUserId: e.createdUserId, // createdAt: e.createdAt,
lastUpdateUserId: e.lastUpdateUserId, // lastUpdatedAt: e.lastUpdatedAt,
}); // lastUpdateFullName: e.lastUpdateFullName,
}); // isActive: e.isActive,
}) // createdFullName: e.createdFullName,
.catch((e) => { // createdUserId: e.createdUserId,
messageError($q, e); // lastUpdateUserId: e.lastUpdateUserId,
}) // });
.finally(() => { // });
updateData.value = false; // })
hideLoader(); // .catch((e) => {
}); // messageError($q, e);
// })
// .finally(() => {
// updateData.value = false;
// hideLoader();
// });
}; };
/** /**

View file

@ -5,6 +5,14 @@ import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { RequestItemsHistoryObject } from "@/modules/01_metadata/interface/request/person/Prefix"; import type { RequestItemsHistoryObject } from "@/modules/01_metadata/interface/request/person/Prefix";
import type { RequestItemsHistoryObject as InsigniaResponse } from "@/modules/01_metadata/interface/request/insignia/Insignia";
import type { RequestItemsHistoryObject as InsigniaTypeResponse } from "@/modules/01_metadata/interface/request/insignia/InsigniaType";
import type { RequestItemsHistoryObject as positionEmployeeResponse } from "@/modules/01_metadata/interface/request/positionEmployee/Position";
import type { RequestItemsHistoryObject as positionEmployeeSideResponse } from "@/modules/01_metadata/interface/request/positionEmployee/PositionSide";
import type { RequestItemsHistoryObject as positionEmployeeGroupResponse } from "@/modules/01_metadata/interface/request/positionEmployee/Group";
import type { RequestItemsHistoryObject as positionEmployeeLineResponse } from "@/modules/01_metadata/interface/request/positionEmployee/Line";
import type { RequestItemsHistoryObject as positionEmployeeLevelResponse } from "@/modules/01_metadata/interface/request/positionEmployee/Level";
import type { RequestItemsHistoryObject as positionEmployeeStatusResponse } from "@/modules/01_metadata/interface/request/positionEmployee/Status";
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
@ -13,6 +21,23 @@ const { success, messageError, showLoader, hideLoader } = mixin;
export const useManageDataStore = defineStore("manage", () => { export const useManageDataStore = defineStore("manage", () => {
const dataPrefix = ref<RequestItemsHistoryObject[]>([]); //list data table const dataPrefix = ref<RequestItemsHistoryObject[]>([]); //list data table
const draftPrefix = ref<RequestItemsHistoryObject[]>([]); //list data table const draftPrefix = ref<RequestItemsHistoryObject[]>([]); //list data table
const dataInsignia = ref<InsigniaResponse[]>([]); //list data table
const draftInsignia = ref<InsigniaResponse[]>([]); //list data table
const dataInsigniaType = ref<InsigniaTypeResponse[]>([]); //list data table
const draftInsigniaType = ref<InsigniaTypeResponse[]>([]); //list data table
const dataPositionEmployee = ref<positionEmployeeResponse[]>([]); //list data table
const draftPositionEmployee = ref<positionEmployeeResponse[]>([]); //list data table
const dataPositionEmployeeSide = ref<positionEmployeeSideResponse[]>([]); //list data table
const draftPositionEmployeeSide = ref<positionEmployeeSideResponse[]>([]); //list data table
const dataPositionEmployeeGroup = ref<positionEmployeeGroupResponse[]>([]); //list data table
const draftPositionEmployeeGroup = ref<positionEmployeeGroupResponse[]>([]); //list data table
const dataPositionEmployeeLine = ref<positionEmployeeLineResponse[]>([]); //list data table
const draftPositionEmployeeLine = ref<positionEmployeeLineResponse[]>([]); //list data table
const dataPositionEmployeeLevel = ref<positionEmployeeLevelResponse[]>([]); //list data table
const draftPositionEmployeeLevel = ref<positionEmployeeLevelResponse[]>([]); //list data table
const dataPositionEmployeeStatus = ref<positionEmployeeStatusResponse[]>([]); //list data table
const draftPositionEmployeeStatus = ref<positionEmployeeStatusResponse[]>([]); //list data table
const storeIdVersion = ref<string>(""); //id data ใน mongodb const storeIdVersion = ref<string>(""); //id data ใน mongodb
const storeVersion = ref<string>("published"); //รายการข้อมูลล่าสุดได้เผยแพร่หรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่ const storeVersion = ref<string>("published"); //รายการข้อมูลล่าสุดได้เผยแพร่หรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
interface manage { interface manage {
@ -269,6 +294,238 @@ export const useManageDataStore = defineStore("manage", () => {
} }
}; };
const getInsigniaType = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataInsignia.value.length === 0) {
await fetchInsigniaType(true, selector);
return {
data: draftInsigniaType.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchInsigniaType(true, selector);
return {
data: draftInsigniaType.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftInsigniaType.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getInsignia = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataInsignia.value.length === 0) {
await fetchInsignia(true, selector);
return {
data: draftInsignia.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchInsignia(true, selector);
return {
data: draftInsignia.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftInsignia.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployee = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployee.value.length === 0) {
await fetchPositionEmployee(true, selector);
return {
data: draftPositionEmployee.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployee(true, selector);
return {
data: draftPositionEmployee.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployee.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployeeSide = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployeeSide.value.length === 0) {
await fetchPositionEmployeeSide(true, selector);
return {
data: draftPositionEmployeeSide.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployeeSide(true, selector);
return {
data: draftPositionEmployeeSide.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployeeSide.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployeeGroup = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployeeGroup.value.length === 0) {
await fetchPositionEmployeeGroup(true, selector);
return {
data: draftPositionEmployeeGroup.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployeeGroup(true, selector);
return {
data: draftPositionEmployeeGroup.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployeeGroup.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployeeLine = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployeeLine.value.length === 0) {
await fetchPositionEmployeeLine(true, selector);
return {
data: draftPositionEmployeeLine.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployeeLine(true, selector);
return {
data: draftPositionEmployeeLine.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployeeLine.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployeeLevel = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployeeLevel.value.length === 0) {
await fetchPositionEmployeeLevel(true, selector);
return {
data: draftPositionEmployeeLevel.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployeeLevel(true, selector);
return {
data: draftPositionEmployeeLevel.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployeeLevel.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const getPositionEmployeeStatus = async (
selector: boolean = false,
newFetch: boolean = false
) => {
if (dataPositionEmployeeStatus.value.length === 0) {
await fetchPositionEmployeeStatus(true, selector);
return {
data: draftPositionEmployeeStatus.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
if (newFetch) {
await fetchPositionEmployeeStatus(true, selector);
return {
data: draftPositionEmployeeStatus.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
} else {
return {
data: draftPositionEmployeeStatus.value,
version: storeVersion.value,
idversion: storeIdVersion.value,
};
}
}
};
const fetchPrefix = async (loader: boolean, selector: boolean) => { const fetchPrefix = async (loader: boolean, selector: boolean) => {
let apiPrefix = ""; let apiPrefix = "";
if (loader) { if (loader) {
@ -316,8 +573,548 @@ export const useManageDataStore = defineStore("manage", () => {
}); });
}; };
const fetchInsignia = async (loader: boolean, selector: boolean) => {
let apiInsignia = "";
if (loader) {
showLoader();
}
if (selector) {
apiInsignia = config.API.insignia;
} else {
apiInsignia = config.API.listInsigniaHistory;
}
await http
.get(apiInsignia)
.then((res) => {
const data = res.data.result;
let rows: InsigniaResponse[] = [];
if (selector) {
data.map((e: InsigniaResponse) => {
rows.push({
id: e.id,
name: e.name,
shortName: e.shortName,
level: e.level,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
insigniaType: e.insigniaType,
note: e.note,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: InsigniaResponse) => {
rows.push({
id: e.id,
name: e.name,
shortName: e.shortName,
level: e.level,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
insigniaType: e.insigniaType,
note: e.note,
});
});
}
draftInsignia.value = rows;
if (loader) {
dataInsignia.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchInsigniaType = async (loader: boolean, selector: boolean) => {
let apiInsigniaType = "";
if (loader) {
showLoader();
}
if (selector) {
apiInsigniaType = config.API.insigniaType;
} else {
apiInsigniaType = config.API.listInsigniaTypeHistory;
}
await http
.get(apiInsigniaType)
.then((res) => {
const data = res.data.result;
let rows: InsigniaTypeResponse[] = [];
if (selector) {
data.map((e: InsigniaTypeResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: InsigniaTypeResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
}
draftInsigniaType.value = rows;
if (loader) {
dataInsigniaType.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployee = async (loader: boolean, selector: boolean) => {
let apiPositionEmployee = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployee = config.API.positionEmployeePosition;
} else {
apiPositionEmployee = config.API.listPositionEmployeePositionHistory;
}
await http
.get(apiPositionEmployee)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeResponse[] = [];
if (selector) {
data.map((e: positionEmployeeResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
note: e.note,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
note: e.note,
});
});
}
draftPositionEmployee.value = rows;
if (loader) {
dataPositionEmployee.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployeeSide = async (
loader: boolean,
selector: boolean
) => {
let apiPositionEmployeeSide = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployeeSide = config.API.positionEmployeePositionSide;
} else {
apiPositionEmployeeSide =
config.API.listPositionEmployeePositionSideHistory;
}
await http
.get(apiPositionEmployeeSide)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeSideResponse[] = [];
if (selector) {
data.map((e: positionEmployeeSideResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
note: e.note,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeSideResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
note: e.note,
});
});
}
draftPositionEmployeeSide.value = rows;
if (loader) {
dataPositionEmployeeSide.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployeeGroup = async (
loader: boolean,
selector: boolean
) => {
let apiPositionEmployeeGroup = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployeeGroup = config.API.positionEmployeeGroup;
} else {
apiPositionEmployeeGroup = config.API.listPositionEmployeeGroupHistory;
}
await http
.get(apiPositionEmployeeGroup)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeGroupResponse[] = [];
if (selector) {
data.map((e: positionEmployeeGroupResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeGroupResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
}
draftPositionEmployeeGroup.value = rows;
if (loader) {
dataPositionEmployeeGroup.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployeeLine = async (
loader: boolean,
selector: boolean
) => {
let apiPositionEmployeeLine = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployeeLine = config.API.positionEmployeeLine;
} else {
apiPositionEmployeeLine = config.API.listPositionEmployeeLineHistory;
}
await http
.get(apiPositionEmployeeLine)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeLineResponse[] = [];
if (selector) {
data.map((e: positionEmployeeLineResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeLineResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
}
draftPositionEmployeeLine.value = rows;
if (loader) {
dataPositionEmployeeLine.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployeeLevel = async (
loader: boolean,
selector: boolean
) => {
let apiPositionEmployeeLevel = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployeeLevel = config.API.positionEmployeeLevel;
} else {
apiPositionEmployeeLevel = config.API.listPositionEmployeeLevelHistory;
}
await http
.get(apiPositionEmployeeLevel)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeLevelResponse[] = [];
if (selector) {
data.map((e: positionEmployeeLevelResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeLevelResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
}
draftPositionEmployeeLevel.value = rows;
if (loader) {
dataPositionEmployeeLevel.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
const fetchPositionEmployeeStatus = async (
loader: boolean,
selector: boolean
) => {
let apiPositionEmployeeStatus = "";
if (loader) {
showLoader();
}
if (selector) {
apiPositionEmployeeStatus = config.API.positionEmployeeStatus;
} else {
apiPositionEmployeeStatus = config.API.listPositionEmployeeStatusHistory;
}
await http
.get(apiPositionEmployeeStatus)
.then((res) => {
const data = res.data.result;
let rows: positionEmployeeStatusResponse[] = [];
if (selector) {
data.map((e: positionEmployeeStatusResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
} else {
storeVersion.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
storeIdVersion.value = data.id; //เลข id ใน mongodb
data.items.map((e: positionEmployeeStatusResponse) => {
rows.push({
id: e.id,
name: e.name,
createdAt: e.createdAt,
lastUpdatedAt: e.lastUpdatedAt,
lastUpdateFullName: e.lastUpdateFullName,
isActive: e.isActive,
createdFullName: e.createdFullName,
createdUserId: e.createdUserId,
lastUpdateUserId: e.lastUpdateUserId,
});
});
}
draftPositionEmployeeStatus.value = rows;
if (loader) {
dataPositionEmployeeStatus.value = rows;
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
if (loader) {
hideLoader();
}
});
};
return { return {
dataPrefix, dataPrefix,
dataInsignia,
dataInsigniaType,
dataPositionEmployee,
dataPositionEmployeeSide,
dataPositionEmployeeGroup,
dataPositionEmployeeLine,
dataPositionEmployeeLevel,
dataPositionEmployeeStatus,
storeIdVersion, storeIdVersion,
storeVersion, storeVersion,
manageData, manageData,
@ -325,5 +1122,13 @@ export const useManageDataStore = defineStore("manage", () => {
changeManageCurrentTab, changeManageCurrentTab,
changeManageLink, changeManageLink,
changeManageColumns, changeManageColumns,
getInsignia,
getInsigniaType,
getPositionEmployee,
getPositionEmployeeSide,
getPositionEmployeeGroup,
getPositionEmployeeLine,
getPositionEmployeeLevel,
getPositionEmployeeStatus,
}; };
}); });

View file

@ -165,7 +165,8 @@ onMounted(async () => {
fiscalYearFilter() fiscalYearFilter()
examTimeFilter() examTimeFilter()
examTypeFilter() examTypeFilter()
expiredAccountFilter() await expiredAccountFilter()
searchFilterTable()
}) })
// //
@ -276,7 +277,7 @@ const expiredAccountFilter = async () => {
const currentDate = new Date(); const currentDate = new Date();
const updatedRows = OriginalData.value.map((data) => { const updatedRows = OriginalData.value.map((data) => {
let expirationDate = new Date(data.accountExpirationDate); let expirationDate = new Date(data.accountExpirationDate);
let isExpired = expirationDate < currentDate; let isExpired = expirationDate < currentDate
return { ...data, isExpired }; return { ...data, isExpired };
}); });

View file

@ -165,7 +165,8 @@ onMounted(async () => {
fiscalYearFilter() fiscalYearFilter()
examTimeFilter() examTimeFilter()
examTypeFilter() examTypeFilter()
expiredAccountFilter() await expiredAccountFilter()
searchFilterTable()
}) })
// //
@ -276,7 +277,7 @@ const expiredAccountFilter = async () => {
const currentDate = new Date(); const currentDate = new Date();
const updatedRows = OriginalData.value.map((data) => { const updatedRows = OriginalData.value.map((data) => {
let expirationDate = new Date(data.accountExpirationDate); let expirationDate = new Date(data.accountExpirationDate);
let isExpired = expirationDate < currentDate; let isExpired = expirationDate < currentDate
return { ...data, isExpired }; return { ...data, isExpired };
}); });

View file

@ -35,22 +35,23 @@ export const usePlacementDataStore = defineStore("placement", () => {
DataMainUpdate.value = []; DataMainUpdate.value = [];
if (filter_1 === null && filter_2 === 0 && filter_3 === false) { if (filter_1 === null && filter_2 === 0 && filter_3 === false) {
// console.log('case 1'); // console.log('case 1');
return DataMainUpdate.value = DataMainOrig.value; // return DataMainUpdate.value = DataMainOrig.value; อันเก่า
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
} else if (filter_1 === null && filter_2 === null && filter_3 === false) { } else if (filter_1 === null && filter_2 === null && filter_3 === false) {
// console.log('case 1.1'); // console.log('case 1.1');
return DataMainUpdate.value = DataMainOrig.value; return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
} else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) { } else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) {
// console.log('case 2'); // console.log('case 2');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.isExpired === filter_3);
} else if (filter_1 !== null && filter_2 === null && filter_3 === false) { } else if (filter_1 !== null && filter_2 === null && filter_3 === false) {
// console.log('case 2.1'); // console.log('case 2.1');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.isExpired === filter_3);
} else if (filter_1 !== null && filter_2 !== 0 && filter_3 === false) { } else if (filter_1 !== null && filter_2 !== 0 && filter_3 === false) {
// console.log('case 2.2'); // console.log('case 2.2');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.examType === filter_2); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.examType === filter_2 && item.isExpired === filter_3);
} else if (filter_1 === null && filter_2 !== 0 && filter_3 === false) { } else if (filter_1 === null && filter_2 !== 0 && filter_3 === false) {
// console.log('case 3'); // console.log('case 3');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType === filter_2); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType === filter_2 && item.isExpired === filter_3);
} else if (filter_1 === null && filter_2 === 0 && filter_3 === true) { } else if (filter_1 === null && filter_2 === 0 && filter_3 === true) {
// console.log('case 3.1'); // console.log('case 3.1');
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);