From ecb5e6b7c33ae0a8f2f5ee74591d914657d9a0b9 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 18 Oct 2024 12:06:01 +0700 Subject: [PATCH] update wrokflow --- src/components/Workflow/DialogApprove.vue | 44 +-- .../Workflow/DialogSelectPerson.vue | 9 +- src/components/Workflow/Main.vue | 44 ++- src/interface/response/workflow/Main.ts | 1 + .../requestEdit/01_TabInformation.vue | 14 +- .../requestEdit/Dialog01_EditStatus.vue | 2 +- .../components/requestEdit/Page01_Detail.vue | 270 ++++++++++++++++++ .../04_registryPerson/interface/index/Main.ts | 16 ++ .../interface/response/Main.ts | 4 +- src/modules/04_registryPerson/router.ts | 14 + .../components/2_Leave/DetailLeave.vue | 88 +++--- 11 files changed, 414 insertions(+), 92 deletions(-) create mode 100644 src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue diff --git a/src/components/Workflow/DialogApprove.vue b/src/components/Workflow/DialogApprove.vue index 9e54b0058..acf0507de 100644 --- a/src/components/Workflow/DialogApprove.vue +++ b/src/components/Workflow/DialogApprove.vue @@ -13,38 +13,36 @@ const { dialogConfirm, showLoader, hideLoader, messageError } = useCounterMixin(); const modal = defineModel("modal", { required: true }); -const { stateId } = defineProps({ - stateId: { type: String, require: true }, +const props = defineProps({ + dataUserComment: { type: Object, require: true }, + fetchData: { type: Function, require: true }, }); const isAcceptSetting = ref(false); const isApproveSetting = ref(false); const isReasonSetting = ref(false); +const stateUserCommentId = ref(""); const isAccept = ref(false); const isApprove = ref(""); const reason = ref(""); async function fetchData() { - showLoader(); - await http - .post(config.API.workflow + `comment-state-user`, { stateId: stateId }) - .then(async (res) => { - const data = res.data.result; - isAcceptSetting.value = data.isAcceptSetting; - isApproveSetting.value = data.isApproveSetting; - isReasonSetting.value = data.isReasonSetting; - - isAccept.value = data.isAccept; - isApprove.value = data.isApprove ? "approve" : ""; - reason.value = data.reason; - }) - .catch((err) => { - messageError($q, err); - }) - .finally(() => { - hideLoader(); - }); + const data = props.dataUserComment; + if (data) { + stateUserCommentId.value = data.id; + isAcceptSetting.value = data.isAcceptSetting; + isApproveSetting.value = data.isApproveSetting; + isReasonSetting.value = data.isReasonSetting; + isAccept.value = data.isAccept; + isApprove.value = + data.isApprove === true + ? "approve" + : data.isApprove === false + ? "reject" + : ""; + reason.value = data.reason; + } } function onSubmit() { @@ -52,7 +50,7 @@ function onSubmit() { showLoader(); await http .post(config.API.workflow + `comment`, { - stateId: stateId, + stateUserCommentId: stateUserCommentId.value, isAccept: isAcceptSetting.value ? isAccept.value : undefined, isApprove: isApproveSetting.value ? isApprove.value === "approve" @@ -62,6 +60,7 @@ function onSubmit() { reason: isReasonSetting.value ? reason.value : undefined, }) .then(async () => { + await props.fetchData?.(); onCloseModal(); }) .catch((err) => { @@ -135,6 +134,7 @@ watch(modal, (val) => {
("modal", { required: true }); -const { stateId, fetchData } = defineProps({ +const props = defineProps({ stateId: { type: String, require: true }, fetchData: { type: Function, require: true }, }); @@ -89,14 +89,14 @@ function onSubmit() { showLoader(); await http .post(config.API.workflow + `add-step`, { - stateId: stateId, + stateId: props.stateId, profileId: selected.value[0].id, isAcceptSetting: isAcceptSetting.value, isApproveSetting: isApproveSetting.value, isReasonSetting: isReasonSetting.value, }) .then(async () => { - await fetchData?.(); + await props.fetchData?.(); onCloseModal(); }) .catch((err) => { @@ -112,6 +112,9 @@ function onCloseModal() { modal.value = false; selected.value = []; rows.value = []; + isAcceptSetting.value = false; + isApproveSetting.value = false; + isReasonSetting.value = false; } watch(modal, (val) => { diff --git a/src/components/Workflow/Main.vue b/src/components/Workflow/Main.vue index 35703d950..01f20074d 100644 --- a/src/components/Workflow/Main.vue +++ b/src/components/Workflow/Main.vue @@ -23,6 +23,7 @@ const { id, sysName } = defineProps({ const stateId = ref(""); //id state ปัจุบัน const state = ref(1); //state ปัจุบัน +const dataUserComment = ref(); const isPermission = ref(true); //การเข้าถึง Workflow const permission = ref({ @@ -47,8 +48,12 @@ async function fetchCheckState() { .then(async (res) => { await fetchData(); const data = await res.data.result; + stateId.value = data.stateId; - state.value = data.stateNo === 4 ? 5 : data.stateNo; + state.value = + data.stateNo === itemState.value.length + ? data.stateNo + 1 + : data.stateNo; permission.value = { isChangeState: data.can_change_state, isOperate: data.can_operate, @@ -112,11 +117,6 @@ defineExpose({
Workflow
-
@@ -154,10 +154,7 @@ defineExpose({ >
- + {{ `${item.prefix}${item.firstName} ${item.lastName}` }} @@ -169,19 +166,32 @@ defineExpose({ - + {{ item.isAcceptSetting ? item.isAccept ? "รับทราบ" : "" : item.isApproveSetting - ? item.isApprove + ? item.isApprove === true ? "อนุมันติ" + : item.isApprove === false + ? "ไม่อนุมันติ" : "" : "" - }} + }} + + + @@ -215,5 +225,9 @@ defineExpose({ :fetch-data="fetchCheckState" /> - + diff --git a/src/interface/response/workflow/Main.ts b/src/interface/response/workflow/Main.ts index 99b0da399..e0e0ad2e3 100644 --- a/src/interface/response/workflow/Main.ts +++ b/src/interface/response/workflow/Main.ts @@ -25,6 +25,7 @@ interface StateUserComments { firstName: string; lastName: string; prefix: string; + isComment: boolean; } interface DataCommander { diff --git a/src/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue b/src/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue index e14af72f0..57de70343 100644 --- a/src/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue +++ b/src/modules/04_registryPerson/components/requestEdit/01_TabInformation.vue @@ -4,6 +4,7 @@ import { useQuasar } from "quasar"; import { useRequestEditStore } from "@/modules/04_registryPerson/stores/RequestEdit"; import { useCounterMixin } from "@/stores/mixin"; +import { useRouter } from "vue-router"; import config from "@/app.config"; import http from "@/plugins/http"; @@ -12,21 +13,23 @@ import type { QTableProps } from "quasar"; import type { DataOption, Pagination, + Request, } from "@/modules/04_registryPerson/interface/index/Main"; -import type { DateRequest } from "@/modules/04_registryPerson/interface/response/Main"; +import type { DataRequest } from "@/modules/04_registryPerson/interface/response/Main"; /** importComponents*/ import DialogStatus from "@/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue"; import DialogUpdate from "@/modules/04_registryPerson/components/Dialog/DialogUpdate.vue"; const $q = useQuasar(); +const router = useRouter(); const store = useRequestEditStore(); const { showLoader, hideLoader, messageError, date2Thai } = useCounterMixin(); //Table const idCard = ref(""); const profileId = ref(""); -const rows = ref([]); //รายการข้อมูลคำร้องขอแก้ไขทะเบียนประวัติ +const rows = ref([]); //รายการข้อมูลคำร้องขอแก้ไขทะเบียนประวัติ const page = ref(1); //หน้า const pageSize = ref(10); //จำนวนต่อหน้า const rowsTotal = ref(0); //จำนวนรายการ @@ -176,14 +179,15 @@ function filterOption(val: string, update: Function) { * funciton แก่ไขคำร้อง * @param id รายการคำร้อง */ -function onclickEdit(data: any) { +function onclickEdit(data: Request) { requestId.value = data.id; if (data.topic == "ขออัปเดตข้อมูลจากกรมการปกครอง") { modalUpdate.value = true; idCard.value = data.idcard as string; profileId.value = data.profileId; } else { - modalStatus.value = true; + // modalStatus.value = true; + router.push(`/registry-officer/request-edit/personal/${data.id}`); } } @@ -416,7 +420,7 @@ onMounted(() => { v-model:id-card="idCard" v-model:profile-id="profileId" :fetch-data="fetchListRequset" - :request-id=requestId + :request-id="requestId" /> diff --git a/src/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue b/src/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue index 277232104..e496ee49a 100644 --- a/src/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue +++ b/src/modules/04_registryPerson/components/requestEdit/Dialog01_EditStatus.vue @@ -26,7 +26,7 @@ const isReadOnly = ref(false); //อ่ายได้อย่าง //ฟอร์มสถานะคำร้อง const formData = reactive({ status: "", //สถานะ - remark: "", //หมายเหตุ + remark: "", //หมายเหตุแ }); //ข้อมูลรายการสถานะ const statusOptionMain = ref( diff --git a/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue new file mode 100644 index 000000000..6f4b70874 --- /dev/null +++ b/src/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/src/modules/04_registryPerson/interface/index/Main.ts b/src/modules/04_registryPerson/interface/index/Main.ts index 9670b7a9e..e34533956 100644 --- a/src/modules/04_registryPerson/interface/index/Main.ts +++ b/src/modules/04_registryPerson/interface/index/Main.ts @@ -72,6 +72,21 @@ interface DataItemsDevelopment { label: string; } +interface Request { + createdAt: string; + createdFullName: string; + detail: string; + fullname: string; + id: string; + idcard: string; + lastUpdateFullName: string; + lastUpdatedAt: string; + profileId: string; + remark: string; + status: string; + topic: string; +} + export type { Pagination, DataOption, @@ -86,4 +101,5 @@ export type { DataOptionEducation, DataOptionEducationLevel, DataItemsDevelopment, + Request, }; diff --git a/src/modules/04_registryPerson/interface/response/Main.ts b/src/modules/04_registryPerson/interface/response/Main.ts index 370eaee4e..77d645333 100644 --- a/src/modules/04_registryPerson/interface/response/Main.ts +++ b/src/modules/04_registryPerson/interface/response/Main.ts @@ -26,7 +26,7 @@ interface DataPerson { rank?: string; } -interface DateRequest { +interface DataRequest { createdAt: string; createdFullName: string; detail: string; @@ -182,7 +182,7 @@ export type { DataType, DataLevel, DataPerson, - DateRequest, + DataRequest, DataProfile, DataLeave, DataLeaveType, diff --git a/src/modules/04_registryPerson/router.ts b/src/modules/04_registryPerson/router.ts index a25ea4199..68da2a53a 100644 --- a/src/modules/04_registryPerson/router.ts +++ b/src/modules/04_registryPerson/router.ts @@ -8,6 +8,10 @@ const detailPage = () => // รายการคำร้องขอแก้ไขทะเบียนประวัติ const requestEdit = () => import("@/modules/04_registryPerson/views/requestEditView.vue"); +const Page01_Detail = () => + import( + "@/modules/04_registryPerson/components/requestEdit/Page01_Detail.vue" + ); export default [ { @@ -60,4 +64,14 @@ export default [ Role: "STAFF", }, }, + { + path: "/registry-officer/request-edit/personal/:id", + name: "registryNewRequestEdit/personal", + component: Page01_Detail, + meta: { + Auth: true, + Key: "SYS_REGISTRY_OFFICER", + Role: "STAFF", + }, + }, ]; diff --git a/src/modules/09_leave/components/2_Leave/DetailLeave.vue b/src/modules/09_leave/components/2_Leave/DetailLeave.vue index 5b39702a6..0de7cab2d 100644 --- a/src/modules/09_leave/components/2_Leave/DetailLeave.vue +++ b/src/modules/09_leave/components/2_Leave/DetailLeave.vue @@ -329,45 +329,45 @@ function checkLeaveType(leaveTypeId: string, formData: FremData) { } /** Function dialog*/ -async function openModal(data: string) { - if (data === "approve") { - modalApprove.value = true; - dialogTitle.value = "อนุมัติ"; - } - if (data === "UnApprove") { - modalApprove.value = true; - dialogTitle.value = "ไม่อนุมัติ"; - } - if (data === "authority") { - modalApprove.value = true; - dialogTitle.value = "ส่งไปยังผู้มีอำนาจ"; - dialogLabel.value = "ความคิดเห็น"; - } -} +// async function openModal(data: string) { +// if (data === "approve") { +// modalApprove.value = true; +// dialogTitle.value = "อนุมัติ"; +// } +// if (data === "UnApprove") { +// modalApprove.value = true; +// dialogTitle.value = "ไม่อนุมัติ"; +// } +// if (data === "authority") { +// modalApprove.value = true; +// dialogTitle.value = "ส่งไปยังผู้มีอำนาจ"; +// dialogLabel.value = "ความคิดเห็น"; +// } +// } /** function ส่งไปผู้บังคับบัญชา*/ -function sendToCommand() { - dialogConfirm( - $q, - async () => { - showLoader(); - await http - .get(config.API.leaveApproveToComander(formData.id)) - .then(async () => { - await fetchDetailLeave(paramsId); - success($q, "บันทึกข้อมูลสำเร็จ"); - }) - .catch((err) => { - messageError($q, err); - }) - .finally(async () => { - hideLoader(); - }); - }, - "ยืนยันการส่งไปผู้บังคับบัญชา", - "ต้องการยืนยันการส่งไปผู้บังคับบัญชานี้ใช่หรือไม่ ?" - ); -} +// function sendToCommand() { +// dialogConfirm( +// $q, +// async () => { +// showLoader(); +// await http +// .get(config.API.leaveApproveToComander(formData.id)) +// .then(async () => { +// await fetchDetailLeave(paramsId); +// success($q, "บันทึกข้อมูลสำเร็จ"); +// }) +// .catch((err) => { +// messageError($q, err); +// }) +// .finally(async () => { +// hideLoader(); +// }); +// }, +// "ยืนยันการส่งไปผู้บังคับบัญชา", +// "ต้องการยืนยันการส่งไปผู้บังคับบัญชานี้ใช่หรือไม่ ?" +// ); +// } /** Function Save */ function clickSave(reason: string) { @@ -695,7 +695,7 @@ onMounted(async () => {
-
-
+ +