From 26a1270dd24e7508e7858d0293635ac23f26267e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 5 Feb 2025 15:23:40 +0700 Subject: [PATCH] fix ViewCommand --- .../GovernmentInformation/05_ActingPos.vue | 66 +++++++++++++++++-- .../05_ActingPosHistory.vue | 2 +- .../06_HelpGovernment.vue | 58 ++++++++++++---- .../interface/response/Government.ts | 3 + .../components/DialogPreviewCommand.vue | 25 +------ 5 files changed, 113 insertions(+), 41 deletions(-) diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue index 24b8b03a0..4b5222de3 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPos.vue @@ -14,6 +14,7 @@ import type { ResActingPosData } from "@/modules/04_registryPerson/interface/res import DialogHeader from "@/components/DialogHeader.vue"; import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue"; +import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue"; const route = useRoute(); const $q = useQuasar(); @@ -83,6 +84,15 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", }, + { + name: "refCommandNo", + align: "left", + label: "เลขที่คำสั่ง", + sortable: true, + field: "refCommandNo", + headerStyle: "font-size: 14px", + style: "font-size: 14px", + }, { name: "status", align: "left", @@ -92,7 +102,7 @@ const columns = ref([ headerStyle: "font-size: 14px", style: "font-size: 14px", format(val, row) { - return row.status ? "Active" : "NoActive"; + return row.status ? "Active" : "-"; }, }, ]); @@ -101,6 +111,7 @@ const visibleColumns = ref([ "dateEnd", "posNo", "position", + "refCommandNo", "status", ]); @@ -109,6 +120,11 @@ const isStatusEdit = ref(false); const modal = ref(false); const modalHistory = ref(false); const rowId = ref(""); + +const modalCommand = ref(false); +const command = ref(""); +const commandId = ref(""); + const formData = reactive({ dateStart: null, dateEnd: null, @@ -127,6 +143,7 @@ function serchDataTable() { } async function fetchData() { + showLoader(); await http .get(config.API.profileActposition(empType.value, profileId.value)) .then((res) => { @@ -187,6 +204,12 @@ function showHistoryDialog(id: string) { rowId.value = id; } +function openViewCommand(data: ResActingPosData) { + command.value = data.refCommandNo; + commandId.value = data.commandId; + modalCommand.value = true; +} + function closeDialogForm() { modal.value = false; isStatusEdit.value = false; @@ -318,7 +341,8 @@ onMounted(() => { flat dense round - color="edit" + :color="props.row.commandId ? 'grey-5' : 'edit'" + :disable="props.row.commandId !== null" icon="edit" @click.stop.prevent="openEditDialog(props.row)" > @@ -326,7 +350,19 @@ onMounted(() => { -
+
+ {{ col.value ? col.value : "-" }} + ดูคำสั่ง +
+
{{ col.value ? col.value : "-" }}
@@ -352,7 +388,8 @@ onMounted(() => { v-if=" isLeave === false && checkPermission($route)?.attrIsUpdate " - color="edit" + :color="props.row.commandId ? 'grey-5' : 'edit'" + :disable="props.row.commandId !== null" icon="edit" flat round @@ -393,9 +430,21 @@ onMounted(() => {
+
+ เลขที่คำสั่ง +
+
+ {{ props.row.refCommandNo }} + ดูคำสั่ง +
+
-
สถานะ
- {{ props.row.status ? "Active" : "NoActive" }} + {{ props.row.status ? "Active" : "-" }}
@@ -521,6 +570,7 @@ onMounted(() => {
{ + + diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue index cfac36576..ad7084b08 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/05_ActingPosHistory.vue @@ -76,7 +76,7 @@ const columns = ref([ sortable: true, field: "status", format(val, row) { - return row.status ? "Active" : "NoActive"; + return row.status ? "Active" : "-"; }, headerStyle: "font-size: 14px", style: "font-size: 14px", diff --git a/src/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue b/src/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue index c2a46f85a..3ff019b47 100644 --- a/src/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue +++ b/src/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernment.vue @@ -18,6 +18,7 @@ import type { import DialogHeader from "@/components/DialogHeader.vue"; import DialogHistory from "@/modules/04_registryPerson/components/detail/GovernmentInformation/06_HelpGovernmentHistory.vue"; +import DialogPreviewCommand from "@/modules/18_command/components/DialogPreviewCommand.vue"; const route = useRoute(); const $q = useQuasar(); @@ -113,6 +114,10 @@ const rowId = ref(""); const modal = ref(false); const modalHistory = ref(false); +const modalCommand = ref(false); +const command = ref(""); +const commandId = ref(""); + const formData = reactive({ agency: "", dateStart: null, @@ -134,6 +139,7 @@ function serchDataTable() { } async function fetchData() { + showLoader(); await http .get(config.API.profileAssistance(empType.value, profileId.value)) .then((res) => { @@ -156,15 +162,6 @@ function onSubmit() { ...formData, profileId: isStatusEdit.value ? undefined : profileId.value, isUpload: !isStatusEdit.value ? undefined : isUpload.value, - // isUpload: isStatusEdit.value - // ? formData.isUpload - // ? formData.isUpload - // : fileUpload.value - // ? true - // : false - // : fileUpload.value - // ? true - // : false, }; const method = isStatusEdit.value ? "patch" : "post"; await http[method]( @@ -300,6 +297,12 @@ function showHistoryDialog(id: string) { rowId.value = id; } +function openViewCommand(data: ResAssistanceData) { + command.value = data.commandNo; + commandId.value = data.commandId; + modalCommand.value = true; +} + function closeDialogForm() { modal.value = false; isStatusEdit.value = false; @@ -434,7 +437,8 @@ onMounted(() => { flat dense round - color="edit" + :color="props.row.commandId ? 'grey-5' : 'edit'" + :disable="props.row.commandId !== null" icon="edit" @click.stop.prevent="openEditDialog(props.row)" > @@ -442,7 +446,19 @@ onMounted(() => { -
+
+ {{ col.value ? col.value : "-" }} + ดูคำสั่ง +
+
{{ col.value ? col.value : "-" }}
@@ -478,7 +494,8 @@ onMounted(() => { {
เลขที่คำสั่ง
-
+
+ {{ props.row.commandNo }} + ดูคำสั่ง +
+ +
{{ props.row.commandNo ? props.row.commandNo : "-" }}
@@ -774,6 +800,12 @@ onMounted(() => { + + diff --git a/src/modules/04_registryPerson/interface/response/Government.ts b/src/modules/04_registryPerson/interface/response/Government.ts index e4ef15454..959ed19fb 100644 --- a/src/modules/04_registryPerson/interface/response/Government.ts +++ b/src/modules/04_registryPerson/interface/response/Government.ts @@ -13,11 +13,14 @@ interface ResActingPosData { profileEmployeeId: string; profileId: string; status: boolean; + refCommandNo: string; + commandId: string; } interface ResAssistanceData { agency: string; commandNo: string; + commandId: string; createdAt: Date | null; createdFullName: string; createdUserId: string; diff --git a/src/modules/18_command/components/DialogPreviewCommand.vue b/src/modules/18_command/components/DialogPreviewCommand.vue index 65a486c8e..6db6def25 100644 --- a/src/modules/18_command/components/DialogPreviewCommand.vue +++ b/src/modules/18_command/components/DialogPreviewCommand.vue @@ -7,8 +7,6 @@ import { VuePDF, usePDF } from "@tato30/vue-pdf"; import http from "@/plugins/http"; import config from "@/app.config"; import { useCounterMixin } from "@/stores/mixin"; -import genReport from "@/plugins/genreport"; -import genReportXLSX from "@/plugins/genreportxlsx"; import DialogHeader from "@/components/DialogHeader.vue"; @@ -21,7 +19,6 @@ const { showLoader, hideLoader, messageError } = useCounterMixin(); const modal = defineModel("modal", { required: true }); const command = defineModel("command", { required: true }); const commandId = defineModel("commandId", { required: true }); -const issue = ref(null); const promises = ref([]); const tab = ref("main"); //tab @@ -80,21 +77,8 @@ async function checkAttachment() { async function downloadCover(type: string) { if (tab.value === "main") { window.open(dataCover.value?.downloadUrl, "_blank"); - - // genReport( - // dataCover.value, - // `คำสั่ง ${issue.value}`, - // type, - // "?folder=command" - // ); } else { window.open(dataAttachment.value?.downloadUrl, "_blank"); - // genReportXLSX( - // dataAttachment.value, - // `เอกสารแนบท้าย ${issue.value}`, - // type, - // "?folder=command" - // ); } } @@ -161,11 +145,9 @@ watch( if (modal.value) { showLoader(); promises.value = [checkAttachment(), fetchDataCommand("cover")]; - await Promise.all(promises.value) .catch((e) => { messageError($q, e); - hideLoader(); }) .finally(() => { hideLoader(); @@ -177,9 +159,7 @@ watch( } ); -/** - * check tab เมื่อมีการเปลี่ยน tab - */ +/** check tab เมื่อมีการเปลี่ยน tab*/ watch( () => tab.value, () => { @@ -198,7 +178,7 @@ watch( - +
คำสั่ง
@@ -231,6 +211,7 @@ watch( label="ดาวน์โหลดไฟล์ PDF" @click="downloadCover('pdf')" class="q-px-sm" + :loading="!isLoadView" >