Merge branch 'develop' into anandadev
This commit is contained in:
commit
7c6cc819ca
25 changed files with 3194 additions and 1828 deletions
|
|
@ -14,6 +14,7 @@ export default {
|
|||
/**
|
||||
* api ตำแหน่ง
|
||||
*/
|
||||
positionEmployeePosition,
|
||||
listPositionEmployeePositionHistory: `${positionEmployeePosition}history`,
|
||||
listPositionEmployeePositionHistoryId: (id: string) =>
|
||||
`${positionEmployeePosition}history/${id}`,
|
||||
|
|
@ -23,6 +24,7 @@ export default {
|
|||
/**
|
||||
* api ด้านของตำแหน่ง
|
||||
*/
|
||||
positionEmployeePositionSide,
|
||||
listPositionEmployeePositionSideHistory: `${positionEmployeePositionSide}history`,
|
||||
listPositionEmployeePositionSideHistoryId: (id: string) =>
|
||||
`${positionEmployeePositionSide}history/${id}`,
|
||||
|
|
@ -32,6 +34,7 @@ export default {
|
|||
/**
|
||||
* api กลุ่มงาน
|
||||
*/
|
||||
positionEmployeeGroup,
|
||||
listPositionEmployeeGroupHistory: `${positionEmployeeGroup}history`,
|
||||
listPositionEmployeeGroupHistoryId: (id: string) =>
|
||||
`${positionEmployeeGroup}history/${id}`,
|
||||
|
|
@ -41,6 +44,7 @@ export default {
|
|||
/**
|
||||
* api สายงาน
|
||||
*/
|
||||
positionEmployeeLine,
|
||||
listPositionEmployeeLineHistory: `${positionEmployeeLine}history`,
|
||||
listPositionEmployeeLineHistoryId: (id: string) =>
|
||||
`${positionEmployeeLine}history/${id}`,
|
||||
|
|
@ -50,6 +54,7 @@ export default {
|
|||
/**
|
||||
* api ระดับชั้นงาน
|
||||
*/
|
||||
positionEmployeeLevel,
|
||||
listPositionEmployeeLevelHistory: `${positionEmployeeLevel}history`,
|
||||
listPositionEmployeeLevelHistoryId: (id: string) =>
|
||||
`${positionEmployeeLevel}history/${id}`,
|
||||
|
|
@ -59,6 +64,7 @@ export default {
|
|||
/**
|
||||
* api สถานะของตำแหน่ง
|
||||
*/
|
||||
positionEmployeeStatus,
|
||||
listPositionEmployeeStatusHistory: `${positionEmployeeStatus}history`,
|
||||
listPositionEmployeeStatusHistoryId: (id: string) =>
|
||||
`${positionEmployeeStatus}history/${id}`,
|
||||
|
|
|
|||
|
|
@ -303,8 +303,8 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const { manageData, changeManageColumns, getInsignia, dataInsignia } = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>(dataInsignia); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
const tittleHistory = ref<string>("ประวัติแก้ไขชื่อเครื่องราชฯ"); //
|
||||
|
|
@ -574,46 +574,51 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listInsigniaHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
rows.value.sort(
|
||||
(
|
||||
firstItem: RequestItemsHistoryObject,
|
||||
secondItem: RequestItemsHistoryObject
|
||||
) => firstItem.level - secondItem.level
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fetchinsigniaType();
|
||||
});
|
||||
const result = await getInsignia(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listInsigniaHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// rows.value.sort(
|
||||
// (
|
||||
// firstItem: RequestItemsHistoryObject,
|
||||
// secondItem: RequestItemsHistoryObject
|
||||
// ) => firstItem.level - secondItem.level
|
||||
// );
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// await fetchinsigniaType();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,8 +204,9 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const { manageData, changeManageColumns, getInsigniaType, dataInsigniaType } =
|
||||
store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>(dataInsigniaType); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
const tittleHistory = ref<string>("ประวัติแก้ไขลำดับชั้นเครื่องราชฯ"); //
|
||||
|
|
@ -363,37 +364,42 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listInsigniaTypeHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getInsigniaType(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listInsigniaTypeHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -371,15 +371,15 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
// rows.value = [];
|
||||
const result = await getPrefix(false, true);
|
||||
const result = await getPrefix(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
console.log(result);
|
||||
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
|
|
@ -459,7 +459,7 @@ const clearPublishedData = async () => {
|
|||
})
|
||||
.finally(async () => {
|
||||
await fetchHistory();
|
||||
await fetchData();
|
||||
await fetchData(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ const publishedData = async () => {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await fetchData();
|
||||
await fetchData(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -538,7 +538,7 @@ const save = async (publish: boolean) => {
|
|||
.then(async (res) => {
|
||||
if (publish === false) {
|
||||
success($q, "บันทึกข้อมูลร่างสำเร็จ");
|
||||
await fetchData(); //ไม่เผยแพร่และ get data ล่าสุดมาใหม่
|
||||
await fetchData(true); //ไม่เผยแพร่และ get data ล่าสุดมาใหม่
|
||||
} else {
|
||||
await publishedData(); //เผยแพร่ข้อมูลต
|
||||
}
|
||||
|
|
@ -570,7 +570,7 @@ const checkDupDataName = (val: string) => {
|
|||
* ฟังก์ชันปุ่มแก้ไข ให้ get data มาใหม่
|
||||
*/
|
||||
const clickEdit = async () => {
|
||||
await fetchData();
|
||||
await fetchData(true);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -592,7 +592,7 @@ const clickDelete = async () => {
|
|||
*/
|
||||
const clickCancel = async () => {
|
||||
edit.value = false;
|
||||
await fetchData();
|
||||
await fetchData(true);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const { manageData, changeManageColumns, getPositionPath, dataPositionPath } =
|
||||
store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -400,38 +401,43 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionPathHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionPath(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionPathHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,7 +204,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployeeGroup,
|
||||
dataPositionEmployeeGroup,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -363,37 +368,42 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeeGroupHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployeeGroup(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeeGroupHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,7 +204,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployeeLevel,
|
||||
dataPositionEmployeeLevel,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -362,37 +367,43 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeeLevelHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployeeLevel(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeeLevelHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,7 +204,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployeeLine,
|
||||
dataPositionEmployeeLine,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -363,37 +368,42 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeeLineHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployeeLine(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeeLineHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -216,7 +216,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployee,
|
||||
dataPositionEmployee,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -399,38 +404,43 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeePositionHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployee(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeePositionHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -216,7 +216,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployeeSide,
|
||||
dataPositionEmployeeSide,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -399,38 +404,43 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeePositionSideHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployeeSide(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeePositionSideHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -204,7 +204,12 @@ const { loaderPage } = dataStore;
|
|||
const mixin = useCounterMixin();
|
||||
const { success, dateText, messageError, showLoader, hideLoader } = mixin;
|
||||
const store = useManageDataStore();
|
||||
const { manageData, changeManageColumns } = store;
|
||||
const {
|
||||
manageData,
|
||||
changeManageColumns,
|
||||
getPositionEmployeeStatus,
|
||||
dataPositionEmployeeStatus,
|
||||
} = store;
|
||||
const rows = ref<RequestItemsHistoryObject[]>([]); //list data table
|
||||
const rowsHistory = ref<RequestItemsHistoryObject[]>([]); //select data history
|
||||
const rawHistory = ref<RequestItemsHistoryObject[]>([]); //raw data history
|
||||
|
|
@ -363,37 +368,42 @@ const $q = useQuasar();
|
|||
/**
|
||||
* ฟังก์ชัน get data ล่าสุด
|
||||
*/
|
||||
const fetchData = async () => {
|
||||
const fetchData = async (load: boolean = false) => {
|
||||
await props.fetchDataComponent();
|
||||
rows.value.splice(0);
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.listPositionEmployeeStatusHistory)
|
||||
.then((res) => {
|
||||
let data = res.data.result;
|
||||
version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = data.id; //เลข id ใน mongodb
|
||||
data.items.map((e: RequestItemsHistoryObject) => {
|
||||
rows.value.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,
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
updateData.value = false;
|
||||
hideLoader();
|
||||
});
|
||||
const result = await getPositionEmployeeStatus(false, load);
|
||||
version.value = result.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
idVersion.value = result.idversion; //เลข id ใน mongodb
|
||||
rows.value = result.data;
|
||||
updateData.value = false;
|
||||
// rows.value.splice(0);
|
||||
// showLoader();
|
||||
// await http
|
||||
// .get(config.API.listPositionEmployeeStatusHistory)
|
||||
// .then((res) => {
|
||||
// let data = res.data.result;
|
||||
// version.value = data.version; //ตัวแปรที่บอกว่าข้อมูลเผยแพร่ไปหรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
// idVersion.value = data.id; //เลข id ใน mongodb
|
||||
// data.items.map((e: RequestItemsHistoryObject) => {
|
||||
// rows.value.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,
|
||||
// });
|
||||
// });
|
||||
// })
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// updateData.value = false;
|
||||
// hideLoader();
|
||||
// });
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,15 @@ import http from "@/plugins/http";
|
|||
import config from "@/app.config";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
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";
|
||||
import type { RequestItemsHistoryObject as positionPathResponse } from "@/modules/01_metadata/interface/request/position/Path";
|
||||
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
|
|
@ -13,6 +22,25 @@ const { success, messageError, showLoader, hideLoader } = mixin;
|
|||
export const useManageDataStore = defineStore("manage", () => {
|
||||
const dataPrefix = 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 dataPositionPath = ref<positionPathResponse[]>([]); //list data table
|
||||
const draftPositionPath = ref<positionPathResponse[]>([]); //list data table
|
||||
|
||||
const storeIdVersion = ref<string>(""); //id data ใน mongodb
|
||||
const storeVersion = ref<string>("published"); //รายการข้อมูลล่าสุดได้เผยแพร่หรือยัง published=เผยแพร่แล้ว draft=ยังไม่เผยแพร่
|
||||
interface manage {
|
||||
|
|
@ -269,6 +297,267 @@ 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 getPositionPath = async (
|
||||
selector: boolean = false,
|
||||
newFetch: boolean = false
|
||||
) => {
|
||||
if (dataPositionPath.value.length === 0) {
|
||||
await fetchPositionPath(true, selector);
|
||||
return {
|
||||
data: draftPositionPath.value,
|
||||
version: storeVersion.value,
|
||||
idversion: storeIdVersion.value,
|
||||
};
|
||||
} else {
|
||||
if (newFetch) {
|
||||
await fetchPositionPath(true, selector);
|
||||
return {
|
||||
data: draftPositionPath.value,
|
||||
version: storeVersion.value,
|
||||
idversion: storeIdVersion.value,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
data: draftPositionPath.value,
|
||||
version: storeVersion.value,
|
||||
idversion: storeIdVersion.value,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const fetchPrefix = async (loader: boolean, selector: boolean) => {
|
||||
let apiPrefix = "";
|
||||
if (loader) {
|
||||
|
|
@ -316,8 +605,614 @@ 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();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const fetchPositionPath = async (loader: boolean, selector: boolean) => {
|
||||
let apiPositionPath = "";
|
||||
if (loader) {
|
||||
showLoader();
|
||||
}
|
||||
if (selector) {
|
||||
apiPositionPath = config.API.positionPath;
|
||||
} else {
|
||||
apiPositionPath = config.API.listPositionPathHistory;
|
||||
}
|
||||
await http
|
||||
.get(apiPositionPath)
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
let rows: positionPathResponse[] = [];
|
||||
if (selector) {
|
||||
data.map((e: positionPathResponse) => {
|
||||
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: positionPathResponse) => {
|
||||
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,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
draftPositionPath.value = rows;
|
||||
if (loader) {
|
||||
dataPositionPath.value = rows;
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
if (loader) {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
dataPrefix,
|
||||
dataInsignia,
|
||||
dataInsigniaType,
|
||||
dataPositionEmployee,
|
||||
dataPositionEmployeeSide,
|
||||
dataPositionEmployeeGroup,
|
||||
dataPositionEmployeeLine,
|
||||
dataPositionEmployeeLevel,
|
||||
dataPositionEmployeeStatus,
|
||||
dataPositionPath,
|
||||
storeIdVersion,
|
||||
storeVersion,
|
||||
manageData,
|
||||
|
|
@ -325,5 +1220,14 @@ export const useManageDataStore = defineStore("manage", () => {
|
|||
changeManageCurrentTab,
|
||||
changeManageLink,
|
||||
changeManageColumns,
|
||||
getInsignia,
|
||||
getInsigniaType,
|
||||
getPositionEmployee,
|
||||
getPositionEmployeeSide,
|
||||
getPositionEmployeeGroup,
|
||||
getPositionEmployeeLine,
|
||||
getPositionEmployeeLevel,
|
||||
getPositionEmployeeStatus,
|
||||
getPositionPath,
|
||||
};
|
||||
});
|
||||
|
|
|
|||
426
src/modules/05_placement/components/exams_korkor/Main.vue
Normal file
426
src/modules/05_placement/components/exams_korkor/Main.vue
Normal file
|
|
@ -0,0 +1,426 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, useAttrs } from 'vue';
|
||||
import type { QTableProps } from 'quasar';
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||
import type { DataOption } from "@/modules/05_placement/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||
import router from '@/router';
|
||||
|
||||
const DataStore = usePlacementDataStore()
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dateText } = mixin;
|
||||
|
||||
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
||||
const textDate = (value: Date) => {
|
||||
return dateText(value);
|
||||
};
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "id",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "id",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "examRound",
|
||||
align: "left",
|
||||
label: "รอบการสอบ",
|
||||
sortable: true,
|
||||
field: "examRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examOrder",
|
||||
align: "left",
|
||||
label: "ครั้งที่",
|
||||
sortable: true,
|
||||
field: "examOrder",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fiscalYear",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "fiscalYear",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "numberofCandidates",
|
||||
align: "left",
|
||||
label: "จำนวนผู้สอบได้",
|
||||
sortable: false,
|
||||
field: "numberofCandidates",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examType",
|
||||
align: "left",
|
||||
label: "ประเภทการสอบ",
|
||||
sortable: false,
|
||||
field: "examType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "accountExpirationDate",
|
||||
align: "left",
|
||||
label: "วันที่บัญชีหมดอายุ",
|
||||
sortable: true,
|
||||
field: "accountExpirationDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormPlacementMainData[]>([{
|
||||
id: 1,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 3,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 8,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 12,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 20,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-01-31T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2022,
|
||||
numberofCandidates: 16,
|
||||
examType: 2,
|
||||
accountExpirationDate: "2023-11-30T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 1,
|
||||
fiscalYear: 2021,
|
||||
numberofCandidates: 20,
|
||||
examType: 2,
|
||||
accountExpirationDate: "2024-05-21T14:47:04.1785384Z",
|
||||
},
|
||||
]);
|
||||
|
||||
let OriginalData = ref<FormPlacementMainData[]>([]);
|
||||
let UpdataData = ref<FormPlacementMainData[]>([]);
|
||||
|
||||
const OriginalDataFetch = async () => {
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
await DataStore.DataMain(rows.value)
|
||||
OriginalData.value = await DataStore.DataMainOrig
|
||||
UpdataData.value = OriginalData.value
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await OriginalDataFetch()
|
||||
fiscalYearFilter()
|
||||
examTimeFilter()
|
||||
examTypeFilter()
|
||||
await expiredAccountFilter()
|
||||
searchFilterTable()
|
||||
})
|
||||
|
||||
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
||||
const redirectToPage = (id: number) => {
|
||||
router.push({
|
||||
name: 'placementDetail',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// เลือกปีงบประมาณ
|
||||
const fiscalyear = ref<number | null>(0);
|
||||
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: 'ทั้งหมด' }]);
|
||||
const addedfiscalYearValues: number[] = [];
|
||||
const fiscalYearFilter = async () => {
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// DataStore.DataMainYearSet(rows.value);
|
||||
// fiscalyearOP.value = DataStore.DataMainYearGet;
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
for (let data of OriginalData.value) {
|
||||
const year = data.fiscalYear + 543;
|
||||
|
||||
if (fiscalyear.value === null || year > fiscalyear.value) {
|
||||
fiscalyear.value = year;
|
||||
}
|
||||
|
||||
if (!addedfiscalYearValues.includes(year)) {
|
||||
fiscalyearOP.push({ id: year, name: year.toString() });
|
||||
addedfiscalYearValues.push(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// เลือกปีงบประมาณตาม API
|
||||
const searchfiscalyear = () => {
|
||||
console.log('Input value changed:', fiscalyear.value);
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
};
|
||||
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const visibleColumns = ref<string[]>(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// ครั้งที่สอบ
|
||||
const examTime = ref<number | null>(null);
|
||||
const examTimeOP = ref<number[]>([]);
|
||||
const examTimeFilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
if (!examTimeOP.value.includes(data.examOrder)) {
|
||||
examTimeOP.value.push(data.examOrder);
|
||||
}
|
||||
}
|
||||
examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ
|
||||
}
|
||||
|
||||
// ประเภทการสอบ
|
||||
const examType = ref<number | null>(0);
|
||||
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
||||
const addedexamTypeValues: number[] = [];
|
||||
const examTypeFilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const examTypeValue = data.examType;
|
||||
if (examTypeValue == 1 && !addedexamTypeValues.includes(1)) {
|
||||
examTypeOP.push({ id: 1, name: "คัดเลือก" });
|
||||
addedexamTypeValues.push(1);
|
||||
} else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) {
|
||||
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
|
||||
addedexamTypeValues.push(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const searchFilterTable = async () => {
|
||||
// console.log('Input value changed:', examTime.value, examType.value, expiredAccount.value);
|
||||
await DataStore.DataUpdateMain(examTime.value, examType.value, expiredAccount.value);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
};
|
||||
|
||||
// บัญชีหมดอายุ
|
||||
const expiredAccount = ref<boolean>(false);
|
||||
const expiredAccountFilter = async () => {
|
||||
const currentDate = new Date();
|
||||
const updatedRows = OriginalData.value.map((data) => {
|
||||
let expirationDate = new Date(data.accountExpirationDate);
|
||||
let isExpired = expirationDate < currentDate
|
||||
|
||||
return { ...data, isExpired };
|
||||
});
|
||||
await DataStore.DataMain(updatedRows);
|
||||
};
|
||||
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true)
|
||||
return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการสอบแข่งขัน / คัดเลือก
|
||||
</div>
|
||||
<div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="row q-pa-md">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP"
|
||||
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-6"></div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-input standout dense v-model="filterKeyword" ref="filterRef" outlined debounce="300" placeholder="ค้นหา"
|
||||
class="q-ml-sm">
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon v-if="filterKeyword !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select v-model="visibleColumns" multiple outlined dense options-dense :display-value="$q.lang.table.columns"
|
||||
emit-value map-options :options="columns" option-value="name" options-cover style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-card bordered class="col-12 filter-card">
|
||||
<div class="row q-pa-sm">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select v-model="examTime" label="ครั้งที่" dense clearable emit-value map-options :options="examTimeOP"
|
||||
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select v-model="examType" label="ประเภทการสอบ" dense clearable emit-value map-options option-label="name"
|
||||
:options="examTypeOP" option-value="id" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||
<q-toggle v-model="expiredAccount" class="toggle-expired-account" color="blue" label="แสดงบัญชีหมดอายุ"
|
||||
@update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-table ref="table" :columns="columns" :rows="UpdataData" :filter="filterKeyword" row-key="id" flat bordered
|
||||
dense class="custom-header-table" v-bind="attrs" :visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel">
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer" @click="redirectToPage(props.row.id)">
|
||||
<q-td key="id" :props="props">
|
||||
{{ props.row.id }}
|
||||
</q-td>
|
||||
<q-td key="examRound" :props="props">
|
||||
{{ props.row.examRound }}
|
||||
</q-td>
|
||||
<q-td key="examOrder" :props="props">
|
||||
{{ props.row.examOrder }}
|
||||
</q-td>
|
||||
<q-td key="fiscalYear" :props="props">
|
||||
{{ props.row.fiscalYear + 543 }}
|
||||
</q-td>
|
||||
<q-td key="numberofCandidates" :props="props">
|
||||
{{ props.row.numberofCandidates }}
|
||||
</q-td>
|
||||
<q-td key="examType" :props="props">
|
||||
{{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
|
||||
</q-td>
|
||||
<q-td key="accountExpirationDate" :props="props">
|
||||
{{ textDate(props.row.accountExpirationDate) }}
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.filter-card {
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
.toggle-expired-account {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 150%;
|
||||
color: #35373C;
|
||||
}
|
||||
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
}
|
||||
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* this will be the loading indicator */
|
||||
.q-table thead tr:last-child th {
|
||||
/* height of all previous header rows */
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
426
src/modules/05_placement/components/exams_sorkorcho/Main.vue
Normal file
426
src/modules/05_placement/components/exams_sorkorcho/Main.vue
Normal file
|
|
@ -0,0 +1,426 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, useAttrs } from 'vue';
|
||||
import type { QTableProps } from 'quasar';
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||
import type { DataOption } from "@/modules/05_placement/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||
import router from '@/router';
|
||||
|
||||
const DataStore = usePlacementDataStore()
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dateText } = mixin;
|
||||
|
||||
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
||||
const textDate = (value: Date) => {
|
||||
return dateText(value);
|
||||
};
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "id",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "id",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "examRound",
|
||||
align: "left",
|
||||
label: "รอบการสอบ",
|
||||
sortable: true,
|
||||
field: "examRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examOrder",
|
||||
align: "left",
|
||||
label: "ครั้งที่",
|
||||
sortable: true,
|
||||
field: "examOrder",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "fiscalYear",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "fiscalYear",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "numberofCandidates",
|
||||
align: "left",
|
||||
label: "จำนวนผู้สอบได้",
|
||||
sortable: false,
|
||||
field: "numberofCandidates",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "examType",
|
||||
align: "left",
|
||||
label: "ประเภทการสอบ",
|
||||
sortable: false,
|
||||
field: "examType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "accountExpirationDate",
|
||||
align: "left",
|
||||
label: "วันที่บัญชีหมดอายุ",
|
||||
sortable: true,
|
||||
field: "accountExpirationDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormPlacementMainData[]>([{
|
||||
id: 1,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 3,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 8,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 12,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2023,
|
||||
numberofCandidates: 20,
|
||||
examType: 1,
|
||||
accountExpirationDate: "2023-01-31T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 2,
|
||||
fiscalYear: 2022,
|
||||
numberofCandidates: 16,
|
||||
examType: 2,
|
||||
accountExpirationDate: "2023-11-30T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
examOrder: 1,
|
||||
fiscalYear: 2021,
|
||||
numberofCandidates: 20,
|
||||
examType: 2,
|
||||
accountExpirationDate: "2024-05-21T14:47:04.1785384Z",
|
||||
},
|
||||
]);
|
||||
|
||||
let OriginalData = ref<FormPlacementMainData[]>([]);
|
||||
let UpdataData = ref<FormPlacementMainData[]>([]);
|
||||
|
||||
const OriginalDataFetch = async () => {
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
await DataStore.DataMain(rows.value)
|
||||
OriginalData.value = await DataStore.DataMainOrig
|
||||
UpdataData.value = OriginalData.value
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await OriginalDataFetch()
|
||||
fiscalYearFilter()
|
||||
examTimeFilter()
|
||||
examTypeFilter()
|
||||
await expiredAccountFilter()
|
||||
searchFilterTable()
|
||||
})
|
||||
|
||||
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
||||
const redirectToPage = (id: number) => {
|
||||
router.push({
|
||||
name: 'placementDetail',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// เลือกปีงบประมาณ
|
||||
const fiscalyear = ref<number | null>(0);
|
||||
const fiscalyearOP = reactive<DataOption[]>([{ id: 0, name: 'ทั้งหมด' }]);
|
||||
const addedfiscalYearValues: number[] = [];
|
||||
const fiscalYearFilter = async () => {
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// DataStore.DataMainYearSet(rows.value);
|
||||
// fiscalyearOP.value = DataStore.DataMainYearGet;
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
for (let data of OriginalData.value) {
|
||||
const year = data.fiscalYear + 543;
|
||||
|
||||
if (fiscalyear.value === null || year > fiscalyear.value) {
|
||||
fiscalyear.value = year;
|
||||
}
|
||||
|
||||
if (!addedfiscalYearValues.includes(year)) {
|
||||
fiscalyearOP.push({ id: year, name: year.toString() });
|
||||
addedfiscalYearValues.push(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// เลือกปีงบประมาณตาม API
|
||||
const searchfiscalyear = () => {
|
||||
console.log('Input value changed:', fiscalyear.value);
|
||||
// API
|
||||
// await http
|
||||
// .get(config.API.// ตัวอย่าง)
|
||||
// .then((res: any) => {
|
||||
// })
|
||||
// .catch((e: any) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(async () => {
|
||||
// });
|
||||
};
|
||||
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const visibleColumns = ref<string[]>(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// ครั้งที่สอบ
|
||||
const examTime = ref<number | null>(null);
|
||||
const examTimeOP = ref<number[]>([]);
|
||||
const examTimeFilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
if (!examTimeOP.value.includes(data.examOrder)) {
|
||||
examTimeOP.value.push(data.examOrder);
|
||||
}
|
||||
}
|
||||
examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ
|
||||
}
|
||||
|
||||
// ประเภทการสอบ
|
||||
const examType = ref<number | null>(0);
|
||||
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
||||
const addedexamTypeValues: number[] = [];
|
||||
const examTypeFilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const examTypeValue = data.examType;
|
||||
if (examTypeValue == 1 && !addedexamTypeValues.includes(1)) {
|
||||
examTypeOP.push({ id: 1, name: "คัดเลือก" });
|
||||
addedexamTypeValues.push(1);
|
||||
} else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) {
|
||||
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
|
||||
addedexamTypeValues.push(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const searchFilterTable = async () => {
|
||||
// console.log('Input value changed:', examTime.value, examType.value, expiredAccount.value);
|
||||
await DataStore.DataUpdateMain(examTime.value, examType.value, expiredAccount.value);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
};
|
||||
|
||||
// บัญชีหมดอายุ
|
||||
const expiredAccount = ref<boolean>(false);
|
||||
const expiredAccountFilter = async () => {
|
||||
const currentDate = new Date();
|
||||
const updatedRows = OriginalData.value.map((data) => {
|
||||
let expirationDate = new Date(data.accountExpirationDate);
|
||||
let isExpired = expirationDate < currentDate
|
||||
|
||||
return { ...data, isExpired };
|
||||
});
|
||||
await DataStore.DataMain(updatedRows);
|
||||
};
|
||||
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true)
|
||||
return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการสอบแข่งขัน / คัดเลือก
|
||||
</div>
|
||||
<div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="row q-pa-md">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select v-model="fiscalyear" label="ปีงบประมาณ" dense clearable emit-value map-options :options="fiscalyearOP"
|
||||
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-6"></div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-input standout dense v-model="filterKeyword" ref="filterRef" outlined debounce="300" placeholder="ค้นหา"
|
||||
class="q-ml-sm">
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon v-if="filterKeyword !== ''" name="clear" class="cursor-pointer" @click="resetFilter" />
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select v-model="visibleColumns" multiple outlined dense options-dense :display-value="$q.lang.table.columns"
|
||||
emit-value map-options :options="columns" option-value="name" options-cover style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-card bordered class="col-12 filter-card">
|
||||
<div class="row q-pa-sm">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select v-model="examTime" label="ครั้งที่" dense clearable emit-value map-options :options="examTimeOP"
|
||||
option-value="id" option-label="name" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select v-model="examType" label="ประเภทการสอบ" dense clearable emit-value map-options option-label="name"
|
||||
:options="examTypeOP" option-value="id" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||
<q-toggle v-model="expiredAccount" class="toggle-expired-account" color="blue" label="แสดงบัญชีหมดอายุ"
|
||||
@update:model-value="searchFilterTable" />
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-table ref="table" :columns="columns" :rows="UpdataData" :filter="filterKeyword" row-key="id" flat bordered
|
||||
dense class="custom-header-table" v-bind="attrs" :visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel">
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer" @click="redirectToPage(props.row.id)">
|
||||
<q-td key="id" :props="props">
|
||||
{{ props.row.id }}
|
||||
</q-td>
|
||||
<q-td key="examRound" :props="props">
|
||||
{{ props.row.examRound }}
|
||||
</q-td>
|
||||
<q-td key="examOrder" :props="props">
|
||||
{{ props.row.examOrder }}
|
||||
</q-td>
|
||||
<q-td key="fiscalYear" :props="props">
|
||||
{{ props.row.fiscalYear + 543 }}
|
||||
</q-td>
|
||||
<q-td key="numberofCandidates" :props="props">
|
||||
{{ props.row.numberofCandidates }}
|
||||
</q-td>
|
||||
<q-td key="examType" :props="props">
|
||||
{{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
|
||||
</q-td>
|
||||
<q-td key="accountExpirationDate" :props="props">
|
||||
{{ textDate(props.row.accountExpirationDate) }}
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.filter-card {
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
.toggle-expired-account {
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 150%;
|
||||
color: #35373C;
|
||||
}
|
||||
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
}
|
||||
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* this will be the loading indicator */
|
||||
.q-table thead tr:last-child th {
|
||||
/* height of all previous header rows */
|
||||
top: 48px;
|
||||
}
|
||||
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,14 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref } from "vue";
|
||||
|
||||
import { useQuasar } from "quasar";
|
||||
import { defineAsyncComponent } from "@vue/runtime-core";
|
||||
import { useRouter } from "vue-router";
|
||||
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const year = ref<string>("2566");
|
||||
const round = ref<string>("1");
|
||||
const title = ref<string>("การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ");
|
||||
|
||||
const sizeCard = (val: number) => {
|
||||
if (val === 5) {
|
||||
return "width:15%;";
|
||||
}
|
||||
};
|
||||
const itemTop = reactive([
|
||||
{
|
||||
id: 1,
|
||||
|
|
@ -54,13 +58,11 @@ const AddTablePosition = defineAsyncComponent(
|
|||
</div>
|
||||
<q-space />
|
||||
|
||||
<div class="q-py-md row col-12 no-wrap">
|
||||
<hr class="q-separator q-separator--vertical gt-sm" aria-orientation="vertical" style="width: 2px" />
|
||||
|
||||
<div class="q-py-md row col-12">
|
||||
<div class="col-12 row bg-white">
|
||||
<div class="fit q-pa-md">
|
||||
<div class="row col-12 q-col-gutter-md fit">
|
||||
<div class="" v-for="item in itemTop" :key="item.id" style="width: 15%">
|
||||
<div class="" v-for="item in itemTop" :key="item.id" :style="$q.screen.lt.md ? '' : sizeCard(5)" :class="$q.screen.lt.sm ? 'col-4' : ''">
|
||||
<div class="q-card q-card--bordered q-card--flat no-shadow row fit cardNum items-center q-pa-sm">
|
||||
<div class="col-12 row items-center q-pa-sm">
|
||||
<div class="col-12 text-h5 text-weight-bold" :style="{ color: item.color }">
|
||||
|
|
|
|||
|
|
@ -1,21 +1,4 @@
|
|||
<template>
|
||||
<q-card-actions class="text-primary">
|
||||
<q-space />
|
||||
<q-btn v-if="!editvisible" flat round :disabled="editvisible" :color="editvisible ? 'grey-7' : 'primary'"
|
||||
@click="edit" icon="mdi-pencil-outline">
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<div v-else>
|
||||
|
||||
<q-btn flat round :disabled="!editvisible" :color="!editvisible ? 'grey-7' : 'public'" @click="checkSave"
|
||||
icon="mdi-content-save-outline">
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-card-actions>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, useAttrs } from "vue";
|
||||
|
||||
const props = defineProps({
|
||||
editvisible: Boolean,
|
||||
|
|
@ -59,3 +42,18 @@ const checkSave = () => {
|
|||
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<q-card-actions class="text-primary">
|
||||
<q-space />
|
||||
<q-btn v-if="!editvisible" flat round :disabled="editvisible" :color="editvisible ? 'grey-7' : 'primary'"
|
||||
@click="edit" icon="mdi-pencil-outline">
|
||||
<q-tooltip>แก้ไขข้อมูล</q-tooltip>
|
||||
</q-btn>
|
||||
<div v-else>
|
||||
<q-btn flat round :disabled="!editvisible" :color="!editvisible ? 'grey-7' : 'public'" @click="checkSave"
|
||||
icon="mdi-content-save-outline">
|
||||
<q-tooltip>บันทึก</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</q-card-actions>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,4 @@
|
|||
<template>
|
||||
<q-toolbar>
|
||||
<q-toolbar-title class="text-subtitle2 text-bold">{{ title }}</q-toolbar-title>
|
||||
<q-btn
|
||||
icon="close"
|
||||
unelevated
|
||||
round
|
||||
dense
|
||||
@click="close"
|
||||
style="color: #ff8080; background-color: #ffdede"
|
||||
/>
|
||||
</q-toolbar>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
import { ref, useAttrs } from "vue";
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
close: {
|
||||
|
|
@ -24,5 +9,23 @@ const props = defineProps({
|
|||
const close = async () => {
|
||||
props.close();
|
||||
};
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<q-toolbar class="header-main">
|
||||
<q-toolbar-title class="header-text">{{ title }}</q-toolbar-title>
|
||||
<q-btn icon="close" unelevated round dense @click="close" style="color: #ff8080; background-color: #ffdede" />
|
||||
</q-toolbar>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header-main {
|
||||
padding: 16px 0px 16px 27px;
|
||||
}
|
||||
|
||||
.header-text {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
line-height: 26px;
|
||||
color: #35373C;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
313
src/modules/05_placement/components/pass/TableDetail.vue
Normal file
313
src/modules/05_placement/components/pass/TableDetail.vue
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
<script setup lang="ts">
|
||||
|
||||
import { ref } from "vue";
|
||||
import DialogHeader from "@/modules/05_placement/components/pass/DialogHeader.vue";
|
||||
import DialogFooter from "@/modules/05_placement/components/pass/DialogFooter.vue";
|
||||
|
||||
const save = ref<boolean>(true);
|
||||
const props = defineProps({
|
||||
Modal: Boolean,
|
||||
close: {
|
||||
type: Function,
|
||||
default: () => console.log("not function"),
|
||||
},
|
||||
getdetail: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
});
|
||||
|
||||
interface CheckboxItem {
|
||||
id: number;
|
||||
label: string;
|
||||
}
|
||||
|
||||
const selection = ref([]);
|
||||
const checkboxItems: CheckboxItem[] = [
|
||||
{ id: 1, label: 'ไม่เป็นผู้ดำรงตำแหน่งทางการเมือง' },
|
||||
{ id: 2, label: 'ไม่เป็นคนไร้ความสามารถ คนเสมือนไร้ความสามารถ คนวิกลจริตหรือจิตฟั่นเฟือน ไม่สมประกอบหรือเป็นโรคตามที่กำหนดในกฎ ก.พ.' },
|
||||
{ id: 3, label: 'ไม่เป็นผู้อยู่ในระหว่างถูกสั่งพักราชการหรือถูกสั่งให้ออกจากราชการไว้ก่อนตามพระราชบัญญัตินี้ หรือตามกฎหมายอื่น' },
|
||||
{ id: 4, label: 'ไม่เป็นผู้บกพร่องในศีลธรรมอันดีจนเป็นที่รังเกียจของสังคม' },
|
||||
{ id: 5, label: 'ไม่เป็นกรรมการหรือผู้ดำรงตำแหน่งที่รับผิดชอบในการบริหารพรรคการเมือง หรือเจ้าหน้าที่ในพรรคการเมือง' },
|
||||
{ id: 6, label: 'ไม่เป็นบุคคลล้มละลาย' },
|
||||
{ id: 7, label: 'ไม่เป็นผู้เคยต้องรับโทษจำคุกโดยคำพิพากษาถึงที่สุดให้จำคุกเพราะกระทำความผิดทางอาญา เว้นแต่เป็นโทษสำหรับความผิดที่ใด้กระทำโดยประมาทหรือความผิดลหุโทษ' },
|
||||
{ id: 8, label: 'ไม่เป็นผู้เคยถูกลงโทษให้ออก ปลดออก หรือไล่ออกจากรัฐวิสาหกิจ หรือ หน่วยงานอื่นของรัฐ' },
|
||||
{ id: 9, label: 'เป็นผู้เคยถูลงโทษให้ออก หรือปลดออก เพราะกระทำผิตวินัยตามพระราชบัญญัตินี้ หรือตามกฎหมายอื่น' },
|
||||
{ id: 10, label: 'เป็นผู้เคยถูกลงโทษไล่ออก เพราะกระทำผิดวินัยตามพระราชบัญญัตินี้ หรือตามกฎหมายอื่น' },
|
||||
{ id: 11, label: 'เป็นผู้เคยกระทำการทุจริตในการสอบเข้ารับราชการ หรือเข้าปฏิบัติงานใน หน่วยงานของรัฐ' },
|
||||
];
|
||||
|
||||
const clickSave = async () => {
|
||||
console.log(selection.value)
|
||||
};
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<q-dialog v-model="props.Modal">
|
||||
<q-card style="max-width: 100%;width:80%;">
|
||||
<q-form ref="myForm">
|
||||
<div class="row">
|
||||
<DialogHeader :title="`รายละเอียดของ ${props.getdetail.fullName}`" :close="close" />
|
||||
</div>
|
||||
<q-separator />
|
||||
|
||||
<div class="contanier-box-main">
|
||||
<div class="contanier-box-mini">
|
||||
<q-card bordered class="card-panding">
|
||||
<div class="row items-center q-pa-xs header-text">
|
||||
ข้อมูลทั่วไป <span class="check-officer"><q-icon name="mdi-check" />
|
||||
ข้าราชการฯ กทม</span>
|
||||
</div>
|
||||
<div class="row q-pa-xs">
|
||||
<div class="col-3 header-sub-text">
|
||||
<div class="q-pb-md">
|
||||
เลขที่ประจำตัวประชาชน
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
วัน/เดือน/ปีเกิด
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 sub-text">
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.profileID }}
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.dateOfBirth }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 header-sub-text">
|
||||
<div class="q-pb-md">
|
||||
ชื่อ-นามสกุล
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
เพศ
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 sub-text">
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.fullName }}
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.gender }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="contanier-box-mini">
|
||||
<q-card bordered class="card-panding">
|
||||
<div class="row items-center q-pa-xs header-text">
|
||||
ภูมิลำนำ
|
||||
</div>
|
||||
<div class="row q-pa-xs">
|
||||
<div class="col-3 header-sub-text">
|
||||
ที่อยู่
|
||||
</div>
|
||||
<div class="col-9 header-sub-text">
|
||||
{{ props.getdetail.address }}
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="contanier-box-mini">
|
||||
<q-card bordered class="card-panding">
|
||||
<div class="row items-center q-pa-xs header-text">
|
||||
การศึกษา
|
||||
</div>
|
||||
<div class="row q-pa-xs">
|
||||
<div class="col-3 header-sub-text">
|
||||
<div class="q-pb-md">
|
||||
สถานศึกษา
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
สาขาวิชาเอก
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 sub-text">
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.university }}
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.major }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 header-sub-text">
|
||||
<div class="q-pb-md">
|
||||
วุฒิการศึกษา
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
อื่นๆ
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 sub-text">
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.degree ? props.getdetail.degree : '-' }}
|
||||
</div>
|
||||
<div class="q-pb-md">
|
||||
{{ props.getdetail.remark ? props.getdetail.remark : '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="contanier-box-mini">
|
||||
<q-card bordered class="card-panding">
|
||||
<div class="row items-center q-pa-xs header-text">
|
||||
การสอบ
|
||||
</div>
|
||||
<div class="row q-pa-xs">
|
||||
<div class="col-6">
|
||||
<q-card class="card-exam q-pa-sm">
|
||||
<div class="row">
|
||||
<div class="col-4 q-pa-xs header-sub-text-exam">
|
||||
<div> ประเภท </div>
|
||||
<div> ภาค ก </div>
|
||||
<div> ภาค ข </div>
|
||||
<div> ภาค ค </div>
|
||||
<div> รวมทั้งหมด </div>
|
||||
</div>
|
||||
<div class="col-4 q-pa-xs">
|
||||
<div class="header-sub-text-exam-2"> คะแนนที่ได้</div>
|
||||
<div class="sub-text-exam"> {{
|
||||
props.getdetail.scoreResult.scoreAFull }}</div>
|
||||
<div class="sub-text-exam"> {{
|
||||
props.getdetail.scoreResult.scoreBFull }}</div>
|
||||
<div class="sub-text-exam"> {{
|
||||
props.getdetail.scoreResult.scoreCFull }}</div>
|
||||
<div class="sub-text-exam"> {{
|
||||
(props.getdetail.scoreResult.scoreSumFull) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 q-pa-xs header-sub-text-exam-2">
|
||||
<div class="header-sub-text-exam-2">ผลการสอบ</div>
|
||||
<div class="sub-text-exam">{{ props.getdetail.scoreResult.scoreA
|
||||
}}</div>
|
||||
<div class="sub-text-exam">{{ props.getdetail.scoreResult.scoreB
|
||||
}}</div>
|
||||
<div class="sub-text-exam">{{ props.getdetail.scoreResult.scoreC
|
||||
}}</div>
|
||||
<div class="sub-text-exam">{{
|
||||
(props.getdetail.scoreResult.scoreSum) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="col-1"></div>
|
||||
<div class="col-5 q-pt-sm q-pl-lg">
|
||||
<div class="row">
|
||||
<div class="col-7 header-sub-text">
|
||||
<div class="q-pb-sm">ผลการสอบ</div>
|
||||
<div class="q-pb-sm">ลำดับที่สอบได้</div>
|
||||
<div class="q-pb-sm">จำนวนครั้งที่สมัครสอบ</div>
|
||||
</div>
|
||||
<div class="col-5 sub-text-exam">
|
||||
<div class="q-pb-sm">{{ props.getdetail.scoreResult.examResult }}
|
||||
</div>
|
||||
<div class="q-pb-sm">{{ props.getdetail.number }}</div>
|
||||
<div class="q-pb-sm">{{ props.getdetail.examCount }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
|
||||
<div class="contanier-box-mini">
|
||||
<q-card bordered class="card-panding">
|
||||
<div class="col-12 row items-center q-pa-sm header-text">
|
||||
การคัดกรองคุณสมบัติ
|
||||
</div>
|
||||
<div v-for="item of checkboxItems" :key="item.id" class="q-pa-sm">
|
||||
<q-checkbox size="xs" v-model="selection" :val="item.id" :label="item.label" keep-color
|
||||
color="teal" class="checkbox-group" />
|
||||
<q-separator />
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator />
|
||||
<div>
|
||||
<DialogFooter :save="clickSave" v-model:editvisible="save" />
|
||||
</div>
|
||||
</q-form>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.icon-officer {
|
||||
color: #00AA86;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.check-officer {
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
line-height: 26px;
|
||||
color: #00AA86;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.contanier-box-main {
|
||||
padding: 10px 21px 10px 21px;
|
||||
}
|
||||
|
||||
.contanier-box-mini {
|
||||
padding: 10px 0px 10px 0px;
|
||||
}
|
||||
|
||||
.card-panding {
|
||||
padding: 15px 21px 15px 21px;
|
||||
}
|
||||
|
||||
.header-text {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #4F4F4F;
|
||||
}
|
||||
|
||||
.header-sub-text {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
line-height: 150%;
|
||||
color: #818181;
|
||||
}
|
||||
|
||||
.sub-text {
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
letter-spacing: 0.0025em;
|
||||
color: #35373C;
|
||||
}
|
||||
|
||||
.card-exam {
|
||||
border-radius: 5px;
|
||||
background: #FAFAFA;
|
||||
}
|
||||
|
||||
.header-sub-text-exam {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
line-height: 150%;
|
||||
color: #818181;
|
||||
}
|
||||
|
||||
.header-sub-text-exam-2 {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
line-height: 150%;
|
||||
color: #00AA86;
|
||||
}
|
||||
|
||||
.sub-text-exam {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.checkbox-group {
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #35373C;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
// ข้อมูลรายการสอบแข่งขัน/คัดเลือก
|
||||
interface FormPlacementMainData {
|
||||
id: number;
|
||||
ExamRound: string;
|
||||
ExamOrder: number;
|
||||
FiscalYear: number;
|
||||
NumberofCandidates: number;
|
||||
ExamType: number;
|
||||
AccountExpirationDate: string;
|
||||
examRound: string;
|
||||
examOrder: number;
|
||||
fiscalYear: number;
|
||||
numberofCandidates: number;
|
||||
examType: number;
|
||||
accountExpirationDate: string;
|
||||
isExpired?: boolean;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
interface TableName {
|
||||
Id: string;
|
||||
profileID: string;
|
||||
position: number;
|
||||
Name: string;
|
||||
fullName: string;
|
||||
dateOfBirth: string;
|
||||
gender: string;
|
||||
ExamOrder: number;
|
||||
unitId: string;
|
||||
UnitGroup: string;
|
||||
|
|
@ -10,6 +12,24 @@ interface TableName {
|
|||
BMAOfficer: boolean;
|
||||
Status: string;
|
||||
checkList: any;
|
||||
}
|
||||
address: string;
|
||||
university: string;
|
||||
degree: string;
|
||||
major: string;
|
||||
remark: string;
|
||||
number: number;
|
||||
examCount: number;
|
||||
scoreResult: {
|
||||
scoreAFull:number
|
||||
scoreA: number;
|
||||
scoreBFull: number;
|
||||
scoreB: number;
|
||||
scoreCFull: number;
|
||||
scoreC: number;
|
||||
scoreSumFull: number;
|
||||
scoreSum: number;
|
||||
examResult: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type { TableName };
|
||||
|
|
@ -2,15 +2,25 @@
|
|||
* Router บรรจุ แต่งตั้ง ย้าย โอน (Placement)
|
||||
*/
|
||||
|
||||
const Main = () => import("@/modules/05_placement/views/Main.vue");
|
||||
const MainSorkorcho = () => import("@/modules/05_placement/components/exams_sorkorcho/Main.vue");
|
||||
const MainSorkorkor = () => import("@/modules/05_placement/components/exams_korkor/Main.vue");
|
||||
const PlacementDetail = () => import("@/modules/05_placement/components/pass/Detail.vue");
|
||||
const Domination = () => import("@/modules/05_placement/views/Domination.vue");
|
||||
|
||||
export default [
|
||||
{
|
||||
path: "/placement",
|
||||
name: "placement",
|
||||
component: Main,
|
||||
component: MainSorkorcho,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [7],
|
||||
Role: "placement",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/placement2",
|
||||
name: "placement2",
|
||||
component: MainSorkorkor,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [7],
|
||||
|
|
@ -37,15 +47,5 @@ export default [
|
|||
Role: "placement",
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/domination",
|
||||
name: "domination",
|
||||
component: Domination,
|
||||
meta: {
|
||||
Auth: true,
|
||||
Key: [7],
|
||||
Role: "placement",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { ref } from "vue";
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main"
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main"
|
||||
export const useProfileDataStore = defineStore("placement", () => {
|
||||
return {};
|
||||
});
|
||||
|
|
@ -26,19 +26,61 @@ export const usePlacementDataStore = defineStore("placement", () => {
|
|||
);
|
||||
}
|
||||
|
||||
let DataMainOrig = ref<FormPlacementMainData[]>([]) // ข้อมูลหลัก
|
||||
let DataMainYear = ref<object[]>([]) // ข้อมูลจำนวนปี
|
||||
let DataMainOrig = ref<FormPlacementMainData[]>([]) // ข้อมูลหลักดั้งเดิม
|
||||
let DataMainUpdate = ref<FormPlacementMainData[]>([]) // ข้อมูลเปลี่ยนแปลง
|
||||
const DataMain = (val: any) => (DataMainOrig.value = val)
|
||||
const DataUpdateMain = (val: any) => {
|
||||
const DataMainYearSet = (val: FormPlacementMainData[]) => (DataMainYear.value = val)
|
||||
const DataMain = (val: FormPlacementMainData[]) => (DataMainOrig.value = val)
|
||||
const DataUpdateMain = (filter_1: number | null, filter_2: number | null, filter_3: boolean) => {
|
||||
DataMainUpdate.value = [];
|
||||
DataMainUpdate.value = val;
|
||||
if (filter_1 === null && filter_2 === 0 && filter_3 === false) {
|
||||
// console.log('case 1');
|
||||
// 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) {
|
||||
// console.log('case 1.1');
|
||||
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
|
||||
} else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) {
|
||||
// console.log('case 2');
|
||||
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) {
|
||||
// console.log('case 2.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) {
|
||||
// console.log('case 2.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) {
|
||||
// console.log('case 3');
|
||||
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) {
|
||||
// console.log('case 3.1');
|
||||
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
|
||||
} else if (filter_1 === null && filter_2 === null && filter_3 === true) {
|
||||
// console.log('case 3.2');
|
||||
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3);
|
||||
} else if (filter_1 !== null && filter_2 === 0 && filter_3 === true) {
|
||||
// console.log('case 3.3');
|
||||
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 === true) {
|
||||
// console.log('case 3.4');
|
||||
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 === true) {
|
||||
// console.log('case 3.5');
|
||||
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 === true) {
|
||||
// console.log('case 3.6');
|
||||
return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType == filter_2 && item.isExpired == filter_3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
placementData,
|
||||
changePlacementColumns,
|
||||
DataMainYear,
|
||||
DataMainOrig,
|
||||
DataMainUpdate,
|
||||
DataMainYearSet,
|
||||
DataMain,
|
||||
DataUpdateMain,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,496 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, useAttrs } from 'vue';
|
||||
import type { QTableProps } from 'quasar';
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||
import type { DataOption } from "@/modules/05_placement/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||
import router from '@/router';
|
||||
|
||||
const DataStore = usePlacementDataStore()
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dateText } = mixin;
|
||||
|
||||
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
||||
const textDate = (value: Date) => {
|
||||
return dateText(value);
|
||||
};
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "id",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "id",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "ExamRound",
|
||||
align: "left",
|
||||
label: "รอบการสอบ",
|
||||
sortable: true,
|
||||
field: "ExamRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "ExamOrder",
|
||||
align: "left",
|
||||
label: "ครั้งที่",
|
||||
sortable: true,
|
||||
field: "ExamOrder",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "FiscalYear",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "FiscalYear",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "NumberofCandidates",
|
||||
align: "left",
|
||||
label: "จำนวนผู้สอบได้",
|
||||
sortable: false,
|
||||
field: "NumberofCandidates",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "ExamType",
|
||||
align: "left",
|
||||
label: "ประเภทการสอบ",
|
||||
sortable: false,
|
||||
field: "ExamType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "AccountExpirationDate",
|
||||
align: "left",
|
||||
label: "วันที่บัญชีหมดอายุ",
|
||||
sortable: true,
|
||||
field: "AccountExpirationDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormPlacementMainData[]>([{
|
||||
id: 1,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 3,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 8,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 12,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 20,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-01-31T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2022,
|
||||
NumberofCandidates: 16,
|
||||
ExamType: 2,
|
||||
AccountExpirationDate: "2023-11-30T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 1,
|
||||
FiscalYear: 2021,
|
||||
NumberofCandidates: 20,
|
||||
ExamType: 2,
|
||||
AccountExpirationDate: "2024-05-21T14:47:04.1785384Z",
|
||||
},
|
||||
]);
|
||||
|
||||
let OriginalData = ref<FormPlacementMainData[]>([]);
|
||||
let UpdataData = ref<FormPlacementMainData[]>([]);
|
||||
|
||||
const OriginalDataFetch = async () => {
|
||||
await DataStore.DataMain(rows.value)
|
||||
OriginalData.value = await DataStore.DataMainOrig
|
||||
UpdataData.value = OriginalData.value
|
||||
}
|
||||
|
||||
onMounted( async () => {
|
||||
await OriginalDataFetch()
|
||||
fiscalyearfilter()
|
||||
examTimefilter()
|
||||
examTypefilter()
|
||||
})
|
||||
|
||||
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
||||
const redirectToPage = (id:number) => {
|
||||
router.push({
|
||||
name: 'placementDetail',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// เลือกปีงบประมาณ
|
||||
const fiscalyear = ref<number | null>(0);
|
||||
const fiscalyearOP = reactive<DataOption[]>([{id: 0, name: 'ทั้งหมด'}]);
|
||||
const addedFiscalYearValues: number[] = [];
|
||||
const fiscalyearfilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const year = data.FiscalYear + 543;
|
||||
if (!addedFiscalYearValues.includes(year)) {
|
||||
fiscalyearOP.push({ id: year, name: year.toString() });
|
||||
addedFiscalYearValues.push(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// เลือกปีงบประมาณตาม API
|
||||
const searchFiscalyear = () => {
|
||||
// API
|
||||
console.log('Input value changed:', fiscalyear.value);
|
||||
};
|
||||
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const visibleColumns = ref<string[]>([ 'id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// ครั้งที่สอบ
|
||||
const examTime = ref<number | null>(null);
|
||||
const examTimeOP = ref<number[]>([]);
|
||||
const examTimefilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
if (!examTimeOP.value.includes(data.ExamOrder)) {
|
||||
examTimeOP.value.push(data.ExamOrder);
|
||||
}
|
||||
}
|
||||
examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ
|
||||
}
|
||||
|
||||
// แสดงครั้งที่สอบตามที่เลือก
|
||||
const searchExamTime = async () => {
|
||||
if (examTime.value !== null) {
|
||||
const selectExamTime = OriginalData.value.filter((data: { ExamOrder: number | null; }) => data.ExamOrder === examTime.value);
|
||||
await DataStore.DataUpdateMain(selectExamTime);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
} else {
|
||||
OriginalDataFetch();
|
||||
}
|
||||
};
|
||||
|
||||
// ประเภทการสอบ
|
||||
const examType = ref<number | null>(0);
|
||||
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
||||
const addedExamTypeValues: number[] = [];
|
||||
const examTypefilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const examTypeValue = data.ExamType;
|
||||
if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) {
|
||||
examTypeOP.push({ id: 1, name: "คัดเลือก" });
|
||||
addedExamTypeValues.push(1);
|
||||
} else if (examTypeValue == 2 && !addedExamTypeValues.includes(2)) {
|
||||
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
|
||||
addedExamTypeValues.push(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// แสดงประเภทการสอบตามที่เลือก
|
||||
const searchExamType = async () => {
|
||||
if (examType.value !== null) {
|
||||
const selectExamType = OriginalData.value.filter((data: { ExamType: number | null; }) => {
|
||||
if (examType.value === 0) {
|
||||
OriginalDataFetch();
|
||||
return data.ExamType === 1 || data.ExamType === 2;
|
||||
} else {
|
||||
return data.ExamType === examType.value;
|
||||
}
|
||||
});
|
||||
await DataStore.DataUpdateMain(selectExamType);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
}
|
||||
};
|
||||
|
||||
// บัญชีหมดอายุ
|
||||
const expiredAccount = ref<boolean>(false);
|
||||
const searchExpiredAccount = async () => {
|
||||
const currentDate = new Date();
|
||||
const updatedRows = OriginalData.value.map((data) => {
|
||||
let expirationDate = new Date(data.AccountExpirationDate);
|
||||
let isExpired = expirationDate < currentDate;
|
||||
|
||||
return { ...data, isExpired };
|
||||
});
|
||||
if (expiredAccount.value) {
|
||||
const expiredRows = updatedRows.filter((data) => data.isExpired);
|
||||
await DataStore.DataUpdateMain(expiredRows);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
} else {
|
||||
OriginalDataFetch();
|
||||
}
|
||||
};
|
||||
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true)
|
||||
return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการสอบแข่งขัน / คัดเลือก
|
||||
</div>
|
||||
<div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="row q-pa-md" >
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select
|
||||
v-model="fiscalyear"
|
||||
label="ปีงบประมาณ"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
:options="fiscalyearOP"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchFiscalyear"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-6"></div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filterKeyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filterKeyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-card bordered class="col-12 filter-card">
|
||||
<div class="row q-pa-sm">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select
|
||||
v-model="examTime"
|
||||
label="ครั้งที่"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
:options="examTimeOP"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchExamTime"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select
|
||||
v-model="examType"
|
||||
label="ประเภทการสอบ"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="examTypeOP"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchExamType"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||
<q-toggle
|
||||
v-model="expiredAccount"
|
||||
class="toggle-expired-account"
|
||||
color="blue"
|
||||
label="แสดงบัญชีหมดอายุ"
|
||||
@update:model-value="searchExpiredAccount"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="UpdataData"
|
||||
:filter="filterKeyword"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
>
|
||||
<template v-slot:body="props" >
|
||||
<q-tr :props="props" class="cursor-pointer" @click="redirectToPage(props.row.id)">
|
||||
<q-td key="id" :props="props">
|
||||
{{ props.row.id }}
|
||||
</q-td>
|
||||
<q-td key="ExamRound" :props="props">
|
||||
{{ props.row.ExamRound }}
|
||||
</q-td>
|
||||
<q-td key="ExamOrder" :props="props">
|
||||
{{ props.row.ExamOrder }}
|
||||
</q-td>
|
||||
<q-td key="FiscalYear" :props="props">
|
||||
{{ props.row.FiscalYear + 543 }}
|
||||
</q-td>
|
||||
<q-td key="NumberofCandidates" :props="props">
|
||||
{{ props.row.NumberofCandidates }}
|
||||
</q-td>
|
||||
<q-td key="ExamType" :props="props">
|
||||
{{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
|
||||
</q-td>
|
||||
<q-td key="AccountExpirationDate" :props="props">
|
||||
{{ textDate(props.row.AccountExpirationDate) }}
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.filter-card {
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
.toggle-expired-account{
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 150%;
|
||||
color: #35373C;
|
||||
}
|
||||
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
}
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
/* this will be the loading indicator */
|
||||
.q-table thead tr:last-child th {
|
||||
/* height of all previous header rows */
|
||||
top: 48px;
|
||||
}
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,496 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref, useAttrs } from 'vue';
|
||||
import type { QTableProps } from 'quasar';
|
||||
import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main";
|
||||
import type { DataOption } from "@/modules/05_placement/interface/index/Main";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { usePlacementDataStore } from "@/modules/05_placement/store";
|
||||
import router from '@/router';
|
||||
|
||||
const DataStore = usePlacementDataStore()
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { dateText } = mixin;
|
||||
|
||||
// แปลงเวลา ค.ศ ให้เป็น พ.ศ
|
||||
const textDate = (value: Date) => {
|
||||
return dateText(value);
|
||||
};
|
||||
|
||||
// หัวตาราง
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
{
|
||||
name: "id",
|
||||
align: "left",
|
||||
label: "ลำดับ",
|
||||
sortable: true,
|
||||
field: "id",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "ExamRound",
|
||||
align: "left",
|
||||
label: "รอบการสอบ",
|
||||
sortable: true,
|
||||
field: "ExamRound",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "ExamOrder",
|
||||
align: "left",
|
||||
label: "ครั้งที่",
|
||||
sortable: true,
|
||||
field: "ExamOrder",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "FiscalYear",
|
||||
align: "left",
|
||||
label: "ปีงบประมาณ",
|
||||
sortable: true,
|
||||
field: "FiscalYear",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
},
|
||||
{
|
||||
name: "NumberofCandidates",
|
||||
align: "left",
|
||||
label: "จำนวนผู้สอบได้",
|
||||
sortable: false,
|
||||
field: "NumberofCandidates",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "ExamType",
|
||||
align: "left",
|
||||
label: "ประเภทการสอบ",
|
||||
sortable: false,
|
||||
field: "ExamType",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
{
|
||||
name: "AccountExpirationDate",
|
||||
align: "left",
|
||||
label: "วันที่บัญชีหมดอายุ",
|
||||
sortable: true,
|
||||
field: "AccountExpirationDate",
|
||||
headerStyle: "font-size: 14px",
|
||||
style: "font-size: 14px",
|
||||
sort: (a: string, b: string) =>
|
||||
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||
},
|
||||
|
||||
]);
|
||||
|
||||
// ข้อมูลตาราง (จำลอง)
|
||||
const rows = ref<FormPlacementMainData[]>([{
|
||||
id: 1,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 3,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 8,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 12,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-02-28T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2023,
|
||||
NumberofCandidates: 20,
|
||||
ExamType: 1,
|
||||
AccountExpirationDate: "2023-01-31T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 2,
|
||||
FiscalYear: 2022,
|
||||
NumberofCandidates: 16,
|
||||
ExamType: 2,
|
||||
AccountExpirationDate: "2023-11-30T14:47:04.1785384Z"
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป",
|
||||
ExamOrder: 1,
|
||||
FiscalYear: 2021,
|
||||
NumberofCandidates: 20,
|
||||
ExamType: 2,
|
||||
AccountExpirationDate: "2024-05-21T14:47:04.1785384Z",
|
||||
},
|
||||
]);
|
||||
|
||||
let OriginalData = ref<FormPlacementMainData[]>([]);
|
||||
let UpdataData = ref<FormPlacementMainData[]>([]);
|
||||
|
||||
const OriginalDataFetch = async () => {
|
||||
await DataStore.DataMain(rows.value)
|
||||
OriginalData.value = await DataStore.DataMainOrig
|
||||
UpdataData.value = OriginalData.value
|
||||
}
|
||||
|
||||
onMounted( async () => {
|
||||
await OriginalDataFetch()
|
||||
fiscalyearfilter()
|
||||
examTimefilter()
|
||||
examTypefilter()
|
||||
})
|
||||
|
||||
// ดูรายการสอบแข่งขัน หน้าต่อไป
|
||||
const redirectToPage = (id:number) => {
|
||||
router.push({
|
||||
name: 'placementDetail',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// เลือกปีงบประมาณ
|
||||
const fiscalyear = ref<number | null>(0);
|
||||
const fiscalyearOP = reactive<DataOption[]>([{id: 0, name: 'ทั้งหมด'}]);
|
||||
const addedFiscalYearValues: number[] = [];
|
||||
const fiscalyearfilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const year = data.FiscalYear + 543;
|
||||
if (!addedFiscalYearValues.includes(year)) {
|
||||
fiscalyearOP.push({ id: year, name: year.toString() });
|
||||
addedFiscalYearValues.push(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// เลือกปีงบประมาณตาม API
|
||||
const searchFiscalyear = () => {
|
||||
// API
|
||||
console.log('Input value changed:', fiscalyear.value);
|
||||
};
|
||||
|
||||
// ค้นหาในตาราง
|
||||
const filterKeyword = ref<string>("");
|
||||
const filterRef = ref<any>(null);
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
};
|
||||
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const visibleColumns = ref<string[]>([ 'id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง
|
||||
|
||||
// ครั้งที่สอบ
|
||||
const examTime = ref<number | null>(null);
|
||||
const examTimeOP = ref<number[]>([]);
|
||||
const examTimefilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
if (!examTimeOP.value.includes(data.ExamOrder)) {
|
||||
examTimeOP.value.push(data.ExamOrder);
|
||||
}
|
||||
}
|
||||
examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ
|
||||
}
|
||||
|
||||
// แสดงครั้งที่สอบตามที่เลือก
|
||||
const searchExamTime = async () => {
|
||||
if (examTime.value !== null) {
|
||||
const selectExamTime = OriginalData.value.filter((data: { ExamOrder: number | null; }) => data.ExamOrder === examTime.value);
|
||||
await DataStore.DataUpdateMain(selectExamTime);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
} else {
|
||||
OriginalDataFetch();
|
||||
}
|
||||
};
|
||||
|
||||
// ประเภทการสอบ
|
||||
const examType = ref<number | null>(0);
|
||||
const examTypeOP = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
|
||||
const addedExamTypeValues: number[] = [];
|
||||
const examTypefilter = async () => {
|
||||
for (let data of OriginalData.value) {
|
||||
const examTypeValue = data.ExamType;
|
||||
if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) {
|
||||
examTypeOP.push({ id: 1, name: "คัดเลือก" });
|
||||
addedExamTypeValues.push(1);
|
||||
} else if (examTypeValue == 2 && !addedExamTypeValues.includes(2)) {
|
||||
examTypeOP.push({ id: 2, name: "สอบแข่งขัน" });
|
||||
addedExamTypeValues.push(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// แสดงประเภทการสอบตามที่เลือก
|
||||
const searchExamType = async () => {
|
||||
if (examType.value !== null) {
|
||||
const selectExamType = OriginalData.value.filter((data: { ExamType: number | null; }) => {
|
||||
if (examType.value === 0) {
|
||||
OriginalDataFetch();
|
||||
return data.ExamType === 1 || data.ExamType === 2;
|
||||
} else {
|
||||
return data.ExamType === examType.value;
|
||||
}
|
||||
});
|
||||
await DataStore.DataUpdateMain(selectExamType);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
}
|
||||
};
|
||||
|
||||
// บัญชีหมดอายุ
|
||||
const expiredAccount = ref<boolean>(false);
|
||||
const searchExpiredAccount = async () => {
|
||||
const currentDate = new Date();
|
||||
const updatedRows = OriginalData.value.map((data) => {
|
||||
let expirationDate = new Date(data.AccountExpirationDate);
|
||||
let isExpired = expirationDate < currentDate;
|
||||
|
||||
return { ...data, isExpired };
|
||||
});
|
||||
if (expiredAccount.value) {
|
||||
const expiredRows = updatedRows.filter((data) => data.isExpired);
|
||||
await DataStore.DataUpdateMain(expiredRows);
|
||||
UpdataData.value = DataStore.DataMainUpdate
|
||||
} else {
|
||||
OriginalDataFetch();
|
||||
}
|
||||
};
|
||||
|
||||
const paging = ref<boolean>(true);
|
||||
const paginationLabel = (start: string, end: string, total: string) => {
|
||||
if (paging.value == true)
|
||||
return " " + start + "-" + end + " ใน " + total;
|
||||
else return start + "-" + end + " ใน " + total;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="toptitle text-dark col-12 row items-center">
|
||||
รายการสอบแข่งขัน / คัดเลือก
|
||||
</div>
|
||||
<div>
|
||||
<q-card flat bordered class="col-12 q-mt-sm">
|
||||
<div class="row q-pa-md" >
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select
|
||||
v-model="fiscalyear"
|
||||
label="ปีงบประมาณ"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
:options="fiscalyearOP"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchFiscalyear"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-6"></div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-input
|
||||
standout
|
||||
dense
|
||||
v-model="filterKeyword"
|
||||
ref="filterRef"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
class="q-ml-sm"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword == ''" name="search" />
|
||||
<q-icon
|
||||
v-if="filterKeyword !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2">
|
||||
<q-select
|
||||
v-model="visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="gt-xs q-ml-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-card bordered class="col-12 filter-card">
|
||||
<div class="row q-pa-sm">
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select
|
||||
v-model="examTime"
|
||||
label="ครั้งที่"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
:options="examTimeOP"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchExamTime"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-2 q-pl-sm">
|
||||
<q-select
|
||||
v-model="examType"
|
||||
label="ประเภทการสอบ"
|
||||
dense
|
||||
clearable
|
||||
emit-value
|
||||
map-options
|
||||
option-label="name"
|
||||
:options="examTypeOP"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="searchExamType"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||
<q-toggle
|
||||
v-model="expiredAccount"
|
||||
class="toggle-expired-account"
|
||||
color="blue"
|
||||
label="แสดงบัญชีหมดอายุ"
|
||||
@update:model-value="searchExpiredAccount"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
<div class="q-pt-sm q-pl-md q-pr-md q-pb-md">
|
||||
<q-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="UpdataData"
|
||||
:filter="filterKeyword"
|
||||
row-key="id"
|
||||
flat
|
||||
bordered
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
>
|
||||
<template v-slot:body="props" >
|
||||
<q-tr :props="props" class="cursor-pointer" @click="redirectToPage(props.row.id)">
|
||||
<q-td key="id" :props="props">
|
||||
{{ props.row.id }}
|
||||
</q-td>
|
||||
<q-td key="ExamRound" :props="props">
|
||||
{{ props.row.ExamRound }}
|
||||
</q-td>
|
||||
<q-td key="ExamOrder" :props="props">
|
||||
{{ props.row.ExamOrder }}
|
||||
</q-td>
|
||||
<q-td key="FiscalYear" :props="props">
|
||||
{{ props.row.FiscalYear + 543 }}
|
||||
</q-td>
|
||||
<q-td key="NumberofCandidates" :props="props">
|
||||
{{ props.row.NumberofCandidates }}
|
||||
</q-td>
|
||||
<q-td key="ExamType" :props="props">
|
||||
{{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }}
|
||||
</q-td>
|
||||
<q-td key="AccountExpirationDate" :props="props">
|
||||
{{ textDate(props.row.AccountExpirationDate) }}
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
</q-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.filter-card {
|
||||
background-color: #EDEDED;
|
||||
}
|
||||
|
||||
.toggle-expired-account{
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
font-size: 15px;
|
||||
line-height: 150%;
|
||||
color: #35373C;
|
||||
}
|
||||
|
||||
.icon-color {
|
||||
color: #4154b3;
|
||||
}
|
||||
.custom-header-table {
|
||||
max-height: 64vh;
|
||||
.q-table tr:nth-child(odd) td {
|
||||
background: white;
|
||||
}
|
||||
.q-table tr:nth-child(even) td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.q-table thead tr {
|
||||
background: #ecebeb;
|
||||
}
|
||||
|
||||
.q-table thead tr th {
|
||||
position: sticky;
|
||||
z-index: 1;
|
||||
}
|
||||
/* this will be the loading indicator */
|
||||
.q-table thead tr:last-child th {
|
||||
/* height of all previous header rows */
|
||||
top: 48px;
|
||||
}
|
||||
.q-table thead tr:first-child th {
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue