Merge branch 'develop' into devTee
This commit is contained in:
commit
44ab6c18fe
11 changed files with 429 additions and 393 deletions
|
|
@ -1384,7 +1384,7 @@ onMounted(async () => {
|
||||||
:outlined="true"
|
:outlined="true"
|
||||||
:hide-dropdown-icon="false"
|
:hide-dropdown-icon="false"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `กรุณาเลือกประเภทเครื่องราช`,
|
(val:string) => !!val || `กรุณาเลือกประเภทเครื่องราช`,
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1396,7 +1396,7 @@ onMounted(async () => {
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
lazy-rules
|
lazy-rules
|
||||||
:rules="[(val) => !!val || `กรุณากรอกหมายเหตุ`]"
|
:rules="[(val:string) => !!val || `กรุณากรอกหมายเหตุ`]"
|
||||||
v-model="reason"
|
v-model="reason"
|
||||||
:label="`หมายเหตุ`"
|
:label="`หมายเหตุ`"
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ function backHistory() {
|
||||||
async function fecthlistRound() {
|
async function fecthlistRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.listRoundInsignia())
|
.get(config.API.listRoundInsignia(), { params: { path: "REPORT" } })
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
optionsList.value = res.data.result.map((e: ResponsePeriod) => ({
|
optionsList.value = res.data.result.map((e: ResponsePeriod) => ({
|
||||||
id: e.period_id,
|
id: e.period_id,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, useAttrs, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
|
||||||
import { checkPermission } from "@/utils/permissions";
|
import { checkPermission } from "@/utils/permissions";
|
||||||
|
|
@ -14,8 +14,6 @@ import type { FormProprsalsRound2 } from "@/modules/07_insignia/interface/reques
|
||||||
|
|
||||||
import DialogDetail from "@/modules/07_insignia/components/1_Round/DialogDetail.vue";
|
import DialogDetail from "@/modules/07_insignia/components/1_Round/DialogDetail.vue";
|
||||||
|
|
||||||
/** import Store*/
|
|
||||||
|
|
||||||
/** use */
|
/** use */
|
||||||
const $q = useQuasar(); //ใช้ noti quasar
|
const $q = useQuasar(); //ใช้ noti quasar
|
||||||
const storeInsignia = useInsigniaDataStore();
|
const storeInsignia = useInsigniaDataStore();
|
||||||
|
|
@ -109,7 +107,7 @@ const roundId = ref<string>(""); //id ที่ต้องการ ดูร
|
||||||
async function fetchData() {
|
async function fetchData() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.listRoundInsignia())
|
.get(config.API.listRoundInsignia(), { params: { path: "ROUND" } })
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
rows.value = await data.map((e: FormProprsalsRound2) => ({
|
rows.value = await data.map((e: FormProprsalsRound2) => ({
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
|
||||||
/**
|
/**
|
||||||
* ตัวแปร
|
* ตัวแปร
|
||||||
*/
|
*/
|
||||||
const loading = ref<boolean>(false); //การโหลด
|
|
||||||
const loadview = ref<boolean>(false); //แสดง View
|
const loadview = ref<boolean>(false); //แสดง View
|
||||||
const hideBottom = ref<boolean>(false);
|
const hideBottom = ref<boolean>(false);
|
||||||
const round = ref<string>(""); //รอยการเสนอขอ
|
const round = ref<string>(""); //รอยการเสนอขอ
|
||||||
|
|
@ -64,10 +63,12 @@ const modalbackInsignia2Role = ref<boolean>(false); // popup หมายเห
|
||||||
* function เรียกรอบการเสนอขอพระราชทานเครื่อง
|
* function เรียกรอบการเสนอขอพระราชทานเครื่อง
|
||||||
*/
|
*/
|
||||||
async function fecthlistRound() {
|
async function fecthlistRound() {
|
||||||
|
showLoader();
|
||||||
|
loadview.value = false;
|
||||||
await http
|
await http
|
||||||
.get(config.API.listRoundInsignia())
|
.get(config.API.listRoundInsignia(), { params: { path: "MANAGE" } })
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
optionRound.value = res.data.result.map((e: ResponsePeriod) => ({
|
optionRound.value = await res.data.result.map((e: ResponsePeriod) => ({
|
||||||
id: e.period_id,
|
id: e.period_id,
|
||||||
year: e.period_year,
|
year: e.period_year,
|
||||||
name: e.period_name,
|
name: e.period_name,
|
||||||
|
|
@ -84,14 +85,15 @@ async function fecthlistRound() {
|
||||||
}
|
}
|
||||||
DataStore.roundId = round.value;
|
DataStore.roundId = round.value;
|
||||||
roundName.value = lastValue.name;
|
roundName.value = lastValue.name;
|
||||||
|
loadview.value = true;
|
||||||
await fecthStat(round.value);
|
await fecthStat(round.value);
|
||||||
} else {
|
} else {
|
||||||
loadview.value = false;
|
hideLoader();
|
||||||
loading.value = false;
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
|
hideLoader();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,23 +111,6 @@ async function fecthStat(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* funcion เช็คหน่วยงาน
|
|
||||||
*/
|
|
||||||
async function fecthAgency() {
|
|
||||||
await http
|
|
||||||
.get(config.API.keycloakPosition())
|
|
||||||
.then((res) => {
|
|
||||||
loadview.value = true;
|
|
||||||
DataStore.agency = res.data.result.rootId;
|
|
||||||
DataStore.typeOc = DataStore.agency;
|
|
||||||
loading.value = true;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
messageError($q, err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* function fetch โครองสร้างปัจจุบัน
|
* function fetch โครองสร้างปัจจุบัน
|
||||||
*/
|
*/
|
||||||
|
|
@ -145,9 +130,8 @@ function fetchActiveId() {
|
||||||
* function fetch ข้อมูลโครองสร้างปัจจุบัน
|
* function fetch ข้อมูลโครองสร้างปัจจุบัน
|
||||||
* @param id โครงสร้างปัจจุบัน
|
* @param id โครงสร้างปัจจุบัน
|
||||||
*/
|
*/
|
||||||
function fetchListOrg(id: string) {
|
async function fetchListOrg(id: string) {
|
||||||
showLoader();
|
await http
|
||||||
http
|
|
||||||
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = await res.data.result.map((item: DataStructureTree) => ({
|
const data = await res.data.result.map((item: DataStructureTree) => ({
|
||||||
|
|
@ -156,11 +140,24 @@ function fetchListOrg(id: string) {
|
||||||
}));
|
}));
|
||||||
optiontypeOc.value = data;
|
optiontypeOc.value = data;
|
||||||
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
DataStore.fetchOption(optiontypeOc.value); //ค่าของหน่วยงานทั้งหมดไว้ที่ DataStore
|
||||||
await fecthAgency();
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
messageError($q, err);
|
messageError($q, err);
|
||||||
hideLoader();
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* funcion เช็คหน่วยงาน
|
||||||
|
*/
|
||||||
|
async function fecthAgency() {
|
||||||
|
await http
|
||||||
|
.get(config.API.keycloakPosition())
|
||||||
|
.then((res) => {
|
||||||
|
DataStore.agency = res.data.result.rootId;
|
||||||
|
DataStore.typeOc = DataStore.agency;
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -191,7 +188,7 @@ async function changround() {
|
||||||
DataStore.agency != null //ถ้ามี agency เรียกข้อมูลตาม agency ถ้าไม่มีเรียนตาม Oc ที่เลือก
|
DataStore.agency != null //ถ้ามี agency เรียกข้อมูลตาม agency ถ้าไม่มีเรียนตาม Oc ที่เลือก
|
||||||
? DataStore.agency
|
? DataStore.agency
|
||||||
: DataStore.typeOc;
|
: DataStore.typeOc;
|
||||||
fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
await fecthInsigniaByOc(round.value, organization, "officer", tab.value); // เรียกข้อมูลรายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
|
||||||
// get round name
|
// get round name
|
||||||
const roundFilter = optionRound.value.find((x: any) => round.value === x.id);
|
const roundFilter = optionRound.value.find((x: any) => round.value === x.id);
|
||||||
if (roundFilter) {
|
if (roundFilter) {
|
||||||
|
|
@ -214,6 +211,7 @@ async function fecthInsigniaByOc(
|
||||||
role: string,
|
role: string,
|
||||||
status: string
|
status: string
|
||||||
) {
|
) {
|
||||||
|
DataStore.rows = [];
|
||||||
if (roundId && ocId && role && status) {
|
if (roundId && ocId && role && status) {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
|
|
@ -225,7 +223,6 @@ async function fecthInsigniaByOc(
|
||||||
document.value = res.data.result.document;
|
document.value = res.data.result.document;
|
||||||
await DataStore.fetchData(res.data.result.items); // ส่งรายชื่อข้าราชการสามัญฯ
|
await DataStore.fetchData(res.data.result.items); // ส่งรายชื่อข้าราชการสามัญฯ
|
||||||
await DataStore.fetchDataInsignia(res.data.result); // ส่งข้อมูลรอบบการแสดง
|
await DataStore.fetchDataInsignia(res.data.result); // ส่งข้อมูลรอบบการแสดง
|
||||||
loading.value = true;
|
|
||||||
// แสดงปุมล็อกข้อมูล
|
// แสดงปุมล็อกข้อมูล
|
||||||
if (res.data.result.items !== null) {
|
if (res.data.result.items !== null) {
|
||||||
if (res.data.result.items.length !== 0) {
|
if (res.data.result.items.length !== 0) {
|
||||||
|
|
@ -434,7 +431,13 @@ async function uploadFile(event: any) {
|
||||||
*/
|
*/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
tab.value = DataStore.mainTab ?? "";
|
tab.value = DataStore.mainTab ?? "";
|
||||||
Promise.all([fecthInsignia(), fecthlistRound(), fetchActiveId()]);
|
await Promise.all([
|
||||||
|
fecthlistRound(),
|
||||||
|
fecthInsignia(),
|
||||||
|
fecthInsignia(),
|
||||||
|
fetchActiveId(),
|
||||||
|
fecthAgency(),
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -506,6 +509,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<q-card v-else>
|
<q-card v-else>
|
||||||
<div class="q-pa-md q-gutter-sm">
|
<div class="q-pa-md q-gutter-sm">
|
||||||
<q-banner inline-actions rounded class="bg-grey-1 text-center">
|
<q-banner inline-actions rounded class="bg-grey-1 text-center">
|
||||||
|
|
@ -514,7 +518,7 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
<q-card flat bordered class="col-12 q-mt-sm" v-if="loading">
|
<q-card flat bordered class="col-12 q-mt-sm" v-if="loadview">
|
||||||
<div
|
<div
|
||||||
v-if="
|
v-if="
|
||||||
(roleDataStore.insignia1Role && requestStatus == 'st4') ||
|
(roleDataStore.insignia1Role && requestStatus == 'st4') ||
|
||||||
|
|
@ -531,6 +535,7 @@ onMounted(async () => {
|
||||||
{{ requestNote }}
|
{{ requestNote }}
|
||||||
</q-banner>
|
</q-banner>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
<q-tabs
|
<q-tabs
|
||||||
v-model="tab"
|
v-model="tab"
|
||||||
|
|
@ -550,48 +555,49 @@ onMounted(async () => {
|
||||||
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
|
label="หน่วยงานที่ยังไม่ได้ส่งรายชื่อ"
|
||||||
/>
|
/>
|
||||||
</q-tabs>
|
</q-tabs>
|
||||||
|
|
||||||
|
<div class="col-12"><q-separator /></div>
|
||||||
|
<q-tab-panels v-model="tab" animated>
|
||||||
|
<!-- แทบคนที่ยื่นขอ -->
|
||||||
|
<q-tab-panel name="pending" class="q-pa-none">
|
||||||
|
<tab1
|
||||||
|
:tab="tab"
|
||||||
|
:round-id="round"
|
||||||
|
:round-name="roundName"
|
||||||
|
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||||
|
:request-status="requestStatus"
|
||||||
|
:fecth-stat="fecthStat"
|
||||||
|
/>
|
||||||
|
</q-tab-panel>
|
||||||
|
|
||||||
|
<!-- แทบคนที่ไม่ยื่นขอ -->
|
||||||
|
<q-tab-panel name="reject" class="q-pa-none">
|
||||||
|
<tab2
|
||||||
|
:tab="tab"
|
||||||
|
:round-id="round"
|
||||||
|
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||||
|
/>
|
||||||
|
</q-tab-panel>
|
||||||
|
|
||||||
|
<!-- แทบคนที่ถูกลบออก -->
|
||||||
|
<q-tab-panel name="delete" class="q-pa-none">
|
||||||
|
<tab3
|
||||||
|
:tab="tab"
|
||||||
|
:round-id="round"
|
||||||
|
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
||||||
|
/>
|
||||||
|
</q-tab-panel>
|
||||||
|
|
||||||
|
<!-- แทบหน่วยงานที่ยังไม่ได้ส่งรายชื่อ -->
|
||||||
|
<q-tab-panel
|
||||||
|
v-if="roleDataStore.adminRole"
|
||||||
|
name="organization"
|
||||||
|
class="q-pa-none"
|
||||||
|
>
|
||||||
|
<tab4 :tab="tab" :round-id="round" />
|
||||||
|
</q-tab-panel>
|
||||||
|
</q-tab-panels>
|
||||||
</div>
|
</div>
|
||||||
<q-separator />
|
|
||||||
<q-tab-panels v-model="tab" animated>
|
|
||||||
<!-- แทบคนที่ยื่นขอ -->
|
|
||||||
<q-tab-panel name="pending" class="q-pa-none">
|
|
||||||
<tab1
|
|
||||||
:tab="tab"
|
|
||||||
:round-id="round"
|
|
||||||
:round-name="roundName"
|
|
||||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
|
||||||
:request-status="requestStatus"
|
|
||||||
:fecth-stat="fecthStat"
|
|
||||||
/>
|
|
||||||
</q-tab-panel>
|
|
||||||
|
|
||||||
<!-- แทบคนที่ไม่ยื่นขอ -->
|
|
||||||
<q-tab-panel name="reject" class="q-pa-none">
|
|
||||||
<tab2
|
|
||||||
:tab="tab"
|
|
||||||
:round-id="round"
|
|
||||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
|
||||||
/>
|
|
||||||
</q-tab-panel>
|
|
||||||
|
|
||||||
<!-- แทบคนที่ถูกลบออก -->
|
|
||||||
<q-tab-panel name="delete" class="q-pa-none">
|
|
||||||
<tab3
|
|
||||||
:tab="tab"
|
|
||||||
:round-id="round"
|
|
||||||
:fecth-insignia-by-oc="fecthInsigniaByOc"
|
|
||||||
/>
|
|
||||||
</q-tab-panel>
|
|
||||||
|
|
||||||
<!-- แทบหน่วยงานที่ยังไม่ได้ส่งรายชื่อ -->
|
|
||||||
<q-tab-panel
|
|
||||||
v-if="roleDataStore.adminRole"
|
|
||||||
name="organization"
|
|
||||||
class="q-pa-none"
|
|
||||||
>
|
|
||||||
<tab4 :tab="tab" :round-id="round" />
|
|
||||||
</q-tab-panel>
|
|
||||||
</q-tab-panels>
|
|
||||||
|
|
||||||
<q-toolbar class="q-py-md text-right">
|
<q-toolbar class="q-py-md text-right">
|
||||||
<q-file
|
<q-file
|
||||||
|
|
@ -703,21 +709,21 @@ onMounted(async () => {
|
||||||
@click="popupBackToInsignia2Role"
|
@click="popupBackToInsignia2Role"
|
||||||
/>
|
/>
|
||||||
</q-toolbar>
|
</q-toolbar>
|
||||||
|
|
||||||
<!-- popup หมายเหตุ -->
|
|
||||||
<DialogPopupReason
|
|
||||||
v-model:modal="modalPopupBackToEdit"
|
|
||||||
title="หมายเหตุการตีกลับ"
|
|
||||||
label="หมายเหตุ"
|
|
||||||
:savaForm="backToEdit"
|
|
||||||
/>
|
|
||||||
<DialogPopupReason
|
|
||||||
v-model:modal="modalbackInsignia2Role"
|
|
||||||
title="หมายเหตุการตีกลับ"
|
|
||||||
label="หมายเหตุ"
|
|
||||||
:savaForm="backToEditinsignia2Role"
|
|
||||||
/>
|
|
||||||
</q-card>
|
</q-card>
|
||||||
|
|
||||||
|
<!-- popup หมายเหตุ -->
|
||||||
|
<DialogPopupReason
|
||||||
|
v-model:modal="modalPopupBackToEdit"
|
||||||
|
title="หมายเหตุการตีกลับ"
|
||||||
|
label="หมายเหตุ"
|
||||||
|
:savaForm="backToEdit"
|
||||||
|
/>
|
||||||
|
<DialogPopupReason
|
||||||
|
v-model:modal="modalbackInsignia2Role"
|
||||||
|
title="หมายเหตุการตีกลับ"
|
||||||
|
label="หมายเหตุ"
|
||||||
|
:savaForm="backToEditinsignia2Role"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scope>
|
<style lang="scss" scope>
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ const visibleColumns = ref<String[]>([
|
||||||
async function fecthRound() {
|
async function fecthRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.noteround())
|
.get(config.API.noteround(), { params: { path: "RECORD" } })
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
if (data.length !== 0) {
|
if (data.length !== 0) {
|
||||||
|
|
@ -254,7 +254,6 @@ async function fecthRound() {
|
||||||
id: e.id,
|
id: e.id,
|
||||||
}));
|
}));
|
||||||
selectRound.value = data[0].id;
|
selectRound.value = data[0].id;
|
||||||
|
|
||||||
await Promise.all([fecthInsignia(), fecthInsigniaType()]);
|
await Promise.all([fecthInsignia(), fecthInsigniaType()]);
|
||||||
} else {
|
} else {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
|
@ -436,6 +435,9 @@ function perviewfile(event: any, actionType: string) {
|
||||||
type: e.requestInsignia,
|
type: e.requestInsignia,
|
||||||
employeeType: DataStore.profileType(e.profileType),
|
employeeType: DataStore.profileType(e.profileType),
|
||||||
profileType: e.profileType,
|
profileType: e.profileType,
|
||||||
|
date: date2Thai(e.date),
|
||||||
|
volumeNo: e.volumeNo,
|
||||||
|
section: e.section,
|
||||||
page: e.page,
|
page: e.page,
|
||||||
number: e.no,
|
number: e.no,
|
||||||
vatnumber: e.number,
|
vatnumber: e.number,
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ const pagination = ref({
|
||||||
async function fecthRound() {
|
async function fecthRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.noteround())
|
.get(config.API.noteround(), { params: { path: "ALLOCATE" } })
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
if (data.length !== 0) {
|
if (data.length !== 0) {
|
||||||
|
|
@ -135,6 +135,8 @@ async function fecthRound() {
|
||||||
} else {
|
} else {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
hideLoader();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ const employeeClassOps = ref<any>(DataStore.employeeClassOps);
|
||||||
async function fecthRound() {
|
async function fecthRound() {
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.get(config.API.noteround())
|
.get(config.API.noteround(), { params: { path: "BORROW" } })
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
let data = res.data.result;
|
let data = res.data.result;
|
||||||
if (data.length !== 0) {
|
if (data.length !== 0) {
|
||||||
|
|
@ -295,11 +295,14 @@ async function fecthRound() {
|
||||||
filterSelectRoundOption.value = selectRoundOption.value;
|
filterSelectRoundOption.value = selectRoundOption.value;
|
||||||
yearRound.value = data[0].year;
|
yearRound.value = data[0].year;
|
||||||
roundYear.value = data[0].year;
|
roundYear.value = data[0].year;
|
||||||
|
|
||||||
if (roundYear.value) {
|
if (roundYear.value) {
|
||||||
await fecthInsigniaType();
|
await fecthInsigniaType();
|
||||||
} else {
|
} else {
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
hideLoader();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,7 @@ let formData = reactive<FormDataDetail>({
|
||||||
commandAffectDate: null, //วันที่ลงนาม
|
commandAffectDate: null, //วันที่ลงนาม
|
||||||
commandExcecuteDate: null, //วันที่คำสั่งมีผล
|
commandExcecuteDate: null, //วันที่คำสั่งมีผล
|
||||||
isBangkok: false,
|
isBangkok: false,
|
||||||
isAttachment:true
|
isAttachment: true,
|
||||||
|
|
||||||
});
|
});
|
||||||
const modalPreview = ref<boolean>(false); //แสดงตัวอย่าง
|
const modalPreview = ref<boolean>(false); //แสดงตัวอย่าง
|
||||||
|
|
||||||
|
|
@ -88,68 +87,117 @@ defineExpose({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<q-card-section>
|
<q-form greedy @submit.prevent @validation-success="onSubmit">
|
||||||
<div class="row q-col-gutter-sm">
|
<q-card-section>
|
||||||
<!-- คำสั่งเลขที่ -->
|
<div class="row q-col-gutter-sm">
|
||||||
<!-- คำสั่งเรื่อง -->
|
<!-- คำสั่งเลขที่ -->
|
||||||
<div class="col-12">
|
<!-- คำสั่งเรื่อง -->
|
||||||
<q-input
|
<div class="col-12">
|
||||||
:class="store.classInput(!store.readonly)"
|
|
||||||
:readonly="store.readonly"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
v-model="formData.issue"
|
|
||||||
hide-bottom-space
|
|
||||||
:label="`${'คำสั่งเรื่อง'}`"
|
|
||||||
@update:model-value="onCheckChangeData()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-4 row">
|
|
||||||
<div class="col-6">
|
|
||||||
<q-input
|
<q-input
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model="formData.commandNo"
|
v-model="formData.issue"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'คำสั่งเลขที่'}`"
|
:label="`${'คำสั่งเรื่อง'}`"
|
||||||
@update:model-value="onCheckChangeData()"
|
@update:model-value="onCheckChangeData()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<label class="col-1 flex justify-center items-center text-bold">
|
|
||||||
/
|
<div class="col-4 row">
|
||||||
</label>
|
<div class="col-6">
|
||||||
<div class="col-5">
|
<q-input
|
||||||
|
:class="store.classInput(!store.readonly)"
|
||||||
|
:readonly="store.readonly"
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
v-model="formData.commandNo"
|
||||||
|
hide-bottom-space
|
||||||
|
:label="`${'คำสั่งเลขที่'}`"
|
||||||
|
@update:model-value="onCheckChangeData()"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<label class="col-1 flex justify-center items-center text-bold">
|
||||||
|
/
|
||||||
|
</label>
|
||||||
|
<div class="col-5">
|
||||||
|
<datepicker
|
||||||
|
menu-class-name="modalfix"
|
||||||
|
v-model="formData.commandYear"
|
||||||
|
:locale="'th'"
|
||||||
|
autoApply
|
||||||
|
year-picker
|
||||||
|
:enableTimePicker="false"
|
||||||
|
:class="store.classInput(!store.readonly)"
|
||||||
|
:readonly="store.readonly"
|
||||||
|
@update:model-value="onCheckChangeData()"
|
||||||
|
>
|
||||||
|
<template #year="{ year }">{{ year + 543 }}</template>
|
||||||
|
<template #year-overlay-value="{ value }">{{
|
||||||
|
parseInt(value + 543)
|
||||||
|
}}</template>
|
||||||
|
<template #trigger>
|
||||||
|
<q-input
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
hide-bottom-space
|
||||||
|
:class="store.classInput(!store.readonly)"
|
||||||
|
:readonly="store.readonly"
|
||||||
|
:model-value="
|
||||||
|
formData.commandYear == null
|
||||||
|
? null
|
||||||
|
: formData.commandYear + 543
|
||||||
|
"
|
||||||
|
:label="`${'พ.ศ.'}`"
|
||||||
|
>
|
||||||
|
<template v-slot:prepend>
|
||||||
|
<q-icon
|
||||||
|
name="event"
|
||||||
|
class="cursor-pointer"
|
||||||
|
style="color: var(--q-primary)"
|
||||||
|
>
|
||||||
|
</q-icon>
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
</template>
|
||||||
|
</datepicker>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-4">
|
||||||
<datepicker
|
<datepicker
|
||||||
|
clearable
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="formData.commandYear"
|
v-model="formData.commandAffectDate"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
year-picker
|
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
@update:model-value="onCheckChangeData()"
|
@update:model-value="onCheckChangeData()"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">{{ year + 543 }}</template>
|
<template #year="{ year }">
|
||||||
<template #year-overlay-value="{ value }">{{
|
{{ year + 543 }}
|
||||||
parseInt(value + 543)
|
</template>
|
||||||
}}</template>
|
<template #year-overlay-value="{ value }">
|
||||||
|
{{ parseInt(value + 543) }}
|
||||||
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
|
clearable
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
:model-value="
|
:model-value="
|
||||||
formData.commandYear == null
|
formData.commandAffectDate == null
|
||||||
? null
|
? null
|
||||||
: formData.commandYear + 543
|
: date2Thai(formData.commandAffectDate)
|
||||||
"
|
"
|
||||||
:label="`${'พ.ศ.'}`"
|
:label="`${'วันที่ลงนาม'}`"
|
||||||
|
@clear="() => (formData.commandAffectDate = null)"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
|
|
@ -163,114 +211,68 @@ defineExpose({
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-4">
|
<div class="col-4">
|
||||||
<datepicker
|
<datepicker
|
||||||
clearable
|
clearable
|
||||||
menu-class-name="modalfix"
|
menu-class-name="modalfix"
|
||||||
v-model="formData.commandAffectDate"
|
v-model="formData.commandExcecuteDate"
|
||||||
:locale="'th'"
|
:locale="'th'"
|
||||||
autoApply
|
autoApply
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
@update:model-value="onCheckChangeData()"
|
@update:model-value="onCheckChangeData()"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">
|
<template #year="{ year }">
|
||||||
{{ year + 543 }}
|
{{ year + 543 }}
|
||||||
</template>
|
</template>
|
||||||
<template #year-overlay-value="{ value }">
|
<template #year-overlay-value="{ value }">
|
||||||
{{ parseInt(value + 543) }}
|
{{ parseInt(value + 543) }}
|
||||||
</template>
|
</template>
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<q-input
|
<q-input
|
||||||
clearable
|
clearable
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
:model-value="
|
:model-value="
|
||||||
formData.commandAffectDate == null
|
formData.commandExcecuteDate == null
|
||||||
? null
|
? null
|
||||||
: date2Thai(formData.commandAffectDate)
|
: date2Thai(formData.commandExcecuteDate)
|
||||||
"
|
"
|
||||||
:label="`${'วันที่ลงนาม'}`"
|
:label="`${'วันที่คำสั่งมีผล'}`"
|
||||||
@clear="() => (formData.commandAffectDate = null)"
|
@clear="() => (formData.commandExcecuteDate = null)"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<q-icon
|
<q-icon
|
||||||
name="event"
|
name="event"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
style="color: var(--q-primary)"
|
style="color: var(--q-primary)"
|
||||||
>
|
>
|
||||||
</q-icon>
|
</q-icon>
|
||||||
</template>
|
</template>
|
||||||
</q-input>
|
</q-input>
|
||||||
</template>
|
</template>
|
||||||
</datepicker>
|
</datepicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
|
||||||
<datepicker
|
<!-- เนื้อหาคำสั่งส่วนต้น -->
|
||||||
clearable
|
<div class="col-12">
|
||||||
menu-class-name="modalfix"
|
<q-input
|
||||||
v-model="formData.commandExcecuteDate"
|
:class="store.classInput(!store.readonly)"
|
||||||
:locale="'th'"
|
:readonly="store.readonly"
|
||||||
autoApply
|
outlined
|
||||||
:enableTimePicker="false"
|
dense
|
||||||
:class="store.classInput(!store.readonly)"
|
v-model="formData.detailHeader"
|
||||||
:readonly="store.readonly"
|
hide-bottom-space
|
||||||
@update:model-value="onCheckChangeData()"
|
:label="`${'เนื้อหาคำสั่งขึ้นต้น (optional)'}`"
|
||||||
>
|
@update:model-value="onCheckChangeData()"
|
||||||
<template #year="{ year }">
|
type="textarea"
|
||||||
{{ year + 543 }}
|
/>
|
||||||
</template>
|
<!-- <q-card bordered flat>
|
||||||
<template #year-overlay-value="{ value }">
|
|
||||||
{{ parseInt(value + 543) }}
|
|
||||||
</template>
|
|
||||||
<template #trigger>
|
|
||||||
<q-input
|
|
||||||
clearable
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
hide-bottom-space
|
|
||||||
:class="store.classInput(!store.readonly)"
|
|
||||||
:readonly="store.readonly"
|
|
||||||
:model-value="
|
|
||||||
formData.commandExcecuteDate == null
|
|
||||||
? null
|
|
||||||
: date2Thai(formData.commandExcecuteDate)
|
|
||||||
"
|
|
||||||
:label="`${'วันที่คำสั่งมีผล'}`"
|
|
||||||
@clear="() => (formData.commandExcecuteDate = null)"
|
|
||||||
>
|
|
||||||
<template v-slot:prepend>
|
|
||||||
<q-icon
|
|
||||||
name="event"
|
|
||||||
class="cursor-pointer"
|
|
||||||
style="color: var(--q-primary)"
|
|
||||||
>
|
|
||||||
</q-icon>
|
|
||||||
</template>
|
|
||||||
</q-input>
|
|
||||||
</template>
|
|
||||||
</datepicker>
|
|
||||||
</div>
|
|
||||||
<!-- เนื้อหาคำสั่งส่วนต้น -->
|
|
||||||
<div class="col-12">
|
|
||||||
<q-input
|
|
||||||
:class="store.classInput(!store.readonly)"
|
|
||||||
:readonly="store.readonly"
|
|
||||||
outlined
|
|
||||||
dense
|
|
||||||
v-model="formData.detailHeader"
|
|
||||||
hide-bottom-space
|
|
||||||
:label="`${'เนื้อหาคำสั่งขึ้นต้น (optional)'}`"
|
|
||||||
@update:model-value="onCheckChangeData()"
|
|
||||||
type="textarea"
|
|
||||||
/>
|
|
||||||
<!-- <q-card bordered flat>
|
|
||||||
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
||||||
เนื้อหาคำสั่งส่วนต้น
|
เนื้อหาคำสั่งส่วนต้น
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -307,23 +309,24 @@ defineExpose({
|
||||||
</q-field>
|
</q-field>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card> -->
|
</q-card> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- เนื้อหาคำสั่งส่วนกลาง -->
|
<!-- เนื้อหาคำสั่งส่วนกลาง -->
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<q-input
|
<q-input
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model="formData.detailBody"
|
v-model="formData.detailBody"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'เนื้อหาคำสั่งหลัก'}`"
|
:label="`${'เนื้อหาคำสั่งหลัก'}`"
|
||||||
@update:model-value="onCheckChangeData()"
|
@update:model-value="onCheckChangeData()"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:rules="[(val: string) => !!val || `${'กรุณากรอกเนื้อหาคำสั่งหลัก'}`]"
|
:rules="[(val: string) => !!val || `${'กรุณากรอกเนื้อหาคำสั่งหลัก'}`]"
|
||||||
/>
|
lazy-rules
|
||||||
<!-- <q-card bordered flat>
|
/>
|
||||||
|
<!-- <q-card bordered flat>
|
||||||
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
||||||
เนื้อหาคำสั่งส่วนกลาง
|
เนื้อหาคำสั่งส่วนกลาง
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -360,22 +363,22 @@ defineExpose({
|
||||||
</q-field>
|
</q-field>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card> -->
|
</q-card> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- เนื้อหาคำสั่งส่วนท้าย -->
|
<!-- เนื้อหาคำสั่งส่วนท้าย -->
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<q-input
|
<q-input
|
||||||
:class="store.classInput(!store.readonly)"
|
:class="store.classInput(!store.readonly)"
|
||||||
:readonly="store.readonly"
|
:readonly="store.readonly"
|
||||||
outlined
|
outlined
|
||||||
dense
|
dense
|
||||||
v-model="formData.detailFooter"
|
v-model="formData.detailFooter"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
:label="`${'เนื้อหาคำสั่งลงท้าย (optional)'}`"
|
:label="`${'เนื้อหาคำสั่งลงท้าย (optional)'}`"
|
||||||
@update:model-value="onCheckChangeData()"
|
@update:model-value="onCheckChangeData()"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
/>
|
/>
|
||||||
<!-- <q-card bordered flat>
|
<!-- <q-card bordered flat>
|
||||||
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
<div class="bg-grey-2 row q-py-sm q-px-md text-bold">
|
||||||
เนื้อหาคำสั่งส่วนท้าย
|
เนื้อหาคำสั่งส่วนท้าย
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -412,25 +415,26 @@ defineExpose({
|
||||||
</q-field>
|
</q-field>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
</q-card> -->
|
</q-card> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<q-checkbox
|
||||||
|
keep-color
|
||||||
|
color="primary"
|
||||||
|
dense
|
||||||
|
v-model="formData.isBangkok"
|
||||||
|
label="นี่คือคำสั่งกรุงเทพมหานคร"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
|
||||||
<div class="col-12">
|
<q-separator />
|
||||||
<q-checkbox
|
|
||||||
keep-color
|
|
||||||
color="primary"
|
|
||||||
dense
|
|
||||||
v-model="formData.isBangkok"
|
|
||||||
label="นี่คือคำสั่งกรุงเทพมหานคร"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
|
|
||||||
<q-separator />
|
<q-card-actions align="right" v-if="!store.readonly">
|
||||||
|
<q-btn label="บันทึก" color="public" type="submit" />
|
||||||
<q-card-actions align="right" v-if="!store.readonly">
|
</q-card-actions>
|
||||||
<q-btn label="บันทึก" color="public" @click="onSubmit" />
|
</q-form>
|
||||||
</q-card-actions>
|
|
||||||
|
|
||||||
<DialogPerview
|
<DialogPerview
|
||||||
v-model:modal="modalPreview"
|
v-model:modal="modalPreview"
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,8 @@ defineExpose({
|
||||||
dense
|
dense
|
||||||
v-model="props.row.sendCC"
|
v-model="props.row.sendCC"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => !!val || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
(val:string) => !!val || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
||||||
(val) =>
|
(val:string) =>
|
||||||
val.length > 0 || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
val.length > 0 || `${'กรุณาเลือกช่องทางการส่งสำเนา'}`,
|
||||||
]"
|
]"
|
||||||
:label="`${'เลือกช่องทางการส่งสำเนา'}`"
|
:label="`${'เลือกช่องทางการส่งสำเนา'}`"
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,28 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref, watch } from "vue";
|
import { onMounted, ref, watch } from "vue";
|
||||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||||
import axios from "axios";
|
|
||||||
import { useQuasar } from "quasar";
|
import { useQuasar } from "quasar";
|
||||||
|
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
import { useRoute } from "vue-router";
|
||||||
import http from "@/plugins/http";
|
import http from "@/plugins/http";
|
||||||
import config from "@/app.config";
|
import config from "@/app.config";
|
||||||
import genReport from "@/plugins/genreport";
|
import genReport from "@/plugins/genreport";
|
||||||
|
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||||
|
|
||||||
import type { PDFDocumentLoadingTask } from "pdfjs-dist/types/src/display/api";
|
import type { DataFileOrder } from "@/modules/18_command/interface/response/Main";
|
||||||
|
|
||||||
import { useCounterMixin } from "@/stores/mixin";
|
import { useCounterMixin } from "@/stores/mixin";
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
|
const route = useRoute();
|
||||||
const mixin = useCounterMixin();
|
const mixin = useCounterMixin();
|
||||||
const {
|
const { messageError, showLoader, hideLoader } = mixin;
|
||||||
date2Thai,
|
|
||||||
messageError,
|
const commandId = ref<string>(route.params.id.toString());
|
||||||
showLoader,
|
|
||||||
hideLoader,
|
|
||||||
dialogConfirm,
|
|
||||||
success,
|
|
||||||
} = mixin;
|
|
||||||
|
|
||||||
const isChangeData = defineModel<boolean>("isChangeData", { required: true });
|
|
||||||
const isAttachment = defineModel<boolean>("isAttachment", { required: true });
|
const isAttachment = defineModel<boolean>("isAttachment", { required: true });
|
||||||
const { onCheckChangeData } = defineProps({
|
|
||||||
onCheckChangeData: { type: Function, required: true },
|
|
||||||
});
|
|
||||||
|
|
||||||
const tab = ref<string>("main"); //tab
|
const tab = ref<string>("main"); //tab
|
||||||
const page = ref<number>(1);
|
const page = ref<number>(1);
|
||||||
|
|
@ -35,28 +30,37 @@ const numOfPages = ref<number>(0); //จำนวนหน้า pdf
|
||||||
const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // ตัวแปรเก็บ เเสดง pdf
|
const pdfSrc = ref<PDFDocumentLoadingTask | undefined>(); // ตัวแปรเก็บ เเสดง pdf
|
||||||
|
|
||||||
const dialog = ref<boolean>(false); // เปิด dialog
|
const dialog = ref<boolean>(false); // เปิด dialog
|
||||||
|
const isLoadView = ref<boolean>(false);
|
||||||
|
const dataCover = ref<DataFileOrder>(); //ข้อมูลไฟล์คำสั่ง
|
||||||
|
const dataAttachment = ref<DataFileOrder>(); //ข้อมูลไฟล์แบนท้าย
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* เปลี่ยน tab
|
* ฟังก์ชันดึงข้อมูลโหลดไฟล์คำสั่ง
|
||||||
* @param val ชื่อ tab
|
* @param type ประเภท cover เป็นคำสั่ง attachment เป็น แบนท้าย
|
||||||
*/
|
*/
|
||||||
function setTab(val: string) {
|
async function fetchDataCommand(type: string) {
|
||||||
tab.value = val;
|
await http
|
||||||
page.value = 1;
|
.get(config.API.commandAction(commandId.value, `tab4/${type}`))
|
||||||
|
.then(async (res) => {
|
||||||
|
const dataMain = await res.data.result;
|
||||||
|
if (type === "cover") {
|
||||||
|
dataCover.value = dataMain;
|
||||||
|
await fetchPDF(dataCover.value);
|
||||||
|
} else {
|
||||||
|
dataAttachment.value = dataMain;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
messageError($q, err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ดึง class ตามที่ set ไว้ */
|
/**
|
||||||
function getClass(val: boolean) {
|
* ฟังชั่นกำหนดค่าของ PDF
|
||||||
return {
|
*
|
||||||
"card-header-active q-px-lg q-py-md cursor-pointer": val,
|
*/
|
||||||
"card-header q-px-lg q-py-md cursor-pointer": !val,
|
async function fetchPDF(data: any, type: string = "docx?folder=command") {
|
||||||
};
|
isLoadView.value = false;
|
||||||
}
|
|
||||||
function onSubmit() {}
|
|
||||||
|
|
||||||
/** ฟังชั่นจองลอง แสดง pdf */
|
|
||||||
async function genPDf(data: any, type: string = "docx") {
|
|
||||||
showLoader();
|
|
||||||
await axios
|
await axios
|
||||||
.post(config.API.reportTemplate + `/${type}`, data, {
|
.post(config.API.reportTemplate + `/${type}`, data, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -68,17 +72,16 @@ async function genPDf(data: any, type: string = "docx") {
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const blob = new Blob([res.data]);
|
const blob = new Blob([res.data]);
|
||||||
const objectUrl = URL.createObjectURL(blob);
|
const objectUrl = URL.createObjectURL(blob);
|
||||||
|
|
||||||
const pdfData = usePDF(`${objectUrl}`);
|
const pdfData = usePDF(`${objectUrl}`);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
pdfSrc.value = pdfData.pdf.value;
|
pdfSrc.value = pdfData.pdf.value;
|
||||||
numOfPages.value = pdfData.pages.value;
|
numOfPages.value = pdfData.pages.value;
|
||||||
hideLoader();
|
isLoadView.value = true;
|
||||||
}, 1500);
|
}, 1500);
|
||||||
})
|
})
|
||||||
.catch(async (e) => {
|
.catch(async (e) => {
|
||||||
messageError($q, e);
|
messageError($q, e);
|
||||||
hideLoader();
|
isLoadView.value = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,88 +90,62 @@ async function genPDf(data: any, type: string = "docx") {
|
||||||
* @param type pdf/docx
|
* @param type pdf/docx
|
||||||
*/
|
*/
|
||||||
async function downloadCover(type: string) {
|
async function downloadCover(type: string) {
|
||||||
genReport(
|
if (tab.value === "main") {
|
||||||
tab.value == "main" ? data1 : data2,
|
genReport(
|
||||||
`${
|
dataCover.value,
|
||||||
tab.value == "main"
|
"คำสั่ง คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้",
|
||||||
? "คำสั่ง คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้"
|
type
|
||||||
: "เอกสารแนบท้าย คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้"
|
);
|
||||||
}`,
|
} else {
|
||||||
type
|
genReportXLSX(
|
||||||
);
|
dataAttachment.value,
|
||||||
|
"เอกสารแนบท้าย คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้",
|
||||||
|
type
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ข้อมูลจำลอง */
|
/**
|
||||||
const data1 = {
|
* เปลี่ยน tab
|
||||||
template: "C-PM-01",
|
* @param val ชื่อ tab
|
||||||
reportName: "docx-report",
|
*/
|
||||||
data: {
|
function setTab(val: string) {
|
||||||
commandNo: "",
|
tab.value = val;
|
||||||
commandYear: "๒๕๖๗",
|
page.value = 1;
|
||||||
issuerOrganizationName: "",
|
}
|
||||||
conclusionRegisterNo: "test",
|
|
||||||
conclusionRegisterDate: "๒ สิงหาคม ๒๕๖๗",
|
|
||||||
conclusionResultNo: "test",
|
|
||||||
conclusionResultDate: "๓ สิงหาคม ๒๕๖๗",
|
|
||||||
positionList: "",
|
|
||||||
count: "๑",
|
|
||||||
commandAffectDate: "๑ สิงหาคม ๒๕๖๗",
|
|
||||||
authorizedUserFullName: "นายวิษณุ สุวรรณรัตน์",
|
|
||||||
authorizedPosition: "ผู้อำนวยการ",
|
|
||||||
subject: "เรื่อง คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const data2 = {
|
|
||||||
template: "C-PM-01-attachment",
|
|
||||||
reportName: "docx-report",
|
|
||||||
data: {
|
|
||||||
commandNo: "",
|
|
||||||
commandYear: "๒๕๖๗",
|
|
||||||
issuerOrganizationName: "",
|
|
||||||
commandExcecuteDate: "-",
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
citizenId: "๒๔๕๙๙๐๐๐๑๙๖๘๐",
|
|
||||||
fullName: "นางสาวบุปผารัตน์ สีลาเหลี่ยม",
|
|
||||||
oc: "สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร",
|
|
||||||
positionName: "นักบริหาร",
|
|
||||||
positionLevel: "ต้น",
|
|
||||||
positionType: "บริหาร",
|
|
||||||
positionNumber: "สกก.๒",
|
|
||||||
salary: "๑๒,๐๐๐",
|
|
||||||
appointDate: "๒๓ ส.ค. ๖๗",
|
|
||||||
examNumber: "๑",
|
|
||||||
placementName: "สอบแข่งขันนักคอมพิวเตอร์ ครั้งที่ ๑/๒๕๖๗",
|
|
||||||
seq: "๑",
|
|
||||||
education: "การศึกษาบัณฑิต",
|
|
||||||
remarkHorizontal:
|
|
||||||
"โดยมีเงื่อนไขว่าต้องปฏิบัติงานให้กรุงเทพมหานครเป็นระยะเวลาไม่น้อยกว่า ๕ ปี นับแต่วันที่ได้รับการบรรจุและแต่งตั้ง โดยห้ามโอนไปหน่วยงานหรือส่วนราชการอื่น เว้นเเต่ลาออกจากราชการ",
|
|
||||||
remarkVertical: null,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังก์ชันที่ต้องการนำฟังก์ชันออกไปใช้ใน Components แม่
|
* ดึง class ตามที่ set ไว้
|
||||||
*/
|
*/
|
||||||
defineExpose({
|
function getClass(val: boolean) {
|
||||||
onSubmit,
|
return {
|
||||||
});
|
"card-header-active q-px-lg q-py-md cursor-pointer": val,
|
||||||
|
"card-header q-px-lg q-py-md cursor-pointer": !val,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/** check tab เมื่อมีการเปลี่ยน tab */
|
/**
|
||||||
|
* check tab เมื่อมีการเปลี่ยน tab
|
||||||
|
*/
|
||||||
watch(tab, () => {
|
watch(tab, () => {
|
||||||
if (tab.value === "main") {
|
if (tab.value === "main") {
|
||||||
genPDf(data1);
|
fetchPDF(dataCover.value);
|
||||||
}
|
}
|
||||||
if (tab.value === "second") {
|
if (tab.value === "second") {
|
||||||
genPDf(data2);
|
fetchPDF(dataAttachment.value, "xlsx?folder=command");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/** hook */
|
/** hook */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await genPDf(data1);
|
showLoader();
|
||||||
|
const promises = [fetchDataCommand("cover")];
|
||||||
|
if (isAttachment.value) {
|
||||||
|
promises.push(fetchDataCommand("attachment"));
|
||||||
|
}
|
||||||
|
await Promise.all(promises).finally(() => {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -209,14 +186,24 @@ onMounted(async () => {
|
||||||
</q-btn>
|
</q-btn>
|
||||||
|
|
||||||
<q-btn
|
<q-btn
|
||||||
|
v-if="tab === 'main'"
|
||||||
outline
|
outline
|
||||||
class="q-px-sm"
|
class="q-px-sm"
|
||||||
color="blue"
|
color="blue"
|
||||||
icon="mdi-file-word"
|
icon="mdi-file-word"
|
||||||
label="ดาวน์โหลดไฟล์ docx"
|
label="ดาวน์โหลดไฟล์ docx"
|
||||||
@click="downloadCover('docx')"
|
@click="downloadCover('docx')"
|
||||||
>
|
/>
|
||||||
</q-btn>
|
|
||||||
|
<q-btn
|
||||||
|
v-else
|
||||||
|
outline
|
||||||
|
class="q-px-sm"
|
||||||
|
color="green"
|
||||||
|
icon="mdi-file-excel"
|
||||||
|
label="ดาวน์โหลดไฟล์ xlsx"
|
||||||
|
@click="downloadCover('xlsx')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<q-card bordered class="card-pdf q-mx-sm q-pa-md">
|
<q-card bordered class="card-pdf q-mx-sm q-pa-md">
|
||||||
<div class="justify-between items-center align-center q-pb-sm row">
|
<div class="justify-between items-center align-center q-pb-sm row">
|
||||||
|
|
@ -242,9 +229,25 @@ onMounted(async () => {
|
||||||
<q-icon name="mdi-chevron-right" />
|
<q-icon name="mdi-chevron-right" />
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
<div class="pdfWidth">
|
<div class="pdfWidth" v-if="isLoadView">
|
||||||
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
|
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="full-width row flex-center text-accent q-gutter-sm" v-else>
|
||||||
|
<span
|
||||||
|
><div
|
||||||
|
style="
|
||||||
|
height: 60vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
"
|
||||||
|
class="text-grey-5"
|
||||||
|
>
|
||||||
|
<q-spinner color="primary" size="3em" :thickness="10" />
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</q-card>
|
</q-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,27 @@ interface DataFileDownload {
|
||||||
upload: boolean;
|
upload: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DataFileOrder {
|
||||||
|
reportName: string;
|
||||||
|
template: string;
|
||||||
|
data: {
|
||||||
|
commandDate: string;
|
||||||
|
commandExcecuteDate: string;
|
||||||
|
commandNo: string;
|
||||||
|
commandTitle: string;
|
||||||
|
commandYear: 2024;
|
||||||
|
detailBody: string;
|
||||||
|
detailFooter: string;
|
||||||
|
detailHeader: string;
|
||||||
|
name: string;
|
||||||
|
position: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
ResListCommand,
|
ResListCommand,
|
||||||
DataListCommand,
|
DataListCommand,
|
||||||
DataCommandType,
|
DataCommandType,
|
||||||
DataFileDownload,
|
DataFileDownload,
|
||||||
|
DataFileOrder,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue