Merge branch 'develop' into devTee
This commit is contained in:
commit
c423e68d01
7 changed files with 466 additions and 66 deletions
|
|
@ -20,6 +20,7 @@ import type {
|
||||||
} from "@/modules/04_registryPerson/interface/response/Education";
|
} from "@/modules/04_registryPerson/interface/response/Education";
|
||||||
|
|
||||||
import dialogHeader from "@/components/DialogHeader.vue";
|
import dialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
import DialogSortEducation from "@/modules/04_registryPerson/components/detail/PersonalInformation/DialogSortEducation.vue";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
@ -523,6 +524,9 @@ const educationData = reactive<RequestItemsObject>({
|
||||||
positionPathId: "",
|
positionPathId: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const modalSort = ref<boolean>(false);
|
||||||
|
const dataSort = ref<ResponseObject[]>([]);
|
||||||
|
|
||||||
/** function ยืนยันการบันทึกข้อมูล*/
|
/** function ยืนยันการบันทึกข้อมูล*/
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
dialogConfirm(
|
dialogConfirm(
|
||||||
|
|
@ -642,6 +646,7 @@ async function fetchData(id: string) {
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
rows.value = await res.data.result;
|
rows.value = await res.data.result;
|
||||||
rowsMain.value = await res.data.result;
|
rowsMain.value = await res.data.result;
|
||||||
|
dataSort.value = res.data.result;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -769,7 +774,7 @@ onMounted(async () => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="row items-center q-gutter-x-sm q-pb-sm">
|
<div class="row items-center q-col-gutter-x-sm q-pb-sm">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
|
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
|
||||||
round
|
round
|
||||||
|
|
@ -787,6 +792,17 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
<q-tooltip>เพิ่มข้อมูล</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
|
<q-btn
|
||||||
|
v-if="isLeave == false && checkPermission($route)?.attrIsUpdate"
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
color="blue"
|
||||||
|
icon="mdi-sort"
|
||||||
|
@click="modalSort = true"
|
||||||
|
>
|
||||||
|
<q-tooltip>จัดลำดับข้อมูล</q-tooltip></q-btn
|
||||||
|
>
|
||||||
|
|
||||||
<q-space />
|
<q-space />
|
||||||
<q-input
|
<q-input
|
||||||
|
|
@ -1534,6 +1550,8 @@ onMounted(async () => {
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
|
|
||||||
|
<DialogSortEducation v-model:modal="modalSort" :data-sort="dataSort" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,327 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
|
import http from "@/plugins/http";
|
||||||
|
import config from "@/app.config";
|
||||||
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
import { useOrganizational } from "@/modules/02_organization/store/organizational";
|
||||||
|
|
||||||
|
/** importType*/
|
||||||
|
import type { QTableProps } from "quasar";
|
||||||
|
import type { PropType } from "vue";
|
||||||
|
|
||||||
|
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Education";
|
||||||
|
|
||||||
|
/** importComponents*/
|
||||||
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
|
/** use*/
|
||||||
|
const $q = useQuasar();
|
||||||
|
const store = useOrganizational();
|
||||||
|
const {
|
||||||
|
dialogConfirm,
|
||||||
|
showLoader,
|
||||||
|
success,
|
||||||
|
hideLoader,
|
||||||
|
messageError,
|
||||||
|
date2Thai,
|
||||||
|
} = useCounterMixin();
|
||||||
|
|
||||||
|
/** props*/
|
||||||
|
const modal = defineModel<boolean>("modal", { required: true });
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
dataSort: Array as PropType<ResponseObject[]>,
|
||||||
|
});
|
||||||
|
|
||||||
|
/** ข้อมูล Table*/
|
||||||
|
const rows = ref<ResponseObject[]>([]);
|
||||||
|
const columns = ref<QTableProps["columns"]>([
|
||||||
|
{
|
||||||
|
name: "no",
|
||||||
|
align: "left",
|
||||||
|
label: "ลำดับ",
|
||||||
|
sortable: true,
|
||||||
|
field: "no",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "educationLevel",
|
||||||
|
align: "left",
|
||||||
|
label: "ระดับการศึกษา",
|
||||||
|
sortable: true,
|
||||||
|
field: "educationLevel",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "institute",
|
||||||
|
align: "left",
|
||||||
|
label: "สถานศึกษา",
|
||||||
|
sortable: true,
|
||||||
|
field: "institute",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "startDate",
|
||||||
|
align: "left",
|
||||||
|
label: "ตั้งแต่",
|
||||||
|
sortable: true,
|
||||||
|
field: "startDate",
|
||||||
|
format(val, row) {
|
||||||
|
return row.isDate
|
||||||
|
? date2Thai(row.startDate)
|
||||||
|
: new Date(row.startDate).getFullYear() + 543;
|
||||||
|
},
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "endDate",
|
||||||
|
align: "left",
|
||||||
|
label: "ถึง",
|
||||||
|
sortable: true,
|
||||||
|
field: "endDate",
|
||||||
|
format(val, row) {
|
||||||
|
return row.isDate
|
||||||
|
? date2Thai(row.endDate)
|
||||||
|
: new Date(row.endDate).getFullYear() + 543;
|
||||||
|
},
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "finishDate",
|
||||||
|
align: "left",
|
||||||
|
label: "วันที่สำเร็จการศึกษา",
|
||||||
|
sortable: true,
|
||||||
|
field: "finishDate",
|
||||||
|
format: (v) => date2Thai(v),
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "isEducation",
|
||||||
|
align: "left",
|
||||||
|
label: "เป็นวุฒิการศึกษาในตำแหน่ง",
|
||||||
|
sortable: true,
|
||||||
|
field: "isEducation",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
format: (v) => (v === true ? "ใช่" : "ไม่ใช่"),
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "degree",
|
||||||
|
align: "left",
|
||||||
|
label: "วุฒิการศึกษา",
|
||||||
|
sortable: true,
|
||||||
|
field: "degree",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "field",
|
||||||
|
align: "left",
|
||||||
|
label: "สาขาวิชา/ทาง",
|
||||||
|
sortable: true,
|
||||||
|
field: "field",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "fundName",
|
||||||
|
align: "left",
|
||||||
|
label: "ทุน",
|
||||||
|
sortable: true,
|
||||||
|
field: "fundName",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "gpa",
|
||||||
|
align: "left",
|
||||||
|
label: "เกรดเฉลี่ย",
|
||||||
|
sortable: true,
|
||||||
|
field: "gpa",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "country",
|
||||||
|
align: "left",
|
||||||
|
label: "ประเทศ",
|
||||||
|
sortable: true,
|
||||||
|
field: "country",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "other",
|
||||||
|
align: "left",
|
||||||
|
label: "ข้อมูลการติดต่อ",
|
||||||
|
sortable: true,
|
||||||
|
field: "other",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "duration",
|
||||||
|
align: "left",
|
||||||
|
label: "ระยะเวลา",
|
||||||
|
sortable: true,
|
||||||
|
field: "duration",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "durationYear",
|
||||||
|
align: "left",
|
||||||
|
label: "ระยะเวลาหลักสูตร (ปี)",
|
||||||
|
sortable: true,
|
||||||
|
field: "durationYear",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "note",
|
||||||
|
align: "left",
|
||||||
|
label: "หมายเหตุ",
|
||||||
|
sortable: true,
|
||||||
|
field: "note",
|
||||||
|
headerStyle: "font-size: 14px",
|
||||||
|
style: "font-size: 14px",
|
||||||
|
sort: (a: string, b: string) =>
|
||||||
|
a.localeCompare(b, undefined, { numeric: true, sensitivity: "base" }),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
/**
|
||||||
|
* fiunction จัดลำดับ
|
||||||
|
* @param from ตำแหน่งปัจุบัน
|
||||||
|
* @param to ตำแหน่งที่จะย้ายไป
|
||||||
|
*/
|
||||||
|
function onDrop(from: number, to: number) {
|
||||||
|
rows.value.splice(to, 0, rows.value.splice(from, 1)[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** function บันทึกการจัดลำดับ*/
|
||||||
|
function onSubmit() {
|
||||||
|
dialogConfirm($q, () => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(modal, async () => {
|
||||||
|
if (modal.value && props.dataSort) {
|
||||||
|
rows.value = props.dataSort;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<template>
|
||||||
|
<q-dialog v-model="modal" persistent>
|
||||||
|
<q-card style="min-width: 80vw">
|
||||||
|
<DialogHeader
|
||||||
|
:tittle="`จัดลำดับการแสดง`"
|
||||||
|
:close="() => (modal = false)"
|
||||||
|
/>
|
||||||
|
<q-separator />
|
||||||
|
|
||||||
|
<q-card-section style="max-height: 70vh" class="scroll">
|
||||||
|
<q-table
|
||||||
|
v-if="rows.length > 0"
|
||||||
|
v-draggable-table="{
|
||||||
|
options: {
|
||||||
|
mode: 'row',
|
||||||
|
onlyBody: true,
|
||||||
|
dragHandler: 'td',
|
||||||
|
},
|
||||||
|
onDrop,
|
||||||
|
}"
|
||||||
|
flat
|
||||||
|
bordered
|
||||||
|
:rows="rows"
|
||||||
|
:columns="columns"
|
||||||
|
:rows-per-page-options="[100]"
|
||||||
|
row-key="id"
|
||||||
|
hide-bottom
|
||||||
|
hide-pagination
|
||||||
|
hide-header
|
||||||
|
>
|
||||||
|
<template v-slot:body="props">
|
||||||
|
<q-tr :props="props">
|
||||||
|
<q-td
|
||||||
|
v-for="col in props.cols"
|
||||||
|
:key="col.id"
|
||||||
|
:class="props.rowIndex === 0 ? 'text-primary' : ''"
|
||||||
|
>
|
||||||
|
<div v-if="col.name === 'no'">
|
||||||
|
{{
|
||||||
|
props.rowIndex === 0
|
||||||
|
? "วุฒิในตำแหน่ง"
|
||||||
|
: props.rowIndex === 1
|
||||||
|
? "ลำดับที่ 2"
|
||||||
|
: props.rowIndex === 2
|
||||||
|
? "ลำดับที่ 3"
|
||||||
|
: ""
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
{{
|
||||||
|
col.value === "" || col.value === null ? "-" : col.value
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</q-tr>
|
||||||
|
</template>
|
||||||
|
</q-table>
|
||||||
|
<div v-else class="bg-grey-1 text-center q-pa-md">ไม่มีข้อมูล</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-separator />
|
||||||
|
<q-card-actions align="right" class="bg-white text-teal">
|
||||||
|
<q-btn
|
||||||
|
:disable="rows.length === 0"
|
||||||
|
type="submit"
|
||||||
|
:label="`บันทึก`"
|
||||||
|
color="public"
|
||||||
|
@click="onSubmit"
|
||||||
|
>
|
||||||
|
<q-tooltip>บันทึก</q-tooltip>
|
||||||
|
</q-btn>
|
||||||
|
</q-card-actions>
|
||||||
|
</q-card>
|
||||||
|
</q-dialog>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
||||||
|
|
@ -244,7 +244,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "leave",
|
name: "leave",
|
||||||
align: "left",
|
align: "left",
|
||||||
label: "ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น เนื่องจากลาเกิน",
|
label: "ไม่ได้เลื่อนเงินเดือน/ไม่ได้เลื่อนขั้น (เนื่องจากลาเกิน)",
|
||||||
sortable: false,
|
sortable: false,
|
||||||
field: "",
|
field: "",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -253,8 +253,7 @@ const columns = ref<QTableProps["columns"]>([
|
||||||
{
|
{
|
||||||
name: "assessments",
|
name: "assessments",
|
||||||
align: "left",
|
align: "left",
|
||||||
label:
|
label: "ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี",
|
||||||
"ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี ต่ำกว่าระดับดี (น้อยกว่าร้อยละ 70)",
|
|
||||||
sortable: false,
|
sortable: false,
|
||||||
field: "",
|
field: "",
|
||||||
headerStyle: "font-size: 14px",
|
headerStyle: "font-size: 14px",
|
||||||
|
|
@ -1096,7 +1095,6 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
<q-th v-else auto-width></q-th>
|
<q-th v-else auto-width></q-th>
|
||||||
<q-th auto-width></q-th>
|
<q-th auto-width></q-th>
|
||||||
<q-th auto-width></q-th>
|
|
||||||
|
|
||||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||||
<span class="text-weight-medium">{{ col.label }}</span>
|
<span class="text-weight-medium">{{ col.label }}</span>
|
||||||
|
|
@ -1267,7 +1265,7 @@ onMounted(async () => {
|
||||||
<q-tooltip>หมายเหตุ</q-tooltip>
|
<q-tooltip>หมายเหตุ</q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="warn" class="text-center">
|
<!-- <q-td key="warn" class="text-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="
|
||||||
props.row.statusMark && checkPermission($route)?.attrIsGet
|
props.row.statusMark && checkPermission($route)?.attrIsGet
|
||||||
|
|
@ -1287,17 +1285,14 @@ onMounted(async () => {
|
||||||
>
|
>
|
||||||
<q-tooltip>แจ้งเตือน</q-tooltip></q-btn
|
<q-tooltip>แจ้งเตือน</q-tooltip></q-btn
|
||||||
>
|
>
|
||||||
</q-td>
|
</q-td> -->
|
||||||
<q-td key="discipline" class="text-center">
|
<q-td key="discipline" class="text-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
checkPermission($route)?.attrIsGet &&
|
|
||||||
props.row.markDiscipline
|
|
||||||
"
|
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
icon="info"
|
icon="info"
|
||||||
color="red"
|
color="info"
|
||||||
@click.pervent="
|
@click.pervent="
|
||||||
onClickViewInfo(
|
onClickViewInfo(
|
||||||
'discipline',
|
'discipline',
|
||||||
|
|
@ -1310,13 +1305,11 @@ onMounted(async () => {
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="leave" class="text-center">
|
<q-td key="leave" class="text-center">
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
checkPermission($route)?.attrIsGet && props.row.markLeave
|
|
||||||
"
|
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
icon="info"
|
icon="info"
|
||||||
color="red"
|
color="info"
|
||||||
@click.pervent="
|
@click.pervent="
|
||||||
onClickViewInfo(
|
onClickViewInfo(
|
||||||
'leave',
|
'leave',
|
||||||
|
|
@ -1328,14 +1321,13 @@ onMounted(async () => {
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="assessments" class="text-center">
|
<q-td key="assessments" class="text-center">
|
||||||
|
<!-- ผลการประเมินการปฏิบัติราชการในรอบ 5 ปี ต่ำกว่าระดับดี (น้อยกว่าร้อยละ 70) -->
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="
|
v-if="checkPermission($route)?.attrIsGet"
|
||||||
checkPermission($route)?.attrIsGet && props.row.markRate
|
|
||||||
"
|
|
||||||
flat
|
flat
|
||||||
dense
|
dense
|
||||||
icon="info"
|
icon="info"
|
||||||
color="red"
|
color="info"
|
||||||
@click.pervent="
|
@click.pervent="
|
||||||
onClickViewInfo(
|
onClickViewInfo(
|
||||||
'assessments',
|
'assessments',
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,7 @@ import genReportXLSX from "@/plugins/genreportxlsx";
|
||||||
import DialogHeader from "@/components/DialogHeader.vue";
|
import DialogHeader from "@/components/DialogHeader.vue";
|
||||||
|
|
||||||
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
||||||
import type {
|
import type { DataFile } from "@/modules/18_command/interface/index/Main";
|
||||||
DataFileOrder,
|
|
||||||
FormDataDetail,
|
|
||||||
} from "@/modules/18_command/interface/index/Main";
|
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
const { showLoader, hideLoader, messageError } = useCounterMixin();
|
||||||
|
|
@ -34,9 +31,9 @@ const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // ตัวแปร
|
||||||
|
|
||||||
const dialog = ref<boolean>(false); // เปิด dialog
|
const dialog = ref<boolean>(false); // เปิด dialog
|
||||||
const isLoadView = ref<boolean>(false);
|
const isLoadView = ref<boolean>(false);
|
||||||
const isAttachment = ref<boolean>(false);
|
const isUploadAttachment = ref<boolean>(false);
|
||||||
const dataCover = ref<DataFileOrder>(); //ข้อมูลไฟล์คำสั่ง
|
const dataCover = ref<DataFile>(); //ข้อมูลไฟล์คำสั่ง
|
||||||
const dataAttachment = ref<DataFileOrder>(); //ข้อมูลไฟล์แบนท้าย
|
const dataAttachment = ref<DataFile>(); //ข้อมูลไฟล์แบนท้าย
|
||||||
|
|
||||||
/** ปิด popup */
|
/** ปิด popup */
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
|
|
@ -69,8 +66,8 @@ async function checkAttachment() {
|
||||||
.get(config.API.commandRegister(commandId.value))
|
.get(config.API.commandRegister(commandId.value))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
isAttachment.value = data.isAttachment;
|
isUploadAttachment.value = data.isUploadAttachment;
|
||||||
if (isAttachment.value) {
|
if (isUploadAttachment.value) {
|
||||||
promises.value.push(fetchDataCommand("attachment"));
|
promises.value.push(fetchDataCommand("attachment"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -82,19 +79,22 @@ async function checkAttachment() {
|
||||||
*/
|
*/
|
||||||
async function downloadCover(type: string) {
|
async function downloadCover(type: string) {
|
||||||
if (tab.value === "main") {
|
if (tab.value === "main") {
|
||||||
genReport(
|
window.open(dataCover.value?.downloadUrl, "_blank");
|
||||||
dataCover.value,
|
|
||||||
`คำสั่ง ${issue.value}`,
|
// genReport(
|
||||||
type,
|
// dataCover.value,
|
||||||
"?folder=command"
|
// `คำสั่ง ${issue.value}`,
|
||||||
);
|
// type,
|
||||||
|
// "?folder=command"
|
||||||
|
// );
|
||||||
} else {
|
} else {
|
||||||
genReportXLSX(
|
window.open(dataAttachment.value?.downloadUrl, "_blank");
|
||||||
dataAttachment.value,
|
// genReportXLSX(
|
||||||
`เอกสารแนบท้าย ${issue.value}`,
|
// dataAttachment.value,
|
||||||
type,
|
// `เอกสารแนบท้าย ${issue.value}`,
|
||||||
"?folder=command"
|
// type,
|
||||||
);
|
// "?folder=command"
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,30 +103,53 @@ async function downloadCover(type: string) {
|
||||||
* @param type ประเภท cover เป็นคำสั่ง attachment เป็น แบนท้าย
|
* @param type ประเภท cover เป็นคำสั่ง attachment เป็น แบนท้าย
|
||||||
*/
|
*/
|
||||||
async function fetchDataCommand(type: string) {
|
async function fetchDataCommand(type: string) {
|
||||||
|
let newType = type === "cover" ? "คำสั่ง" : "แนบท้าย";
|
||||||
await http
|
await http
|
||||||
.get(config.API.commandRegisterByType(commandId.value, type))
|
.get(
|
||||||
|
config.API.fileByFile("ระบบออกคำสั่ง", newType, commandId.value, newType)
|
||||||
|
)
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const dataMain = await res.data.result;
|
const data = res.data;
|
||||||
|
console.log(res);
|
||||||
|
|
||||||
if (type === "cover") {
|
if (type === "cover") {
|
||||||
dataCover.value = dataMain;
|
dataCover.value = data;
|
||||||
issue.value = await res.data.result.data.commandTitle;
|
|
||||||
await fetchPDF(dataCover.value);
|
await fetchPDF(dataCover.value);
|
||||||
} else {
|
} else {
|
||||||
dataAttachment.value = dataMain;
|
dataAttachment.value = data;
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
messageError($q, e);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
hideLoader();
|
||||||
});
|
});
|
||||||
|
// await http
|
||||||
|
// .get(config.API.commandRegisterByType(commandId.value, type))
|
||||||
|
// .then(async (res) => {
|
||||||
|
// const dataMain = await res.data.result;
|
||||||
|
// if (type === "cover") {
|
||||||
|
// dataCover.value = dataMain;
|
||||||
|
// issue.value = await res.data.result.data.commandTitle;
|
||||||
|
// await fetchPDF(dataCover.value);
|
||||||
|
// } else {
|
||||||
|
// dataAttachment.value = dataMain;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ฟังชั่นกำหนดค่าของ PDF*/
|
/** ฟังชั่นกำหนดค่าของ PDF*/
|
||||||
async function fetchPDF(data: any, type: string = "docx?folder=command") {
|
async function fetchPDF(data: any, type: string = "docx?folder=command") {
|
||||||
isLoadView.value = false;
|
isLoadView.value = false;
|
||||||
await axios
|
axios
|
||||||
.post(config.API.reportTemplate + `/${type}`, data, {
|
.get(data.downloadUrl, {
|
||||||
headers: {
|
method: "GET",
|
||||||
accept: "application/pdf",
|
|
||||||
"content-Type": "application/json",
|
|
||||||
},
|
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: type, // ถ้ามีการระบุเมื่ออัปโหลด
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const blob = new Blob([res.data]);
|
const blob = new Blob([res.data]);
|
||||||
|
|
@ -138,10 +161,33 @@ async function fetchPDF(data: any, type: string = "docx?folder=command") {
|
||||||
isLoadView.value = true;
|
isLoadView.value = true;
|
||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch((err) => {
|
||||||
messageError($q, e);
|
messageError($q, err);
|
||||||
isLoadView.value = true;
|
isLoadView.value = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// await axios
|
||||||
|
// .post(config.API.reportTemplate + `/${type}`, data, {
|
||||||
|
// headers: {
|
||||||
|
// accept: "application/pdf",
|
||||||
|
// "content-Type": "application/json",
|
||||||
|
// },
|
||||||
|
// responseType: "blob",
|
||||||
|
// })
|
||||||
|
// .then(async (res) => {
|
||||||
|
// const blob = new Blob([res.data]);
|
||||||
|
// const objectUrl = URL.createObjectURL(blob);
|
||||||
|
// const pdfData = usePDF(`${objectUrl}`);
|
||||||
|
// setTimeout(() => {
|
||||||
|
// pdfSrc.value = pdfData.pdf.value;
|
||||||
|
// numOfPages.value = pdfData.pages.value;
|
||||||
|
// isLoadView.value = true;
|
||||||
|
// }, 1500);
|
||||||
|
// })
|
||||||
|
// .catch(async (e) => {
|
||||||
|
// messageError($q, e);
|
||||||
|
// isLoadView.value = true;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
|
|
@ -191,7 +237,7 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="isAttachment"
|
v-if="isUploadAttachment"
|
||||||
@click="setTab('second')"
|
@click="setTab('second')"
|
||||||
:class="getClass(tab == 'second')"
|
:class="getClass(tab == 'second')"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ const isSignature = ref<boolean | null>(null);
|
||||||
const isDraft = ref<boolean>(false); //ทำแบบร่าง
|
const isDraft = ref<boolean>(false); //ทำแบบร่าง
|
||||||
const isSign = ref<boolean>(false); //การลงนาม
|
const isSign = ref<boolean>(false); //การลงนาม
|
||||||
const isAttachment = ref<boolean>(false); //เอกสารแนบท้าย
|
const isAttachment = ref<boolean>(false); //เอกสารแนบท้าย
|
||||||
|
const isUploadAttachment = ref<boolean>(false);
|
||||||
|
|
||||||
/** ฟังก์ชันเรียกข้อมูลสถานะคำสั่ง*/
|
/** ฟังก์ชันเรียกข้อมูลสถานะคำสั่ง*/
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
|
|
@ -47,7 +48,8 @@ async function fetchData() {
|
||||||
isDraft.value = data.isDraft;
|
isDraft.value = data.isDraft;
|
||||||
isSign.value = data.isSign;
|
isSign.value = data.isSign;
|
||||||
isAttachment.value = data.isAttachment;
|
isAttachment.value = data.isAttachment;
|
||||||
store.isSalary = data.isSalary
|
isUploadAttachment.value = data.isUploadAttachment;
|
||||||
|
store.isSalary = data.isSalary;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
|
@ -211,7 +213,7 @@ onMounted(async () => {
|
||||||
v-model:step="step"
|
v-model:step="step"
|
||||||
v-model:is-draft="isDraft"
|
v-model:is-draft="isDraft"
|
||||||
v-model:is-authority="isSign"
|
v-model:is-authority="isSign"
|
||||||
v-model:is-attachment="isAttachment"
|
v-model:is-attachment="isUploadAttachment"
|
||||||
:fetch-data="fetchData"
|
:fetch-data="fetchData"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -224,7 +226,7 @@ onMounted(async () => {
|
||||||
<DigitalView
|
<DigitalView
|
||||||
v-model:step="step"
|
v-model:step="step"
|
||||||
v-model:is-draft="isDraft"
|
v-model:is-draft="isDraft"
|
||||||
v-model:is-attachment="isAttachment"
|
v-model:is-attachment="isUploadAttachment"
|
||||||
:fetch-data="fetchData"
|
:fetch-data="fetchData"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -392,14 +392,7 @@ onMounted(async () => {
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div class="col-6" v-if="isAttachment || store.dataCommand">
|
||||||
class="col-6"
|
|
||||||
v-if="
|
|
||||||
isAttachment ||
|
|
||||||
(store.dataCommand &&
|
|
||||||
store.dataCommand.commandCode == 'C-PM-38')
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<q-card
|
<q-card
|
||||||
bordered
|
bordered
|
||||||
class="row col-12"
|
class="row col-12"
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,27 @@ interface FormDataDetail {
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DataFile {
|
||||||
|
author: string;
|
||||||
|
category: [];
|
||||||
|
createdAt: string;
|
||||||
|
createdBy: string;
|
||||||
|
description: string;
|
||||||
|
downloadUrl: string;
|
||||||
|
fileName: string;
|
||||||
|
fileSize: number;
|
||||||
|
fileType: string;
|
||||||
|
hidden: boolean;
|
||||||
|
keyword: [];
|
||||||
|
metadata: {};
|
||||||
|
path: string;
|
||||||
|
pathname: string;
|
||||||
|
title: string;
|
||||||
|
updatedAt: string;
|
||||||
|
updatedBy: string;
|
||||||
|
upload: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
Pagination,
|
Pagination,
|
||||||
DataOption,
|
DataOption,
|
||||||
|
|
@ -119,4 +140,5 @@ export type {
|
||||||
DataFileOrder,
|
DataFileOrder,
|
||||||
FormDataDetail,
|
FormDataDetail,
|
||||||
TabOptions,
|
TabOptions,
|
||||||
|
DataFile,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue