diff --git a/src/api/manage/api.positionEmployee.ts b/src/api/manage/api.positionEmployee.ts index a57137a7e..240d943cd 100644 --- a/src/api/manage/api.positionEmployee.ts +++ b/src/api/manage/api.positionEmployee.ts @@ -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}`, diff --git a/src/modules/01_metadata/components/insignia/Insignia.vue b/src/modules/01_metadata/components/insignia/Insignia.vue index 7434cdc4e..a55d09e87 100644 --- a/src/modules/01_metadata/components/insignia/Insignia.vue +++ b/src/modules/01_metadata/components/insignia/Insignia.vue @@ -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([]); //list data table +const { manageData, changeManageColumns, getInsignia, dataInsignia } = store; +const rows = ref(dataInsignia); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //raw data history const tittleHistory = ref("ประวัติแก้ไขชื่อเครื่องราชฯ"); // @@ -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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/insignia/InsigniaType.vue b/src/modules/01_metadata/components/insignia/InsigniaType.vue index e84b36ba1..493e21f85 100644 --- a/src/modules/01_metadata/components/insignia/InsigniaType.vue +++ b/src/modules/01_metadata/components/insignia/InsigniaType.vue @@ -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([]); //list data table +const { manageData, changeManageColumns, getInsigniaType, dataInsigniaType } = + store; +const rows = ref(dataInsigniaType); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //raw data history const tittleHistory = ref("ประวัติแก้ไขลำดับชั้นเครื่องราชฯ"); // @@ -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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/position/Path.vue b/src/modules/01_metadata/components/position/Path.vue index 1e7160b25..4a853ce0e 100644 --- a/src/modules/01_metadata/components/position/Path.vue +++ b/src/modules/01_metadata/components/position/Path.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/Group.vue b/src/modules/01_metadata/components/positionEmployee/Group.vue index 36d83bf4c..26f32eca3 100644 --- a/src/modules/01_metadata/components/positionEmployee/Group.vue +++ b/src/modules/01_metadata/components/positionEmployee/Group.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/Level.vue b/src/modules/01_metadata/components/positionEmployee/Level.vue index 15896590b..58e30aa71 100644 --- a/src/modules/01_metadata/components/positionEmployee/Level.vue +++ b/src/modules/01_metadata/components/positionEmployee/Level.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/Line.vue b/src/modules/01_metadata/components/positionEmployee/Line.vue index 037e47d18..031581b62 100644 --- a/src/modules/01_metadata/components/positionEmployee/Line.vue +++ b/src/modules/01_metadata/components/positionEmployee/Line.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/Position.vue b/src/modules/01_metadata/components/positionEmployee/Position.vue index 6d8f6663d..e27bbf862 100644 --- a/src/modules/01_metadata/components/positionEmployee/Position.vue +++ b/src/modules/01_metadata/components/positionEmployee/Position.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/PositionSide.vue b/src/modules/01_metadata/components/positionEmployee/PositionSide.vue index b40942375..22584ada8 100644 --- a/src/modules/01_metadata/components/positionEmployee/PositionSide.vue +++ b/src/modules/01_metadata/components/positionEmployee/PositionSide.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/components/positionEmployee/Status.vue b/src/modules/01_metadata/components/positionEmployee/Status.vue index f636feec4..ba2fe9bac 100644 --- a/src/modules/01_metadata/components/positionEmployee/Status.vue +++ b/src/modules/01_metadata/components/positionEmployee/Status.vue @@ -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([]); //list data table const rowsHistory = ref([]); //select data history const rawHistory = ref([]); //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(); + // }); }; /** diff --git a/src/modules/01_metadata/store.ts b/src/modules/01_metadata/store.ts index d0c6efc0c..01e310555 100644 --- a/src/modules/01_metadata/store.ts +++ b/src/modules/01_metadata/store.ts @@ -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([]); //list data table const draftPrefix = ref([]); //list data table + const dataInsignia = ref([]); //list data table + const draftInsignia = ref([]); //list data table + const dataInsigniaType = ref([]); //list data table + const draftInsigniaType = ref([]); //list data table + const dataPositionEmployee = ref([]); //list data table + const draftPositionEmployee = ref([]); //list data table + const dataPositionEmployeeSide = ref([]); //list data table + const draftPositionEmployeeSide = ref([]); //list data table + const dataPositionEmployeeGroup = ref([]); //list data table + const draftPositionEmployeeGroup = ref([]); //list data table + const dataPositionEmployeeLine = ref([]); //list data table + const draftPositionEmployeeLine = ref([]); //list data table + const dataPositionEmployeeLevel = ref([]); //list data table + const draftPositionEmployeeLevel = ref([]); //list data table + const dataPositionEmployeeStatus = ref([]); //list data table + const draftPositionEmployeeStatus = ref([]); //list data table + const dataPositionPath = ref([]); //list data table + const draftPositionPath = ref([]); //list data table + const storeIdVersion = ref(""); //id data ใน mongodb const storeVersion = ref("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, }; }); diff --git a/src/modules/05_placement/components/exams_other/Detail.vue b/src/modules/05_placement/components/exams_other/Detail.vue new file mode 100644 index 000000000..f77c1728b --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Detail.vue @@ -0,0 +1,73 @@ + + + + \ No newline at end of file diff --git a/src/modules/05_placement/components/exams_other/DialogFooter.vue b/src/modules/05_placement/components/exams_other/DialogFooter.vue new file mode 100644 index 000000000..9bfa25774 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/DialogFooter.vue @@ -0,0 +1,93 @@ + + diff --git a/src/modules/05_placement/components/exams_other/DialogHeader.vue b/src/modules/05_placement/components/exams_other/DialogHeader.vue new file mode 100644 index 000000000..bf1bff6de --- /dev/null +++ b/src/modules/05_placement/components/exams_other/DialogHeader.vue @@ -0,0 +1,27 @@ + + diff --git a/src/modules/05_placement/components/exams_other/Education.vue b/src/modules/05_placement/components/exams_other/Education.vue new file mode 100644 index 000000000..726596805 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Education.vue @@ -0,0 +1,1381 @@ + + + + diff --git a/src/modules/05_placement/components/exams_other/ExamResult.vue b/src/modules/05_placement/components/exams_other/ExamResult.vue new file mode 100644 index 000000000..ae4564dc4 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/ExamResult.vue @@ -0,0 +1,101 @@ + + + \ No newline at end of file diff --git a/src/modules/05_placement/components/exams_other/Information/Address.vue b/src/modules/05_placement/components/exams_other/Information/Address.vue new file mode 100644 index 000000000..9f49214a1 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Information/Address.vue @@ -0,0 +1,834 @@ + + + \ No newline at end of file diff --git a/src/modules/05_placement/components/exams_other/Information/Certicate.vue b/src/modules/05_placement/components/exams_other/Information/Certicate.vue new file mode 100644 index 000000000..41663f571 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Information/Certicate.vue @@ -0,0 +1,828 @@ + + + + diff --git a/src/modules/05_placement/components/exams_other/Information/Information.vue b/src/modules/05_placement/components/exams_other/Information/Information.vue new file mode 100644 index 000000000..2f280eb6c --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Information/Information.vue @@ -0,0 +1,992 @@ + + + \ No newline at end of file diff --git a/src/modules/05_placement/components/exams_other/Information/layout.vue b/src/modules/05_placement/components/exams_other/Information/layout.vue new file mode 100644 index 000000000..6e277187c --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Information/layout.vue @@ -0,0 +1,51 @@ + + + diff --git a/src/modules/05_placement/components/exams_other/Information/top.vue b/src/modules/05_placement/components/exams_other/Information/top.vue new file mode 100644 index 000000000..807a8d143 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Information/top.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/src/modules/05_placement/components/exams_other/Insignia.vue b/src/modules/05_placement/components/exams_other/Insignia.vue new file mode 100644 index 000000000..e7b8f2624 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Insignia.vue @@ -0,0 +1,1199 @@ + + + diff --git a/src/modules/05_placement/components/exams_korkor/Main.vue b/src/modules/05_placement/components/exams_other/Main.vue similarity index 79% rename from src/modules/05_placement/components/exams_korkor/Main.vue rename to src/modules/05_placement/components/exams_other/Main.vue index 2b53fb1bb..d1627d0e8 100644 --- a/src/modules/05_placement/components/exams_korkor/Main.vue +++ b/src/modules/05_placement/components/exams_other/Main.vue @@ -29,62 +29,62 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "ExamRound", + name: "examRound", align: "left", label: "รอบการสอบ", sortable: true, - field: "ExamRound", + 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", + name: "examOrder", align: "left", label: "ครั้งที่", sortable: true, - field: "ExamOrder", + field: "examOrder", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "FiscalYear", + name: "fiscalYear", align: "left", label: "ปีงบประมาณ", sortable: true, - field: "FiscalYear", + field: "fiscalYear", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "NumberofCandidates", + name: "numberofCandidates", align: "left", label: "จำนวนผู้สอบได้", sortable: false, - field: "NumberofCandidates", + 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", + name: "examType", align: "left", label: "ประเภทการสอบ", sortable: false, - field: "ExamType", + 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", + name: "accountExpirationDate", align: "left", label: "วันที่บัญชีหมดอายุ", sortable: true, - field: "AccountExpirationDate", + field: "accountExpirationDate", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -96,48 +96,48 @@ const columns = ref([ // ข้อมูลตาราง (จำลอง) const rows = ref([{ id: 1, - ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", - ExamOrder: 3, - FiscalYear: 2023, - NumberofCandidates: 8, - ExamType: 1, - AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" + 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" + 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" + 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" + 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", + examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", + examOrder: 1, + fiscalYear: 2021, + numberofCandidates: 20, + examType: 2, + accountExpirationDate: "2024-05-21T14:47:04.1785384Z", }, ]); @@ -165,23 +165,19 @@ onMounted(async () => { fiscalYearFilter() examTimeFilter() examTypeFilter() - expiredAccountFilter() + await expiredAccountFilter() + searchFilterTable() }) // ดูรายการสอบแข่งขัน หน้าต่อไป -const redirectToPage = (id: number) => { - router.push({ - name: 'placementDetail', - params: { - id: id - } - }); +const redirectToPage = (id?: number) => { + router.push(`/placement2/detail`); }; // เลือกปีงบประมาณ const fiscalyear = ref(0); const fiscalyearOP = reactive([{ id: 0, name: 'ทั้งหมด' }]); -const addedFiscalYearValues: number[] = []; +const addedfiscalYearValues: number[] = []; const fiscalYearFilter = async () => { // API // await http @@ -196,21 +192,21 @@ const fiscalYearFilter = async () => { // .finally(async () => { // }); for (let data of OriginalData.value) { - const year = data.FiscalYear + 543; + const year = data.fiscalYear + 543; if (fiscalyear.value === null || year > fiscalyear.value) { fiscalyear.value = year; } - if (!addedFiscalYearValues.includes(year)) { + if (!addedfiscalYearValues.includes(year)) { fiscalyearOP.push({ id: year, name: year.toString() }); - addedFiscalYearValues.push(year); + addedfiscalYearValues.push(year); } } } // เลือกปีงบประมาณตาม API -const searchFiscalyear = () => { +const searchfiscalyear = () => { console.log('Input value changed:', fiscalyear.value); // API // await http @@ -233,15 +229,15 @@ const resetFilter = () => { }; const attrs = ref(useAttrs()); -const visibleColumns = ref(['id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง +const visibleColumns = ref(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง // ครั้งที่สอบ const examTime = ref(null); const examTimeOP = ref([]); const examTimeFilter = async () => { for (let data of OriginalData.value) { - if (!examTimeOP.value.includes(data.ExamOrder)) { - examTimeOP.value.push(data.ExamOrder); + if (!examTimeOP.value.includes(data.examOrder)) { + examTimeOP.value.push(data.examOrder); } } examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ @@ -250,16 +246,16 @@ const examTimeFilter = async () => { // ประเภทการสอบ const examType = ref(0); const examTypeOP = reactive([{ id: 0, name: "ทั้งหมด" }]); -const addedExamTypeValues: number[] = []; +const addedexamTypeValues: number[] = []; const examTypeFilter = async () => { for (let data of OriginalData.value) { - const examTypeValue = data.ExamType; - if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) { + 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)) { + addedexamTypeValues.push(1); + } else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) { examTypeOP.push({ id: 2, name: "สอบแข่งขัน" }); - addedExamTypeValues.push(2); + addedexamTypeValues.push(2); } } } @@ -275,8 +271,8 @@ const expiredAccount = ref(false); const expiredAccountFilter = async () => { const currentDate = new Date(); const updatedRows = OriginalData.value.map((data) => { - let expirationDate = new Date(data.AccountExpirationDate); - let isExpired = expirationDate < currentDate; + let expirationDate = new Date(data.accountExpirationDate); + let isExpired = expirationDate < currentDate return { ...data, isExpired }; }); @@ -302,7 +298,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
+ :outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
@@ -349,23 +345,23 @@ const paginationLabel = (start: string, end: string, total: string) => { {{ props.row.id }} - - {{ props.row.ExamRound }} + + {{ props.row.examRound }} - - {{ props.row.ExamOrder }} + + {{ props.row.examOrder }} - - {{ props.row.FiscalYear + 543 }} + + {{ props.row.fiscalYear + 543 }} - - {{ props.row.NumberofCandidates }} + + {{ props.row.numberofCandidates }} - - {{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} + + {{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} - - {{ textDate(props.row.AccountExpirationDate) }} + + {{ textDate(props.row.accountExpirationDate) }} diff --git a/src/modules/05_placement/components/exams_other/Qualification.vue b/src/modules/05_placement/components/exams_other/Qualification.vue new file mode 100644 index 000000000..83337eaa3 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Qualification.vue @@ -0,0 +1,84 @@ + + + \ No newline at end of file diff --git a/src/modules/05_placement/components/exams_other/Table.vue b/src/modules/05_placement/components/exams_other/Table.vue new file mode 100644 index 000000000..85c5d5443 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/Table.vue @@ -0,0 +1,201 @@ + + + diff --git a/src/modules/05_placement/components/exams_other/profileType.ts b/src/modules/05_placement/components/exams_other/profileType.ts new file mode 100644 index 000000000..9ba368651 --- /dev/null +++ b/src/modules/05_placement/components/exams_other/profileType.ts @@ -0,0 +1,171 @@ +//interface class array object {name string ,id number} + +import type { childrenFamily } from "@/modules/04_registry/interface/response/Family"; +interface ChangeActive { + name: string; + id: number; +} + +//ข้อมูลส่วนตัว +interface Information { + cardid: string | null; + prefix: string | null; + age: string | null; + prefixId: string | null; + firstname: string | null; + lastname: string | null; + birthDate: Date; + genderId: string | null; + bloodId: string | null; + nationality: string | null; + ethnicity: string | null; + statusId: string | null; + religionId: string | null; + tel: string | null; + employeeType: string | null; + employeeClass: string | null; + profileType: string | null; +} + +interface Family { + prefixC: string | null; // couple + prefixIdC: string | null; + firstnameC: string | null; + lastnameC: string | null; + lastnameCOld: string | null; + occupationC: string | null; + prefixM: string | null; // male + prefixIdM: string | null; + firstnameM: string | null; + lastnameM: string | null; + occupationM: string | null; + prefixF: string | null; // female + prefixIdF: string | null; + firstnameF: string | null; + lastnameF: string | null; + occupationF: string | null; + same: string | null; + childrens: childrenFamily[]; +} + +interface Address { + address: string | null; + provinceId: string | null; + districtId: string | null; + subdistrictId: string | null; + addressC: string | null; + provinceIdC: string | null; + districtIdC: string | null; + subdistrictIdC: string | null; + same: string | null; +} + +interface Goverment { + ocId: string | null; + positionId: string | null; + workId: string | null; + typeId: string | null; + levelId: string | null; + numberId: string | null; + businessId: string | null; + containDate: Date; + workDate: Date; + retireDate: string | null; + absent: number | null; + age: number | null; + ageAll: string | null; + reasonSameDate: string | null; +} + +interface DataOption { + id: string | number; + name: string; + zipCode?: string; +} + +interface zipCodeOption { + id: string; + name: string; + zipCode: string; +} + +const defaultGoverment: Goverment = { + ocId: null, + positionId: null, + workId: null, + typeId: null, + levelId: null, + numberId: null, + businessId: null, + containDate: new Date(), + workDate: new Date(), + retireDate: null, + absent: 0, + age: 0, + ageAll: null, + reasonSameDate: null, +}; + +const defaultAddress: Address = { + address: null, + provinceId: null, + districtId: null, + subdistrictId: null, + addressC: null, + provinceIdC: null, + districtIdC: null, + subdistrictIdC: null, + same: "0", +}; + +const defaultInformation: Information = { + cardid: null, + age: null, + prefix: null, + prefixId: null, + firstname: null, + lastname: null, + birthDate: new Date(), + genderId: null, + bloodId: null, + nationality: null, + ethnicity: null, + statusId: null, + religionId: null, + tel: null, + employeeType: null, + employeeClass: null, + profileType: null, +}; + +const defaultFamily: Family = { + prefixC: null, + prefixIdC: null, + firstnameC: null, + lastnameC: null, + lastnameCOld: null, + occupationC: null, + prefixM: null, + prefixIdM: null, + firstnameM: null, + lastnameM: null, + occupationM: null, + prefixF: null, + prefixIdF: null, + firstnameF: null, + lastnameF: null, + occupationF: null, + same: "0", + childrens: [], +}; + +export { defaultInformation, defaultFamily, defaultAddress, defaultGoverment }; +export type { + ChangeActive, + Information, + Family, + Address, + Goverment, + DataOption, + zipCodeOption, +}; diff --git a/src/modules/05_placement/components/exams_sorkorcho/Main.vue b/src/modules/05_placement/components/exams_sorkorcho/Main.vue index 2b53fb1bb..c4a78ea29 100644 --- a/src/modules/05_placement/components/exams_sorkorcho/Main.vue +++ b/src/modules/05_placement/components/exams_sorkorcho/Main.vue @@ -29,62 +29,62 @@ const columns = ref([ style: "font-size: 14px", }, { - name: "ExamRound", + name: "examRound", align: "left", label: "รอบการสอบ", sortable: true, - field: "ExamRound", + 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", + name: "examOrder", align: "left", label: "ครั้งที่", sortable: true, - field: "ExamOrder", + field: "examOrder", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "FiscalYear", + name: "fiscalYear", align: "left", label: "ปีงบประมาณ", sortable: true, - field: "FiscalYear", + field: "fiscalYear", headerStyle: "font-size: 14px", style: "font-size: 14px", }, { - name: "NumberofCandidates", + name: "numberofCandidates", align: "left", label: "จำนวนผู้สอบได้", sortable: false, - field: "NumberofCandidates", + 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", + name: "examType", align: "left", label: "ประเภทการสอบ", sortable: false, - field: "ExamType", + 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", + name: "accountExpirationDate", align: "left", label: "วันที่บัญชีหมดอายุ", sortable: true, - field: "AccountExpirationDate", + field: "accountExpirationDate", headerStyle: "font-size: 14px", style: "font-size: 14px", sort: (a: string, b: string) => @@ -96,48 +96,48 @@ const columns = ref([ // ข้อมูลตาราง (จำลอง) const rows = ref([{ id: 1, - ExamRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", - ExamOrder: 3, - FiscalYear: 2023, - NumberofCandidates: 8, - ExamType: 1, - AccountExpirationDate: "2023-02-28T14:47:04.1785384Z" + 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" + 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" + 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" + 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", + examRound: "การสอบแข่งขันเพื่อรับบุคคลทั่วไปเข้ารับราชการ ส่วนการจัดการทั่วไป", + examOrder: 1, + fiscalYear: 2021, + numberofCandidates: 20, + examType: 2, + accountExpirationDate: "2024-05-21T14:47:04.1785384Z", }, ]); @@ -165,23 +165,20 @@ onMounted(async () => { fiscalYearFilter() examTimeFilter() examTypeFilter() - expiredAccountFilter() + await expiredAccountFilter() + searchFilterTable() }) // ดูรายการสอบแข่งขัน หน้าต่อไป -const redirectToPage = (id: number) => { - router.push({ - name: 'placementDetail', - params: { - id: id - } - }); +const redirectToPage = (id?: number) => { + // router.push({ name: 'placementDetail'}); + router.push(`/placement/detail`); }; // เลือกปีงบประมาณ const fiscalyear = ref(0); const fiscalyearOP = reactive([{ id: 0, name: 'ทั้งหมด' }]); -const addedFiscalYearValues: number[] = []; +const addedfiscalYearValues: number[] = []; const fiscalYearFilter = async () => { // API // await http @@ -196,21 +193,21 @@ const fiscalYearFilter = async () => { // .finally(async () => { // }); for (let data of OriginalData.value) { - const year = data.FiscalYear + 543; + const year = data.fiscalYear + 543; if (fiscalyear.value === null || year > fiscalyear.value) { fiscalyear.value = year; } - if (!addedFiscalYearValues.includes(year)) { + if (!addedfiscalYearValues.includes(year)) { fiscalyearOP.push({ id: year, name: year.toString() }); - addedFiscalYearValues.push(year); + addedfiscalYearValues.push(year); } } } // เลือกปีงบประมาณตาม API -const searchFiscalyear = () => { +const searchfiscalyear = () => { console.log('Input value changed:', fiscalyear.value); // API // await http @@ -233,15 +230,15 @@ const resetFilter = () => { }; const attrs = ref(useAttrs()); -const visibleColumns = ref(['id', 'ExamRound', 'ExamOrder', 'FiscalYear', 'NumberofCandidates', 'ExamType', 'AccountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง +const visibleColumns = ref(['id', 'examRound', 'examOrder', 'fiscalYear', 'numberofCandidates', 'examType', 'accountExpirationDate']) //ค้นหา คอลัมน์ คอลัมน์ที่แสดง // ครั้งที่สอบ const examTime = ref(null); const examTimeOP = ref([]); const examTimeFilter = async () => { for (let data of OriginalData.value) { - if (!examTimeOP.value.includes(data.ExamOrder)) { - examTimeOP.value.push(data.ExamOrder); + if (!examTimeOP.value.includes(data.examOrder)) { + examTimeOP.value.push(data.examOrder); } } examTimeOP.value.sort((a, b) => a - b); // เรียงลำดับ @@ -250,16 +247,16 @@ const examTimeFilter = async () => { // ประเภทการสอบ const examType = ref(0); const examTypeOP = reactive([{ id: 0, name: "ทั้งหมด" }]); -const addedExamTypeValues: number[] = []; +const addedexamTypeValues: number[] = []; const examTypeFilter = async () => { for (let data of OriginalData.value) { - const examTypeValue = data.ExamType; - if (examTypeValue == 1 && !addedExamTypeValues.includes(1)) { + 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)) { + addedexamTypeValues.push(1); + } else if (examTypeValue == 2 && !addedexamTypeValues.includes(2)) { examTypeOP.push({ id: 2, name: "สอบแข่งขัน" }); - addedExamTypeValues.push(2); + addedexamTypeValues.push(2); } } } @@ -275,8 +272,8 @@ const expiredAccount = ref(false); const expiredAccountFilter = async () => { const currentDate = new Date(); const updatedRows = OriginalData.value.map((data) => { - let expirationDate = new Date(data.AccountExpirationDate); - let isExpired = expirationDate < currentDate; + let expirationDate = new Date(data.accountExpirationDate); + let isExpired = expirationDate < currentDate return { ...data, isExpired }; }); @@ -302,7 +299,7 @@ const paginationLabel = (start: string, end: string, total: string) => {
+ :outlined="true" :hide-dropdown-icon="false" @update:model-value="searchfiscalyear" />
@@ -349,23 +346,23 @@ const paginationLabel = (start: string, end: string, total: string) => { {{ props.row.id }} - - {{ props.row.ExamRound }} + + {{ props.row.examRound }} - - {{ props.row.ExamOrder }} + + {{ props.row.examOrder }} - - {{ props.row.FiscalYear + 543 }} + + {{ props.row.fiscalYear + 543 }} - - {{ props.row.NumberofCandidates }} + + {{ props.row.numberofCandidates }} - - {{ props.row.ExamType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} + + {{ props.row.examType == 1 ? 'คัดเลือก' : 'สอบแข่งขัน' }} - - {{ textDate(props.row.AccountExpirationDate) }} + + {{ textDate(props.row.accountExpirationDate) }} diff --git a/src/modules/05_placement/components/pass/Detail.vue b/src/modules/05_placement/components/pass/Detail.vue index 825fa12a1..9db3af52b 100644 --- a/src/modules/05_placement/components/pass/Detail.vue +++ b/src/modules/05_placement/components/pass/Detail.vue @@ -1,14 +1,18 @@ + diff --git a/src/modules/05_placement/components/pass/DialogHeader.vue b/src/modules/05_placement/components/pass/DialogHeader.vue index b02ec8f26..a20e917b0 100644 --- a/src/modules/05_placement/components/pass/DialogHeader.vue +++ b/src/modules/05_placement/components/pass/DialogHeader.vue @@ -1,19 +1,4 @@ - + + + diff --git a/src/modules/05_placement/components/pass/Table.vue b/src/modules/05_placement/components/pass/Table.vue index d7a033d69..3ad89235c 100644 --- a/src/modules/05_placement/components/pass/Table.vue +++ b/src/modules/05_placement/components/pass/Table.vue @@ -1,170 +1,377 @@ \ No newline at end of file +.img-info { + width: 30px !important; + height: 30px !important; + border-radius: 50%; + object-fit: cover; + margin-right: 10px; +} + diff --git a/src/modules/05_placement/components/pass/TableDetail.vue b/src/modules/05_placement/components/pass/TableDetail.vue new file mode 100644 index 000000000..b4250883a --- /dev/null +++ b/src/modules/05_placement/components/pass/TableDetail.vue @@ -0,0 +1,309 @@ + + + \ No newline at end of file diff --git a/src/modules/05_placement/interface/index/Main.ts b/src/modules/05_placement/interface/index/Main.ts index c28c2f576..438d71ab3 100644 --- a/src/modules/05_placement/interface/index/Main.ts +++ b/src/modules/05_placement/interface/index/Main.ts @@ -1,7 +1,67 @@ +import type { zipCodeOption } from "../../components/exams_other/profileType"; interface DataOption { - id: number; - name: string; + id: number | string; + name: string; + disable?: boolean; +} + +interface DataOptionInsignia { + id: string; + name: string; + typeName: string; +} + +interface EduOps { + levelOptions: DataOption[]; + positionPathOptions: DataOption[]; } -export type { DataOption }; +interface InformationOps { + prefixOps: DataOption[]; + genderOps: DataOption[]; + bloodOps: DataOption[]; + statusOps: DataOption[]; + religionOps: DataOption[]; + employeeClassOps: DataOption[]; + employeeTypeOps: DataOption[]; +} + +interface AddressOps { + provinceOps: DataOption[]; + districtOps: DataOption[]; + districtCOps: DataOption[]; + subdistrictOps: zipCodeOption[]; + subdistrictCOps: zipCodeOption[]; +} + +interface InsigniaOps { + insigniaOptions: DataOptionInsignia[]; +} + +interface Pagination { + rowsPerPage: number; +} + +interface treeTab { + id: string; + label: string; + children: treeTab[]; +} + +interface CheckboxItem { + id: number; + label: string; +} + +export type { + DataOption, + DataOptionInsignia, + treeTab, + InformationOps, + AddressOps, + Pagination, + EduOps, + InsigniaOps, + CheckboxItem +}; diff --git a/src/modules/05_placement/interface/request/Address.ts b/src/modules/05_placement/interface/request/Address.ts new file mode 100644 index 000000000..f8cff7753 --- /dev/null +++ b/src/modules/05_placement/interface/request/Address.ts @@ -0,0 +1,55 @@ +interface DataProps { + row: RequestItemsObject; + rowIndex: number; +} + +//ข้อมูล +interface RequestItemsObject { + currentAddress: String | null; + currentDistrictId: String | null; + currentProvinceId: String | null; + currentSubDistrictId: String | null; + currentZipCode: String | null; + registrationAddress: String | null; + registrationDistrictId: String | null; + registrationProvinceId: String | null; + registrationSame: Boolean | null; + registrationSubDistrictId: String | null; + registrationZipCode: String | null; +} + +interface RequestItemsHistoryObject { + currentAddress: String | null; + currentDistrict: String | null; + currentProvince: String | null; + currentSubDistrict: String | null; + currentZipCode: String | null; + registrationAddress: String | null; + registrationDistrict: String | null; + registrationProvince: String | null; + registrationSame: Boolean | null; + registrationSubDistrict: String | null; + registrationZipCode: String | null; + createdFullName: String | null; + createdAt: Date; +} + +//columns +interface Columns { + [index: number]: { + name: String; + align: String; + label: String; + sortable: Boolean; + field: String; + headerStyle: String; + style: String; + }; +} + +export type { + RequestItemsObject, + Columns, + DataProps, + RequestItemsHistoryObject, +}; diff --git a/src/modules/05_placement/interface/request/Certificate.ts b/src/modules/05_placement/interface/request/Certificate.ts new file mode 100644 index 000000000..a1df312c3 --- /dev/null +++ b/src/modules/05_placement/interface/request/Certificate.ts @@ -0,0 +1,31 @@ +interface DataProps { + row: RequestItemsObject; + rowIndex: number; +} + +//ข้อมูล +interface RequestItemsObject { + id: string; + certificateNo: string; + issuer: string; + issueDate: Date; + expireDate: Date; + certificateType: string; + createdFullName: string; + createdAt: Date; +} + +//columns +interface Columns { + [index: number]: { + name: String; + align: String; + label: String; + sortable: Boolean; + field: String; + headerStyle: String; + style: String; + }; +} + +export type { RequestItemsObject, Columns, DataProps }; diff --git a/src/modules/05_placement/interface/request/Education.ts b/src/modules/05_placement/interface/request/Education.ts new file mode 100644 index 000000000..eb0270198 --- /dev/null +++ b/src/modules/05_placement/interface/request/Education.ts @@ -0,0 +1,42 @@ +interface DataProps { + row: RequestItemsObject; + rowIndex: number; +} + +//ข้อมูล +interface RequestItemsObject { + id: string; + level: string; + levelId: string; + positionPath: string; + positionPathId: string; + institute: string; + degree: string; + field: string; + gpa: string; + country: string; + duration: string; + durationYear: number; + other: string; + fundName: string; + finishDate: Date; + startDate: number; + endDate: number; + createdFullName: string; + createdAt: Date; +} + +//columns +interface Columns { + [index: number]: { + name: String; + align: String; + label: String; + sortable: Boolean; + field: String; + headerStyle: String; + style: String; + }; +} + +export type { RequestItemsObject, Columns, DataProps }; diff --git a/src/modules/05_placement/interface/request/Information.ts b/src/modules/05_placement/interface/request/Information.ts new file mode 100644 index 000000000..39aac0621 --- /dev/null +++ b/src/modules/05_placement/interface/request/Information.ts @@ -0,0 +1,59 @@ +interface DataProps { + row: RequestItemsObject; + rowIndex: number; +} + +//ข้อมูล +interface RequestItemsObject { + birthDate: Date | null; + bloodGroupId: string | null; + citizenId: string | null; + firstName: string | null; + genderId: string | null; + lastName: string | null; + nationality: string | null; + prefixId: string | null; + race: string | null; + relationshipId: string | null; + religionId: string | null; + telephoneNumber: string | null; + employeeType: string | null; + employeeClass: string | null; +} + +interface RequestItemsHistoryObject { + citizenId: string | null; + prefix: string | null; + firstName: string | null; + lastName: string | null; + birthDate: Date; + gender: string | null; + relationship: string | null; + bloodGroup: string | null; + nationality: string | null; + race: string | null; + religion: string | null; + telephoneNumber: string | null; + createdFullName: string | null; + createdAt: Date; + employeeType: string | null; + employeeClass: string | null; +} + +//columns +interface Columns { + name: String; + align: String; + label: String; + sortable: Boolean; + field: String; + headerStyle: String; + style: String; +} + +export type { + RequestItemsObject, + Columns, + DataProps, + RequestItemsHistoryObject, +}; diff --git a/src/modules/05_placement/interface/request/Insignia.ts b/src/modules/05_placement/interface/request/Insignia.ts new file mode 100644 index 000000000..8fa100368 --- /dev/null +++ b/src/modules/05_placement/interface/request/Insignia.ts @@ -0,0 +1,38 @@ +interface DataProps { + row: RequestItemsObject; + rowIndex: number; +} + +//ข้อมูล +interface RequestItemsObject { + id: string; + insigniaType: string; + insignia: string; + insigniaId: string; + year: number; + no: string; + issue: string; + volumeNo: string; + volume: string; + section: string; + page: string; + receiveDate: Date; + dateAnnounce: Date; + createdFullName: string; + createdAt: Date; +} + +//columns +interface Columns { + [index: number]: { + name: String; + align: String; + label: String; + sortable: Boolean; + field: String; + headerStyle: String; + style: String; + }; +} + +export type { RequestItemsObject, Columns, DataProps }; diff --git a/src/modules/05_placement/interface/request/Main.ts b/src/modules/05_placement/interface/request/Main.ts index 9690875aa..54d363323 100644 --- a/src/modules/05_placement/interface/request/Main.ts +++ b/src/modules/05_placement/interface/request/Main.ts @@ -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; } diff --git a/src/modules/05_placement/interface/request/placement.ts b/src/modules/05_placement/interface/request/placement.ts index 504a4556b..199265b2a 100644 --- a/src/modules/05_placement/interface/request/placement.ts +++ b/src/modules/05_placement/interface/request/placement.ts @@ -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 }; \ No newline at end of file diff --git a/src/modules/05_placement/interface/response/Address.ts b/src/modules/05_placement/interface/response/Address.ts new file mode 100644 index 000000000..8769bd1b4 --- /dev/null +++ b/src/modules/05_placement/interface/response/Address.ts @@ -0,0 +1,34 @@ +//ข้อมูล +interface ResponseObject { + currentAddress: string | null; + currentDistrictId: string | null; + currentProvinceId: string | null; + currentSubDistrictId: string | null; + currentZipCode: string | null; + registrationAddress: string | null; + registrationDistrictId: string | null; + registrationProvinceId: string | null; + registrationSame: Boolean | null; + registrationSubDistrictId: string | null; + registrationZipCode: string | null; + createdFullName: string | null; + createdAt: Date; +} + +interface ResponseHistory { + currentAddress: string | null; + currentDistrictId: string | null; + currentProvinceId: string | null; + currentSubDistrictId: string | null; + currentZipCode: string | null; + registrationAddress: string | null; + registrationDistrictId: string | null; + registrationProvinceId: string | null; + registrationSame: string | null; + registrationSubDistrictId: string | null; + registrationZipCode: string | null; + createdFullName: string | null; + createdAt: Date; +} + +export type { ResponseObject, ResponseHistory }; diff --git a/src/modules/05_placement/interface/response/Certificate.ts b/src/modules/05_placement/interface/response/Certificate.ts new file mode 100644 index 000000000..32756682e --- /dev/null +++ b/src/modules/05_placement/interface/response/Certificate.ts @@ -0,0 +1,13 @@ +//ข้อมูล +interface ResponseObject { + id: string; + certificateNo: string; + issuer: string; + issueDate: Date; + expireDate: Date; + certificateType: string; + createdFullName: string; + createdAt: Date; +} + +export type { ResponseObject }; diff --git a/src/modules/05_placement/interface/response/Education.ts b/src/modules/05_placement/interface/response/Education.ts new file mode 100644 index 000000000..7dcd3bdf2 --- /dev/null +++ b/src/modules/05_placement/interface/response/Education.ts @@ -0,0 +1,24 @@ +//ข้อมูล +interface ResponseObject { + id: string; + educationLevel: string; + educationLevelId: string; + positionPath: string; + positionPathId: string; + institute: string; + degree: string; + field: string; + gpa: string; + country: string; + duration: string; + durationYear: number; + other: string; + fundName: string; + finishDate: Date; + startDate: number; + endDate: number; + createdFullName: string; + createdAt: Date; +} + +export type { ResponseObject }; diff --git a/src/modules/05_placement/interface/response/Information.ts b/src/modules/05_placement/interface/response/Information.ts new file mode 100644 index 000000000..ecb93f462 --- /dev/null +++ b/src/modules/05_placement/interface/response/Information.ts @@ -0,0 +1,23 @@ +//ข้อมูล +interface ResponseObject { + birthDate: Date; + bloodGroupId: string | null; + citizenId: string | null; + firstName: string | null; + genderId: string | null; + lastName: string | null; + nationality: string | null; + prefixId: string | null; + race: string | null; + relationshipId: string | null; + religionId: string | null; + telephoneNumber: string | null; + createdFullName: string | null; + createdAt: Date; + age: string | null; + employeeType: string | null; + employeeClass: string | null; + profileType: string | null; +} + +export type { ResponseObject }; diff --git a/src/modules/05_placement/interface/response/Insignia.ts b/src/modules/05_placement/interface/response/Insignia.ts new file mode 100644 index 000000000..d60b4e22d --- /dev/null +++ b/src/modules/05_placement/interface/response/Insignia.ts @@ -0,0 +1,20 @@ +//ข้อมูล +interface ResponseObject { + id: string; + insigniaType: string; + insignia: string; + insigniaId: string; + year: number; + no: string; + issue: string; + volumeNo: string; + volume: string; + section: string; + page: string; + receiveDate: Date; + dateAnnounce: Date; + createdFullName: string; + createdAt: Date; +} + +export type { ResponseObject }; diff --git a/src/modules/05_placement/router.ts b/src/modules/05_placement/router.ts index 0d6745f2f..b59e6fbaf 100644 --- a/src/modules/05_placement/router.ts +++ b/src/modules/05_placement/router.ts @@ -3,8 +3,10 @@ */ 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 MainOther = () => import("@/modules/05_placement/components/exams_other/Main.vue"); +const Placement2Detail = () => import("@/modules/05_placement/components/exams_other/Detail.vue"); + export default [ { @@ -17,10 +19,20 @@ export default [ Role: "placement", }, }, + { + path: "/placement/detail", + name: "placementDetail", + component: PlacementDetail, + meta: { + Auth: true, + Key: [7], + Role: "placement", + }, + }, { path: "/placement2", name: "placement2", - component: MainSorkorkor, + component: MainOther, meta: { Auth: true, Key: [7], @@ -28,19 +40,9 @@ export default [ }, }, { - path: "/placement/detail", - name: "placementDetail", - component: PlacementDetail, - meta: { - Auth: true, - Key: [7], - Role: "placement", - }, - }, - { - path: "/placement/detail", - name: "placementDetail", - component: PlacementDetail, + path: "/placement2/detail", + name: "placement2Detail", + component: Placement2Detail, meta: { Auth: true, Key: [7], diff --git a/src/modules/05_placement/store.ts b/src/modules/05_placement/store.ts index 06308826e..122c3daec 100644 --- a/src/modules/05_placement/store.ts +++ b/src/modules/05_placement/store.ts @@ -1,8 +1,83 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import type { FormPlacementMainData } from "@/modules/05_placement/interface/request/Main" -export const useProfileDataStore = defineStore("placement", () => { - return {}; + +export const useProfileDataStore = defineStore("profile", () => { + interface profile { + main: { columns: String[] }; + education: { columns: String[] }; + certicate: { columns: String[] }; + train: { columns: String[] }; + insignia: { columns: String[] }; + coined: { columns: String[] }; + assessment: { columns: String[] }; + salary: { columns: String[] }; + discipline: { columns: String[] }; + leave: { columns: String[] }; + talent: { columns: String[] }; + work: { columns: String[] }; + record: { columns: String[] }; + other: { columns: String[] }; + document: { columns: String[] }; + } + + const birthDate = ref(new Date()); + const retireText = ref(null); + const changeRetireText = (val: string | null) => { + retireText.value = val; + }; + const changeBirth = (val: Date) => { + birthDate.value = val; + }; + const profileData = ref({ + main: { columns: [] }, + education: { columns: [] }, + certicate: { columns: [] }, + train: { columns: [] }, + insignia: { columns: [] }, + coined: { columns: [] }, + assessment: { columns: [] }, + salary: { columns: [] }, + discipline: { columns: [] }, + leave: { columns: [] }, + talent: { columns: [] }, + work: { columns: [] }, + record: { columns: [] }, + other: { columns: [] }, + document: { columns: [] }, + }); + + const changeProfileColumns = (system: String, val: String[]) => { + if (system == "main") profileData.value.main.columns = val; + if (system == "education") profileData.value.education.columns = val; + if (system == "certicate") profileData.value.certicate.columns = val; + if (system == "train") profileData.value.train.columns = val; + if (system == "insignia") profileData.value.insignia.columns = val; + if (system == "coined") profileData.value.coined.columns = val; + if (system == "assessment") profileData.value.assessment.columns = val; + if (system == "salary") profileData.value.salary.columns = val; + if (system == "discipline") profileData.value.discipline.columns = val; + if (system == "leave") profileData.value.leave.columns = val; + if (system == "talent") profileData.value.talent.columns = val; + if (system == "work") profileData.value.work.columns = val; + if (system == "record") profileData.value.record.columns = val; + if (system == "other") profileData.value.other.columns = val; + if (system == "document") profileData.value.document.columns = val; + localStorage.setItem("profile", JSON.stringify(profileData.value)); + }; + + if (localStorage.getItem("profile") !== null) { + profileData.value = JSON.parse(localStorage.getItem("profile") || "{}"); + } + + return { + profileData, + changeProfileColumns, + birthDate, + changeBirth, + retireText, + changeRetireText, + }; }); export const usePlacementDataStore = defineStore("placement", () => { interface placement { @@ -29,28 +104,29 @@ export const usePlacementDataStore = defineStore("placement", () => { let DataMainYear = ref([]) // ข้อมูลจำนวนปี let DataMainOrig = ref([]) // ข้อมูลหลักดั้งเดิม let DataMainUpdate = ref([]) // ข้อมูลเปลี่ยนแปลง - const DataMainYearSet = (val: any) => (DataMainYear.value = val) - const DataMain = (val: any) => (DataMainOrig.value = val) + 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 = []; if (filter_1 === null && filter_2 === 0 && filter_3 === false) { // console.log('case 1'); - return DataMainUpdate.value = DataMainOrig.value; + // return DataMainUpdate.value = DataMainOrig.value; อันเก่า + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); } else if (filter_1 === null && filter_2 === null && filter_3 === false) { // console.log('case 1.1'); - return DataMainUpdate.value = DataMainOrig.value; + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); } else if (filter_1 !== null && filter_2 === 0 && filter_3 === false) { // console.log('case 2'); - return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1); + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.isExpired === filter_3); } else if (filter_1 !== null && filter_2 === null && filter_3 === false) { // console.log('case 2.1'); - return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1); + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.isExpired === filter_3); } else if (filter_1 !== null && filter_2 !== 0 && filter_3 === false) { // console.log('case 2.2'); - return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamOrder === filter_1 && item.ExamType === filter_2); + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examOrder === filter_1 && item.examType === filter_2 && item.isExpired === filter_3); } else if (filter_1 === null && filter_2 !== 0 && filter_3 === false) { // console.log('case 3'); - return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.ExamType === filter_2); + return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType === filter_2 && item.isExpired === filter_3); } else if (filter_1 === null && filter_2 === 0 && filter_3 === true) { // console.log('case 3.1'); return DataMainUpdate.value = DataMainOrig.value.filter((item) => item.isExpired === filter_3); @@ -59,16 +135,16 @@ export const usePlacementDataStore = defineStore("placement", () => { 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); + 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); + 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); + 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 DataMainUpdate.value = DataMainOrig.value.filter((item) => item.examType == filter_2 && item.isExpired == filter_3); } }