From d94531204a1e4350d8ad1dd0e15db207fa9d2fd0 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 22 Sep 2023 11:16:25 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B8=A1=20interfac?= =?UTF-8?q?e=20row?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppointMent/AppointmentModal.vue | 124 +++--------------- .../components/AppointMent/Main.vue | 20 +-- .../05_placement/components/Other/Main.vue | 3 +- .../components/Receive/receiveMain.vue | 2 +- .../components/Repatriate/RepatriateMain.vue | 2 +- .../components/helpgovernment/mainHelp.vue | 2 +- .../components/probation/MainProbation.vue | 4 +- .../05_placement/interface/request/Main.ts | 23 +++- .../interface/response/AppointMent.ts | 38 ++++++ .../05_placement/interface/response/Main.ts | 7 +- .../interface/response/OhterMain.ts | 6 +- .../interface/response/officer.ts | 1 - 12 files changed, 99 insertions(+), 133 deletions(-) create mode 100644 src/modules/05_placement/interface/response/AppointMent.ts diff --git a/src/modules/05_placement/components/AppointMent/AppointmentModal.vue b/src/modules/05_placement/components/AppointMent/AppointmentModal.vue index e4ea460dd..9e5c49897 100644 --- a/src/modules/05_placement/components/AppointMent/AppointmentModal.vue +++ b/src/modules/05_placement/components/AppointMent/AppointmentModal.vue @@ -19,7 +19,15 @@ const myFormPosition = ref(); const selected = ref(""); const selectedFile = ref(""); const dataRespone = ref(); +const personal = ref(); +const expanded = ref([]); +const treeData = ref>([]); +const placementPosition = ref([]); +const search = ref(""); +const filterRef = ref(null); +const id = ref(""); +const editDataStatus = ref(false); // Set form field let dataForm = reactive({ personalId: "", @@ -53,7 +61,7 @@ const fetchPublishFile = async () => { }; // โหลดข้อมูลโครงสร้างจาก json -const treeData = ref>([]); + const loadTreeData = async () => { expanded.value = []; await http @@ -75,7 +83,6 @@ const loadTreeData = async () => { }; function filterByPersonIdNull(obj: any) { - // console.log(obj); if (obj.name === null && obj.isCondition != true) { return true; } @@ -87,7 +94,7 @@ function filterByPersonIdNull(obj: any) { } // โหลด position -const placementPosition = ref([]); + const fetchplacementPosition = async () => { await http .get(config.API.apppointmentPosition()) @@ -99,13 +106,7 @@ const fetchplacementPosition = async () => { }); }; -const search = ref(""); -//reset Tree Filter -const filterRef = ref(null); -// const resetFilter = () => { -// search.value = ""; -// filterRef.value.focus(); -// }; + const props = defineProps({ personalId: String, @@ -121,23 +122,19 @@ const myFilterMethod = (node: any, filter: string) => { const filt = filter; return ( - // ((node.name && node.name == null) || !node.name) && (node.name && node.name.indexOf(filt) > -1) || (node.organizationName && node.organizationName.indexOf(filt) > -1) || (node.positionNum && node.positionNum.indexOf(filt) > -1) || (node.positionName && node.positionName.indexOf(filt) > -1) || - (node.governmentCode && - node.governmentCode.toString().indexOf(filt) > -1) || + (node.governmentCode && node.governmentCode.toString().indexOf(filt) > -1) || (node.agency && node.agency.indexOf(filt) > -1) || (node.government && node.government.indexOf(filt) > -1) || (node.department && node.department.indexOf(filt) > -1) || (node.pile && node.pile.indexOf(filt) > -1) || - (node.organizationShortName && - node.organizationShortName.indexOf(filt) > -1) || + (node.organizationShortName && node.organizationShortName.indexOf(filt) > -1) || (node.positionSideName && node.positionSideName.indexOf(filt) > -1) || (node.executivePosition && node.executivePosition.indexOf(filt) > -1) || - (node.executivePositionSide && - node.executivePositionSide.indexOf(filt) > -1) || + (node.executivePositionSide && node.executivePositionSide.indexOf(filt) > -1) || (node.positionLevel && node.positionLevel.indexOf(filt) > -1) ); }; @@ -150,17 +147,14 @@ const validateData = async () => { } }); }; -const id = ref(""); -const saveAppoint = async () => { - console.log("save", dataForm); +const saveAppoint = async () => { myFormPosition.value.validate().then(async (result: boolean) => { if (props.personalId !== undefined) { id.value = props.personalId.toString(); } if (result) { const dataAppoint = await { - // personalId: props.personalId, recruitDate: dataForm.containDate, posNoId: dataForm.posNoId, positionId: dataForm.positionId, @@ -168,16 +162,11 @@ const saveAppoint = async () => { positionLineId: dataForm.positionLineId, positionPathSideId: dataForm.positionPathSideId, positionTypeId: dataForm.positionTypeId, - // salaryAmount: dataForm.salaryAmount, - // mouthSalaryAmount: dataForm.mouthSalaryAmount, - // positionSalaryAmount: dataForm.positionSalaryAmount, }; - console.log("save appoint===>", dataAppoint); showLoader(); await http .put(config.API.appointmentPosition(id.value), dataAppoint) .then((res) => { - console.log("respone=>", res); success($q, "บันทึกสำเร็จ"); }) .catch((e) => { @@ -185,7 +174,6 @@ const saveAppoint = async () => { }) .finally(async () => { await closeAndClear(); - // await resetFilter(); await fetchPublishFile(); await loadTreeData(); await fetchplacementPosition(); @@ -195,10 +183,7 @@ const saveAppoint = async () => { }); }; -const editDataStatus = ref(false); -const clickEditRow = () => { - editDataStatus.value = true; -}; + const closeModal = () => { if (editDataStatus.value == true) { dialogConfirm( @@ -227,9 +212,6 @@ const closeAndClear = async () => { dataForm.positionLineId = ""; dataForm.positionPathSideId = ""; dataForm.positionTypeId = ""; - // dataForm.salaryAmount = null; - // dataForm.mouthSalaryAmount = null; - // dataForm.positionSalaryAmount = null; }; // ตำแหน่งเลขที่ const posNoOptions = ref([ @@ -275,9 +257,7 @@ const positionLevelOptions = ref([ ]); const selectedPosition = async (data: any) => { - console.log("selecteds", data); if (data.name == null && selected.value != data.keyId) { - // console.log("selecteds", data); editDataStatus.value = true; selected.value = data.keyId; @@ -359,51 +339,40 @@ const selectedPosition = async (data: any) => { dataForm.positionPathSideId = ""; dataForm.positionTypeId = ""; } - console.log("dataForm", dataForm); }; const checkPosition = (val: string) => { const num = placementPosition.value.findIndex((e: string) => e === val); return num; }; -const personal = ref(); -const expanded = ref([]); + watch(props, () => { expanded.value = []; const dataPersonal = props.personal; - console.log(props.personal); if (dataPersonal) { dataPersonal.map((data: any) => { personal.value = data; }); - console.log("personal", personal.value); } - // console.log("draft===>", personal.value.draft); if (personal.value) { - // const findData = dataRespone.value.find(findByPerson); let findData: any = null; dataRespone.value.map((x: any) => { findData = findByPerson(x); - // console.log(findData); - if (findData != null) { - // console.log("findData===>", findData); selectedPosition(findData); for (let i = 3; i <= findData.keyId.length; i += 2) { expanded.value.push(findData.keyId.slice(0, i)); } } }); - // loadTreeData(); - // selectedPosition(findData.children.children.children) + } }); function findByPerson(element: any): any { - // console.log("searchTree element===>", element) if ( element.positionNumId && element.positionLineId === personal.value.positionLineId && @@ -472,10 +441,6 @@ function findByPerson(element: any): any {
{{ prop.node.organizationName }}
- - - @@ -711,55 +675,6 @@ function findByPerson(element: any): any { map-options /> - - - - - - @@ -793,6 +708,5 @@ function findByPerson(element: any): any { background: #a3d3fb48 !important; font-weight: 600; border: 1px solid rgba(175, 185, 196, 0.217); - /* box-shadow: 1px 1px 7px 1px rgba(41, 95, 255, 0.15) !important; */ } diff --git a/src/modules/05_placement/components/AppointMent/Main.vue b/src/modules/05_placement/components/AppointMent/Main.vue index 7e5ed0036..3daf05f62 100644 --- a/src/modules/05_placement/components/AppointMent/Main.vue +++ b/src/modules/05_placement/components/AppointMent/Main.vue @@ -7,7 +7,8 @@ import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store" import Dialogbody from "@/modules/05_placement/components/AppointMent/Dialogbody.vue" import DialogOrgTree from "@/modules/05_placement/components/AppointMent/AppointmentModal.vue"; - +import type { listAppointType,resData,orgFilter } from "@/modules/05_placement/interface/response/AppointMent" +import type { OpType } from "@/modules/05_placement/interface/response/Main" import http from "@/plugins/http"; import config from "@/app.config"; @@ -26,16 +27,16 @@ const { } = mixin; const router = useRouter(); -const rows = ref([]); -const rows2 = ref([]); +const rows = ref([]); +const rows2 = ref([]); const modalTree = ref(false); const personal = ref([]); const personalId = ref(""); const filterKeyword = ref(""); const filterKeyword2 = ref(""); const filterRef = ref(null); -const listRecevice = ref([]); -const optionsType = ref([]); +const listRecevice = ref([]); +const optionsType = ref([]); const type = ref(""); const visibleColumns = ref([ @@ -147,7 +148,7 @@ const fecthlistappointment = async () => { .then((res) => { let response = res.data.result; listRecevice.value = response; - rows.value = response.map((e: any) => ({ + rows.value = response.map((e: resData) => ({ personalId: e.id, citizenId: e.citizenId, fullname: e.prefix + e.firstname + " " + e.lastname, @@ -165,11 +166,10 @@ const fecthlistappointment = async () => { positionPath: e.positionPath, status: statusText(e.status), createdAt: date2Thai(e.createdAt), - birthday: e.dateOfBirth == null ? "-" : date2Thai(e.dateOfBirth), })); rows2.value = rows.value.filter( - (e: any) => + (e: orgFilter) => e.orgName !== null && e.status !== "ส่งรายชื่อไปออกคำสั่ง" && e.status !== "ออกคำสั่งเสร็จแล้ว" @@ -189,7 +189,7 @@ const fecthTypeOption = async () => { .get(config.API.typeOrder()) .then((res) => { optionsType.value = res.data.result.filter( - (e: any) => + (e: OpType) => e.commandCode === "C-PM-05" || e.commandCode === "C-PM-06" || e.commandCode === "C-PM-07" @@ -203,7 +203,7 @@ const fecthTypeOption = async () => { // เปิดโครงสร้าง const openModalTree = (id: string) => { personalId.value = id; - personal.value = listRecevice.value.filter((e: any) => e.id === id); + personal.value = listRecevice.value.filter((e) => e.id === id); modalTree.value = true; }; //เเจ้งเตือนลบข้อมูล diff --git a/src/modules/05_placement/components/Other/Main.vue b/src/modules/05_placement/components/Other/Main.vue index 708960ee9..6d911817d 100644 --- a/src/modules/05_placement/components/Other/Main.vue +++ b/src/modules/05_placement/components/Other/Main.vue @@ -5,7 +5,8 @@ import { useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; import { useTransferDataStore } from "@/modules/05_placement/store" import type { QTableProps } from "quasar"; -import type { listMain,listMainAPI,OpType } from "@/modules/05_placement/interface/response/OhterMain" +import type { listMain,listMainAPI } from "@/modules/05_placement/interface/response/OhterMain" +import type { OpType } from "@/modules/05_placement/interface/response/Main" import http from "@/plugins/http"; import config from "@/app.config"; diff --git a/src/modules/05_placement/components/Receive/receiveMain.vue b/src/modules/05_placement/components/Receive/receiveMain.vue index cfcb4ea26..98f9ae8c9 100644 --- a/src/modules/05_placement/components/Receive/receiveMain.vue +++ b/src/modules/05_placement/components/Receive/receiveMain.vue @@ -31,7 +31,7 @@ const filterKeyword = ref(""); const filterKeyword2 = ref(""); const filterRef = ref(null); const files = ref(); -const listRecevice = ref([]); +const listRecevice = ref([]); const filters = ref([]); const rows = ref([]); const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง diff --git a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue index f50787d2f..d4de1077f 100644 --- a/src/modules/05_placement/components/Repatriate/RepatriateMain.vue +++ b/src/modules/05_placement/components/Repatriate/RepatriateMain.vue @@ -17,7 +17,7 @@ const filterKeyword2 = ref(""); const filterRef = ref(null); const router = useRouter(); const rows = ref([]); -const rows2 = ref([]); +const rows2 = ref([]); const modal = ref(false); const mixin = useCounterMixin(); diff --git a/src/modules/05_placement/components/helpgovernment/mainHelp.vue b/src/modules/05_placement/components/helpgovernment/mainHelp.vue index db5b34bbd..a0116fc5f 100644 --- a/src/modules/05_placement/components/helpgovernment/mainHelp.vue +++ b/src/modules/05_placement/components/helpgovernment/mainHelp.vue @@ -21,7 +21,7 @@ const filterRef = ref(null); const router = useRouter(); const rows = ref([]); -const rows2 = ref([]); +const rows2 = ref([]); const modal = ref(false); const mixin = useCounterMixin(); const { diff --git a/src/modules/05_placement/components/probation/MainProbation.vue b/src/modules/05_placement/components/probation/MainProbation.vue index 8ce2fb284..3b1765795 100644 --- a/src/modules/05_placement/components/probation/MainProbation.vue +++ b/src/modules/05_placement/components/probation/MainProbation.vue @@ -4,7 +4,7 @@ import { useCounterMixin } from "@/stores/mixin"; import { useQuasar } from "quasar"; import { useTransferDataStore } from "@/modules/05_placement/store" import type { QTableProps } from "quasar"; -import type { FormMainProbation, FormMainProbation2 } from "@/modules/05_placement/interface/request/Main"; +import type { FormMainProbation, FormMainProbation2,mapData } from "@/modules/05_placement/interface/request/Main"; import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue"; import router from "@/router"; @@ -296,7 +296,7 @@ const findlist = async (id: string) => { response2.forEach((e: any) => probationlist.value.push({ ...e, probation: false }) ); - rows2.value = probationlist.value.map((e: any) => ({ + rows2.value = probationlist.value.map((e: mapData) => ({ id: e.id, fullname: e.fullname, position: e.position, diff --git a/src/modules/05_placement/interface/request/Main.ts b/src/modules/05_placement/interface/request/Main.ts index 0eb49e443..dc133d78e 100644 --- a/src/modules/05_placement/interface/request/Main.ts +++ b/src/modules/05_placement/interface/request/Main.ts @@ -65,9 +65,20 @@ interface FormProbationPersonal { order_number: string, probation_status: string } -export type { FormPlacementMainData }; -export type { FormOrderPlacementMainData }; -export type { FormMainProbation }; -export type { FormMainProbation2 }; -export type { FormProbationDetail }; -export type { FormProbationPersonal }; +interface mapData { +id:string +fullname:string +position:string +positionEmployeeLevel:string +oc:string +probation:string +} +export type { + FormPlacementMainData, + FormOrderPlacementMainData, + FormMainProbation, + FormMainProbation2, + FormProbationDetail, + FormProbationPersonal, + mapData, +}; diff --git a/src/modules/05_placement/interface/response/AppointMent.ts b/src/modules/05_placement/interface/response/AppointMent.ts new file mode 100644 index 000000000..e02c3a0b5 --- /dev/null +++ b/src/modules/05_placement/interface/response/AppointMent.ts @@ -0,0 +1,38 @@ +interface listAppointType { +personalId:string +citizenId:number +fullname:string +organizationName:string +orgName:string +organizationShortName:string +positionNumber:string +positionPath:string +status:string +createdAt:string +birthday:string +} + +interface resData { + id:string + citizenId:number + prefix:string + firstname:string + lastname:string + organizationName:string + organizationShortName:string + positionNumber:string + positionPath:string + status:string + createdAt:Date + dateOfBirth:Date +} +interface orgFilter{ + orgName:string + status:string +} + +export type { + listAppointType, + resData, + orgFilter +} \ No newline at end of file diff --git a/src/modules/05_placement/interface/response/Main.ts b/src/modules/05_placement/interface/response/Main.ts index e4ea7770c..331e391b1 100644 --- a/src/modules/05_placement/interface/response/Main.ts +++ b/src/modules/05_placement/interface/response/Main.ts @@ -1 +1,6 @@ -export type {}; +interface OpType { + commandCode:string +} +export type { + OpType +}; diff --git a/src/modules/05_placement/interface/response/OhterMain.ts b/src/modules/05_placement/interface/response/OhterMain.ts index 118176efe..dfec62dff 100644 --- a/src/modules/05_placement/interface/response/OhterMain.ts +++ b/src/modules/05_placement/interface/response/OhterMain.ts @@ -44,11 +44,9 @@ interface listMainAPI { statustext:string createdAt:Date } -interface OpType { - commandCode:string -} + export type { listMain, listMainAPI, - OpType + } \ No newline at end of file diff --git a/src/modules/05_placement/interface/response/officer.ts b/src/modules/05_placement/interface/response/officer.ts index ef6c83f14..847f2789e 100644 --- a/src/modules/05_placement/interface/response/officer.ts +++ b/src/modules/05_placement/interface/response/officer.ts @@ -1,5 +1,4 @@ interface officerType { - no: number; id: string; prefix: string; firstName: string;