From 018e430289413eda05dfb28bc7389b654232e2b7 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Mon, 28 Oct 2024 09:54:06 +0700 Subject: [PATCH 1/2] fix load --- .../18_command/components/Step/0_Main.vue | 8 ++++--- .../18_command/components/Step/1_Detail.vue | 21 ++++++++--------- .../components/Step/2_ListPersons.vue | 20 +++++++--------- .../components/Step/3_ReceivedCopy.vue | 1 - .../18_command/interface/request/Main.ts | 23 ++++++++----------- 5 files changed, 31 insertions(+), 42 deletions(-) diff --git a/src/modules/18_command/components/Step/0_Main.vue b/src/modules/18_command/components/Step/0_Main.vue index 6481fb0ef..6e8df6a8b 100644 --- a/src/modules/18_command/components/Step/0_Main.vue +++ b/src/modules/18_command/components/Step/0_Main.vue @@ -8,8 +8,8 @@ import { useCommandDetail } from "@/modules/18_command/store/DetailStore"; import http from "@/plugins/http"; import config from "@/app.config"; -import LiveView from "@/modules/18_command/components/Step/View0_Live.vue"; -import DigitalView from "@/modules/18_command/components/Step/View0_Digital.vue"; +import LiveView from "@/modules/18_command/components/Step/View0_Live.vue"; //เซ็นสด +import DigitalView from "@/modules/18_command/components/Step/View0_Digital.vue"; //Digital Signature const $q = useQuasar(); const route = useRoute(); @@ -19,7 +19,7 @@ const { showLoader, hideLoader, messageError, dialogConfirm } = useCounterMixin(); const commandId = ref(route.params.id.toString()); //ID คำสั่ง -const step = ref(1); +const step = ref(1); //สถานะของคำสั่ง const isStatus = ref(""); //สถานะของคำสั่ง const signaturetype = ref(""); //วิธีการลงนาม const isSignature = ref(null); @@ -28,6 +28,7 @@ const isDraft = ref(false); //ทำแบบร่าง const isSign = ref(false); //การลงนาม const isAttachment = ref(false); //เอกสารแนบท้าย +/** ฟังก์ชันเรียกข้อมูลสถานะคำสั่ง*/ async function fetchData() { showLoader(); await http @@ -55,6 +56,7 @@ async function fetchData() { }); } +/** ฟังก์ชันยืนยันวิธีลงนาม*/ function onConfirmSignature() { dialogConfirm( $q, diff --git a/src/modules/18_command/components/Step/1_Detail.vue b/src/modules/18_command/components/Step/1_Detail.vue index 4ade2a325..0439c538d 100644 --- a/src/modules/18_command/components/Step/1_Detail.vue +++ b/src/modules/18_command/components/Step/1_Detail.vue @@ -36,21 +36,21 @@ const props = defineProps({ const commandId = ref(route.params.id.toString()); //ID คำสั่ง // ฟอร์มข้อมูล -let formData = reactive({ - commandNo: "", - commandYear: null, - detailHeader: "", - detailBody: "", - detailFooter: "", - issue: null, +let formData = reactive({ + issue: null, //คำสั่งเรื่อง + commandNo: "", //คำสั่งเลขที่ + commandYear: null, //พ.ศ. + detailHeader: "", //เนื้อหาคำสั่งขึ้นต้น + detailBody: "", //เนื้อหาคำสั่งหลัก + detailFooter: "", //เนื้อหาคำสั่งลงท้าย commandAffectDate: null, //วันที่ลงนาม commandExcecuteDate: null, //วันที่คำสั่งมีผล - isBangkok: null, - // isAttachment: true, + isBangkok: null, //คำสั่งสำนักปลัดกรุงเทพมหานคร }); const modalPreview = ref(false); //แสดงตัวอย่าง const isIdofficer = ref(false); //เช็ค สกจ. +/** ฟังก์ชันเช็ค สกจ.*/ async function fetchCheckIdofficer() { await http .get(config.API.checkIdofficer) @@ -90,7 +90,6 @@ async function onSubmit() { */ onMounted(async () => { await fetchCheckIdofficer(); - formData.commandNo = props.formCommandList.commandNo; formData.commandYear = props.formCommandList.commandYear; formData.detailHeader = props.formCommandList.detailHeader; @@ -109,8 +108,6 @@ onMounted(async () => {
- -
(route.params.id.toString()); //ID คำสั่ const storePosSalary = usePosSalaryDataStore(); const store = useCommandDetail(); const { - dialogMessageNotify, dialogConfirm, dialogRemove, messageError, @@ -34,7 +33,7 @@ const { success, } = useCounterMixin(); -const isChangeData = defineModel("isChangeData", { required: true }); //การเปลี่ยนแปลงของข้อมูล +// const isChangeData = defineModel("isChangeData", { required: true }); //การเปลี่ยนแปลงของข้อมูล const props = defineProps({ onCheckChangeData: { type: Function, required: true }, fetchDataCommandList: { type: Function, required: true }, @@ -219,7 +218,6 @@ function savePosition() { } async function getCommandSalaryList(type: string) { - showLoader(); await http .get(config.API.commandSalaryList(type)) .then(async (res) => { @@ -228,15 +226,11 @@ async function getCommandSalaryList(type: string) { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } /** ดึงข้อมูล บุคคล */ async function getPersonList() { - showLoader(); await http .get(config.API.commandAction(commandId.value, "tab2")) .then(async (res) => { @@ -247,17 +241,19 @@ async function getPersonList() { }) .catch((e) => { messageError($q, e); - }) - .finally(() => { - hideLoader(); }); } onMounted(async () => { - await getPersonList(); + const promises = [getPersonList()]; + if (props.commandSysId) { - await getCommandSalaryList(props.commandSysId); + promises.push(getCommandSalaryList(props.commandSysId)); } + showLoader(); + await Promise.all(promises).finally(() => { + hideLoader(); + }); }); diff --git a/src/modules/18_command/components/Step/3_ReceivedCopy.vue b/src/modules/18_command/components/Step/3_ReceivedCopy.vue index 108e92ef3..4a07f94bc 100644 --- a/src/modules/18_command/components/Step/3_ReceivedCopy.vue +++ b/src/modules/18_command/components/Step/3_ReceivedCopy.vue @@ -119,7 +119,6 @@ async function fetchData() { .then(async (res) => { const data = await res.data.result; rows.value = data; - isChangeData.value = false; }) .catch((err) => { diff --git a/src/modules/18_command/interface/request/Main.ts b/src/modules/18_command/interface/request/Main.ts index b928e4b16..1caba8670 100644 --- a/src/modules/18_command/interface/request/Main.ts +++ b/src/modules/18_command/interface/request/Main.ts @@ -12,20 +12,15 @@ interface FormCommand { } interface FormDataDetail { - id?: string; - status?: string; - commandNo: string; - commandYear: number | null; - detailHeader: string; - detailBody: string; - detailFooter: string; - issue: string | null; - commandAffectDate: Date | null; - commandExcecuteDate: Date | null; - commandSysId?: string; - commandTypeName?: string; - isBangkok?: string | null; - isAttachment: boolean; + issue: string | null; //คำสั่งเรื่อง + commandNo: string; //คำสั่งเลขที่ + commandYear: number | null; //พ.ศ. + detailHeader: string; //เนื้อหาคำสั่งขึ้นต้น + detailBody: string; //เนื้อหาคำสั่งหลัก + detailFooter: string; //เนื้อหาคำสั่งลงท้าย + commandAffectDate: Date | null; //วันที่ลงนาม + commandExcecuteDate: Date | null; //วันที่คำสั่งมีผล + isBangkok: string | null; //คำสั่งสำนักปลัดกรุงเทพมหานคร } interface ListCommandSalaryType { From 3aba66a07cbf1003948f1a9c078aeebe53c07b8a Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Mon, 28 Oct 2024 10:35:20 +0700 Subject: [PATCH 2/2] VITE_URL_SSO --- .env | 3 ++- .env.production | 3 ++- entrypoint.sh | 1 + src/plugins/auth.ts | 6 ++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 872a5e0c4..5ecafeff4 100644 --- a/.env +++ b/.env @@ -6,4 +6,5 @@ VITE_S3CLUSTER_PUBLIC_URL: "https://s3cluster.frappet.com/bma-ehr-fpt/organizati VITE_URL_KEYCLOAK: "https://id.frappet.synology.me" VITE_REALM_KEYCLOAK: "bma-ehr" VITE_CLIENTID_KEYCLOAK: "gettoken" -VITE_CLIENTSECRET_KEYCLOAK: "qsFwDb5anVoXKKwoeivrByIn9VYWQNRn" \ No newline at end of file +VITE_CLIENTSECRET_KEYCLOAK: "qsFwDb5anVoXKKwoeivrByIn9VYWQNRn" +VITE_URL_SSO: "https://bma-sso.frappet.synology.me" \ No newline at end of file diff --git a/.env.production b/.env.production index 7acb1db10..8729b2cba 100644 --- a/.env.production +++ b/.env.production @@ -8,4 +8,5 @@ VITE_URL_KEYCLOAK: VITE_URL_KEYCLOAK VITE_REALM_KEYCLOAK: VITE_REALM_KEYCLOAK VITE_CLIENTID_KEYCLOAK: VITE_CLIENTID_KEYCLOAK VITE_CLIENTSECRET_KEYCLOAK: VITE_CLIENTSECRET_KEYCLOAK -VITE_MANUAL_URL: VITE_MANUAL_URL \ No newline at end of file +VITE_MANUAL_URL: VITE_MANUAL_URL +VITE_URL_SSO: VITE_URL_SSO \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index f9467745a..4e86264d7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,6 +19,7 @@ do sed -i 's|VITE_CLIENTID_KEYCLOAK|'${VITE_CLIENTID_KEYCLOAK}'|g' $file sed -i 's|VITE_CLIENTSECRET_KEYCLOAK|'${VITE_CLIENTSECRET_KEYCLOAK}'|g' $file sed -i 's|VITE_MANUAL_URL|'${VITE_MANUAL_URL}'|g' $file + sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file done diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts index 7e2001c36..4010c10d8 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -1,5 +1,7 @@ const ACCESS_TOKEN = "BMAHRIS_KEYCLOAK_IDENTITY"; - +const key_C_Config = { + url_Logout: import.meta.env.VITE_URL_SSO, +}; interface AuthResponse { access_token: string; expires_in: number; @@ -15,7 +17,7 @@ async function setAuthen(r: AuthResponse) { async function logout() { await deleteCookie(ACCESS_TOKEN); - window.location.href = "/login"; + window.location.href = key_C_Config.url_Logout; } async function getToken() {