From 3728587c4e426af61ad8a723f71661de607afbec Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 18 Oct 2024 16:48:27 +0700 Subject: [PATCH] =?UTF-8?q?UI=20=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B8=84=E0=B8=93=E0=B8=B0?= =?UTF-8?q?=E0=B8=81=E0=B8=A3=E0=B8=A3=E0=B8=A1=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=97=E0=B8=94=E0=B8=A5=E0=B8=AD=E0=B8=87=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/05_placement/api.probation.ts | 3 +- .../DialogOrder/DialogSendToCommand.vue | 242 +++++++++++++++++ .../components/probation/FormAssign.vue | 247 +++++++++++------- .../components/probation/MainAppoint.vue | 43 ++- .../components/probation/MainTabs.vue | 2 +- .../05_placement/interface/index/Main.ts | 21 ++ .../components/DialogCreateCommand.vue | 8 +- 7 files changed, 470 insertions(+), 96 deletions(-) create mode 100644 src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue diff --git a/src/api/05_placement/api.probation.ts b/src/api/05_placement/api.probation.ts index bfcc9f546..48a46c8cb 100644 --- a/src/api/05_placement/api.probation.ts +++ b/src/api/05_placement/api.probation.ts @@ -85,5 +85,6 @@ export default { orgProfileStatus: (profileId: string) => `${orgProfile}/profile/probation/${profileId}`, - appointMain + appointMain, + appointMainList:(id:string)=>`${appointMain}/list/${id}`, }; diff --git a/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue new file mode 100644 index 000000000..0a9bf839a --- /dev/null +++ b/src/modules/05_placement/components/probation/DialogOrder/DialogSendToCommand.vue @@ -0,0 +1,242 @@ + + diff --git a/src/modules/05_placement/components/probation/FormAssign.vue b/src/modules/05_placement/components/probation/FormAssign.vue index 0ce333425..2a7c323bf 100644 --- a/src/modules/05_placement/components/probation/FormAssign.vue +++ b/src/modules/05_placement/components/probation/FormAssign.vue @@ -7,6 +7,10 @@ import http from "@/plugins/http"; import config from "@/app.config"; import genReport from "@/plugins/genreport"; +import type { + AppointTopic, + AppointTopicMain, +} from "@/modules/05_placement/interface/index/Main"; const $q = useQuasar(); const isEdit = ref(false); @@ -27,6 +31,10 @@ const personalId = route.params.personalId as string; const assignId = ref(route.params.form as string); const routeName = router.currentRoute.value.name; +const appointTopic = ref(); +const appointOp = ref([]); +const appointAll = ref([]); + const fullname = ref(); const date_start = ref(); const date_finish = ref(); @@ -121,19 +129,8 @@ const OPcaretaker = ref< positionLevel: string; }>[] >([]); -const OPcommander = ref< - Array<{ - id: string; - prefix: string; - firstName: string; - lastName: string; - name: string; - citizenId: number; - isDirector: boolean; - position: string; - positionLevel: string; - }>[] ->([]); +const OPcaretakerNew = ref([]); +const OPcommander = ref([]); const OPchairman = ref< Array<{ id: string; @@ -152,6 +149,10 @@ interface MonthOption { value: number; label: string; } +interface optionsValue { + id: string; + name: string; +} interface CheckboxItem { id: number; parent_id: number; @@ -332,53 +333,53 @@ async function getUser() { position: item.position, })); - OPcommander.value = data.commander.map((item: any) => ({ - id: item.id, - name: - (item.prefix == null ? "" : item.prefix) + - item.firstName + - " " + - item.lastName, - label: item.position - ? `${item.prefix == null ? "" : item.prefix} ${item.firstName} ${ - item.lastName - } (${item.position}${ - item.posLevel && item.posType - ? ", " + item.posType + ": " + item.posLevel - : "" - })` - : `${item.prefix == null ? "" : item.prefix} ${item.firstName} ${ - item.lastName - }`, - citizenId: item.citizenId, - posLevel: item.posLevel, - posType: item.posType, - position: item.position, - })); + // OPcommander.value = data.commander.map((item: any) => ({ + // id: item.id, + // name: + // (item.prefix == null ? "" : item.prefix) + + // item.firstName + + // " " + + // item.lastName, + // label: item.position + // ? `${item.prefix == null ? "" : item.prefix} ${item.firstName} ${ + // item.lastName + // } (${item.position}${ + // item.posLevel && item.posType + // ? ", " + item.posType + ": " + item.posLevel + // : "" + // })` + // : `${item.prefix == null ? "" : item.prefix} ${item.firstName} ${ + // item.lastName + // }`, + // citizenId: item.citizenId, + // posLevel: item.posLevel, + // posType: item.posType, + // position: item.position, + // })); - OPchairman.value = data.chairman.map((item: any) => ({ - id: item.id, - name: - (item.prefix == null ? "-" : item.prefix) + - item.firstName + - " " + - item.lastName, - label: item.position - ? `${item.prefix == null ? "-" : item.prefix} ${item.firstName} ${ - item.lastName - } (${item.position}${ - item.posLevel && item.posType - ? ", " + item.posType + ": " + item.posLevel - : "" - })` - : `${item.prefix == null ? "-" : item.prefix} ${item.firstName} ${ - item.lastName - }`, - citizenId: item.citizenId, - posLevel: item.posLevel, - posType: item.posType, - position: item.position, - })); + // OPchairman.value = data.chairman.map((item: any) => ({ + // id: item.id, + // name: + // (item.prefix == null ? "-" : item.prefix) + + // item.firstName + + // " " + + // item.lastName, + // label: item.position + // ? `${item.prefix == null ? "-" : item.prefix} ${item.firstName} ${ + // item.lastName + // } (${item.position}${ + // item.posLevel && item.posType + // ? ", " + item.posType + ": " + item.posLevel + // : "" + // })` + // : `${item.prefix == null ? "-" : item.prefix} ${item.firstName} ${ + // item.lastName + // }`, + // citizenId: item.citizenId, + // posLevel: item.posLevel, + // posType: item.posType, + // position: item.position, + // })); }); } @@ -630,6 +631,7 @@ function putDataEdit(id: string) { }); } const data = { + appointId: appointTopic.value ? appointTopic.value.id : "", fullname: fullname.value, position: position.value, monthSelect: @@ -762,6 +764,7 @@ function putData(id: string) { }); } const data = { + appointId: appointTopic.value ? appointTopic.value.id : "", personalId: GUID, fullname: fullname.value, position: position.value, @@ -954,9 +957,9 @@ watch( * @param update fn */ function filterFnCaretaker(val: string, update: any) { - const dataFilter = filtermantor(OPcaretaker.value, [caretaker2.value]).filter( - (i: any) => i.id !== chairman.value.id - ); + const dataFilter = filtermantor(OPcaretakerNew.value, [ + caretaker2.value, + ]).filter((i: any) => i.id !== chairman.value.id); if (val == "") { update(() => { optionCaretaker.value = dataFilter; @@ -1022,25 +1025,6 @@ function filterFnCommander(val: string, update: any) { * @param update fn */ -function filterFnChairman(val: string, update: any) { - const dataFilter = OPchairman.value.filter( - (i: any) => - i.id !== caretaker1.value.id && - i.id !== caretaker2.value.id && - i.id !== commander.value.id - ); - if (val == "") { - update(() => { - OPchairmanFn.value = dataFilter; - }); - } else { - update(() => { - OPchairmanFn.value = dataFilter.filter( - (e: any) => e.name.search(val) !== -1 - ); - }); - } -} /** * ฟิลเตอร์ผู้ดูเเลตาม ที่กรอก * @param val รับค่า input @@ -1058,6 +1042,73 @@ function filterFnKnowledge(val: string, update: any) { }); } +async function getAppoint(id: string) { + http + .get(config.API.appointMainList(id)) + .then((res) => { + const data = res.data.data; + appointOp.value = data; + appointAll.value = data; + }) + .catch((e) => { + messageError($q, e); + }) + .finally(() => {}); +} + +function updateAppointMent() { + if (appointTopic.value) { + const data = appointTopic.value.directors; + + const dataFindChairman = data.find( + (item: AppointTopic) => item.role === "chairman" + ); + const dataFindCommittee = data + .filter((item: AppointTopic) => item.role === "committee") + .map((i: AppointTopic) => ({ + id: i.id, + name: i.name, + label: i.position + ? `${i.name} (${i.position}${ + i.positionLevel && i.positionType + ? ", " + i.positionType + ": " + i.positionLevel + : "" + })` + : i.name, + posLevel: i.positionLevel, + posType: i.positionType, + position: i.position, + })); + const createChairmanObject = (chairmanData: AppointTopic) => ({ + id: chairmanData.id, + name: chairmanData.name, + label: chairmanData.position + ? `${chairmanData.name} (${chairmanData.position}${ + chairmanData.positionLevel && chairmanData.positionType + ? ", " + + chairmanData.positionType + + ": " + + chairmanData.positionLevel + : "" + })` + : chairmanData.name, + posLevel: chairmanData.positionLevel, + posType: chairmanData.positionType, + position: chairmanData.position, + }); + + OPcaretakerNew.value = dataFindCommittee; + OPcommander.value = dataFindCommittee; + + OPchairmanFn.value = dataFindChairman + ? createChairmanObject(dataFindChairman) + : null; + chairman.value = dataFindChairman + ? createChairmanObject(dataFindChairman) + : null; + } +} + /** เมื่อโหลดหน้า เรียกใช้งานฟังชั่น */ onMounted(async () => { await getUser(); @@ -1067,6 +1118,7 @@ onMounted(async () => { await getKnowledge(personalId); await getcompetency(personalId); await getCompetencyGroup(personalId); + await getAppoint(personalId); if (assignId.value !== undefined) { await getAssign(); } @@ -1182,6 +1234,25 @@ onMounted(async () => {
+
+ +
1 ผู้ทดลองปฏิบัติหน้าที่ราชการ @@ -1329,7 +1400,7 @@ onMounted(async () => { { { :options="OPchairmanFn" option-label="label" class="col-xs-12 col-sm-8" - :readonly="isEdit != true" + readonly dense borderless outlined v-model="chairman" label="ประธานกรรมการ" - :rules="[(val:string) => !!val || 'กรุณาเลือก ประธานกรรมการ']" use-input behavior="menu" - @filter="filterFnChairman" bg-color="white" >