Refactoring code module 07_insignia

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-25 16:44:07 +07:00
parent 208d867dfd
commit 6fb6024f53
31 changed files with 1158 additions and 2444 deletions

View file

@ -1,395 +0,0 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar, QForm } from "quasar";
import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Store*/
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
const mixin = useCounterMixin();
const {
date2Thai,
dateToISO,
messageError,
showLoader,
hideLoader,
dialogConfirm,
success,
dialogMessageNotify,
} = mixin;
/** use */
const router = useRouter();
const route = useRoute();
const $q = useQuasar();
const id = ref<string>(route.params.id as string);
const myForm = ref<QForm | null>(null); //form data input
const edit = ref<boolean>(false);
const dateStart = ref<Date>(new Date());
const dateEnd = ref<Date>(new Date());
const yearly = ref<number>(new Date().getFullYear());
const files = ref<any>();
const fileDocDataUpload = ref<File[]>([]);
const roundInsig = ref<any>();
const datelast = ref<number>(1);
const options = ref([
{ label: "รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ 1", value: 1 },
{ label: "รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ 2", value: 2 },
]);
/** Function เรียกข้อมูลของรอบการเสนอขอ */
async function fetchData() {
edit.value = true;
showLoader();
await http
.get(config.API.getRoundInsignia(id.value))
.then((res) => {
const data = res.data.result;
id.value = data.period_id;
roundInsig.value =
options.value.filter((r: any) => r.value == data.period_round).length >
0
? options.value.filter((r: any) => r.value == data.period_round)[0]
: null;
yearly.value = data.period_year;
datelast.value = data.period_amount;
dateStart.value = new Date(data.period_start);
dateEnd.value = new Date(data.period_end);
// files.value = data.period_doc;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* Function พโหลดไฟล
* @param files ไฟล
*/
function fileUploadDoc(files: any) {
files.forEach((file: any) => {
fileDocDataUpload.value.push(file);
});
}
/**
* Function พเดทป
* @param year บคาป คศ
*/
async function updateYear(year: number) {
yearly.value = year;
await updateDateRange();
}
/** Function ตรวจสอบค่าว่างของ Input */
function checkSave() {
if (myForm.value !== null) {
myForm.value.validate().then(async (success) => {
if (success) {
dialogConfirm($q, () => SaveData());
} else if (Number(datelast.value) !== 0) {
dialogMessageNotify($q, "กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ");
}
});
}
}
/** Function บันทึกข้อมูล */
async function SaveData() {
if (edit.value) {
await editData(id.value);
} else {
await addData();
clickBack();
}
}
/** Function อัพเดทวันที่เริ่มต้น และ สิ้นสุด */
function updateDateRange() {
if (roundInsig.value.value == 1) {
dateStart.value = new Date(yearly.value, 9, 1);
dateEnd.value = new Date(yearly.value + 1, 3, 29);
} else if (roundInsig.value.value == 2) {
dateStart.value = new Date(yearly.value + 1, 3, 29);
dateEnd.value = new Date(yearly.value + 1, 4, 29);
}
}
/** Function เพิ่มข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ */
async function addData() {
const formData = new FormData();
const name = `รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ ${
roundInsig.value.value
} ${yearly.value + 543} `;
formData.append("name", name);
formData.append("year", yearly.value.toString());
formData.append("amount", datelast.value.toString());
formData.append("round", roundInsig.value.value);
if (dateStart.value !== null) {
formData.append("startDate", dateToISO(dateStart.value));
}
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
formData.append("file", files.value);
showLoader();
await http
.post(config.API.listRoundInsignia(), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
/** Function แก้ไขข้อมูลรอบการเสนอขอพระราชทานเครื่องราชฯ */
async function editData(id: string) {
const formData = new FormData();
const name = `รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ ${
roundInsig.value.value
} ${yearly.value + 543}`;
formData.append("name", name);
formData.append("year", yearly.value.toString());
formData.append("amount", datelast.value.toString());
formData.append("round", roundInsig.value.value);
if (dateStart.value !== null) {
formData.append("startDate", dateToISO(dateStart.value));
}
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
formData.append("file", files.value);
showLoader();
await http
.put(config.API.editRoundInsignia(id), formData)
.then(() => {
success($q, "แก้ไขข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
clickBack();
});
}
/** Function ย้อนกลับหน้า รอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ */
function clickBack() {
router.push({ name: "insigniaProposals" });
}
/** Hook */
onMounted(async () => {
// params id
(await route.params?.id) && fetchData();
});
</script>
<template>
<div class="col-xs-12 col-sm-12 col-md-11">
<div class="toptitle col-12 row items-center">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="clickBack"
/>
{{
edit
? "รอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์"
: "เพิ่มรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์"
}}
</div>
<q-form ref="myForm">
<div class="col-12">
<q-card bordered>
<div class="col-12 row q-col-gutter-md q-pa-md">
<div class="col-xs-12 col-sm-12 row">
<q-separator />
<div class="col-12 row q-pa-sm q-col-gutter-sm">
<q-select
class="col-10 inputgreen"
dense
outlined
v-model="roundInsig"
:options="options"
option-value="value"
option-label="label"
label="รอบการเสนอขอพระราชทานเครื่องราชฯ"
@update:model-value="updateDateRange"
:rules="[(val) => !!val || `${'กรุณาเลือกรอบที่'}`]"
/>
<datepicker
menu-class-name="modalfix"
v-model="yearly"
class="col-2 inputgreen"
:locale="'th'"
autoApply
year-picker
:enableTimePicker="false"
@update:modelValue="updateYear"
>
<template #year="{ year }">{{ year + 543 }}</template>
<template #year-overlay-value="{ value }">{{
parseInt(value + 543)
}}</template>
<template #trigger>
<q-input
dense
outlined
:model-value="yearly + 543"
:rules="[(val) => !!val || `${'กรุณาเลือกปีที่เสนอ'}`]"
:label="`${'ปีที่เสนอ'}`"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<datepicker
menu-class-name="modalfix"
v-model="dateStart"
:locale="'th'"
autoApply
class="col-xs-12 col-sm-5 inputgreen"
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
outlined
dense
class="full-width datepicker"
:model-value="
dateStart != null ? date2Thai(dateStart) : null
"
:label="`${'วันเริ่มต้น'}`"
:rules="[(val) => !!val || `${'กรุณาเลือกวันเริ่มต้น'}`]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<datepicker
menu-class-name="modalfix"
v-model="dateEnd"
class="col-xs-12 col-sm-5 inputgreen"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
<template #year-overlay-value="{ value }">
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input
outlined
dense
class="col-xs-12 col-sm-4"
:model-value="dateEnd != null ? date2Thai(dateEnd) : null"
:label="`${'วันสิ้นสุด'}`"
:rules="[
(val) => !!val || `${'กรุณาเลือกวันที่วันสิ้นสุด'}`,
]"
>
<template v-slot:prepend>
<q-icon
name="event"
class="cursor-pointer"
style="color: var(--q-primary)"
>
</q-icon>
</template>
</q-input>
</template>
</datepicker>
<q-input
class="col-xs-12 col-sm-2 inputgreen"
dense
outlined
v-model="datelast"
label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด"
mask="###"
:rules="[
(val) =>
!!val || `${'กรุณากรอกจำนวนวันแจ้งเตือนก่อนวันสิ้นสุด'}`,
]"
lazy-rules
/>
<q-file
class="col-xs-12 col-sm-10 inputgreen"
outlined
dense
v-model="files"
@added="fileUploadDoc"
label="อัปโหลดเอกสารประกอบ"
hide-bottom-space
lazy-rules
accept=".pdf,.xlsx,.doc"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</div>
</div>
</div>
<q-separator />
<q-separator />
<div class="row col-12 q-pa-sm">
<q-space />
<q-btn
unelevated
dense
class="q-px-md items-center"
color="light-blue-10"
label="บันทึก"
@click="checkSave"
/>
</div>
</q-card>
</div>
</q-form>
</div>
</template>

View file

@ -1,13 +1,14 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import DialogHeader from "@/components/DialogHeader.vue";
import type { OptionPeriod } from "@/modules/07_insignia/interface/index/Main";
/** import Store*/
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
/** use*/
const $q = useQuasar();
@ -31,6 +32,7 @@ const props = defineProps({
fetchList: { type: Function, required: true },
});
// popup
const title = computed(() => {
return actionType.value === "view"
? "รายละเอียดรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์"
@ -38,24 +40,25 @@ const title = computed(() => {
? "แก้ไขข้อมูล"
: "เพิ่มรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์";
});
//
const readonly = computed(() => {
return actionType.value === "view" ? true : false;
});
const options = ref([
const roundInsig = ref<any>(); //
const yearly = ref<number>(new Date().getFullYear()); //
const dateStart = ref<Date | null>(null); //
const dateEnd = ref<Date | null>(null); //
const datelast = ref<number | null>(null); //
const files = ref<any>(); //
const fileDocDataUpload = ref<File[]>([]); //
//
const options = ref<OptionPeriod[]>([
{ label: "รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ 1", value: 1 },
{ label: "รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ 2", value: 2 },
]);
const roundInsig = ref<any>();
const yearly = ref<number>(new Date().getFullYear());
const dateStart = ref<Date | null>(null);
const dateEnd = ref<Date | null>(null);
const datelast = ref<number | null>(null);
const files = ref<any>();
const fileDocDataUpload = ref<File[]>([]);
/**
* Function เรยกขอมลของรอบการเสนอขอ
*/
@ -63,12 +66,14 @@ function fetchData() {
showLoader();
http
.get(config.API.getRoundInsignia(roundId.value))
.then((res) => {
const data = res.data.result;
.then(async (res) => {
const data = await res.data.result;
roundInsig.value =
options.value.filter((r: any) => r.value == data.period_round).length >
0
? options.value.filter((r: any) => r.value == data.period_round)[0]
options.value.filter((r: OptionPeriod) => r.value == data.period_round)
.length > 0
? options.value.filter(
(r: OptionPeriod) => r.value == data.period_round
)[0]
: null;
yearly.value = data.period_year;
datelast.value = data.period_amount;
@ -83,7 +88,9 @@ function fetchData() {
});
}
/** Function อัพเดทวันที่เริ่มต้น และ สิ้นสุด */
/**
* Function พเดทวนทเรมต และ นส
*/
function updateDateRange() {
if (roundInsig.value.value == 1) {
dateStart.value = new Date(yearly.value, 9, 1);
@ -117,7 +124,7 @@ function fileUploadDoc(files: any) {
* Function นทกขอม
*/
function onSubmit() {
dialogConfirm($q, () => {
dialogConfirm($q, async () => {
showLoader();
const formData = new FormData();
const name = `รอบการเสนอขอพระราชทานเครื่องราชฯ รอบที่ ${
@ -156,6 +163,11 @@ function onSubmit() {
});
}
/**
* function popup รอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
*
* และกำหนดตวแปรเปนค Defult
*/
function onCloseDialog() {
modal.value = false;
roundInsig.value = "";
@ -167,6 +179,23 @@ function onCloseDialog() {
fileDocDataUpload.value = [];
}
/**
* function นคาชอคลาสตามคาทกำหนด
* @param val ากำหนดวาจะแสดงคลาสไหน
* @returns อคลาส
*/
function classInput(val: boolean) {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
}
/**
* ทำงานเม modal เป true actionType เป view
*
*
*/
watch(
() => modal.value,
() => {
@ -177,13 +206,6 @@ watch(
}
}
);
const classInput = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
</script>
<template>

View file

@ -1,13 +1,18 @@
<script setup lang="ts">
import { onMounted, ref, computed, reactive, watch } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar, QForm } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useCounterMixin } from "@/stores/mixin";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter } from "vue-router";
/** import Type*/
import type { QTableProps } from "quasar";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { CheckboxData } from "@/modules/07_insignia/interface/request/Main";
/** import components*/
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
@ -16,11 +21,9 @@ import DialogHeader from "@/components/DialogHeader.vue";
import btnDownloadFile from "@/modules/07_insignia/components/2_Manage/downloadFile.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
/** import Stores*/
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useCounterMixin } from "@/stores/mixin";
/**user stores*/
/**use*/
const myForm = ref<QForm>();
const $q = useQuasar();
const DataStore = useInsigniaDataStore();
const roleDataStore = useroleUserDataStore();
const mixin = useCounterMixin();
@ -33,31 +36,54 @@ const {
dialogMessageNotify,
} = mixin;
const myForm = ref<QForm>();
const router = useRouter();
const $q = useQuasar();
/**
* props
*/
const props = defineProps({
tab: {
type: String,
},
roundId: {
type: String,
},
fecthInsigniaAll: {
type: Function,
},
fecthInsigniaByOc: {
type: Function,
},
roundName: {
type: String,
},
requestStatus: {
type: String,
},
fecthStat: {
type: Function,
},
});
const modelPopupReject = ref<boolean>(false);
const modelPopupDelete = ref<boolean>(false);
const modalAdd = ref<boolean>(false);
const modalEdit = ref<boolean>(false);
const rowid = ref<string>("");
const organization = ref<string>("");
const modelPopupReject = ref<boolean>(false); //popup
const modelPopupDelete = ref<boolean>(false); // popup
const modalAdd = ref<boolean>(false); //popup
const modalEdit = ref<boolean>(false); //popup
const modalPersonal = ref<boolean>(false); //popup
const rowid = ref<string>(""); // id
const organization = ref<string>(""); //
/** หมายเหตุ*/
const dialogNote = ref<boolean>(false);
const dialogTitle = ref<string>("");
const dialogDesc = ref<string>("");
const typeinsigniaOptions = ref<any>(DataStore.typeinsigniaOptions);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
const modalPersonal = ref<boolean>(false);
const dialogNote = ref<boolean>(false); //
const dialogTitle = ref<string>(""); // popup
const dialogDesc = ref<string>(""); //
const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); //
const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); //
/**แจ้งเตือน*/
const dialogWarn = ref<boolean>(false);
const checkboxData = ref<any>([]);
const checkboxData = ref<CheckboxData[]>([]);
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<any>([]);
const organizationOptions = ref<OptionData[]>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<OptionData[]>([]);
/** หัวตาราง*/
const visibleColumns = ref<string[]>([
@ -224,33 +250,9 @@ const columns2 = ref<QTableProps["columns"]>([
},
]);
const rows2 = ref<any[]>([]);
const rows2 = ref<any[]>([]); //
const person = ref<any>([]);
const props = defineProps({
tab: {
type: String,
},
roundId: {
type: String,
},
fecthInsigniaAll: {
type: Function,
},
fecthInsigniaByOc: {
type: Function,
},
roundName: {
type: String,
},
requestStatus: {
type: String,
},
fecthStat: {
type: Function,
},
});
/** เช็คสถานนะแสดงปุ่มเพิ่ม*/
const checkStatus = computed(() => {
if (
@ -328,6 +330,7 @@ async function fecthlistperson(id: string = "") {
organizationOrganization: e.root,
}));
modalAdd.value = true;
rows2.value = data;
})
.catch((err) => {
@ -419,7 +422,7 @@ async function clickmodalEdit(props: any) {
* @param response response
* @param filename อไฟล
*/
function downloadFile(response: any, filename: string) {
async function downloadFile(response: any, filename: string) {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -476,27 +479,27 @@ async function clickSave() {
* @param profileId
*/
async function listEdit(profileId: string) {
showLoader();
let data: any = {
insigniaId: insignia.value,
};
await http
.put(config.API.insigniaEdit(profileId), data)
.then(() => {
.then(async () => {
await props?.fecthInsigniaByOc?.(
props.roundId,
organization.value,
"officer",
props.tab
);
success($q, "แก้ไขเครื่องราชฯ ที่ยื่นขอสำเร็จ");
modalEdit.value = false;
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
modalEdit.value = false;
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
.finally(() => {
hideLoader();
});
}
@ -528,24 +531,25 @@ async function savaReasonReject(reason: string) {
* @param reason หมายเหต
*/
async function listreject(profileId: string, reason: string) {
showLoader();
await http
.put(config.API.insigniaReject(profileId), { reason: reason })
.then(() => {
.then(async () => {
await props?.fecthInsigniaByOc?.(
props.roundId,
organization.value,
"officer",
props.tab
);
success($q, "ย้ายข้อมูลสำเร็จ");
modelPopupReject.value = false;
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
modelPopupReject.value = await false;
.finally(() => {
hideLoader();
});
}
@ -584,24 +588,24 @@ async function savaReasonDelete(reason: string) {
* @param reason หมายเหต
*/
async function listdelete(id: string, reason: string) {
showLoader();
await http
.put(config.API.insigniaDelete(id), { reason: reason })
.then(() => {
.then(async () => {
await props?.fecthInsigniaByOc?.(
props.roundId,
organization.value,
"officer",
props.tab
);
success($q, "ลบข้อมูลสำเร็จ");
closemodelPopupDelete();
})
.catch((err) => {
messageError($q, err);
})
.finally(async () => {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
}
await closemodelPopupDelete();
hideLoader();
});
}
const dataPerson = reactive({
@ -640,7 +644,7 @@ function clearForm() {
}
const insignia = ref<string>("");
const insigniaOptions = ref<any[]>([]);
const insigniaOptions = ref<OptionData[]>([]);
const insigniaType = ref<string>("");
/** function เรียกประเภทเครื่องราช*/
@ -660,8 +664,6 @@ async function fecthInsignia() {
});
}
function onclickViewinfo(id: string) {}
const personId = ref<string>("");
/**
* function redirect to ทะเบยนประว
@ -670,7 +672,6 @@ const personId = ref<string>("");
function nextPage(id: string) {
modalPersonal.value = true;
personId.value = id;
// router.push(`/registry-officer/${id}`);
}
function updatemodalPersonal(modal: boolean) {
@ -753,22 +754,22 @@ function clickShowWarn(
* @param update function
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "";
employeeClassOps.value = DataStore.employeeClassOps.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterOrganizationOP") {
filterOrganizationOP.value = organizationOptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
@ -831,7 +832,7 @@ onMounted(async () => {
:hide-dropdown-icon="false"
style="width: 400px"
@update:model-value="changtypeOc"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'filterOrganizationOP'
)"
/>
@ -900,7 +901,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'typeinsigniaOptions'
)"
>
@ -945,7 +946,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue: any,
@filter="(inputValue: string,
doneFn: Function) => filterSelector(inputValue, doneFn, 'employeeClassOps'
)"
>

View file

@ -1,24 +1,21 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
/** import Type*/
import type { QTableProps } from "quasar";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
/** import components*/
import DialogInformation from "@/components/Dialogs/Information.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
/** import Stores */
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
/** useStore*/
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore();
const router = useRouter();
const props = defineProps({
tab: {
type: String,
@ -35,10 +32,10 @@ const props = defineProps({
});
const organization = ref<string>("1");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<any>([]);
const typeinsigniaOptions = ref<any>(DataStore.typeinsigniaOptions);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
const organizationOptions = ref<OptionData[]>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<OptionData[]>([]); //
const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); //
const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); //
/** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([
@ -179,7 +176,6 @@ const personId = ref<string>("");
function nextPage(id: string) {
modalPersonal.value = true;
personId.value = id;
// router.push(`/registry-officer/${id}`);
}
function updatemodalPersonal(modal: boolean) {
@ -226,22 +222,22 @@ function closeReson() {
* @param update funtion
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "";
employeeClassOps.value = DataStore.employeeClassOps.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterOrganizationOP") {
filterOrganizationOP.value = organizationOptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
@ -302,7 +298,7 @@ onMounted(async () => {
:hide-dropdown-icon="false"
style="width: 400px"
@update:model-value="changtypeOc"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterOrganizationOP'
) "
/>
@ -370,7 +366,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeinsigniaOptions'
) "
>
@ -415,7 +411,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'employeeClassOps'
) "
>

View file

@ -1,25 +1,21 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { onMounted, ref } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
/** import Type*/
import type { QTableProps } from "quasar";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
/** import components*/
import DialogInformation from "@/components/Dialogs/Information.vue";
import PopupPersonal from "@/components/Dialogs/PopupPersonalNew.vue";
/** import Stores */
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
/** useStore*/
const DataStore = useInsigniaDataStore();
const roleDataStore = useroleUserDataStore();
const { adminRole } = roleDataStore;
const router = useRouter();
const props = defineProps({
tab: {
@ -35,11 +31,12 @@ const props = defineProps({
type: Function,
},
});
const typeinsigniaOptions = ref<any>(DataStore.typeinsigniaOptions);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
const filterOrganizationOP = ref<any>([]);
const typeinsigniaOptions = ref<OptionData[]>(DataStore.typeinsigniaOptions); //
const employeeClassOps = ref<OptionData[]>(DataStore.employeeClassOps); //
const filterOrganizationOP = ref<OptionData[]>([]); // //
const organization = ref<string>("1");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const organizationOptions = ref<OptionData[]>([{ id: "1", name: "ทั้งหมด" }]);
/** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([
@ -179,7 +176,6 @@ const personId = ref<string>("");
function nextPage(id: string) {
modalPersonal.value = true;
personId.value = id;
// router.push(`/registry-officer/${id}`);
}
function updatemodalPersonal(modal: boolean) {
@ -204,6 +200,7 @@ const pagination = ref({
const dialogNote = ref<boolean>(false);
const note = ref<string>("");
const noteTitle = ref<string>("");
/**
* function openPopup แสดง หมายเหต
* @param row รายละเอยดขอม
@ -225,22 +222,22 @@ function closeReson() {
* @param update funtion
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "employeeClassOps") {
DataStore.employeeClass = "";
employeeClassOps.value = DataStore.employeeClassOps.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterOrganizationOP") {
filterOrganizationOP.value = organizationOptions.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
@ -301,7 +298,7 @@ onMounted(async () => {
:hide-dropdown-icon="false"
style="width: 400px"
@update:model-value="changtypeOc"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterOrganizationOP'
) "
/>
@ -369,7 +366,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeinsigniaOptions'
) "
>
@ -414,7 +411,7 @@ onMounted(async () => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue: string,
doneFn:Function) => filterSelector(inputValue, doneFn,'employeeClassOps'
) "
>

View file

@ -1,22 +1,25 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Type*/
import type { QTableProps } from "quasar";
import type { ResponseNoSend } from "@/modules/07_insignia/interface/response/Main";
/** import Stores */
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
/** use*/
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const DataStore = useInsigniaDataStore();
const $q = useQuasar();
/**
* props
*/
const props = defineProps({
roundId: {
type: String,
@ -27,7 +30,7 @@ const props = defineProps({
});
/** ข้อมูลตาราง*/
const rows = ref<any[]>([]);
const rows = ref<ResponseNoSend[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -63,7 +66,7 @@ async function fecthOrg() {
.get(config.API.insigniaNosend(props.roundId))
.then((res) => {
let data = res.data.result;
rows.value = data.map((e: any) => ({
rows.value = data.map((e: ResponseNoSend) => ({
orgId: e.orgId,
orgName: e.orgName,
}));

View file

@ -1,19 +1,18 @@
<script setup lang="ts">
import { ref } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import type { Optionround } from "@/modules/07_insignia/interface/index/Main";
/**import Stores */
import { useCounterMixin } from "@/stores/mixin";
/** use Store*/
/** use*/
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const $q = useQuasar();
/** props*/
const props = defineProps({
profileId: {
@ -27,7 +26,7 @@ const props = defineProps({
},
});
const titleReport = ref<string>("");
const titleReport = ref<string>(""); //
/**
* function ดาวนโหลดไฟล
@ -63,6 +62,11 @@ async function downloadDocument(type: string) {
}
}
/**
* function โหลดเอกสาร
* @param response อม
* @param filename อไฟล
*/
function downloadFile(response: any, filename: string) {
const link = document.createElement("a");
var fileName = filename;

View file

@ -1,22 +1,25 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { QForm, useQuasar } from "quasar";
import { ref, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Type*/
import type { DataOption } from "@/modules/04_registry/components/profileType";
import type { DataStructureTree } from "@/interface/main";
/**
* import Components
*/
import DialogHeader from "../DialogHeader.vue";
import DialogHeader from "@/components/DialogHeader.vue";
/** import Stores */
import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
/** useStore*/
/** use*/
const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const {
date2Thai,
@ -28,23 +31,9 @@ const {
dateToISO,
} = mixin;
const route = useRoute();
const $q = useQuasar();
const myForm = ref<any>();
const files = ref<any>();
const filesReturn = ref<any>();
const OrganazationId = ref<string>("");
const OrganazationId2 = ref<string>("");
const OrgList = ref<DataOption[]>([]);
const OrgList2 = ref<DataOption[]>([]);
const Datereceive = ref<Date | null>();
const Datereturn = ref<Date | null>();
const remark = ref<string>("");
const nullii = ref<any>(null);
const filesCheck = ref<string>("");
const filesReturnCheck = ref<string>("");
/**
* props
*/
const props = defineProps({
modal: Boolean,
personId: String,
@ -52,16 +41,31 @@ const props = defineProps({
fecthlistInsignia: Function,
dateCheckReceive: String,
dateCheckReturn: String,
dataModal: Object,
});
/** function clearDate */
const files = ref<any>(); //
const filesReturn = ref<any>(); //
const OrganazationId = ref<string>(""); //id
const OrganazationId2 = ref<string>(""); //id
const OrgList = ref<DataOption[]>([]); //
const OrgList2 = ref<DataOption[]>([]); ////
const Datereceive = ref<Date | null>(); //
const Datereturn = ref<Date | null>(); //
const nullii = ref<any>(null);
const filesCheck = ref<string>("");
const filesReturnCheck = ref<string>("");
/**
* function clearDate
*/
function clearReturnDate() {
Datereturn.value = null;
}
/** function Colsepopup*/
/**
* function Colsepopup
*/
function close() {
props.close?.();
Datereceive.value = null;
@ -83,11 +87,9 @@ function onSubmit(type: string, id: string) {
if (props.dateCheckReceive === null) {
formData.append("Date", dateToISO((Datereceive.value as Date) ?? nullii));
formData.append("File", files.value);
// formData.append("OrgId", OrganazationId.value);
} else {
formData.append("Date", dateToISO((Datereturn.value as Date) ?? nullii));
formData.append("File", filesReturn.value);
// formData.append("OrgId", OrganazationId2.value);
}
showLoader();
http
@ -110,32 +112,26 @@ function onSubmit(type: string, id: string) {
});
}
watch(
() => props.modal,
() => {
if (props.modal == true) {
fetchOrgList();
}
}
);
/** function เรียกหน่วยงาน*/
function fetchOrgList() {
/**
* function เรยกหนวยงาน
*/
async function fetchOrgList() {
showLoader();
http
await http
.get(config.API.activeOrganization)
.then((res) => {
.then(async (res) => {
const data = res.data.result;
http
await http
.get(config.API.orgByIdSystem(data.activeId, route.meta.Key as string))
.then(async (res) => {
const data = await res.data.result.map((item: any) => ({
id: item.orgTreeId,
name: item.orgName,
}));
OrgList.value = data;
OrgList2.value = data;
const dataSystem = await res.data.result.map(
(item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
})
);
OrgList.value = dataSystem;
OrgList2.value = dataSystem;
})
.catch((err) => {
messageError($q, err);
@ -149,7 +145,21 @@ function fetchOrgList() {
});
}
/** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/
/**
* callback function จะทำงานเม modal การเปลยนแปลง
*/
watch(
() => props.modal,
() => {
if (props.modal == true) {
fetchOrgList();
}
}
);
/**
* callback function จะทำงานเม props การเปลยนแปลง
*/
watch(props, () => {
if (props.dataModal) {
Datereceive.value = props.dataModal.dateReceiveInsignia;
@ -172,7 +182,6 @@ watch(props, () => {
<q-dialog v-model="props.modal" persistent>
<q-card style="min-width: 900px">
<q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="
@ -212,7 +221,7 @@ watch(props, () => {
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่ได้รับ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่ได้รับ']"
hide-bottom-space
class="inputgreen"
:model-value="
@ -256,7 +265,7 @@ watch(props, () => {
v-model="files"
label="ไฟล์หลักฐานการรับ"
lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']"
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์หลักฐานการรับ']"
hide-bottom-space
:disable="dateCheckReceive !== null"
>
@ -279,7 +288,7 @@ watch(props, () => {
v-model="OrganazationId"
lazy-rules
:label="`หน่วยงานที่รับ`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่รับ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกหน่วยงานที่รับ']"
:disable="dateCheckReceive !== null"
class="inputgreen"
/>
@ -317,7 +326,7 @@ watch(props, () => {
borderless
outlined
class="inputgreen"
:rules="[(val) => !!val || 'กรุณาเลือกวันที่คืน']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่คืน']"
hide-bottom-space
:model-value="
Datereturn != null ? date2Thai(Datereturn) : undefined
@ -362,7 +371,7 @@ watch(props, () => {
v-model="filesReturn"
label="ไฟล์หลักฐานการคืน"
lazy-rules
:rules="[(val) => val || 'กรุณาเลือกไฟล์หลักฐานการคืน']"
:rules="[(val:string) => val || 'กรุณาเลือกไฟล์หลักฐานการคืน']"
hide-bottom-space
:disable="dateCheckReturn !== null"
>
@ -385,7 +394,7 @@ watch(props, () => {
v-model="OrganazationId2"
lazy-rules
:label="`หน่วยงานที่คืน`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']"
:rules="[(val:string) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']"
:disable="dateCheckReturn !== null"
class="inputgreen"
/>

View file

@ -1,6 +1,9 @@
<script setup lang="ts">
import { ref, watch, computed, reactive } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import http from "@/plugins/http";
import config from "@/app.config";
@ -8,13 +11,8 @@ import config from "@/app.config";
* import Type
*/
import type { DataOption } from "@/modules/04_registry/components/profileType";
import DialogHeader from "@/components/DialogHeader.vue";
/**
* import Stores
*/
import { useCounterMixin } from "@/stores/mixin";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import DialogHeader from "@/components/DialogHeader.vue";
/**
* use
@ -38,9 +36,7 @@ const {
*/
const props = defineProps({
modal: Boolean,
save: {
type: Function,
},
close: {
type: Function,
},
@ -63,29 +59,31 @@ const props = defineProps({
* วแปร
*/
const status = ref<string>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
const brand = ref<string>("");
const cardid = ref<string>("");
const fullName = ref<string>("");
const volume = ref<string>("");
const episode = ref<string>("");
const duty = ref<string>("");
const announced = ref<string>("");
const position = ref<string>("");
const payment = ref<string>("");
const addressPayment = ref<string | null>(null);
const affiliationRequest = ref<string>("");
const affiliationReceived = ref<string>("");
const receivedate = ref<Date | null>();
const announceDate = ref<Date | null>();
const invoiceDate = ref<Date | null>(null);
const filterinsigniaOp2 = ref<any[]>([]);
const employeeClass = ref<string>("");
const Advertise = ref<string>(""); //
const issue = ref<string>(""); //
const brand = ref<string>(""); //
const cardid = ref<string>(""); //
const fullName = ref<string>(""); //-
const volume = ref<string>(""); //
const episode = ref<string>(""); //
const duty = ref<string>(""); //
const announced = ref<string>(""); //
const position = ref<string>(""); //
const payment = ref<string>(""); //
const addressPayment = ref<string | null>(null); //
const affiliationRequest = ref<string>(""); //
const affiliationReceived = ref<string>(""); //
const receivedate = ref<Date | null>(); //
const announceDate = ref<Date | null>(); //
const invoiceDate = ref<Date | null>(null); //
const filterinsigniaOp2 = ref<DataOption[]>([]); //
const employeeClass = ref<string>(""); //./
// ./
const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
{ id: "employee", name: "ลูกจ้างประจำ" },
]);
//
const paymentOp = [
{ label: "จัดส่งทางไปรษณีย์", value: "จัดส่งทางไปรษณีย์" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
@ -97,45 +95,13 @@ const formFilter = reactive({
searchKeyword: "",
});
/** function reset วันที่จ่ายใบกำกับ*/
/**
* function reset นทายใบกำก
*/
function clearDateInvoiceDate() {
invoiceDate.value = null;
}
/**
* callback function จำทำงานเม props.modal = true เป popup เพมรายชอบนทกผล
*/
watch(props, () => {
if (props.modal === true) {
filterinsigniaOp2.value = DataStore.insigniaOp2;
employeeClass.value = "";
cardid.value = "";
fullName.value = "";
position.value = "";
Advertise.value = "";
brand.value = "";
receivedate.value = null;
issue.value = "";
affiliationRequest.value = "";
affiliationReceived.value = "";
announceDate.value = null;
volume.value = "";
episode.value = "";
duty.value = "";
announced.value = "";
invoiceDate.value = null;
payment.value = "";
if (props.personId !== undefined) {
if (props.action === "editData") {
fectDataByid(props.personId); //
}
}
} else {
status.value = "";
selectType();
}
});
/**
* disbleStatus
*/
@ -241,7 +207,9 @@ function fectDataByid(id: string) {
});
}
/** function บักทึกผล*/
/**
* function กทกผล
*/
function onSubmit() {
dialogConfirm($q, () => {
if (props.roundId !== undefined) {
@ -293,17 +261,51 @@ function searchcardid() {
* @param update function
* @param name selec
*/
const filterSelector = (val: any, update: Function, name: any) => {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "insigniaOp2") {
brand.value = "";
brand.value = val ? "" : brand.value;
filterinsigniaOp2.value = DataStore.insigniaOp2.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: DataOption) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
};
}
/**
* callback function จำทำงานเม props.modal = true เป popup เพมรายชอบนทกผล
*/
watch(props, () => {
if (props.modal === true) {
filterinsigniaOp2.value = DataStore.insigniaOp2;
employeeClass.value = "";
cardid.value = "";
fullName.value = "";
position.value = "";
Advertise.value = "";
brand.value = "";
receivedate.value = null;
issue.value = "";
affiliationRequest.value = "";
affiliationReceived.value = "";
announceDate.value = null;
volume.value = "";
episode.value = "";
duty.value = "";
announced.value = "";
invoiceDate.value = null;
payment.value = "";
if (props.personId !== undefined) {
if (props.action === "editData") {
fectDataByid(props.personId); //
}
}
} else {
status.value = "";
selectType();
}
});
</script>
<template>
@ -322,7 +324,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
<div class="col-4">
<q-select
:rules="[
(val) => !!val || 'กรุณาเลือก ขรก.สามัญ/ลูกจ้างประจำ',
(val:string) => !!val || 'กรุณาเลือก ขรก.สามัญ/ลูกจ้างประจำ',
]"
hide-bottom-space
:options="employeeClassOps"
@ -406,7 +408,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
<q-input
:disable="disbleStatus || status == 'DONE'"
:rules="[
(val) =>
(val:string) =>
!!val ||
'กรุณากรอกหมายเลขประกาศนีย์บัตรกำกับเครื่องราชอิสริยาภรณ์',
]"
@ -440,9 +442,9 @@ const filterSelector = (val: any, update: Function, name: any) => {
class="inputgreen"
style="min-width: 150px"
:rules="[
(val) => !!val || 'กรุณากรอกชื่อชั้นตราเครื่องราชอิสริยาภรณ์',
(val:string) => !!val || 'กรุณากรอกชื่อชั้นตราเครื่องราชอิสริยาภรณ์',
]"
@filter="(inputValue:any,doneFn:Function) =>
@filter="(inputValue:string,doneFn:Function) =>
filterSelector(inputValue, doneFn,'insigniaOp2') "
/>
</div>
@ -469,7 +471,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่']"
class="inputgreen"
hide-bottom-space
:model-value="
@ -491,7 +493,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
<div class="col-xs-12 col-sm-6">
<q-input
:disable="disbleStatus || status == 'DONE'"
:rules="[(val) => !!val || 'กรุณากรอกทะเบียนฐานันดร']"
:rules="[(val:string) => !!val || 'กรุณากรอกทะเบียนฐานันดร']"
class="inputgreen"
hide-bottom-space
dense
@ -507,7 +509,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
:disable="
disbleStatus || status == 'DONE' || status == 'PENDING'
"
:rules="[(val) => !!val || 'กรุณากรอกสังกัด']"
:rules="[(val:string) => !!val || 'กรุณากรอกสังกัด']"
class="inputgreen"
hide-bottom-space
dense
@ -523,7 +525,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
:disable="
disbleStatus || status == 'DONE' || status == 'PENDING'
"
:rules="[(val) => !!val || 'กรุณากรอกสังกัด']"
:rules="[(val:string) => !!val || 'กรุณากรอกสังกัด']"
class="inputgreen"
hide-bottom-space
dense
@ -561,7 +563,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่']"
class="inputgreen"
hide-bottom-space
:model-value="
@ -591,7 +593,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
borderless
v-model="volume"
:label="`เล่มที่`"
:rules="[(val) => !!val || 'กรุณากรอกเล่มที่']"
:rules="[(val:string) => !!val || 'กรุณากรอกเล่มที่']"
/>
</div>
<div class="col-xs-12 col-sm-4">
@ -605,7 +607,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
borderless
v-model="episode"
:label="`ตอนที่`"
:rules="[(val) => !!val || 'กรุณากรอกตอนที่']"
:rules="[(val:string) => !!val || 'กรุณากรอกตอนที่']"
/>
</div>
<div class="col-xs-12 col-sm-6">
@ -619,7 +621,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
borderless
v-model="duty"
:label="`หน้าที่`"
:rules="[(val) => !!val || 'กรุณากรอกหน้าที่']"
:rules="[(val:string) => !!val || 'กรุณากรอกหน้าที่']"
/>
</div>
<div class="col-xs-12 col-sm-6">
@ -633,7 +635,7 @@ const filterSelector = (val: any, update: Function, name: any) => {
borderless
v-model="announced"
:label="`ลำดับที่`"
:rules="[(val) => !!val || 'กรุณากรอกลำดับที่']"
:rules="[(val:string) => !!val || 'กรุณากรอกลำดับที่']"
/>
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>

View file

@ -1,30 +1,41 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Type*/
import type { QTableProps, QForm } from "quasar";
import type { TypeData } from "@/modules/07_insignia/interface/index/Main";
import type {
TypeData,
DataDocuments,
} from "@/modules/07_insignia/interface/index/Main";
/** import Stores */
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
/** use*/
const $q = useQuasar();
const mixin = useCounterMixin();
const { success, messageError, hideLoader, dialogConfirm, showLoader } = mixin;
const $q = useQuasar();
const myForm = ref<any>();
/**
* props
*/
const props = defineProps({
roundId: {
type: String,
},
});
const fileUpload = ref<any>(null);
const reason = ref<string>("");
const documentTitle = ref<string>("");
const filterKeyword = ref<string>("");
const filterDoc = ref<any>(null);
const myForm = ref<any>();
const fileUpload = ref<any>(null); //
const documentTitle = ref<string>(""); //
const reason = ref<string>(""); //
const filterKeyword = ref<string>(""); //
/** คอลัมน์ตาราง*/
const rows2 = ref<DataDocuments[]>([]);
const colums2 = ref<QTableProps["columns"]>([
{
name: "no",
@ -61,15 +72,10 @@ const visibleColumnsReference = ref<String[]>([
"annotation",
"file",
]);
const rows2 = ref<any>([]);
const props = defineProps({
roundId: {
type: String,
},
});
/** function ดึงข้อมูลรายการเอกสารอ้างอิง */
/**
* function งขอมลรายการเอกสารอางอ
*/
async function getRequest() {
showLoader();
await http
@ -93,46 +99,46 @@ async function getRequest() {
});
}
/** function เช็คฟอร์มก่อนบันทึก และยืนยันการบันทึกข้อมูล */
/**
* function เชคฟอรมกอนบนท และยนยนการบนทกขอม
*/
function save() {
myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, () => putRequest());
dialogConfirm($q, async () => {
showLoader();
const dataAppend = new FormData();
dataAppend.append("Name", documentTitle.value);
dataAppend.append("Reason", reason.value);
dataAppend.append("File", fileUpload.value);
await http
.put(config.API.requestDocNote(props.roundId as string), dataAppend)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
documentTitle.value = "";
reason.value = "";
fileUpload.value = null;
// reset validate
myForm.value.reset();
getRequest();
hideLoader();
});
});
}
});
}
/** function บันทึกเอกสาร */
async function putRequest() {
showLoader();
const dataAppend = new FormData();
dataAppend.append("Name", documentTitle.value);
dataAppend.append("Reason", reason.value);
dataAppend.append("File", fileUpload.value);
await http
.put(config.API.requestDocNote(props.roundId as string), dataAppend)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
documentTitle.value = "";
reason.value = "";
fileUpload.value = null;
// reset validate
myForm.value.reset();
getRequest();
hideLoader();
});
}
/** function resetFilter */
/**
* function resetFilter
*/
function resetFilterRef() {
filterKeyword.value = "";
filterDoc.value.focus();
}
const pagination = ref({
@ -169,7 +175,7 @@ onMounted(async () => {
hide-bottom-space
lazy-rules
accept=".pdf"
:rules="[(val) => !!val || `กรุณาเลือกไฟล์เอกสาร`]"
:rules="[(val:string) => !!val || `กรุณาเลือกไฟล์เอกสาร`]"
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
@ -185,7 +191,7 @@ onMounted(async () => {
v-model="documentTitle"
:label="`${'ชื่อเอกสาร'}`"
hide-bottom-space
:rules="[(val) => !!val || `กรุณากรอกชื่อเอกสาร`]"
:rules="[(val:string) => !!val || `กรุณากรอกชื่อเอกสาร`]"
/>
</div>
<div class="col-6 row no-wrap">
@ -217,7 +223,6 @@ onMounted(async () => {
standout
dense
v-model="filterKeyword"
ref="filterDoc"
outlined
debounce="300"
placeholder="ค้นหา"

View file

@ -1,4 +1,3 @@
div
<script setup lang="ts">
import { ref, watch } from "vue";
import { QForm, useQuasar } from "quasar";
@ -9,14 +8,13 @@ import DialogHeader from "@/components/DialogHeader.vue";
/** impotrStores */
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const mixin = useCounterMixin();
const { dialogConfirm } = mixin;
const $q = useQuasar();
const title = ref<string>("");
const amount = ref<number>();
/**
* props
*/
const props = defineProps({
modal: Boolean,
save: {
@ -36,13 +34,20 @@ const props = defineProps({
},
});
/** function closePopup*/
const title = ref<string>(""); //
const amount = ref<number>(); //
/**
* function closePopup
*/
function closeModal() {
props.close();
}
/** function ยืนยันการบันทึก*/
const onSubmit = () => {
/**
* function นยนการบนท
*/
function onSubmit() {
dialogConfirm($q, () => {
if (props.actionType === "insignia") {
props.save(
@ -55,7 +60,7 @@ const onSubmit = () => {
props.save(props.insigniadata.id, amount.value);
}
});
};
}
watch(props, () => {
if (props.modal === true) {
@ -66,6 +71,7 @@ watch(props, () => {
}
});
</script>
<template>
<q-dialog v-model="props.modal" persistent>
<q-card style="width: 800px">
@ -104,7 +110,7 @@ watch(props, () => {
lazy-rules
type="number"
label="จำนวน"
:rules="[(val) => !!val || `${'กรุณากรอกจำนวน'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกจำนวน'}`]"
/>
</div></div
></q-card-section>

View file

@ -1,27 +1,22 @@
div
<script setup lang="ts">
import { ref, watch } from "vue";
import { QForm, useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
/** impotrComponents */
import DialogHeader from "@/components/DialogHeader.vue";
/** impotrStores */
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { dialogConfirm, dialogMessageNotify } = mixin;
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin();
const { dialogConfirm } = mixin;
const myForm = ref<QForm | null>(null); //form data input
const routeName = router.currentRoute.value.name;
const amount = ref<number | null>();
const Org = ref<string | null>("");
const grandCross = ref<string | null>("");
const filterInsigniaOp = ref<any>();
/**
* props
*/
const props = defineProps({
modal: Boolean,
save: {
@ -38,7 +33,14 @@ const props = defineProps({
},
});
/** function closePopup*/
const routeName = router.currentRoute.value.name;
const amount = ref<number | null>(); //
const grandCross = ref<string | null>(""); //
const filterInsigniaOp = ref<any[]>([]); //
/**
* function closePopup
*/
function closeModal() {
props.close();
}
@ -49,14 +51,16 @@ function closeModal() {
* @param update function
* @param name Selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "filterInsigniaOp") {
grandCross.value = null;
const newList = props.insigniaList.filter(
(e: any) => e.name !== "ทั้งหมด"
);
filterInsigniaOp.value = newList.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
@ -65,22 +69,14 @@ function filterSelector(val: any, update: Function, name: any) {
}
/** function ยืนยันการบันทึก*/
const onSubmit = () => {
// if (myForm.value !== null) {
// myForm.value.validate().then(async (success) => {
// if (success) {
function onSubmit() {
dialogConfirm($q, () => props.save(grandCross.value, amount.value));
// } else {
// dialogMessageNotify($q, "");
// }
// });
// }
};
}
watch(props, () => {
if (props.modal === false) {
grandCross.value = "";
Org.value = "";
amount.value = null;
}
});
@ -122,14 +118,14 @@ watch(
map-options
outlined
options-cover
:rules="[(val) => !!val || `${'กรุณาเลือกเครื่องราชฯ'}`]"
:rules="[(val:string) => !!val || `${'กรุณาเลือกเครื่องราชฯ'}`]"
v-model="grandCross"
:label="
routeName == 'insigniaAllocate'
? `เครื่องราชฯ`
: `เลือกหน่วยงาน`
"
@filter="(inputValue:any,doneFn:Function) =>
@filter="(inputValue:string,doneFn:Function) =>
filterSelector(inputValue, doneFn,'filterInsigniaOp') "
/>
</div>
@ -143,7 +139,7 @@ watch(
lazy-rules
type="number"
label="จำนวน"
:rules="[(val) => !!val || `${'กรุณากรอกจำนวน'}`]"
:rules="[(val:string) => !!val || `${'กรุณากรอกจำนวน'}`]"
/>
</div>
</div>

View file

@ -1,551 +0,0 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
/** impotrComponents */
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import DialogHeader from "@/modules/07_insignia/components/DialogHeader.vue";
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue";
/** impotrStores */
import { useCounterMixin } from "@/stores/mixin";
const mixin = useCounterMixin();
const { dialogMessage } = mixin;
const $q = useQuasar(); // noti quasar
const attrs = ref<any>(useAttrs());
const modal = ref<boolean>(false);
const saveWriteNote = ref<any[]>([]);
const addNote = ref<boolean>(false);
const name = ref<string>("");
const clickNote = () => {
addNote.value = true;
};
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const stat = ref<any>({
total: 3,
sendInsig: 2,
remainInsig: 1,
});
/** ข้อมูล Table1*/
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"organization",
"positionType",
"positionAdmin",
"positionLine",
"positionNum",
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ - นามสกุล",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "สังกัด",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionType",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionAdmin",
align: "left",
label: "ตำแหน่งทางการบริหาร",
sortable: true,
field: "positionAdmin",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionLine",
align: "left",
label: "ตำแหน่งในสายงาน/ระดับ",
sortable: true,
field: "positionLine",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionNum",
align: "left",
label: "ตำแหน่ง เลขที่",
sortable: true,
field: "positionNum",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const rows = ref<any[]>([]);
/** ข้อมูล Table2*/
const visibleColumns2 = ref<string[]>([
"no",
"name",
"position",
"level",
"institution",
]);
const columns2 = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: true,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "position",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "position",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "level",
align: "left",
label: "ระดับ",
sortable: true,
field: "level",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "institution",
align: "left",
label: "สังกัด",
sortable: true,
field: "institution",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const rows2 = ref<any[]>([]);
// const clickDelete = (id: string) => {
// $q.dialog({
// title: "",
// message: "?",
// cancel: {
// flat: true,
// color: "negative",
// },
// persistent: true,
// })
// .onOk(async () => {})
// .onCancel(() => {})
// .onDismiss(() => {});
// };
/** function closePopup*/
function clickClose() {
modal.value = false;
}
/** function openPopupAdd*/
function clickAdd() {
modal.value = true;
}
/** function บันทึกข้อมูล note*/
async function saveNote() {
if (saveWriteNote.value.length == 0) {
dialogMessage(
$q,
"ไม่สามารถบันทึกข้อมูลได้",
"กรุณาเพิ่มหมายเหตุ",
"warning",
undefined,
"orange",
undefined,
undefined,
true
);
return;
}
}
/** ค้นหาในตาราง*/
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
const filterKeyword2 = ref<string>("");
const filterRef2 = ref<any>(null);
const resetFilter2 = () => {
filterKeyword2.value = "";
filterRef2.value.focus();
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายชอทดสรรเครองราชอสรยาภรณ {{ name }}
</div>
<q-card bordered class="q-py-sm row col-12">
<div class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-md fit">
<cardTop
:amount="stat.total"
label="จำนวนเครื่องราช ฯ ทั้งหมด"
color="#016987"
/>
<cardTop
:amount="stat.sendInsig"
label="จำนวนเครื่องราช ฯ ที่จัดสรรให้หน่วยงานแล้ว"
color="#02A998"
/>
<cardTop
:amount="stat.remainInsig"
label="จำนวนเครื่องราช ฯ คงเหลือ"
color="#2EA0FF"
/>
</div>
</div>
</div>
</q-card>
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
<div class="row q-col-gutter-sm">
<div class="row col-12 q-col-gutter-sm">
<div>
<q-btn
@click="clickAdd()"
size="12px"
flat
round
color="add"
icon="mdi-plus"
>
<q-tooltip>เพมรายการจดสรรเครองราชอสรยาภรณ</q-tooltip>
</q-btn>
</div>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword == ''" name="search" />
<q-icon
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<q-select
v-model="visibleColumns"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
option-value="name"
options-cover
style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2"
/>
</div>
<div class="col-12">
<d-table
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="citizenId" :props="props">
{{ props.row.citizenId }}
</q-td>
<q-td key="name" :props="props">
{{ props.row.name }}
</q-td>
<q-td key="organization" :props="props">
{{ props.row.organization }}
</q-td>
<q-td key="positionType" :props="props">
{{ props.row.positionType }}
</q-td>
<q-td key="positionAdmin" :props="props">
{{ props.row.positionAdmin }}
</q-td>
<q-td key="positionLine" :props="props">
{{ props.row.positionLine }}
</q-td>
<q-td key="positionNum" :props="props">
{{ props.row.positionNum }}
</q-td>
<q-td key="status" :props="props">
{{ props.row.status }}
</q-td>
<q-td auto-width>
<q-btn
dense
size="12px"
flat
round
color="blue"
icon="mdi-alert-circle-outline"
>
<q-tooltip>หมายเหต</q-tooltip>
</q-btn>
</q-td>
<q-td>
<q-btn label="คืนแล้ว" @click="clickNote()" color="blue" />
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</q-card>
<q-dialog v-model="modal" persistent>
<q-card style="width: 900px; max-width: 80vw">
<q-form ref="myForm">
<DialogHeader tittle="เพิ่มรายชื่อ " :close="clickClose" />
<q-separator />
<q-card-section class="q-pa-md q-col-gutter-sm">
<q-input
class="col-12"
standout
dense
v-model="filterKeyword2"
ref="filterRef2"
outlined
debounce="300"
placeholder="ค้นหา"
>
<template v-slot:append>
<q-icon v-if="filterKeyword2 == ''" name="search" />
<q-icon
v-if="filterKeyword2 !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter2"
/>
</template>
</q-input>
<div class="col-12">
<d-table
ref="table2"
:columns="columns2"
:rows="rows2"
:filter="filterKeyword2"
row-key="Order"
flat
bordered
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns2"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
>
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else>
{{ col.value }}
</div>
</q-td>
<q-td auto-width>
<q-btn
dense
class="q-px-md"
outline
color="primary"
v-close-popup
label="เพิ่ม"
>
</q-btn>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</q-card-section>
</q-form>
</q-card>
</q-dialog>
<DialogPopupReason
v-model:modal="addNote"
title="คืนเครื่องราชฯ"
label="กรอกเหตุผลที่ต้องการคืนเครื่องราชฯ"
:savaForm="saveNote"
/>
</template>
<style lang="scss" scope>
.filter-card {
background-color: #f1f1f1b0;
}
.toggle-expired-account {
font-size: 12px;
font-weight: 400;
font-size: 15px;
line-height: 150%;
color: #35373c;
}
.icon-color {
color: #4154b3;
}
.custom-header-table {
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style>

View file

@ -1,14 +1,19 @@
<script setup lang="ts">
import { onMounted, ref, useAttrs } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import router from "@/router";
import { useRoute, useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useAllocateDataStore } from "@/modules/07_insignia/storeAllocate";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
/** impotrType */
import type { QTableProps } from "quasar";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { ResponseAllocate } from "@/modules/07_insignia/interface/response/Main";
import type { DataStructureTree } from "@/interface/main";
/** impotrComponents */
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue";
@ -16,8 +21,7 @@ import DialogForm from "@/modules/07_insignia/components/4_Allocate/DialogForm.v
import DialogEdit from "@/modules/07_insignia/components/4_Allocate/DialogEdit.vue";
/** impotrStores */
import { useCounterMixin } from "@/stores/mixin";
import { useAllocateDataStore } from "@/modules/07_insignia/storeAllocate";
const router = useRouter();
const DataStore = useAllocateDataStore();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, success, dialogRemove } = mixin;
@ -27,13 +31,7 @@ const $q = useQuasar(); //ใช้ noti quasar
const route = useRoute();
/** ข้อมูล Table*/
const visibleColumns = ref<string[]>([
"no",
"organization",
"total",
"allocate",
"remain",
]); //
const rows = ref<ResponseAllocate[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -81,27 +79,35 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const rows = ref<any[]>([]);
const visibleColumns = ref<string[]>([
"no",
"organization",
"total",
"allocate",
"remain",
]);
const name = ref<string>("");
const id = ref<string>(route.params.id.toString());
const modal = ref<boolean>(false);
const orgList = ref<any>([]);
const orgList = ref<OptionData[]>([]); //
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const stat = ref<any>({
total: 0,
allocate: 0,
remain: 0,
const stat = ref({
total: 0, //
allocate: 0, //
remain: 0, //
});
/** funcion เรียกข้อมูล stat*/
/**
* funcion เรยกขอม stat
*/
async function fecthDashboard() {
// showLoader();
await http
.get(config.API.insigniaManageOrgDashboard(id.value))
.then((res) => {
@ -114,16 +120,17 @@ async function fecthDashboard() {
.catch((err) => {
messageError($q, err);
});
// .finally(() => hideLoader());
}
/** funcion เรียกข้อมูลรายชื่อ หน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ ตริตาภรณ์มงกุฎไทย ()*/
/**
* funcion เรยกขอมลรายช หนวยงานจดสรรเครองราชอสรยาภรณ ตรตาภรณมงกฎไทย ()
*/
async function fecthListData() {
showLoader();
await http
.get(config.API.insigniaManageOrg(id.value))
.then((res) => {
rows.value = res.data.result.map((e: any) => ({
rows.value = res.data.result.map((e: ResponseAllocate) => ({
id: e.id,
organization: e.organizationOrganization,
total: e.total,
@ -139,7 +146,9 @@ async function fecthListData() {
});
}
/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
/**
* funcion เรยกขอมลหนวยงานจดสรรเครองราชอสรยาภรณ
*/
async function fetchOrgList() {
http
.get(config.API.activeOrganization)
@ -149,7 +158,7 @@ async function fetchOrgList() {
http
.get(config.API.orgByIdSystem(data.activeId, route.meta.Key as string))
.then(async (res) => {
const data = await res.data.result.map((item: any) => ({
const data = await res.data.result.map((item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
}));
@ -164,12 +173,16 @@ async function fetchOrgList() {
});
}
/** funcion ย้อนกลับหน้าจัดสรรเครื่องราชอิสริยาภรณ์*/
/**
* funcion อนกลบหนาจดสรรเครองราชอสรยาภรณ
*/
function backHistory() {
router.push(`/insignia/allocate`);
}
/** funcion closePopup */
/**
* funcion closePopup
*/
function close() {
modal.value = false;
modalEdit.value = false;
@ -225,13 +238,13 @@ async function saveEdit(organizationId: string, amount: number) {
});
}
const rowData = ref<any>([]);
const modalEdit = ref<boolean>(false);
const rowData = ref<ResponseAllocate>(); //
const modalEdit = ref<boolean>(false); // popup
/**
* function openPopup แกไข
* @param data อมลทจะแกไข
*/
function clickEditrow(data: any) {
function clickEditrow(data: ResponseAllocate) {
rowData.value = data;
modalEdit.value = true;
}
@ -259,9 +272,9 @@ async function clickDelete(insigniaId: string) {
});
}
const clickAdd = () => {
function clickAdd() {
modal.value = true;
};
}
/** ค้นหาในตาราง*/
const filterKeyword = ref<string>("");

View file

@ -1,6 +1,9 @@
<script setup lang="ts">
import { ref, watch, onMounted } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
import http from "@/plugins/http";
import config from "@/app.config";
@ -10,15 +13,7 @@ import type { DataOption } from "@/modules/04_registry/components/profileType";
/** impotrComponents */
import DialogHeader from "@/components/DialogHeader.vue";
/** impotrStores */
import { useCounterMixin } from "@/stores/mixin";
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
import { useRoute } from "vue-router";
const $q = useQuasar();
const myForm = ref<QForm>();
const route = useRoute();
const DataStore = useBrrowDataStore();
const mixin = useCounterMixin();
const {
@ -31,22 +26,9 @@ const {
notifyError,
} = mixin;
const brand = ref<string>("");
const roundNo = ref<string | undefined>("");
const cardid = ref<string>("");
const OrganazationId = ref<string>("");
const fullName = ref<string>("");
const receivedate = ref<Date | null>();
const returndate = ref<Date | null>();
const reason = ref<string>("");
const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const filterOrgList = ref<DataOption[]>([]);
const insigniaNoteProfileId = ref<string>("");
const filterSelectRound = ref<any>();
const selectRound = ref<any>();
const type = ref<any>(DataStore.type);
/**
* props
*/
const props = defineProps({
modal: Boolean,
save: {
@ -85,7 +67,25 @@ const props = defineProps({
},
});
/** function เคลียร์ข้อมูลในฟอร์ม*/
const brand = ref<string>(""); //
const roundNo = ref<string | undefined>(""); //
const cardid = ref<string>(""); //
const OrganazationId = ref<string>(""); //
const receivedate = ref<Date | null>(); //
const returndate = ref<Date | null>(); //
const fullName = ref<string>(""); //-
const reason = ref<string>("");
const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const filterOrgList = ref<DataOption[]>([]);
const insigniaNoteProfileId = ref<string>("");
const filterSelectRound = ref<any>();
const selectRound = ref<any>();
const type = ref<any>(DataStore.type);
/**
* function เคลยรอมลในฟอร
*/
function clearData() {
receivedate.value = null;
returndate.value = null;
@ -97,7 +97,9 @@ function clearData() {
reason.value = "";
}
/** function เรียกข้อมูลรายการเครื่องราช */
/**
* function เรยกขอมลรายการเครองราช
*/
async function fecthlistInsignia() {
if (roundNo.value !== "" && roundNo.value !== null) {
showLoader();
@ -125,48 +127,9 @@ async function fecthlistInsignia() {
}
}
/** funcion เรียกข้อมูลหน่วยงานจัดสรรเครื่องราชอิสริยาภรณ์ */
async function fetchOrgList() {
http
.get(config.API.activeOrganization)
.then((res) => {
const data = res.data.result;
http
.get(config.API.orgByIdSystem(data.activeId, route.meta.Key as string))
.then(async (res) => {
const data = await res.data.result.map((item: any) => ({
id: item.orgTreeId,
name: item.orgName,
}));
OrgList.value = data;
filterOrgList.value = data;
})
.catch((err) => {
messageError($q, err);
});
})
.catch((err) => {
messageError($q, err);
});
}
// -
// const fetchData = async () => {
// showLoader();
// await http
// .get(config.API.insigniaManageBorrowById(props.profileId))
// .catch((err) => {
// messageError($q, err);
// })
// .finally(() => {
// hideLoader();
// });
// };
// -
/** function บันทึกการเพิ่มข้อมูล*/
/**
* function นทกการเพมขอม
*/
async function onSubmit() {
dialogConfirm($q, async () => {
showLoader();
@ -205,7 +168,9 @@ async function onSubmit() {
});
}
/** function ค้นหาคนจากเลขประจำตัวประชาชน*/
/**
* function นหาคนจากเลขประจำตวประชาชน
*/
async function searchcardid() {
if (cardid.value.length === 13) {
showLoader();
@ -236,13 +201,17 @@ async function searchcardid() {
}
}
/** function closePopup*/
/**
* function closePopup
*/
function closeDialog() {
clearData();
props.close();
}
/** function reset วันที่คืน*/
/**
* function reset นท
*/
function clearReturnDate() {
returndate.value = null;
}
@ -253,17 +222,17 @@ function clearReturnDate() {
* @param update function
* @param name Selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "filterOrgList") {
OrganazationId.value = "";
OrganazationId.value = val ? "" : OrganazationId.value;
filterOrgList.value = OrgList.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
if (name === "filterSelectRoundOption") {
roundNo.value = "";
roundNo.value = val ? "" : roundNo.value;
filterSelectRound.value = selectRound.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
@ -271,29 +240,32 @@ function filterSelector(val: any, update: Function, name: any) {
});
}
/** function setValue*/
const setValue = () => {
/**
* function setValue
*/
function setValue() {
filterSelectRound.value = props.filterSelectRoundOption;
selectRound.value = props.selectRoundOption;
};
}
/** Hook*/
onMounted(() => {
setValue();
});
/** function callback เช็ค props ถ้าเปิด dialog ให้ดึงรายการข้อมูล */
/**
* function callback เช props าเป dialog ใหงรายการขอม
*/
watch(props, () => {
if (props.modal == true && props.roundId != "all") {
roundNo.value = props.roundId;
if (props.action === "editData") {
// fetchOrgList();
} else {
fecthlistInsignia();
setValue();
}
}
});
/** Hook*/
onMounted(() => {
setValue();
});
</script>
<template>
@ -333,9 +305,9 @@ watch(props, () => {
:readonly="false"
:borderless="false"
style="min-width: 150px"
:rules="[(val) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ']"
@update:model-value="fecthlistInsignia()"
@filter="(inputValue:any,
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterSelectRoundOption'
) "
/>
@ -376,7 +348,7 @@ watch(props, () => {
v-model="fullName"
:label="`${'ชื่อ-นามสกุล'}`"
:rules="[
(val) =>
(val:string) =>
!!val ||
'ชื่อ-นามสกุลต้องไม่ว่าง กรุณากรอกเลขประจำตัวประชาชนให้ถูกต้อง',
]"
@ -388,7 +360,7 @@ watch(props, () => {
</div>
<div class="col-xs-12 col-sm-6">
<q-input
:rules="[(val) => !!val || 'กรุณาเลือกเครื่องราชฯ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกเครื่องราชฯ']"
v-model="brand"
disable
dense
@ -420,7 +392,7 @@ watch(props, () => {
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่']"
hide-bottom-space
:model-value="
receivedate != null ? date2Thai(receivedate) : undefined
@ -468,7 +440,7 @@ watch(props, () => {
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่คืน']"
:rules="[(val:string) => !!val || 'กรุณาเลือกวันที่คืน']"
hide-bottom-space
:model-value="
returndate != null ? date2Thai(returndate) : undefined
@ -491,28 +463,6 @@ watch(props, () => {
</datepicker>
</div>
<!-- <div class="col-xs-12 col-sm-6">
<q-select
hide-bottom-space
:options="filterOrgList"
dense
lazy-rules
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
use-input
v-model="OrganazationId"
:label="`เลือกหน่วยงานที่ส่งคืน`"
:rules="[(val) => !!val || 'กรุณาเลือกหน่วยงานที่คืน']"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterOrgList'
) "
/>
</div> -->
<div class="col-12">
<q-input
class="inputgreen"

View file

@ -1,27 +0,0 @@
<template>
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold">{{
tittle
}}</q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="close"
style="color: #ff8080; background-color: #ffdede"
/>
</q-toolbar>
</template>
<script setup lang="ts">
const props = defineProps({
tittle: String,
close: {
type: Function,
default: () => console.log("not function"),
},
});
const close = async () => {
props.close();
};
</script>

View file

@ -5,6 +5,9 @@ import { useCounterMixin } from "@/stores/mixin";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { ResponsePeriod } from "@/modules/07_insignia/interface/response/Main";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import http from "@/plugins/http";
@ -31,37 +34,45 @@ interface OptionReport {
title: string;
}
onMounted(async () => {
await fecthlistRound();
let report = optionReport.find((e: OptionReport) => e.id == typeReport);
report && (titleReport.value = report.title);
});
const splitterModel = ref(14);
const selectList = ref<any>();
const optionsList = ref<any>([{ id: 0, name: "เลือกกรอบการยื่นขอ" }]);
const filterOtion = ref<any>([]);
const optionsList = ref<OptionData[]>([{ id: 0, name: "เลือกกรอบการยื่นขอ" }]);
const filterOtion = ref<OptionData[]>([]);
const nextPage = () => {
/**
* งกนไปหนาถดไป
*/
function nextPage() {
if (page.value < numOfPages.value) {
page.value++;
}
};
const backPage = () => {
}
/**
* งกนยอนกล
*/
function backPage() {
if (page.value !== 1) {
page.value--;
}
};
}
const backHistory = () => {
/**
* งก Redirect ไปหน รายงานเครองราชอสรยาภรณ
*/
function backHistory() {
window.history.back();
};
}
const fecthlistRound = async () => {
/**
* งกนคงขอมลรอบการเสนอขอ
*/
async function fecthlistRound() {
showLoader();
await http
.get(config.API.listRoundInsignia())
.then((res: any) => {
optionsList.value = res.data.result.map((e: any) => ({
optionsList.value = res.data.result.map((e: ResponsePeriod) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
@ -70,14 +81,24 @@ const fecthlistRound = async () => {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
};
}
const updateSelect = () => {
/**
* งกนเลอกรอบการเสนอขอ
*/
function updateSelect() {
conditionDocument("show");
};
}
const conditionDocument = (type: string) => {
/**
* งกนโหลไฟลรายงาน
* @param type นามสกลไฟลองการ
*/
function conditionDocument(type: string) {
myForm.value?.validate().then(async (success: boolean) => {
if (success) {
if (type == "show") {
@ -87,18 +108,26 @@ const conditionDocument = (type: string) => {
}
}
});
};
}
const showDocument = (url: any) => {
/**
* งกแสดงรายงาน
* @param url
*/
function showDocument(url: any) {
const pdfData = usePDF(url);
setTimeout(() => {
pdfSrc.value = pdfData.pdf.value;
numOfPages.value = pdfData.pages.value;
}, 1000);
};
}
const downloadFile = (response: any, filename: string) => {
/**
* งกนโหลดไฟล
* @param response อมลทองการ
* @param filename อไฟล
*/
function downloadFile(response: any, filename: string) {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -106,12 +135,14 @@ const downloadFile = (response: any, filename: string) => {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
}
const downloadReport = async (
type: string = "pdf",
download: boolean = true
) => {
/**
* งกนโหลดไฟล
* @param type ประเภทไฟล
* @param download
*/
async function downloadReport(type: string = "pdf", download: boolean = true) {
showLoader();
await http
.get(config.API.reportInsignia(typeReport, type, selectList.value.id), {
@ -134,17 +165,30 @@ const downloadReport = async (
.finally(() => {
hideLoader();
});
};
const filterSelector = (val: any, update: Function, name: any) => {
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update function
* @param name Selec
*/
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "selectList") {
filterOtion.value = optionsList.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
};
}
onMounted(async () => {
await fecthlistRound();
let report = optionReport.find((e: OptionReport) => e.id == typeReport);
report && (titleReport.value = report.title);
});
</script>
<template>
@ -181,9 +225,9 @@ const filterSelector = (val: any, update: Function, name: any) => {
label="เลือกรอบ"
option-value="id"
option-label="name"
:rules="[(val) => !!val || 'กรุณาเลือกรอบ']"
:rules="[(val:string) => !!val || 'กรุณาเลือกรอบ']"
@update:model-value="updateSelect"
@filter="(inputValue:any,doneFn:Function) =>
@filter="(inputValue:string,doneFn:Function) =>
filterSelector(inputValue, doneFn,'selectList') "
>
<template v-slot:no-option>

View file

@ -1,423 +0,0 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { VuePDF, usePDF } from "@tato30/vue-pdf";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QForm } from "quasar";
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const $q = useQuasar();
const myForm = ref<QForm>();
const pdfSrc = ref<any>();
const numOfPages = ref<number>(0);
const page = ref<number>(1);
const dialog = ref<boolean>(false);
onMounted(async () => {
await fecthlistRound();
});
const splitterModel = ref(14);
const fileId = ref<string>("");
const selectReport = ref<any>({ id: 39, name: "รายงานขร.1" });
const optionsReport = ref<any>([
{ id: 39, name: "รายงานขร.1" },
{ id: 40, name: "รายงานขร.2" },
{ id: 41, name: "รายงานขร.3" },
{ id: 42, name: "รายงานขร.4" },
]);
const selectList = ref<any>();
const optionsList = ref<any>([{ id: 0, name: "เลือกกรอบการยื่นขอ" }]);
const nextPage = () => {
if (page.value < numOfPages.value) {
page.value++;
}
};
const backPage = () => {
if (page.value !== 1) {
page.value--;
}
};
const backHistory = () => {
window.history.back();
};
const fecthlistRound = async () => {
await http
.get(config.API.listRoundInsignia())
.then((res: any) => {
optionsList.value = res.data.result.map((e: any) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
}));
})
.catch((err) => {
messageError($q, err);
});
};
const updateSelect = () => {
conditionDocument("show");
};
const conditionDocument = (type: string) => {
myForm.value?.validate().then(async (success: boolean) => {
if (success) {
if (type == "show") {
await downloadReport("pdf", false);
} else {
await downloadReport(type, true);
}
}
});
};
const showDocument = (url: any) => {
const pdfData = usePDF(url);
setTimeout(() => {
pdfSrc.value = pdfData.pdf.value;
numOfPages.value = pdfData.pages.value;
}, 1000);
};
const downloadFile = (response: any, filename: string) => {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
const downloadReport = async (
type: string = "pdf",
download: boolean = true
) => {
showLoader();
await http
.get(
config.API.reportInsignia(
selectReport.value.id.toString(),
type,
selectList.value.id
),
{
responseType: "blob",
}
)
.then(async (res) => {
if (download) {
downloadFile(
res,
`${selectReport.value.name} ${selectList.value.name}.${type}`
);
} else {
const url = URL.createObjectURL(new Blob([res.data]));
showDocument(url);
}
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
})
.finally(() => {
hideLoader();
});
};
</script>
<template>
<div class="toptitle">
<q-btn
icon="mdi-arrow-left"
unelevated
round
dense
flat
color="primary"
class="q-mr-sm"
@click="backHistory"
/>
รายงาน ขร.1 - ขร.4
</div>
<div>
<q-card flat bordered class="col-12 q-mt-sm">
<div class="q-pa-md q-gutter-y-sm">
<q-toolbar style="padding: 0">
<q-form ref="myForm" class="row items-center">
<q-select
use-input
fill-input
hide-selected
class="q-mr-sm"
dense
outlined
v-model="selectReport"
:options="optionsReport"
:label="optionsReport.name"
option-value="id"
option-label="name"
style="width: 150px"
@update:model-value="updateSelect"
/>
<q-select
class="q-pa-none"
use-input
fill-input
hide-selected
dense
outlined
v-model="selectList"
:options="optionsList"
label="เลือกรอบ"
option-value="id"
option-label="name"
:rules="[(val) => !!val || 'กรุณาเลือกรอบ']"
@update:model-value="updateSelect"
/>
</q-form>
<!-- style="width: 200px" -->
<q-space />
<div class="q-pa-ms q-gutter-sm" style="padding: 0">
<q-btn outline color="primary" icon="download" label="ดาวน์โหลด">
<q-menu>
<q-list style="min-width: 150px">
<q-item
clickable
v-close-popup
@click="conditionDocument('pdf')"
>
<q-item-section avatar
><q-icon color="red" name="mdi-file-pdf"
/></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="conditionDocument('docx')"
>
<q-item-section avatar
><q-icon color="blue" name="mdi-file-word"
/></q-item-section>
<q-item-section>ไฟล .docx</q-item-section>
</q-item>
<q-item
clickable
v-close-popup
@click="conditionDocument('xlsx')"
>
<q-item-section avatar
><q-icon color="green" name="mdi-file-excel"
/></q-item-section>
<q-item-section>ไฟล .xlsx</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn
unelevated
icon="mdi-refresh"
color="primary"
@click="conditionDocument('show')"
/>
<q-btn
unelevated
color="blue"
icon="mdi-fullscreen"
@click="dialog = true"
/>
</div>
</q-toolbar>
<q-splitter
v-model="splitterModel"
horizontal
style="
height: 70vh;
border: 1px solid rgb(210, 210, 210);
border-radius: 5px;
"
before-class="overflow-hidden disable"
separator-class="bg-white disabled"
>
<template v-slot:before>
<div class="q-px-sm">
<div class="row items-start items-center">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
</div>
</template>
<template v-slot:after>
<div class="q-pa-md">
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
</div>
</template>
<template v-slot:default>
<div class="q-pa-md">
<div class="row items-start items-center">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
</div>
</template>
</q-splitter>
</div>
</q-card>
</div>
<!-- Dialog Full Screen -->
<q-dialog
v-model="dialog"
persistent
:maximized="true"
transition-show="slide-up"
transition-hide="slide-down"
>
<q-card class="bg-white">
<div class="flex justify-end items-center align-center q-mr-md q-mt-sm">
<q-btn
icon="close"
unelevated
round
dense
style="color: #ff8080; background-color: #ffdede"
size="12px"
v-close-popup
/>
</div>
<div class="q-pa-md">
<div class="row items-start items-center">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
<div class="row items- items-center">
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
</div>
<div class="row items- items-end">
<div class="col">
<q-btn
padding="xs"
icon="mdi-chevron-left"
color="grey-2"
text-color="grey-5"
size="md"
class="my-auto"
@click="backPage"
:disable="page == 1"
/>
</div>
<div class="col-12 col-md-auto">
<div class="q-pa-md flex">
หนาท {{ page }} จาก {{ numOfPages }}
</div>
</div>
<div class="col text-right">
<q-btn
padding="xs"
icon="mdi-chevron-right"
color="grey-2"
text-color="grey-5"
size="md"
@click="nextPage"
:disable="page === numOfPages"
/>
</div>
</div>
</div>
</q-card>
</q-dialog>
</template>
<style lang="scss" scope>
.disabled {
pointer-events: none;
}
</style>

View file

@ -1,5 +1,5 @@
interface OptionData {
id: string;
id: string | number;
name: string;
}
@ -33,6 +33,68 @@ interface InsigniaType {
label: string;
name: string;
}
interface OptionPeriod {
label: string;
value: number;
}
interface OptionRound {
id: string;
year: number;
name: string;
}
interface DataStat {
allUserUser: number;
orgAllCount: number;
orgNoSendCount: number;
orgSendCount: number;
}
interface DataPerson {
address: string;
citizenId: string;
date: string;
dateReceive: string;
dateReceiveInsignia: string;
dateReturnInsignia: string;
datepay: string;
docReceiveInsignia: string;
docReturnInsignia: string;
employeeType: string;
id: string;
name: string;
number: string;
orgReceiveInsignia: string;
orgReturnInsignia: string;
page: string;
position: string;
prefix: string;
profileType: string;
section: string;
status: string;
type: string;
typepay: string;
vatnumber: string;
volumeNo: string;
}
interface DataDocuments {
annotation: string;
file: string;
fileName: string;
}
interface DataAllocate {
allocate: number;
id: string;
insignia: string;
insigniaId: string;
remain: number;
total: number;
year: number;
}
export type {
OptionData,
OptionDataYear,
@ -41,4 +103,10 @@ export type {
TypeData,
OptionDataInsignia,
InsigniaType,
OptionPeriod,
OptionRound,
DataStat,
DataPerson,
DataDocuments,
DataAllocate,
};

View file

@ -25,4 +25,16 @@ interface ItemType {
interface ColId {
period_id: string;
}
export type { FormProprsalsRound, FormProprsalsRound2, ItemType, ColId };
interface CheckboxData {
id: number;
name: string;
val: boolean;
}
export type {
FormProprsalsRound,
FormProprsalsRound2,
ItemType,
ColId,
CheckboxData,
};

View file

@ -10,4 +10,38 @@ interface ResponseObject {
note: string;
}
export type { ResponseObject };
interface ResponsePeriod {
period_amount: number;
period_doc: string;
period_end: string;
period_id: string;
period_isActive: boolean;
period_name: string;
period_round: number;
period_start: string;
period_status: string;
period_year: number;
}
interface ResponseNoSend {
orgId: string;
orgName: string;
}
interface ResponseRound {
id: string;
name: string;
year: number;
}
interface ResponseAllocate {
allocate: number;
createdAt: string;
id: string;
lastUpdatedAt: string;
organizationOrganization: string;
remain: number;
total: number;
}
export type { ResponseObject, ResponsePeriod, ResponseNoSend, ResponseRound ,ResponseAllocate};

View file

@ -1,29 +1,32 @@
/**
* Router (insignia)
*/
const ReportView = () =>
import("../07_insignia/components/report/ReportView.vue");
const report_01 = () =>
import("../07_insignia/components/report/Report_01.vue");
const report_02 = () =>
import("../07_insignia/components/report/Report_02.vue");
const RecordInsignia = () =>
import("@/modules/07_insignia/views/ResultPage.vue");
//รายการรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์
const insigniaProposals = () =>
import("@/modules/07_insignia/components/1_Proposals/listProposals.vue");
const roundAdd = () =>
import("@/modules/07_insignia/components/1_Proposals/addProposals.vue");
const listMange = () =>
import("@/modules/07_insignia/components/2_Manage/listManage.vue");
import("@/modules/07_insignia/views/01_RoundMain.vue");
//รายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
const listMange = () => import("@/modules/07_insignia/views/02_ManageMain.vue");
// บันทึกผลการได้รับพระราชทานเครื่องราชอิสริยาภรณ์/การจ่ายใบกำกับ
const RecordInsignia = () =>
import("@/modules/07_insignia/views/03_ResultMain.vue");
// จัดสรรเครื่องราชอิสริยาภรณ์
const listAllocate = () =>
import("@/modules/07_insignia/components/4_Allocate/Main.vue");
import("@/modules/07_insignia/views/04_AllocateMain.vue");
const allocateOrdList = () =>
import("@/modules/07_insignia/components/4_Allocate/OrgList.vue");
import("@/modules/07_insignia/components/4_Allocate/OrgAllocatePageList.vue");
// ยืม - คืนเครื่องราช
const insigniaBorrow = () =>
import("@/modules/07_insignia/components/5_Borrow/Main.vue");
import("@/modules/07_insignia/views/05_BorrowMain.vue");
const ReportView = () => import("./views/06_ReportMain.vue");
const report_02 = () =>
import("./components/report/ReportDetail.vue");
export default [
{
path: "/insignia/round",
@ -35,26 +38,16 @@ export default [
Role: "STAFF",
},
},
// {
// path: "/insignia/round/:id",
// name: "roundAddEdit",
// component: roundAdd,
// meta: {
// Auth: true,
// Key: "SYS_INSIGNIA_ROUND",
// Role: "STAFF",
// },
// },
// {
// path: "/insignia/round/add",
// name: "roundAdd",
// component: roundAdd,
// meta: {
// Auth: true,
// Key: "SYS_INSIGNIA_ROUND",
// Role: "STAFF",
// },
// },
{
path: "/insignia/manage/list-manage",
name: "insigniaManage",
component: listMange,
meta: {
Auth: true,
Key: "SYS_INSIGNIA_MANAGE",
Role: "STAFF",
},
},
{
path: "/insignia/record",
@ -77,17 +70,7 @@ export default [
},
},
{
path: "/insignia/report/report-01",
name: "report-report-01",
component: report_01,
meta: {
Auth: true,
Key: "SYS_INSIGNIA_REPORT",
Role: "STAFF",
},
},
{
path: "/insignia/report/report/:type",
path: "/insignia/report/:type",
name: "report-report",
component: report_02,
meta: {
@ -96,16 +79,7 @@ export default [
Role: "STAFF",
},
},
{
path: "/insignia/manage/list-manage",
name: "insigniaManage",
component: listMange,
meta: {
Auth: true,
Key: "SYS_INSIGNIA_MANAGE",
Role: "STAFF",
},
},
{
path: "/insignia/allocate",
name: "insigniaAllocate",

View file

@ -1,25 +1,23 @@
<script setup lang="ts">
import { ref, useAttrs, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import router from "@/router";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import config from "@/app.config";
import http from "@/plugins/http";
/** import Type*/
import type { QTableProps } from "quasar";
import type {
FormProprsalsRound2,
ColId,
} from "@/modules/07_insignia/interface/request/Main";
import type { FormProprsalsRound2 } from "@/modules/07_insignia/interface/request/Main";
import DialogDetail from "@/modules/07_insignia/components/1_Proposals/DialogDetail.vue";
import DialogDetail from "@/modules/07_insignia/components/1_Round/DialogDetail.vue";
/** import Store*/
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
/** use */
const $q = useQuasar(); // noti quasar
const storeInsignia = useInsigniaDataStore();
const mixin = useCounterMixin();
const {
@ -28,22 +26,13 @@ const {
messageError,
showLoader,
hideLoader,
dialogConfirm,
dialogRemove,
} = mixin;
/** use */
const $q = useQuasar(); // noti quasar
/** คอลัมน์ที่แสดง */
const visibleColumns = ref<string[]>([
"period_name",
"period_year",
"period_start",
"period_end",
"statusRoyal",
]);
/** คอลัมน์ */
/** Table */
const rows = ref<FormProprsalsRound2[]>([]); //
const filterKeyword = ref<string>(""); //
const filterRef = ref<HTMLInputElement | null>(null);
const columns = ref<QTableProps["columns"]>([
{
name: "period_name",
@ -97,17 +86,33 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
/** ข้อมูลตาราง (จำลอง)*/
const rows = ref<FormProprsalsRound2[]>([]);
const visibleColumns = ref<string[]>([
"period_name",
"period_year",
"period_start",
"period_end",
"statusRoyal",
]);
const pagination = ref({
descending: false,
page: 1,
rowsPerPage: 10,
});
/** Function เรียกรายการรอบการเสนอขอพระราชทานเครื่องราชอิสริยาภรณ์ */
const modalForm = ref<boolean>(false); //
const actionType = ref<string>(""); // ,
const roundId = ref<string>(""); //id ,
/**
* Function เรยกรายการรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
*/
async function fetchData() {
showLoader();
await http
.get(config.API.listRoundInsignia())
.then((res) => {
.then(async (res) => {
const data = res.data.result;
rows.value = data.map((e: FormProprsalsRound2) => ({
rows.value = await data.map((e: FormProprsalsRound2) => ({
period_id: e.period_id,
period_name: e.period_name,
period_year: e.period_year + 543,
@ -152,65 +157,33 @@ function clickDelete(id: string) {
});
}
/** Fnction คำนวณรายชื่อผู้ได้รับเครื่องราช */
// async function clickListInsignia(propsId: string) {
// dialogConfirm(
// $q,
// async () => {
// await getRequest(propsId);
// },
// "",
// "?"
// );
// }
/** Fnction เรียกจาก API ข้อมูลผู้ได้รับเครื่องราชฯ */
// async function getRequest(id: string) {
// showLoader();
// await http
// .get(config.API.requestInsignia(id))
// .then(() => {
// success($q, "");
// })
// .catch((err) => {
// messageError($q, err);
// })
// .finally(async () => {
// await fetchData();
// });
// }
/** ค้นหาในตาราง */
const filterKeyword = ref<string>("");
const filterRef = ref<HTMLInputElement | null>(null);
const resetFilter = () => {
/**
* Function กำหนดค filterKeyword เปนคาวาง
*/
function resetFilter() {
filterKeyword.value = "";
if (filterRef.value) {
filterRef.value.focus();
}
};
const attrs = ref<any>(useAttrs());
const pagination = ref({
descending: false,
page: 1,
rowsPerPage: 10,
});
/** Hook */
onMounted(async () => {
await fetchData();
});
const modalForm = ref<boolean>(false);
const actionType = ref<string>("");
const roundId = ref<string>("");
}
/**
* function อมลรายละเอยดรอบการเสนอขอพระราชทานเครองราชอสรยาภรณ
* @param action ประเภท รายละเอยด,แกไข
* @param id id องการ รายละเอยด,แกไข
*/
function onOpenFormDetail(action: string = "", id: string = "") {
modalForm.value = true;
actionType.value = action;
roundId.value = id;
}
/**
* ทำงานเม Componenets กเรยกใชงาน
*/
onMounted(async () => {
await fetchData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
@ -282,7 +255,6 @@ function onOpenFormDetail(action: string = "", id: string = "") {
:paging="true"
dense
class="custom-header-table"
v-bind="attrs"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
@ -385,8 +357,8 @@ function onOpenFormDetail(action: string = "", id: string = "") {
<DialogDetail
v-model:modal="modalForm"
:actionType="actionType"
:roundId="roundId"
:fetchList="fetchData"
:round-id="roundId"
:fetch-list="fetchData"
/>
</template>

View file

@ -1,10 +1,23 @@
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { checkPermission } from "@/utils/permissions";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataStructureTree } from "@/interface/main";
import type {
OptionData,
OptionRound,
DataStat,
} from "@/modules/07_insignia/interface/index/Main";
import type { ResponsePeriod } from "@/modules/07_insignia/interface/response/Main";
/**import Componrnts*/
import cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue"; // stat
import tab1 from "@/modules/07_insignia/components/2_Manage/Tab1.vue"; //
@ -13,57 +26,53 @@ import tab3 from "@/modules/07_insignia/components/2_Manage/Tab3.vue"; //คน
import tab4 from "@/modules/07_insignia/components/2_Manage/Tab4.vue"; //
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue"; //
/**import stoer */
import { useCounterMixin } from "@/stores/mixin";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useRoute } from "vue-router";
/**use */
const $q = useQuasar(); // noti quasar
const route = useRoute();
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const route = useRoute();
/**
* วแปร
*/
const loading = ref<boolean>(false);
const loadview = ref<boolean>(false);
const loading = ref<boolean>(false); //
const loadview = ref<boolean>(false); // View
const hideBottom = ref<boolean>(false);
const round = ref<string>("");
const roundName = ref<string>("");
const optionRound = ref<any>([]);
const optiontypeOc = ref<any>([]);
const tab = ref<any>("");
const stat = ref<any>({
const round = ref<string>(""); //
const roundName = ref<string>(""); //
const optionRound = ref<OptionRound[]>([]);
const optiontypeOc = ref<OptionData[]>([]);
const tab = ref<string>(""); //tab
//
const stat = ref<DataStat>({
allUserUser: 0,
orgAllCount: 0,
orgNoSendCount: 0,
orgSendCount: 0,
});
const requestNote = ref<string>("");
const requestStatus = ref<string>("");
const requestId = ref<string>("");
const document = ref<string>("");
const fileUpload = ref<any>(null);
const requestNote = ref<string>(""); //
const requestStatus = ref<string>(""); //
const requestId = ref<string>(""); //id
const document = ref<string>(""); //
const fileUpload = ref<any>(null); //
const modalPopupBackToEdit = ref<boolean>(false); //model
const modalbackInsignia2Role = ref<boolean>(false);
const modalbackInsignia2Role = ref<boolean>(false); // popup
/**
* function เรยกรอบการเสนอขอพระราชทานเครอง
*/
function fecthlistRound() {
http
async function fecthlistRound() {
await http
.get(config.API.listRoundInsignia())
.then(async (res: any) => {
optionRound.value = res.data.result.map((e: any) => ({
.then(async (res) => {
optionRound.value = res.data.result.map((e: ResponsePeriod) => ({
id: e.period_id,
year: e.period_year,
name: e.period_name,
}));
// UI
if (optionRound.value.length !== 0) {
DataStore.optionRound = optionRound.value;
@ -89,8 +98,8 @@ function fecthlistRound() {
/**
* function เรยกด Stat ของรอบการเสนอขอพระราชทานเครอง
*/
function fecthStat(id: string) {
http
async function fecthStat(id: string) {
await http
.get(config.API.insigniaDashboard(id))
.then((res) => {
stat.value = res.data.result;
@ -103,8 +112,8 @@ function fecthStat(id: string) {
/**
* funcion เชคหนวยงาน
*/
function fecthAgency() {
http
async function fecthAgency() {
await http
.get(config.API.keycloakPosition())
.then((res) => {
loadview.value = true;
@ -141,7 +150,7 @@ function fetchListOrg(id: string) {
http
.get(config.API.orgByIdSystem(id, route.meta.Key as string))
.then(async (res) => {
const data = await res.data.result.map((item: any) => ({
const data = await res.data.result.map((item: DataStructureTree) => ({
id: item.orgTreeId,
name: item.orgName,
}));
@ -158,16 +167,18 @@ function fetchListOrg(id: string) {
/**
* function เรยกประเภทเครองราช
*/
function fecthInsignia() {
http
.get(config.API.insigniaOrg)
.then((res) => {
const data = res.data.result;
DataStore.fetchInsigniaType(data);
})
.catch((err) => {
messageError($q, err);
});
async function fecthInsignia() {
if (DataStore.dataInsigniaType.length === 0) {
await http
.get(config.API.insigniaOrg)
.then((res) => {
const data = res.data.result;
DataStore.fetchInsigniaType(data);
})
.catch((err) => {
messageError($q, err);
});
}
}
/**
@ -176,17 +187,18 @@ function fecthInsignia() {
async function changround() {
DataStore.roundId = round.value;
fecthStat(round.value); // Stat
var organization = await (DataStore.agency != null // agency agency Oc
? DataStore.agency
: DataStore.typeOc);
var organization =
DataStore.agency != null // agency agency Oc
? DataStore.agency
: DataStore.typeOc;
fecthInsigniaByOc(round.value, organization, "officer", tab.value); //
// get round name
const roundFilter = await optionRound.value.find(
(x: any) => round.value === x.id
);
roundName.value = `รอบการเสนอขอพระราชทานเครื่องราชฯ ปี ${
roundFilter.year + 543
}`;
const roundFilter = optionRound.value.find((x: any) => round.value === x.id);
if (roundFilter) {
roundName.value = `รอบการเสนอขอพระราชทานเครื่องราชฯ ปี ${
roundFilter.year + 543
}`;
}
}
/**
@ -196,7 +208,7 @@ async function changround() {
* @param role ประเภท officer,employee
* @param status สถานะ
*/
function fecthInsigniaByOc(
async function fecthInsigniaByOc(
roundId: string,
ocId: string,
role: string,
@ -204,7 +216,7 @@ function fecthInsigniaByOc(
) {
if (roundId && ocId && role && status) {
showLoader();
http
await http
.get(config.API.insigniaList(roundId, ocId, role, status))
.then(async (res) => {
requestNote.value = res.data.result.requestNote;
@ -292,8 +304,8 @@ function backToEdit(reason: string) {
"officer",
tab.value
);
modalPopupBackToEdit.value = await false;
await success($q, "บันทึกสำเร็จ");
modalPopupBackToEdit.value = false;
})
.catch((err) => {
messageError($q, err);
@ -352,8 +364,8 @@ function backToEditinsignia2Role(reason: string) {
"officer",
tab.value
);
modalbackInsignia2Role.value = await false;
await success($q, "การตีกลับสำเร็จ");
modalbackInsignia2Role.value = false;
})
.catch((err) => {
messageError($q, err);
@ -421,10 +433,8 @@ async function uploadFile(event: any) {
* hook
*/
onMounted(async () => {
tab.value = DataStore.mainTab;
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
fecthlistRound();
fetchActiveId();
tab.value = DataStore.mainTab ?? "";
Promise.all([fecthInsignia(), fecthlistRound(), fetchActiveId()]);
});
</script>
@ -547,11 +557,11 @@ onMounted(async () => {
<q-tab-panel name="pending" class="q-pa-none">
<tab1
:tab="tab"
:roundId="round"
:roundName="roundName"
:fecthInsigniaByOc="fecthInsigniaByOc"
:round-id="round"
:round-name="roundName"
:fecth-insignia-by-oc="fecthInsigniaByOc"
:request-status="requestStatus"
:fecthStat="fecthStat"
:fecth-stat="fecthStat"
/>
</q-tab-panel>
@ -559,8 +569,8 @@ onMounted(async () => {
<q-tab-panel name="reject" class="q-pa-none">
<tab2
:tab="tab"
:roundId="round"
:fecthInsigniaByOc="fecthInsigniaByOc"
:round-id="round"
:fecth-insignia-by-oc="fecthInsigniaByOc"
/>
</q-tab-panel>
@ -568,8 +578,8 @@ onMounted(async () => {
<q-tab-panel name="delete" class="q-pa-none">
<tab3
:tab="tab"
:roundId="round"
:fecthInsigniaByOc="fecthInsigniaByOc"
:round-id="round"
:fecth-insignia-by-oc="fecthInsigniaByOc"
/>
</q-tab-panel>
@ -579,7 +589,7 @@ onMounted(async () => {
name="organization"
class="q-pa-none"
>
<tab4 :tab="tab" :roundId="round" />
<tab4 :tab="tab" :round-id="round" />
</q-tab-panel>
</q-tab-panels>

View file

@ -1,29 +1,30 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
/**
* import Typฃ
*/
import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { QTableProps, QInput } from "quasar";
import type {
OptionData,
DataPerson,
} from "@/modules/07_insignia/interface/index/Main";
import type { ResponseRound } from "@/modules/07_insignia/interface/response/Main";
/**
* import Components
*/
import DialogHeader from "@/components/DialogHeader.vue";
import Dialogbody from "@/modules/07_insignia/components/3_result/Dialogbody.vue"; //-
import DialogForm from "@/modules/07_insignia/components/3_result/DialogForm.vue"; //
import fileUploadview from "../components/3_result/fileUpload.vue";
/**
* import Stores
*/
import { useResultDataStore } from "@/modules/07_insignia/storeResult";
import { useCounterMixin } from "@/stores/mixin";
import Dialogbody from "@/modules/07_insignia/components/3_result/DialogReceive_Return.vue"; //-
import DialogForm from "@/modules/07_insignia/components/3_result/DialogResults.vue"; //
import fileUploadview from "../components/3_result/TabDocuments.vue";
/**
* use
@ -43,30 +44,30 @@ const {
/**
* วแปร
*/
const tab = ref<string>("");
const selectRound = ref<string>("");
const selectRoundOption = ref<OptionData[]>([]);
const modal = ref<boolean>(false);
const action = ref<string>("");
const personId = ref<string>();
const profileType = ref<string>("");
const fileResult = ref<any>(null);
const fileinvoice = ref<any>(null);
const loadView = ref<boolean>(false);
const insigniaTypeOption = ref<any>([]);
const insigniaTypeFilter = ref<any>({
insigniaTypeOption: [],
});
const filterInvoice = ref<any>(DataStore.invoiceTypeop);
const filterEmployee = ref<any>(DataStore.employeeClassOps);
const ModalDialog = ref<boolean>(false);
const dateCheckReceive = ref<any>();
const dateCheckReturn = ref<any>();
const dataModal = ref<any>([]);
const tab = ref<string>(""); //Tab
const selectRound = ref<string>(""); //
const selectRoundOption = ref<OptionData[]>([]); //
const modal = ref<boolean>(false); //popup
const action = ref<string>(""); //,
const personId = ref<string>(); //id
const profileType = ref<string>(""); //
const fileResult = ref<any>(null); //
const fileinvoice = ref<any>(null); //
const loadView = ref<boolean>(false); //
const insigniaTypeOption = ref<OptionData[]>([]); //
const insigniaTypeFilter = ref<OptionData[]>([]); //
const filterInvoice = ref<OptionData[]>(DataStore.invoiceTypeop); //
const filterEmployee = ref<OptionData[]>(DataStore.employeeClassOps); //
const ModalDialog = ref<boolean>(false); //popup -
const dateCheckReceive = ref<string>(); //
const dateCheckReturn = ref<string>(); //
const dataModal = ref<DataPerson>(); //
/**
* อม Tabla
*/
const filterRef = ref<QInput>();
const filter = ref<string>("");
const columns = ref<QTableProps["columns"]>([
{
name: "action",
@ -237,27 +238,24 @@ const visibleColumns = ref<String[]>([
"typepay",
"address",
]);
const filterRef = ref<QInput>();
const filter = ref<string>("");
/**
*function เรยกรอบการเสนอขอพระราชทานเครองราช
*/
function fecthRound() {
async function fecthRound() {
showLoader();
http
await http
.get(config.API.noteround())
.then(async (res) => {
let data = res.data.result;
if (data.length !== 0) {
selectRoundOption.value = data.map((e: any) => ({
selectRoundOption.value = data.map((e: ResponseRound) => ({
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
id: e.id,
}));
selectRound.value = data[0].id;
await fecthInsignia();
await fecthInsigniaType();
await Promise.all([fecthInsignia(), fecthInsigniaType()]);
} else {
hideLoader();
}
@ -271,11 +269,11 @@ function fecthRound() {
/**
* function เรยกประเภทเครองราช
*/
function fecthInsignia() {
http
async function fecthInsignia() {
await http
.get(config.API.insigniaOrg)
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
DataStore.fetchDatainsignia(data);
})
.catch((err) => {
@ -286,10 +284,10 @@ function fecthInsignia() {
/**
* function เรยกระดบเครองราช
*/
function fecthInsigniaType() {
http(config.API.insigniaTypeOrg)
.then((res) => {
let data = res.data.result;
async function fecthInsigniaType() {
await http(config.API.insigniaTypeOrg)
.then(async (res) => {
let data = await res.data.result;
DataStore.fetchDatainsigniaType(data);
tab.value = DataStore.insigniaType[0].name;
loadView.value = true;
@ -317,44 +315,20 @@ function selectorRound(round: string) {
fecthlistInsignia();
}
/**
* callback function จำทำงานเม tab การเปลยนแปลง
*/
watch(tab, () => {
if (tab.value !== "doc") {
DataStore.insignia = "";
fecthlistInsignia();
insigniaTypeOption.value = DataStore.insigniaOp.filter(
(e: any) => e.insigniaType == tab.value || e.name == "ทั้งหมด"
);
insigniaTypeFilter.value = insigniaTypeOption.value;
}
});
/**
* callback function จำทำงานเม modal การเปลยนแปลง
*/
// watch(modal, () => {
// if (modal.value == false) {
// fecthlistInsignia();
// }
// });
/**
* function เรยกรายชอบนทกผลการไดบพระราชทานเครองราชอสรยาภรณ/การจายใบกำก
*/
function fecthlistInsignia() {
async function fecthlistInsignia() {
showLoader();
let data = {
insigniaTypeId: tab.value,
insigniaNoteId: selectRound.value,
insigniaId: DataStore.insignia,
};
http
await http
.post(config.API.noteSearch(), data)
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
DataStore.fetchlistinsignia(data);
})
.catch((err) => {
@ -388,7 +362,7 @@ function uploadFile(event: any, action: string) {
}
await success($q, "อัพโหลดไฟล์สำเร็จ");
modelPerview.value = await false;
modelPerview.value = false;
})
.catch((err) => {
messageError($q, err);
@ -400,30 +374,32 @@ function uploadFile(event: any, action: string) {
}
}
/** function closePopup*/
/**
* function popup งหมด
*/
function close() {
modal.value = false;
ModalDialog.value = false;
}
/** function openPopup add*/
/**
* function เป popup นทกผล เพมคน
*/
function addData() {
modal.value = true;
action.value = "addData";
}
/** function openPopup edit*/
function editData(data: any) {
/**
* function เป popup นทกผล แกไขขอม
*/
function editData(data: DataPerson) {
personId.value = data.id;
profileType.value = data.profileType;
action.value = "editData";
modal.value = true;
}
const save = () => {
console.log("save function");
};
/**
* อม ไฟล
*/
@ -486,22 +462,13 @@ const resetFilter = () => {
filter.value = "";
filterRef.value!.focus();
};
const pagination = ref({
sortBy: "name",
descending: false,
page: 1,
rowsPerPage: 10,
});
const paging = ref<boolean>(true);
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
/**
* function openPopup
* function เป popup -นเครองราชฯ
* @param data อมลทองการแกไข
*
*/
function OpenModal(data: any) {
function OpenModal(data: DataPerson) {
dataModal.value = data;
ModalDialog.value = true;
dateCheckReceive.value = data.dateReceiveInsignia;
@ -515,23 +482,23 @@ function OpenModal(data: any) {
* @param update function
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "insigniaTypeFilter") {
DataStore.insignia = null as any;
DataStore.insignia = val ? (null as any) : DataStore.insignia;
insigniaTypeFilter.value = insigniaTypeOption.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterInvoice") {
DataStore.invoiceType = "";
DataStore.invoiceType = val ? "" : DataStore.invoiceType;
filterInvoice.value = DataStore.invoiceTypeop.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
} else if (name === "filterEmployee") {
DataStore.employeeClass = "";
DataStore.employeeClass = val ? "" : DataStore.employeeClass;
filterEmployee.value = DataStore.employeeClassOps.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
(v: OptionData) => v.name.toLowerCase().indexOf(needle) > -1
);
}
});
@ -554,6 +521,33 @@ function clearInsigniaFilters(name: string) {
}
}
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "name",
descending: false,
page: 1,
rowsPerPage: 10,
});
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
/**
* callback function จำทำงานเม tab การเปลยนแปลง
*/
watch(tab, () => {
if (tab.value !== "doc") {
DataStore.rows = [];
DataStore.insignia = "";
fecthlistInsignia();
insigniaTypeOption.value = DataStore.insigniaOp.filter(
(e: any) => e.insigniaType == tab.value || e.name == "ทั้งหมด"
);
insigniaTypeFilter.value = insigniaTypeOption.value;
}
});
/** hook*/
onMounted(() => {
fecthRound();
@ -703,7 +697,7 @@ onMounted(() => {
:borderless="false"
style="width: 300px"
@update:model-value="selectorInsignia"
@filter="(inputValue:any,
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'insigniaTypeFilter'
) "
>
@ -789,7 +783,7 @@ onMounted(() => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterInvoice'
) "
>
@ -836,7 +830,7 @@ onMounted(() => {
DataStore.employeeClass
)
"
@filter="(inputValue:any,
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterEmployee'
) "
>
@ -945,22 +939,22 @@ onMounted(() => {
<Dialogbody
:modal="ModalDialog"
:close="close"
:dateCheckReceive="dateCheckReceive"
:dateCheckReturn="dateCheckReturn"
:dataModal="dataModal"
:personId="personId"
:fecthlistInsignia="fecthlistInsignia"
:date-check-receive="dateCheckReceive"
:date-check-return="dateCheckReturn"
:data-modal="dataModal"
:person-id="personId"
:fecthlist-insignia="fecthlistInsignia"
/>
<!-- DialogForm -->
<!-- นทกผล -->
<DialogForm
:modal="modal"
:save="save"
:close="close"
:roundId="selectRound"
:round-id="selectRound"
:action="action"
:personId="personId"
:profileType="profileType"
:fecthlistInsignia="fecthlistInsignia"
:person-id="personId"
:profile-type="profileType"
:fecthlist-insignia="fecthlistInsignia"
/>
<!-- นยนรายการขอม -->

View file

@ -7,8 +7,13 @@ import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
/** impotrType */
import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main";
import type { QTableProps, QInput } from "quasar";
import type {
OptionDataYear,
OptionData,
DataAllocate,
} from "@/modules/07_insignia/interface/index/Main";
import type { ResponseRound } from "@/modules/07_insignia/interface/response/Main";
/** impotrComponents */
import DialogForm from "@/modules/07_insignia/components/4_Allocate/DialogForm.vue";
@ -24,30 +29,20 @@ const { showLoader, hideLoader, messageError, dialogRemove, success } = mixin;
const $q = useQuasar();
const attrs = ref<any>(useAttrs());
const tab = ref<string>("");
const selectRound = ref<string>();
const selectRoundOption = ref<OptionDataYear[]>([]);
const modal = ref<boolean>(false);
const action = ref<string>("");
const roundYear = ref<number>();
const insigniaOp = ref<any>([]);
const filterInsigniaOp = ref<any>({ insigniaOp: [] });
const loadView = ref<boolean>(false);
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const tab = ref<string>(""); //Tab
const selectRound = ref<string>(); //
const selectRoundOption = ref<OptionDataYear[]>([]); //
const modal = ref<boolean>(false); //popup
const action = ref<string>(""); // ,
const roundYear = ref<number>(); //
const insigniaOp = ref<OptionData[]>([]); //
const filterInsigniaOp = ref<OptionData[]>([]); //
const loadView = ref<boolean>(false); //
/** ข้อมูล Table*/
const visibleColumns = ref<string[]>([
"no",
"insignia",
"total",
"allocate",
"remain",
]);
const filterRef = ref<QInput>();
const filter = ref<string>("");
const rowData = ref<DataAllocate>(); //
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -96,18 +91,31 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const filterRef = ref<QInput>();
const filter = ref<string>("");
const rowData = ref<any>([]);
const visibleColumns = ref<string[]>([
"no",
"insignia",
"total",
"allocate",
"remain",
]);
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
/** function เรียกรอบการเสนอขอ*/
/**
* function เรยกรอบการเสนอขอ
*/
async function fecthRound() {
showLoader();
await http
.get(config.API.noteround())
.then(async (res) => {
let data = res.data.result;
if (data.length !== 0) {
selectRoundOption.value = data.map((e: any) => ({
selectRoundOption.value = data.map((e: ResponseRound) => ({
id: e.id,
name: "รอบการเสนอขอพระราชทานเครื่องราชฯ ปี" + " " + (e.year + 543),
year: e.year,
@ -123,8 +131,7 @@ async function fecthRound() {
DataStore.roundId = selectRound.value;
}
if (roundYear.value) {
await fecthInsignia();
await fecthInsigniaType();
await Promise.all([fecthInsignia(), fecthInsigniaType()]);
} else {
hideLoader();
}
@ -136,14 +143,16 @@ async function fecthRound() {
});
}
/** function เรียกประเภทเครื่องราช*/
/**
* function เรยกประเภทเครองราช
*/
async function fecthInsignia() {
await http
.get(config.API.insigniaOrg)
.then(async (res) => {
let data = res.data.result;
await DataStore.fetchDatainsignia(data);
insigniaOp.value = await DataStore.insigniaOp.filter(
insigniaOp.value = DataStore.insigniaOp.filter(
(x: any) => x.type == tab.value || x.type === ""
);
})
@ -152,8 +161,10 @@ async function fecthInsignia() {
});
}
/** function เรียก Tab*/
const fecthInsigniaType = async () => {
/**
* function เรยก Tab
*/
async function fecthInsigniaType() {
await http(config.API.insigniaTypeOrg)
.then((res) => {
let data = res.data.result;
@ -166,7 +177,7 @@ const fecthInsigniaType = async () => {
.catch((err) => {
messageError($q, err);
});
};
}
/** function เลือกรอบการเสนขอ*/
async function selectorRound(round: string | undefined) {
@ -174,7 +185,9 @@ async function selectorRound(round: string | undefined) {
if (selectRound.value) {
DataStore.roundId = selectRound.value;
}
const yearFilter = selectRoundOption.value.find((x: any) => x.id == round); //
const yearFilter = selectRoundOption.value.find(
(x: OptionDataYear) => x.id == round
); //
roundYear.value = yearFilter?.year;
DataStore.roundYear = roundYear.value;
await fecthlistInsignia();
@ -186,8 +199,8 @@ async function fecthlistInsignia() {
showLoader();
await http
.get(config.API.insigniaManageType(tab.value, Number(roundYear.value)))
.then((res) => {
let data = res.data.result;
.then(async (res) => {
let data = await res.data.result;
DataStore.listinsignia(data);
})
.catch((err) => {
@ -211,26 +224,37 @@ function redirectToPage(id: string, name: string) {
/** ตัวแปร popup*/
const modalEdit = ref<boolean>(false);
const actionType = ref<string>("");
/** function closePopup*/
/**
* function closePopup
*/
function close() {
modal.value = false;
modalEdit.value = false;
}
/** function openPopup การเพิ่มการจัดสรรเครื่องราชฯ*/
const addData = () => {
/**
* function openPopup การเพมการจดสรรเครองราชฯ
*/
function addData() {
modal.value = true;
action.value = "addData";
};
}
/** function openPopup การแกไขการจัดสรรเครื่องราชฯ*/
const clickEditrow = (data: any) => {
/**
* function openPopup การแกไขการจดสรรเครองราชฯ
*/
function clickEditrow(data: DataAllocate) {
rowData.value = data;
modalEdit.value = true;
actionType.value = "insignia";
};
//
const save = async (insigniaId: string, total: string) => {
}
/**
* function นทกการเพมการจดสรรเครองราชฯ
* @param insigniaId เครองราชทองการบนท
* @param total จำนวนทองการ
*/
async function save(insigniaId: string, total: string) {
showLoader();
await http
.post(config.API.insigniaManageAdd(), {
@ -249,7 +273,7 @@ const save = async (insigniaId: string, total: string) => {
hideLoader();
close();
});
};
}
//
/**
@ -320,11 +344,11 @@ function resetFilter() {
* @param update function
* @param name Selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "filterInsigniaOp") {
DataStore.insignia = undefined as any;
DataStore.insignia = val ? (undefined as any) : DataStore.insignia;
filterInsigniaOp.value = insigniaOp.value.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
@ -336,15 +360,16 @@ function filterSelector(val: any, update: Function, name: any) {
* function เคลยร filter
* @param name filter
*/
const clearInsigniaFilters = (name: string) => {
console.log(insigniaOp.value);
function clearInsigniaFilters(name: string) {
if (name === "filterInsigniaOp") {
DataStore.insignia = "";
filterInsigniaOp.value = insigniaOp.value;
}
};
}
/** function callback ทำงานเมื่อ Tab มีการเปลี่ยน*/
/**
* function callback ทำงานเม Tab การเปลยน
*/
watch(tab, () => {
insigniaOp.value = DataStore.insigniaOp.filter(
(x: any) => x.type == tab.value || x.type === ""
@ -443,7 +468,7 @@ onMounted(async () => {
@update:model-value="
DataStore.selectInsignia(DataStore.insignia)
"
@filter="(inputValue:any,
@filter="(inputValue:string,
doneFn:Function) => filterSelector(inputValue, doneFn,'filterInsigniaOp'
) "
>
@ -633,7 +658,8 @@ onMounted(async () => {
:save="saveEdit"
:close="close"
:insigniadata="rowData"
:actionType="actionType"
:action-type="actionType"
/>
</template>
<style lang="scss" scoped></style>

View file

@ -1,9 +1,12 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
import { checkPermission } from "@/utils/permissions";
/** impotrType */
import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main";
@ -13,13 +16,11 @@ import type { QTableProps, QInput } from "quasar";
import DialogForm from "@/modules/07_insignia/components/5_Borrow/DialogForm.vue";
/** impotrStores */
import { useBrrowDataStore } from "@/modules/07_insignia/storeBrrow";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
const DataStore = useBrrowDataStore();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const $q = useQuasar();
const tab = ref<string>("");
/** ข้อมูล Table*/
@ -260,7 +261,9 @@ const fileterInsigniaList = ref<any>([]);
const loadView = ref<boolean>(false);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
/** function เรียกรอบการเสนอขอพระราชทานเครื่องราชฯ*/
/**
* function เรยกรอบการเสนอขอพระราชทานเครองราชฯ
*/
async function fecthRound() {
showLoader();
await http
@ -305,7 +308,9 @@ async function fecthRound() {
});
}
/** function เรียกประเภทเครื่องราชฯ*/
/**
* function เรยกประเภทเครองราชฯ
*/
async function fecthInsignia() {
await http
.get(config.API.insigniaOrg)
@ -323,7 +328,9 @@ async function fecthInsignia() {
});
}
/** function เรียกระดับเครื่องราชฯ Tab*/
/**
* function เรยกระดบเครองราชฯ Tab
*/
async function fecthInsigniaType() {
await http(config.API.insigniaTypeOrg)
.then(async (res) => {
@ -339,8 +346,7 @@ async function fecthInsigniaType() {
.finally(() => {});
}
/** รอบการเสนอขอ*/
const yearRound = ref<number>();
const yearRound = ref<number>(); //
/**
* function เลอกรอบการเสนอขอ
* @param round การเสนอขอ
@ -350,7 +356,9 @@ async function selectorRound(round: number) {
await fecthlistInsignia();
}
/** function เรียกรายชื่อการเสนอขอเครื่องราชฯ */
/**
* function เรยกรายชอการเสนอขอเครองราชฯ
*/
async function fecthlistInsignia() {
showLoader();
await http
@ -368,18 +376,24 @@ async function fecthlistInsignia() {
});
}
/** function closePopup */
/**
* function closePopup
*/
function close() {
modal.value = false;
}
/** function closePopup และเเรียกข้อมูลรายชื่อการเสนอขอเครื่องราชฯ */
/**
* function closePopup และเเรยกขอมลรายชอการเสนอขอเครองราชฯ
*/
async function closeAndFecth() {
await fecthlistInsignia();
modal.value = false;
}
/** function openPopup เพิ่มรายการ ยืม-คืนเครื่องราชฯ*/
/**
* function openPopup เพมรายการ -นเครองราชฯ
*/
function addData() {
modal.value = true;
action.value = "addData";
@ -407,7 +421,7 @@ function resetFilter() {
* @param update function
* @param name Selec
*/
function filterSelector(val: any, update: Function, name: any) {
function filterSelector(val: string, update: Function, name: string) {
update(() => {
const needle = val.toLowerCase();
if (name === "employeeClassOps") {
@ -429,11 +443,6 @@ function filterSelector(val: any, update: Function, name: any) {
});
}
/** Hook*/
onMounted(async () => {
await fecthRound();
});
/** function callblack ทำงานเมือมีการเปลี่ยน Tab*/
watch(tab, async () => {
insigniaList.value = await DataStore.insigniaOp.filter(
@ -443,6 +452,11 @@ watch(tab, async () => {
fileterInsigniaList.value = insigniaList.value;
fecthlistInsignia();
});
/** Hook*/
onMounted(async () => {
await fecthRound();
});
</script>
<template>

View file

@ -1,12 +1,14 @@
<script setup lang="ts">
import { useRouter } from "vue-router";
// import { useInsigniaDataStore } from "@/modules/07_insignia/store";
const router = useRouter();
// const store = useInsigniaDataStore();
const nextPage = (type: string, title: string) => {
router.push(`/insignia/report/report/${type}`);
};
/**
* งก Redirect ไปหนารายงานทเลอก
* @param type ประเภทรายงาน
*/
function nextPage(type: string) {
router.push(`/insignia/report/${type}`);
}
</script>
<template>
@ -16,26 +18,7 @@ const nextPage = (type: string, title: string) => {
<div>
<q-card flat bordered class="col-12 q-mt-sm">
<div class="q-pa-md">
<!-- <q-item to="/insignia/report/report-01" dense class="hover-green">
<q-item-section avatar>
<q-icon color="primary" name="mdi-file" size="xs" />
</q-item-section>
<q-item-section class="text-dark">
รายงาน ขร.1 - ขร.4
</q-item-section>
</q-item> -->
<q-item
clickable
@click="
nextPage(
'45',
'บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชอิสริยาภรณ์'
)
"
dense
class="hover-green"
>
<q-item clickable @click="nextPage('45')" dense class="hover-green">
<q-item-section avatar>
<q-icon color="primary" name="mdi-file" size="xs" />
</q-item-section>
@ -44,14 +27,7 @@ const nextPage = (type: string, title: string) => {
</q-item-section>
</q-item>
<q-item
clickable
@click="
nextPage('43', 'บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี')
"
dense
class="hover-green"
>
<q-item clickable @click="nextPage('43')" dense class="hover-green">
<q-item-section avatar>
<q-icon color="primary" name="mdi-file" size="xs" />
</q-item-section>
@ -60,12 +36,7 @@ const nextPage = (type: string, title: string) => {
</q-item-section>
</q-item>
<q-item
clickable
@click="nextPage('44', 'บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ')"
dense
class="hover-green"
>
<q-item clickable @click="nextPage('44')" dense class="hover-green">
<q-item-section avatar>
<q-icon color="primary" name="mdi-file" size="xs" />
</q-item-section>

View file

@ -1,12 +0,0 @@
<script setup lang="ts"></script>
<template>
<div class="toptitle text-dark col-12 row items-center">
เครองราชอสรยาภรณ
</div>
<div>
<q-card flat bordered class="col-12 q-mt-sm"> </q-card>
</div>
</template>
<style lang="scss" scope></style>

View file

@ -206,8 +206,8 @@ watch(
borderless
v-model="formData.startTimeMorning"
:rules="[
(val) => !!val || 'กรุณากรอกเวลาเข้างาน',
(val) => {
(val:string) => !!val || 'กรุณากรอกเวลาเข้างาน',
(val:string) => {
if (val && formData.endTimeMorning) {
if (val > formData.endTimeMorning) {
return 'ต้องน้อยกว่าเวลาออกงาน';
@ -243,8 +243,8 @@ watch(
lazy-rules
borderless
:rules="[
(val) => !!val || 'กรุณากรอกเวลาออกงาน',
(val) => {
(val:string) => !!val || 'กรุณากรอกเวลาออกงาน',
(val:string) => {
if (val && formData.startTimeMorning) {
if (val < formData.startTimeMorning) {
return 'ต้องมากกว่าเวลาเข้างาน';
@ -277,8 +277,8 @@ watch(
<q-input
ref="pmRef"
:rules="[
(val) => !!val || 'กรุณากรอกเวลาเข้างาน',
(val) => {
(val:string) => !!val || 'กรุณากรอกเวลาเข้างาน',
(val:string) => {
if (val && formData.endTimeAfternoon) {
if (val > formData.endTimeAfternoon) {
return 'ต้องน้อยกว่าเวลาออกงาน';
@ -314,8 +314,8 @@ watch(
<q-input
ref="pmOutRef"
:rules="[
(val) => !!val || 'กรุณากรอกเวลาออกงาน',
(val) => {
(val:string) => !!val || 'กรุณากรอกเวลาออกงาน',
(val:string) => {
if (val && formData.startTimeAfternoon) {
if (val < formData.startTimeAfternoon) {
return 'ต้องมากกว่าเวลาเข้างาน';

View file

@ -8,7 +8,6 @@ import { useCounterMixin } from "@/stores/mixin";
import { useCommandDetail } from "@/modules/18_command/store/DetailStore";
import http from "@/plugins/http";
import config from "@/app.config";
import { log } from "console";
const $q = useQuasar();
const route = useRoute();