From 7a69a1885668045aa45fd265182d2e864b2aaa6e Mon Sep 17 00:00:00 2001 From: waruneeta Date: Fri, 25 Aug 2023 19:10:48 +0700 Subject: [PATCH] =?UTF-8?q?ui=20=E0=B8=A2=E0=B8=B7=E0=B8=A1-=E0=B8=84?= =?UTF-8?q?=E0=B8=B7=E0=B8=99=E0=B9=80=E0=B8=84=E0=B8=A3=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A,=20=E0=B9=81?= =?UTF-8?q?=E0=B8=81=E0=B9=89=20label=20=E0=B9=80=E0=B8=84=E0=B8=A3?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=87=E0=B8=A3=E0=B8=B2=E0=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/1_Proposals/addProposals.vue | 4 +- .../components/4_Allocate/DialogForm.vue | 4 +- .../components/4_Allocate/listAllocate.vue | 7 +- .../components/5_Borrow/DialogForm.vue | 458 ++++++++++++++++++ .../07_insignia/components/5_Borrow/Main.vue | 429 ++++------------ src/modules/07_insignia/views/ResultPage.vue | 2 +- 6 files changed, 551 insertions(+), 353 deletions(-) create mode 100644 src/modules/07_insignia/components/5_Borrow/DialogForm.vue diff --git a/src/modules/07_insignia/components/1_Proposals/addProposals.vue b/src/modules/07_insignia/components/1_Proposals/addProposals.vue index d6de134f3..0f44d80e9 100644 --- a/src/modules/07_insignia/components/1_Proposals/addProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/addProposals.vue @@ -278,7 +278,7 @@ const updateYear = async (e: number) => { const editData = async (id: string) => { const formData = new FormData(); - const name = `รอบการเสนอพระราชทานเครื่องราชรอบที่ ${ + const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ roundInsig.value.value } ปี ${yearly.value + 543} `; formData.append("name", name); @@ -352,7 +352,7 @@ const updateDateRange = () => { const addData = async () => { const formData = new FormData(); - const name = `รอบการเสนอพระราชทานเครื่องราชรอบที่ ${ + const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${ roundInsig.value.value } ปี ${yearly.value + 543} `; console.log(name); diff --git a/src/modules/07_insignia/components/4_Allocate/DialogForm.vue b/src/modules/07_insignia/components/4_Allocate/DialogForm.vue index d21dce968..c2189595d 100644 --- a/src/modules/07_insignia/components/4_Allocate/DialogForm.vue +++ b/src/modules/07_insignia/components/4_Allocate/DialogForm.vue @@ -95,7 +95,7 @@ const dataSave = async () => { - บันทึกผล + จัดสรรเครื่องราชฯ { map-options outlined v-model="Org" - :label="`เครื่องราชฯ`" + :label="`เลือกหน่วยงาน`" />
diff --git a/src/modules/07_insignia/components/4_Allocate/listAllocate.vue b/src/modules/07_insignia/components/4_Allocate/listAllocate.vue index 269bcc7fb..096d7a4dd 100644 --- a/src/modules/07_insignia/components/4_Allocate/listAllocate.vue +++ b/src/modules/07_insignia/components/4_Allocate/listAllocate.vue @@ -56,7 +56,10 @@ const fecthRound = async () => { .get(config.API.noteround()) .then((res) => { let data = res.data.result; - selectRoundOption.value = data; + selectRoundOption.value = data.map((e: any) => ({ + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + id: e.id, + })); selectRound.value = data[0].id; // console.log(selectRound.value); }) @@ -259,7 +262,6 @@ const resetFilter = () => {
รอบ
-
{ @update:emit-value="selectorRound" > -
+import { ref, watch, computed } from "vue"; +import { QForm, useQuasar } from "quasar"; +import { useCounterMixin } from "@/stores/mixin"; +import { useResultDataStore } from "@/modules/07_insignia/storeResult"; +import http from "@/plugins/http"; +import config from "@/app.config"; +import type { DataOption } from "@/modules/04_registry/components/profileType"; + +const DataStore = useResultDataStore(); +const $q = useQuasar(); +const myForm = ref(); +const mixin = useCounterMixin(); +const { + date2Thai, + dialogConfirm, + success, + messageError, + showLoader, + hideLoader, + notifyError, +} = mixin; +const status = ref(""); + +const Advertise = ref(""); +const issue = ref(""); +const brand = 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 receivedate = ref(); +const announceDate = ref(); +const invoiceDate = ref(null); + +const employeeClass = ref(""); +const employeeClassOps = ref([ + { id: "officer", name: "ข้าราชการ กทม.สามัญ" }, + { id: "employee", name: "ลูกจ้างประจำ" }, +]); + +const listPerson = 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 props = defineProps({ + modal: Boolean, + save: { + type: Function, + default: () => console.log("not function"), + }, + close: { + type: Function, + default: () => console.log("not function"), + }, + roundId: { + type: String, + }, + action: { + type: String, + }, + personId: { + type: String, + }, + profileType: { + type: String, + }, + selectRoundOption: { + type: Array + } +}); +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); + } + } +}); +const disbleStatus = computed(() => { + if (employeeClass.value !== "") { + return false; + } else return true; +}); + +const selectType = 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 () => { + await http + .get(config.API.profileOrganizRoot) + .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; + }) + .catch((err) => { + console.log(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); + }); + } + }); +}; +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); + 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, "ไม่พบข้อมูลเลขบัตรประชาชนนี้"); + } +}; + + + \ No newline at end of file diff --git a/src/modules/07_insignia/components/5_Borrow/Main.vue b/src/modules/07_insignia/components/5_Borrow/Main.vue index 876a0b4fd..809d47e18 100644 --- a/src/modules/07_insignia/components/5_Borrow/Main.vue +++ b/src/modules/07_insignia/components/5_Borrow/Main.vue @@ -6,8 +6,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; import { useResultDataStore } from "@/modules/07_insignia/storeResult"; -import DialogForm from "@/modules/07_insignia/components/3_result/DialogForm.vue"; -import fileUploadview from "@/modules/07_insignia/components/3_result/fileUpload.vue"; +import DialogForm from "@/modules/07_insignia/components/5_Borrow/DialogForm.vue"; import type { OptionData } from "@/modules/07_insignia/interface/index/Main"; import type { QTableProps, QInput } from "quasar"; @@ -29,6 +28,8 @@ const tab = ref(""); const selectRound = ref(); const selectRoundOption = ref([]); +const selectRoundAllOption = ref([]); + const modal = ref(false); const action = ref(""); const personId = ref(); @@ -45,7 +46,21 @@ const fecthRound = async () => { .get(config.API.noteround()) .then((res) => { let data = res.data.result; - selectRoundOption.value = data; + selectRoundAllOption.value = [{ + name: "ทั้งหมด", + id: "all", + }] + data.map((e: any) => { + selectRoundOption.value = [...selectRoundOption.value, { + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + id: e.id, + }] + + selectRoundAllOption.value = [...selectRoundAllOption.value, { + name: "รอบการเสนอขอพระราชทานเครื่องราชปี" + " " + (e.year + 543), + id: e.id, + }] + }); selectRound.value = data[0].id; // console.log(selectRound.value); }) @@ -101,11 +116,20 @@ const columns = ref([ sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), }, + // { + // name: "status", + // align: "left", + // label: "สถานะ", + // field: "status", + // sortable: true, + // sort: (a: string, b: string) => + // a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), + // }, { - name: "status", + name: "citizenId", align: "left", - label: "สถานะ", - field: "status", + label: "เลขบัตรประชาชน", + field: "citizenId", sortable: true, sort: (a: string, b: string) => a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }), @@ -245,7 +269,7 @@ const fecthlistInsignia = async () => { citizenId: e.citizenId, prefix: e.prefix, position: e.position, - status: DataStore.status(e.status), + // status: DataStore.status(e.status), name: e.fullName, type: e.requestInsignia, employeeType: DataStore.profileType(e.profileType), @@ -336,48 +360,13 @@ const resetFilter = () => {