Merge branch 'nice' into develop

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-02-05 15:23:55 +07:00
commit 912cee1fc8
4 changed files with 110 additions and 38 deletions

View file

@ -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<QTableProps["columns"]>([
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",
@ -101,6 +111,7 @@ const visibleColumns = ref<String[]>([
"dateEnd",
"posNo",
"position",
"refCommandNo",
"status",
]);
@ -109,6 +120,11 @@ const isStatusEdit = ref<boolean>(false);
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const rowId = ref<string>("");
const modalCommand = ref<boolean>(false);
const command = ref<string>("");
const commandId = ref<string>("");
const formData = reactive<DataActing>({
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(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
<div
v-if="col.name == 'refCommandNo' && props.row.commandId"
@click="col.value ? openViewCommand(props.row) : null"
:class="
col.value
? 'table_ellipsis text-blue cursor-pointer'
: 'table_ellipsis'
"
>
{{ col.value ? col.value : "-" }}
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -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,6 +430,18 @@ onMounted(() => {
</div>
<q-separator />
<div class="row q-pa-sm">
<div class="col-3 text-grey-6 text-weight-medium">
เลขทคำส
</div>
<div
v-if="props.row.commandId"
@click="openViewCommand(props.row)"
class="col-3 text-blue"
>
{{ props.row.refCommandNo }}
<q-tooltip v-if="props.row.commandId">ดูคำสั่ง</q-tooltip>
</div>
<div class="col-3" v-else>-</div>
<div class="col-3 text-grey-6 text-weight-medium">สถานะ</div>
<div class="col-3">
{{ props.row.status ? "Active" : "-" }}
@ -521,6 +570,7 @@ onMounted(() => {
</div>
<div class="col-xs-12 col-sm-6 col-md-6">
<q-checkbox
disable
v-model="formData.status"
label="Active"
keep-color="primary"
@ -539,6 +589,12 @@ onMounted(() => {
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
<DialogPreviewCommand
v-model:modal="modalCommand"
v-model:command="command"
v-model:command-id="commandId"
/>
</template>
<style scoped></style>

View file

@ -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<string>("");
const modal = ref<boolean>(false);
const modalHistory = ref<boolean>(false);
const modalCommand = ref<boolean>(false);
const command = ref<string>("");
const commandId = ref<string>("");
const formData = reactive<DatAssistance>({
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(() => {
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div>
<div
v-if="col.name == 'commandNo' && props.row.commandId"
@click="col.value ? openViewCommand(props.row) : null"
:class="
col.value
? 'table_ellipsis text-blue cursor-pointer'
: 'table_ellipsis'
"
>
{{ col.value ? col.value : "-" }}
<q-tooltip v-if="col.value">ดูคำสั่ง</q-tooltip>
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
@ -478,7 +494,8 @@ onMounted(() => {
</q-btn>
<q-btn
v-if="!isLeave && checkPermission($route)?.attrIsUpdate"
color="edit"
:color="props.row.commandId ? 'grey-5' : 'edit'"
:disable="props.row.commandId !== null"
icon="edit"
flat
round
@ -517,7 +534,16 @@ onMounted(() => {
<div class="col-3 text-grey-6 text-weight-medium">
เลขทคำส
</div>
<div class="col-9">
<div
v-if="props.row.commandId"
@click="openViewCommand(props.row)"
class="col-9 text-blue"
>
{{ props.row.commandNo }}
<q-tooltip v-if="props.row.commandId">ดูคำสั่ง</q-tooltip>
</div>
<div class="col-9" v-else>
{{ props.row.commandNo ? props.row.commandNo : "-" }}
</div>
</div>
@ -774,6 +800,12 @@ onMounted(() => {
</q-dialog>
<DialogHistory v-model:modal="modalHistory" v-model:id="rowId" />
<DialogPreviewCommand
v-model:modal="modalCommand"
v-model:command="command"
v-model:command-id="commandId"
/>
</template>
<style scoped></style>

View file

@ -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;

View file

@ -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<boolean>("modal", { required: true });
const command = defineModel<string>("command", { required: true });
const commandId = defineModel<string>("commandId", { required: true });
const issue = ref<string | null>(null);
const promises = ref<any>([]);
const tab = ref<string>("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(
<DialogHeader :tittle="`คำสั่ง ${command}`" :close="closeDialog" />
<q-separator />
<q-card-section class="scroll" style="max-height: 90vh;">
<q-card-section class="scroll" style="max-height: 90vh">
<div class="space">
<div @click="setTab('main')" :class="getClass(tab == 'main')">
<div class="q-pr-sm">คำส</div>
@ -231,6 +211,7 @@ watch(
label="ดาวน์โหลดไฟล์ PDF"
@click="downloadCover('pdf')"
class="q-px-sm"
:loading="!isLoadView"
>
</q-btn>