diff --git a/src/api/07_insignia/api.insignia.ts b/src/api/07_insignia/api.insignia.ts index ad704fa4f..62e8e4b4e 100644 --- a/src/api/07_insignia/api.insignia.ts +++ b/src/api/07_insignia/api.insignia.ts @@ -35,7 +35,7 @@ export default { insigniaSendToDirector: (roundId: string, ocId: string) => `${insignia}/request/officer/approve/${roundId}/${ocId}`, insigniaDirectorBackToEdit: (roundId: string, ocId: string) => `${insignia}/request/director/reject/${roundId}/${ocId}`, insigniaDirectorApproved: (roundId: string, ocId: string) => `${insignia}/request/director/approve/${roundId}/${ocId}`, - insigniaRequestSendNote: (insigniaPeriodId: string) => `${insignia}/insignia/request/send/note/${insigniaPeriodId}`, + insigniaRequestSendNote: (insigniaPeriodId: string) => `${insignia}/request/send/note/${insigniaPeriodId}`, // uploadfile uploadfilereceice: (noteId: string) => `${insignia}/request/import/receice/${noteId}`, @@ -53,6 +53,6 @@ export default { // ยืม-คืนเครื่องราชฯ insigniaManageBorrow: () => `${insignia}/manage/borrow`, insigniaManageBorrowReturn: (insigniaManageProfileId: string) => `${insignia}/manage/return/${insigniaManageProfileId}`, - insigniaManageBorrowList: (year: number, insigniaTypeId: string) => `${insignia}/borrow/${year}/${insigniaTypeId}`, + insigniaManageBorrowList: (year: number, insigniaTypeId: string) => `${insignia}/manage/borrow/${year}/${insigniaTypeId}`, insigniaManageBorrowById: (insigniaManageProfileId: string) => `${insignia}/manage/borrow/${insigniaManageProfileId}`, }; \ No newline at end of file diff --git a/src/modules/05_placement/components/Transfer/transferRegistry.vue b/src/modules/05_placement/components/Transfer/transferRegistry.vue index bc6ea2a1d..552732a47 100644 --- a/src/modules/05_placement/components/Transfer/transferRegistry.vue +++ b/src/modules/05_placement/components/Transfer/transferRegistry.vue @@ -138,9 +138,6 @@ ไฟล์ PDF - - ไฟล์ WORD - @@ -173,9 +170,9 @@ ดาวน์โหลด - + diff --git a/src/modules/07_insignia/components/4_Allocate/Main.vue b/src/modules/07_insignia/components/4_Allocate/Main.vue index 05ab65f89..027a0f341 100644 --- a/src/modules/07_insignia/components/4_Allocate/Main.vue +++ b/src/modules/07_insignia/components/4_Allocate/Main.vue @@ -24,7 +24,7 @@ const { const redirectToPage = (id: string, name: string) => { DataStore.insigniaName = name - router.push(`/insignia/allocate/detail/${id}`); + router.push(`/insignia/allocate/org/${id}`); }; const paging = ref(true); const paginationLabel = (start: string, end: string, total: string) => { @@ -224,13 +224,12 @@ const editData = (data: any) => { const save = async (insigniaId: string, total: string) => { showLoader() - const formData = new FormData(); - formData.append("Insignia", insigniaId); - formData.append("Year", `${roundYear.value}`); - formData.append("Total", total); - await http - .post(config.API.insigniaManageAdd(), formData) + .post(config.API.insigniaManageAdd(), { + insignia: insigniaId, + year: `${roundYear.value}`, + total: total, + }) .then((res) => { fecthlistInsignia(); }) diff --git a/src/modules/07_insignia/components/4_Allocate/OrgList.vue b/src/modules/07_insignia/components/4_Allocate/OrgList.vue index 9c8d806ca..6f597a81a 100644 --- a/src/modules/07_insignia/components/4_Allocate/OrgList.vue +++ b/src/modules/07_insignia/components/4_Allocate/OrgList.vue @@ -42,7 +42,7 @@ onMounted(async () => { fecthListData(); name.value = DataStore.insigniaName - await fetchTreeRoot() + fetchOrgList() }); const fecthDashboard = async () => { @@ -70,7 +70,7 @@ const fecthListData = async () => { // console.log("res===>", res) rows.value = res.data.result.map((e: any) => ({ id: e.id, - organization: e.organization, + organization: e.organizationOrganization, total: e.total, allocate: e.allocate, remain: e.remain, @@ -82,49 +82,26 @@ const fecthListData = async () => { .finally(() => hideLoader()) }; -const rootOrgID = ref(); // org id ของ root ตัวปัจจุบันที่เลือกอยู่ -const fetchTreeRoot = async () => { - // showLoader(); - let urlRequest = config.API.chartGetTreeRoot; +const fetchOrgList = async () => { + showLoader(); await http - .get(urlRequest) - .then((response) => { - if (response.data.result.length > 0) { - rootOrgID.value = response.data.result[0].organizationId; - } - }) - .catch((e) => { - console.log(e); - }) - .finally(async () => { - await fetchOrgChart() - }); -}; - -const fetchOrgChart = async () => { - // showLoader(); - let urlRequest = config.API.chartGetOrg(rootOrgID.value); - await http - .get(urlRequest) + .get(config.API.typeOc()) .then(async (response: any) => { - if (response.data.result.length > 0) { - // console.log("response===>", response.data.result[0].children) - orgList.value = await response.data.result[0].children.map((e: any) => ({ - id: e.organizationId, - name: e.departmentName - })); - } + orgList.value = response.data.result.map((e: any)=>({ + id: e.organizationId, + name: e.organizationName + })) }) - .catch((e) => { - console.log(e); + .catch((err) => { + messageError($q, err) }) - // .finally(() => { - // hideLoader(); - // }); + .finally(() => { + hideLoader(); + }); }; const backHistory = () => { - router.push(`/insignia/allocate/list-allocate`) + router.push(`/insignia/allocate`) } const close = () => { @@ -299,7 +276,7 @@ const paginationLabel = (start: string, end: string, total: string) => { - {{ props.row.totalInsignia }} + {{ props.row.total }} diff --git a/src/modules/07_insignia/components/4_Allocate/allocateAdd.vue b/src/modules/07_insignia/components/4_Allocate/allocateAdd.vue deleted file mode 100644 index a95f9e1d6..000000000 --- a/src/modules/07_insignia/components/4_Allocate/allocateAdd.vue +++ /dev/null @@ -1,84 +0,0 @@ - - diff --git a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue index 63c087465..8bab40b01 100644 --- a/src/modules/07_insignia/components/5_Borrow/DialogForm.vue +++ b/src/modules/07_insignia/components/5_Borrow/DialogForm.vue @@ -2,7 +2,7 @@ import { ref, watch, computed } from "vue"; import { QForm, useQuasar } from "quasar"; import { useCounterMixin } from "@/stores/mixin"; -import { useResultDataStore } from "@/modules/07_insignia/storeResult"; +import { useResultDataStore } from "@/modules/07_insignia/storeAllocate"; import http from "@/plugins/http"; import config from "@/app.config"; import type { DataOption } from "@/modules/04_registry/components/profileType"; @@ -20,94 +20,31 @@ const { hideLoader, notifyError, } = mixin; -const status = ref(""); -const Advertise = ref(""); -const issue = ref(""); const brand = ref(""); -const roundNo = ref(""); +const roundNo = ref(""); const cardid = ref(""); const OrganazationId = ref(""); const fullName = ref(""); -const volume = ref(""); -const episode = ref(""); -const duty = ref(""); -const announced = ref(""); -const firstname = ref(""); -const lastname = ref(""); -const position = ref(""); -const invoice = ref(null); -const payment = ref(""); -const addressPayment = ref(null); -const affiliationRequest = ref(""); -const affiliationReceived = ref(""); +// const position = ref(""); const receivedate = ref(); -const announceDate = ref(); -const invoiceDate = ref(null); - -const employeeClass = ref(""); -const employeeClassOps = ref([ - { id: "officer", name: "ข้าราชการ กทม.สามัญ" }, - { id: "employee", name: "ลูกจ้างประจำ" }, -]); - +const returndate = ref(); +const reason = ref(""); const listPerson = ref([]); +const OrgList = ref([]); +const insigniaNoteProfileId = ref("") -const paymentOp = [ - { label: "จัดส่งทางไปรษณี", value: "จัดส่งทางไปรษณี" }, - { label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" }, -]; -const volumeOp = [ - { label: "เล่มที่", value: "xx1" }, - { label: "เล่มที่2", value: "xx2" }, - { label: "เล่มที่3", value: "xx3" }, -]; -const episodeOp = [ - { label: "ตอนที่1", value: "xx1" }, - { label: "ตอนที่2", value: "xx2" }, - { label: "ตอนที่3", value: "xx3" }, -]; -const dutyOp = [ - { label: "หน้าที่1", value: "xx1" }, - { label: "หน้าที่2", value: "xx2" }, - { label: "หน้าที่3", value: "xx3" }, -]; -const announcedOp = [ - { label: "ลำดับที่1", value: "xx1" }, - { label: "ลำดับที่2", value: "xx2" }, - { label: "ลำดับที่3", value: "xx3" }, -]; -const affiliationRequestOp = [ - { label: "สังกัด1", value: "xx1" }, - { label: "สังกัด2", value: "xx2" }, - { label: "สังกัด3", value: "xx3" }, -]; -const affiliationReceivedOp = [ - { label: "สังกัด4", value: "xx4" }, - { label: "สังกัด5", value: "xx5" }, - { label: "สังกัด6", value: "xx6" }, -]; -const prefixOp = [ - { label: "นาย", value: "mr" }, - { label: "นางสาว", value: "miss" }, - { label: "นาง", value: "mrs" }, -]; -const positionOp = [ - { label: "ตำแหน่ง1", value: "xxx1" }, - { label: "ตำแหน่ง2", value: "xxx2" }, - { label: "ตำแหน่ง3", value: "xxx3" }, -]; - -const OrgOp = ref([ - { id: "xxx1", name: "หน่วยงาน กทม" }, - { id: "xxx2", name: "หน่วยงาน กทมฯ" }, -]); - -const clearDateExam = () => { - receivedate.value = null; - announceDate.value = null; - invoiceDate.value = null; +const clearData = () => { + receivedate.value = null + returndate.value = null + OrganazationId.value = "" + roundNo.value = "" + cardid.value = "" + fullName.value = "" + brand.value = "" + reason.value = "" }; + const props = defineProps({ modal: Boolean, save: { @@ -118,198 +55,154 @@ const props = defineProps({ type: Function, default: () => console.log("not function"), }, + closeAndFecth: { + type: Function, + default: () => console.log("not function"), + }, roundId: { type: String, }, action: { type: String, }, - personId: { - type: String, - }, - profileType: { + typeId: { type: String, }, selectRoundOption: { type: Array + }, + profileId: { + type: String, + default: "" } }); -watch(props, () => { - if (props.modal === true) { - employeeClass.value = ""; - cardid.value = ""; - fullName.value = ""; - position.value = ""; - Advertise.value = ""; - brand.value = ""; - receivedate.value = null; - issue.value = ""; - affiliationRequest.value = ""; - affiliationReceived.value = ""; - announceDate.value = null; - volume.value = ""; - episode.value = ""; - duty.value = ""; - announced.value = ""; - // invoice.value = ""; - invoiceDate.value = null; - payment.value = ""; - if (props.action === "editData") { - fectDataByid(props.personId); +watch(props, () => { + if (props.modal == true && props.roundId != 'all') { + roundNo.value = props.roundId + fecthlistInsignia() + fetchOrgList() + if (props.action == 'editData') { + fetchData() } } }); -const disbleStatus = computed(() => { - if (employeeClass.value !== "") { - return false; - } else return true; -}); -const selectType = async () => { +const fecthlistInsignia = async () => { showLoader(); - cardid.value = ""; - fullName.value = ""; - position.value = ""; - Advertise.value = ""; - brand.value = ""; - receivedate.value = null; - issue.value = ""; - affiliationRequest.value = ""; - affiliationReceived.value = ""; - announceDate.value = null; - volume.value = ""; - episode.value = ""; - duty.value = ""; - announced.value = ""; - invoiceDate.value = null; - payment.value = ""; - await fecthlistPerson(); -}; - -const fecthlistPerson = async () => { + let data = { + insigniaTypeId: props.typeId, + insigniaNoteId: props.roundId, + insigniaId: "", + }; await http - .get(config.API.profileOrganizRoot) + .post(config.API.noteSearch(), data) .then((res) => { - const id = res.data.result[0].id; - if (id !== "") { - findlist(id); - } - }) - .catch((e) => { - messageError($q, e); - }); -}; -const findlist = async (id: string) => { - let data = [{}]; - if (employeeClass.value === "officer") { - data = [{ criteriaType: "is_retire", criteriaValue: "false" }]; - } else if (employeeClass.value === "employee") { - data = [ - { criteriaType: "is_retire", criteriaValue: "false" }, - { criteriaType: "employee_class", criteriaValue: "perm" }, - ]; - } - await http - .post(config.API.profileSearchNewOcIdType(id, employeeClass.value), { - criterias: data, - }) - .then((res) => { - // console.log(res.data.result); - listPerson.value = res.data.result; - }) - .catch((e) => { - console.log(e); - }) - .finally(() => { - hideLoader(); - }); -}; -const fectDataByid = async (id: string) => { - showLoader(); - await http - .get(config.API.noteByid(id)) - .then((res) => { - let data = res.data.result; - employeeClass.value = ""; - cardid.value = data.citizenId; - fullName.value = data.fullName; - position.value = data.position; - Advertise.value = data.number; - brand.value = data.requestInsigniaId; - receivedate.value = data.dateReceive; - issue.value = data.issue; - affiliationRequest.value = data.organizationOrganizationSend; - affiliationReceived.value = data.organizationOrganizationReceive; - announceDate.value = data.date; - volume.value = data.volumeNo; - episode.value = data.section; - duty.value = data.page; - announced.value = data.no; - invoiceDate.value = data.datePayment; - payment.value = data.typePayment; - addressPayment.value = data.address; - status.value = data.status; - employeeClass.value = props.profileType; + listPerson.value = res.data.result }) .catch((err) => { - console.log(err); + // console.log(err); messageError($q, err); }) .finally(() => { hideLoader(); }); }; + +const fetchOrgList = async () => { + showLoader(); + await http + .get(config.API.typeOc()) + .then(async (response: any) => { + OrgList.value = response.data.result.map((e: any) => ({ + id: e.organizationId, + name: e.organizationName + })) + }) + .catch((err) => { + messageError($q, err) + }) + .finally(() => { + hideLoader(); + }); +}; + +const fetchData = async () => { + showLoader(); + await http + .get(config.API.insigniaManageBorrowById(props.profileId)) + .then(async (response: any) => { + console.log(response.data.result) + }) + .catch((err) => { + messageError($q, err) + }) + .finally(() => { + hideLoader(); + }); +}; + const clickSave = async () => { - let body = { - citizanId: cardid.value, // เลขบัตร - insigniaId: brand.value, // insigniaID - number: Advertise.value, - issue: issue.value, - dateReceive: receivedate.value, // วันที่ได้รับเครื่องราชฯ - organizationOrganizationSend: affiliationRequest.value, - organizationOrganizationReceive: affiliationReceived.value, - date: announceDate.value, // วันที่กิจนุเบก - volumeNo: volume.value, // เล่ม - section: episode.value, //ตอนที่ - page: duty.value, //หน้าที่ - no: announced.value, - // รอฟิล: invoice.value, - datePayment: invoiceDate.value, //วันที่จ่าย - typePayment: payment.value, // รูปแบบการจ่าย - address: addressPayment.value, //ที่อยู่ - }; await myForm.value!.validate().then((result: boolean) => { if (result) { dialogConfirm($q, async () => { - await addNote(body); + if (props.action == 'addData') { + await http + .post(config.API.insigniaManageBorrow(), { + borrowDate: receivedate.value, + borrowOrganizationId: OrganazationId.value, + insigniaNoteProfileId: insigniaNoteProfileId.value + }) + .then(() => { + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + clearData() + props.closeAndFecth(); + }); + } else { + await http + .put(config.API.insigniaManageBorrowReturn(props.profileId), { + returnDate: returndate.value, + returnOrganizationId: OrganazationId.value, + returnReason: reason.value + }) + .then(() => { + success($q, "บันทึกข้อมูลสำเร็จ"); + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + clearData() + props.closeAndFecth(); + }); + } }); } }); }; -const addNote = async (body: any) => { - await http - .put(config.API.noteAdd(props.roundId), body) - .then(() => { - success($q, "เพิ่มราชชื่อสำเร็จ"); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - props.close(); - }); -}; -const searchcardid = () => { - // console.log(cardid.value); + +const searchcardid = async () => { if (cardid.value.length === 13) { - let data = listPerson.value.find((e: any) => e.citizenId === cardid.value); - if (data) { - fullName.value = data.fullname; - position.value = data.positionEmployeePosition; - } else notifyError($q, "ไม่พบข้อมูลเลขบัตรประชาชนนี้"); + const node = await listPerson.value.find((e: any) => e.citizenId === cardid.value); + + if (node) { + console.log("node", node) + fullName.value = `${node.prefix} ${node.fullName}` + brand.value = node.requestInsignia + insigniaNoteProfileId.value = node.id + } else notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้"); } }; + +const closeDialog = () => { + clearData() + props.close() +}