ปรับ Code เคื่องราช

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-08-29 10:59:58 +07:00
parent 51d072ccc0
commit 240862be2c
13 changed files with 548 additions and 885 deletions

View file

@ -1,106 +1,4 @@
<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" 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" :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 lazy-rules 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" 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" :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" dense outlined v-model="datelast"
label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด" />
<q-file class="col-xs-12 col-sm-10" outlined dense v-model="files" @added="fileUploadDoc"
label="อัปโหลดเอกสารประกอบ" hide-bottom-space lazy-rules>
<!-- :rules="[
(val) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
]" -->
<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>
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { ref, onMounted } from "vue";
import { useQuasar, QForm } from "quasar";
import { useRouter, useRoute } from "vue-router";
@ -111,12 +9,12 @@ import config from "@/app.config";
const mixin = useCounterMixin();
const {
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
dialogConfirm,
success,
} = mixin;
const router = useRouter();
const route = useRoute();
@ -138,18 +36,14 @@ const options = ref([
onMounted(async () => {
await fetchData();
});
const fetchData = async () => {
if (route.params.id) {
edit.value = true;
showLoader();
// console.log(id.value);
await http
.get(config.API.getRoundInsignia(id.value))
.then((res) => {
const data = res.data.result;
// const files = res.data.result.files;
id.value = data.period_id;
roundInsig.value =
options.value.filter((r: any) => r.value == data.period_round)
@ -171,8 +65,6 @@ const fetchData = async () => {
}
};
const routeName = router.currentRoute.value.name;
const fileUploadDoc = async (files: any) => {
files.forEach((file: any) => {
fileDocDataUpload.value.push(file);
@ -185,7 +77,9 @@ const updateYear = async (e: number) => {
const editData = async (id: string) => {
const formData = new FormData();
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${roundInsig.value.value} ปี ${yearly.value + 543}`;
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${
roundInsig.value.value
} ${yearly.value + 543}`;
formData.append("name", name);
formData.append("year", yearly.value.toString());
formData.append("amount", datelast.value.toString());
@ -196,15 +90,12 @@ const editData = async (id: string) => {
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
// files.value.forEach((file: any) => {
// formData.append("file", file);
// });
formData.append("file", files.value);
console.log(formData);
showLoader();
await http
.put(config.API.editRoundInsignia(id), formData)
.then(async () => { })
.then(async () => {})
.catch((e) => {
messageError($q, e);
})
@ -231,19 +122,7 @@ const SaveData = async () => {
});
}
};
// const sendData = () => {
// const valueData: any = {
// Name: roundInsig.value,
// year: year.value,
// Amount: datelast.value,
// dateStart: dateStart.value !== null ? dateToISO(dateStart.value) : null,
// dateEnd: dateEnd.value !== null ? dateToISO(dateEnd.value) : null,
// };
// return valueData;
// };
const updateDateRange = () => {
// console.log("test")
if (roundInsig.value.value == 1) {
dateStart.value = new Date(new Date().getFullYear(), 9, 1);
dateEnd.value = new Date(new Date().getFullYear() + 1, 3, 29);
@ -257,8 +136,9 @@ const updateDateRange = () => {
const addData = async () => {
const formData = new FormData();
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${roundInsig.value.value
} ${yearly.value + 543} `;
const name = `รอบการเสนอขอพระราชทานเครื่องราชรอบที่ ${
roundInsig.value.value
} ${yearly.value + 543} `;
console.log(name);
formData.append("name", name);
formData.append("year", yearly.value.toString());
@ -270,17 +150,14 @@ const addData = async () => {
if (dateEnd.value !== null) {
formData.append("endDate", dateToISO(dateEnd.value));
}
console.log(files.value);
// files.value.forEach((file: any) => {
// formData.append("file", file);
// });
formData.append("file", files.value);
console.log(files.value);
showLoader();
await http
.post(config.API.listRoundInsignia(), formData)
.then(async (res) => { })
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
@ -293,3 +170,197 @@ const clickBack = () => {
router.push({ name: "insigniaProposals" });
};
</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"
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"
: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
lazy-rules
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"
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"
: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"
dense
outlined
v-model="datelast"
label="จำนวนวันแจ้งเตือนก่อนวันสิ้นสุด"
/>
<q-file
class="col-xs-12 col-sm-10"
outlined
dense
v-model="files"
@added="fileUploadDoc"
label="อัปโหลดเอกสารประกอบ"
hide-bottom-space
lazy-rules
>
<!-- :rules="[
(val) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
]" -->
<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

@ -5,9 +5,7 @@ import router from "@/router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { FormProprsalsRound } from " @/modules/07_insignia/interface/request/Main.ts";
import { useRoute } from "vue-router";
import config from "@/app.config";
import http from "@/plugins/http";
const mixin = useCounterMixin();
@ -15,22 +13,12 @@ const {
date2Thai,
success,
messageError,
statusLeave,
dialogMessage,
dateToISO,
showLoader,
hideLoader,
dialogConfirm,
dialogRemove,
} = mixin;
const route = useRoute();
const $q = useQuasar(); // noti quasar
const modal = ref<boolean>(false);
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<string[]>([
"round",
@ -194,34 +182,22 @@ const clickEdit = (col: any) => {
router.push(`/insignia/round-add/${col.id}`);
};
// 2
const clickDelete = (id: string) => {
$q.dialog({
title: "ยืนยันการลบข้อมูล",
message: "ต้องการลบข้อมูลนี้ใช่หรือไม่?",
cancel: {
flat: true,
color: "negative",
},
persistent: true,
})
.onOk(async () => {
showLoader();
await http
.delete(config.API.RoundInsignia(id))
.then((res) => {
success($q, "ลบข้อมูลการเสนอขอสำเร็จ");
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.onCancel(() => {})
.onDismiss(() => {});
dialogRemove($q, async () => {
showLoader();
await http
.delete(config.API.RoundInsignia(id))
.then(() => {
success($q, "ลบข้อมูลการเสนอขอสำเร็จ");
fetchData();
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
};
const clickAdd = () => {
@ -247,12 +223,10 @@ const getRequest = async (id: string) => {
showLoader();
await http
.get(config.API.requestInsignia(id))
.then((res) => {
console.log(res);
.then(() => {
success($q, "ยืนยันสำเร็จ");
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(async () => {
@ -268,16 +242,14 @@ const resetFilter = () => {
filterRef.value.focus();
};
const filterKeyword2 = ref<string>("");
const filterRef2 = ref<any>(null);
const resetFilter2 = () => {
filterKeyword2.value = "";
filterRef2.value.focus();
};
const attrs = ref<any>(useAttrs());
const paging = ref<boolean>(true);
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const paginationLabel = (start: string, end: string, total: string) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;

View file

@ -12,14 +12,7 @@ import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
const router = useRouter();
const mixin = useCounterMixin();
const {
dialogRemove,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = mixin;
const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin;
const $q = useQuasar();
const DataStore = useInsigniaDataStore();
@ -30,7 +23,6 @@ const modalAdd = ref<boolean>(false);
const modalEdit = ref<boolean>(false);
const rowid = ref<string>("");
const organization = ref<string>("");
const fileId = ref<string>("");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const visibleColumns = ref<string[]>([
@ -178,7 +170,6 @@ const columns2 = ref<QTableProps["columns"]>([
]);
const rows2 = ref<any[]>([]);
const person = ref<any>([]);
const props = defineProps({
tab: {
@ -205,10 +196,6 @@ const props = defineProps({
});
onMounted(async () => {
// if (DataStore.typeOc == "") {
// // organization.value = DataStore.optionsTypeOc[2].id;
// DataStore.typeOc = organization.value;
// } else organization.value = DataStore.typeOc;
organization.value = await (DataStore.agency != null
? DataStore.agency
: DataStore.typeOc);
@ -250,7 +237,6 @@ const fecthlistRetire = async () => {
}
})
.catch((e) => {
// console.log(e);
messageError($q, e);
});
};
@ -271,8 +257,6 @@ const fecthlistperson = async (id: string) => {
criterias: data,
})
.then((res) => {
// console.log(res);
rows2.value = res.data.result.map((e: any) => ({
id: e.id,
fullname: e.fullname == null ? "-" : e.fullname,
@ -283,14 +267,12 @@ const fecthlistperson = async (id: string) => {
modalAdd.value = true;
})
.catch((e) => {
// console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const clickAdd = async (id: string) => {
dialogConfirm(
$q,
@ -306,17 +288,14 @@ const addlistperson = async (id: string) => {
showLoader();
let data = {
profileId: id,
// insigniaId: organization.value,
insigniaPeriodId: props.roundId,
};
// console.log(data);
await http
.post(config.API.insigniaCreate(), data)
.then(() => {
success($q, "เพิ่มรายชื่อสำเร็จ");
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -333,20 +312,11 @@ const addlistperson = async (id: string) => {
});
};
// const clickAction = (props: any, action: string) => {
// Note.value = "";
// person.value = props;
// titleModal.value = props.name;
// actionModal.value = action;
// modalNote.value = true;
// };
const clickmodalEdit = (props: any) => {
insignia.value = props.insigniaSend;
// insigniaType.value = props.insigniaLevel;
person.value = props;
modalEdit.value = true;
fecthInsignia();
// fecthInsigniaType();
};
const downloadFile = (response: any, filename: string) => {
@ -393,7 +363,6 @@ const clickSave = () => {
const listEdit = async (profileId: string) => {
let data: any = {
insigniaId: insignia.value,
// insigniaTypeId: insigniaType.value,
};
await http
.put(config.API.insigniaEdit(profileId), data)
@ -499,7 +468,6 @@ const listdelete = async (id: string, reason: string) => {
const insignia = ref<string>("");
const insigniaOptions = ref<any>([]);
const insigniaType = ref<string>("");
// const insigniaTypeOptions = ref<any>([]);
const fecthInsignia = async () => {
await http
@ -507,17 +475,10 @@ const fecthInsignia = async () => {
.then((res) => {
insigniaOptions.value = res.data.result;
})
.catch(() => {
// console.log(err);
.catch((e) => {
messageError($q, e);
});
};
// const fecthInsigniaType = async () => {
// await http(config.API.insigniaType)
// .then((res) => {
// insigniaTypeOptions.value = res.data.result;
// })
// .catch((err) => {});
// };
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
@ -559,7 +520,6 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
<div class="col-12 row q-pa-md">
<div class="row col-12">
<div class="row col-12 q-col-gutter-sm">
<!-- {{ DataStore.typeinsigniaOptions }} -->
<q-select
v-if="props.roleUser == 'admin'"
v-model="organization"
@ -958,31 +918,14 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
style="min-width: 150px"
/>
</div>
<!-- <div class="col">
<q-select
v-model="insigniaType"
label="ชั้นเครื่องราชฯ"
dense
emit-value
map-options
:options="insigniaTypeOptions"
option-value="id"
option-label="name"
lazy-rules
hide-bottom-space
:readonly="false"
:borderless="false"
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
/>
</div> -->
</div>
</div>
<q-separator />
<div class="q-pa-md">
<div class="row justify-end">
<q-btn label="บันทึก" @click="clickSave" color="public" />
<q-btn label="บันทึก" @click="clickSave" color="public"
><q-tooltip>นท</q-tooltip></q-btn
>
</div>
</div>
</q-card>
@ -1002,54 +945,4 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
:click-close="closemodelPopupDelete"
:savaForm="savaReasonDelete"
/>
<!-- note -->
<!-- <q-dialog v-model="modalNote" persistent>
<q-card style="min-width: 350px">
<q-toolbar>
<q-toolbar-title class="text-subtitle2 text-bold">
<div v-if="actionModal == 'note'">
เปนเหตผลทไมนขอ {{ titleModal }}
</div>
<div v-if="actionModal == 'delete'">ลบออก {{ titleModal }}</div>
</q-toolbar-title>
<q-btn
icon="close"
unelevated
round
dense
@click="modalNote = false"
style="color: #ff8080; background-color: #ffdede"
/> </q-toolbar
><q-separator />
<q-card-section class="q-pt-none"></q-card-section>
<q-card-section class="q-pt-none">
<q-input
dense
outlined
type="textarea"
label="เหตุผลที่ไม่ยื่นขอ"
v-model="Note"
@keyup.enter="modalNote = false"
:rules="[(val) => !!val || 'เหตุผลที่ไม่ยื่นขอ']"
/>
</q-card-section>
<q-card-actions align="right" class="bg-white text-teal">
<q-btn
v-if="actionModal == 'note'"
label="บันทึก"
@click="clickSavenote"
color="public"
:disable="Note === ''"
/>
<q-btn
v-if="actionModal == 'delete'"
label="บันทึก"
@click="clickDelete"
color="public"
:disable="Note === ''"
/>
</q-card-actions>
</q-card>
</q-dialog> -->
</template>

View file

@ -6,11 +6,7 @@ import { useRouter } from "vue-router";
import DialogInformation from "@/components/Dialogs/Information.vue";
const router = useRouter();
import http from "@/plugins/http";
import config from "@/app.config";
const DataStore = useInsigniaDataStore();
const props = defineProps({
tab: {
type: String,
@ -38,7 +34,6 @@ const visibleColumns = ref<string[]>([
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
@ -143,12 +138,9 @@ onMounted(async () => {
organization.value = await (DataStore.agency != null
? DataStore.agency
: DataStore.typeOc);
// if (props.fecthInsigniaAll) {
// await props.fecthInsigniaAll(props.roundId, props.tab);
// }
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
@ -207,7 +199,6 @@ const closeReson = () => {
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<!-- {{ DataStore.typeinsigniaOptions }} -->
<div class="row col-12 q-col-gutter-sm">
<q-select
v-if="props.roleUser == 'admin'"

View file

@ -8,7 +8,6 @@ import DialogInformation from "@/components/Dialogs/Information.vue";
const router = useRouter();
const DataStore = useInsigniaDataStore();
const props = defineProps({
tab: {
type: String,
@ -138,12 +137,10 @@ onMounted(async () => {
organization.value = await (DataStore.agency != null
? DataStore.agency
: DataStore.typeOc);
// if (props.fecthInsigniaAll) {
// await props.fecthInsigniaAll(props.roundId, props.tab);
// }
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
@ -152,9 +149,9 @@ onMounted(async () => {
}
}
});
const changtypeOc = () => {
const changtypeOc = async () => {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
@ -342,8 +339,7 @@ const closeReson = () => {
flat
round
color="blue"
@click.stop
@click="showNote(props.row)"
@click.stop="showNote(props.row)"
icon="mdi-information-outline"
>
<q-tooltip>เหตผลการลบ</q-tooltip>

View file

@ -9,7 +9,6 @@ import config from "@/app.config";
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const props = defineProps({
roundId: {
type: String,
@ -73,12 +72,6 @@ const fecthOrg = async () => {
});
};
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
const pagination = ref({
sortBy: "desc",
descending: false,
@ -94,77 +87,11 @@ const paginationLabel = (start: number, end: number, total: number) => {
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<!-- <div class="row col-12 q-col-gutter-sm">
<q-select
v-model="organization"
label="หน่วยงาน"
dense
emit-value
map-options
:options="organizationOptions"
option-value="id"
option-label="name"
lazy-rules
hide-bottom-space
:readonly="false"
:borderless="false"
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 150px"
/>
<div>
<q-btn size="md" icon="mdi-download" flat round color="primary">
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn 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">
<q-table
ref="table"
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="name"
dense
flat
@ -180,8 +107,6 @@ const paginationLabel = (start: number, end: number, total: number) => {
<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">

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { onMounted, ref } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import http from "@/plugins/http";
@ -21,17 +21,13 @@ const roleUser = ref<string>("admin");
const DataStore = useInsigniaDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const router = useRouter();
const $q = useQuasar(); // noti quasar
const loading = ref<boolean>(false);
const round = ref<string>("");
const roundName = ref<string>("");
const optionRound = ref<any>([]);
// const typeOc = ref<string>("kljkljk");
const optiontypeOc = ref<any>([]);
const tab = ref<any>("pending");
const stat = ref<any>({
allUserUser: 0,
@ -57,7 +53,6 @@ const checkRole = async () => {
} else {
roleUser.value = "admin";
}
// console.log("roleUser ===> ", roleUser.value);
}
};
@ -70,8 +65,6 @@ const fecthlistRound = async () => {
year: e.period_year,
name: e.period_name,
}));
// console.log(optionRound.value);
// const lastIndex = optionRound.value.length;
const lastValue = optionRound.value[0];
round.value = lastValue.id.toString();
roundName.value = lastValue.name;
@ -126,10 +119,8 @@ const fecthType = async () => {
name: e.organizationName,
}));
DataStore.fetchOption(optiontypeOc.value);
// DataStore.optionsTypeOc = ;
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
@ -151,21 +142,6 @@ const changround = async () => {
roundFilter.year + 543
}`;
};
// const fecthInsigniaAll = async (periodId: string, tab: string) => {
// // let data: any = [];
// // for (const item of DataStore.optionsTypeOc) {
// // await http
// // .get(config.API.insigniaList(periodId, item["id"], "officer", tab))
// // .then((res) => {
// // // console.log(res);
// // data.push(res.data.result);
// // })
// // .catch((err) => {
// // console.log(err);
// // });
// // }
// // console.log(data);
// };
const requestNote = ref<string>("");
const requestStatus = ref<string>("");
const fecthInsigniaByOc = async (
@ -175,19 +151,16 @@ const fecthInsigniaByOc = async (
status: string
) => {
showLoader();
// console.log("ocId===>", ocId);
await http
.get(config.API.insigniaList(roundId, ocId, role, status))
.then(async (res) => {
// console.log(res);
requestNote.value = res.data.result.requestNote;
requestStatus.value = res.data.result.requestStatus;
await DataStore.fetchData(res.data.result.items);
})
.catch((err) => {
// console.log(err);
messageError($q);
messageError($q, err);
})
.finally(() => {
loading.value = true;
@ -210,7 +183,6 @@ const sendToDirector = async () => {
);
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -249,7 +221,6 @@ const backToEdit = async (reason: string) => {
);
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -279,7 +250,6 @@ const directorApproved = async () => {
);
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -308,7 +278,6 @@ const requestSendNote = async () => {
);
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -479,7 +448,9 @@ const requestSendNote = async () => {
color="public"
class="q-px-md q-ml-md"
@click="requestSendNote"
/>
>
<q-tooltip>นทกขอม</q-tooltip>
</q-btn>
</q-toolbar>
<DialogPopupReason

View file

@ -20,22 +20,18 @@ const {
hideLoader,
notifyError,
} = mixin;
const status = ref<status>("");
const status = ref<string>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
const brand = ref<string>("");
const cardid = ref<string>("");
const prefixId = ref<string>("");
const fullName = ref<string>("");
const volume = ref<string>("");
const episode = ref<string>("");
const duty = ref<string>("");
const announced = ref<string>("");
const firstname = ref<string>("");
const lastname = ref<string>("");
const position = ref<string>("");
const invoice = ref<string | null>(null);
const payment = ref<string>("");
const addressPayment = ref<string | null>(null);
const affiliationRequest = ref<string>("");
@ -56,46 +52,6 @@ const paymentOp = [
{ label: "จัดส่งทางไปรษณี", value: "จัดส่งทางไปรษณี" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
];
const volumeOp = [
{ label: "เล่มที่", value: "xx1" },
{ label: "เล่มที่2", value: "xx2" },
{ label: "เล่มที่3", value: "xx3" },
];
const episodeOp = [
{ label: "ตอนที่1", value: "xx1" },
{ label: "ตอนที่2", value: "xx2" },
{ label: "ตอนที่3", value: "xx3" },
];
const dutyOp = [
{ label: "หน้าที่1", value: "xx1" },
{ label: "หน้าที่2", value: "xx2" },
{ label: "หน้าที่3", value: "xx3" },
];
const announcedOp = [
{ label: "ลำดับที่1", value: "xx1" },
{ label: "ลำดับที่2", value: "xx2" },
{ label: "ลำดับที่3", value: "xx3" },
];
const affiliationRequestOp = [
{ label: "สังกัด1", value: "xx1" },
{ label: "สังกัด2", value: "xx2" },
{ label: "สังกัด3", value: "xx3" },
];
const affiliationReceivedOp = [
{ label: "สังกัด4", value: "xx4" },
{ label: "สังกัด5", value: "xx5" },
{ label: "สังกัด6", value: "xx6" },
];
const prefixOp = [
{ label: "นาย", value: "mr" },
{ label: "นางสาว", value: "miss" },
{ label: "นาง", value: "mrs" },
];
const positionOp = [
{ label: "ตำแหน่ง1", value: "xxx1" },
{ label: "ตำแหน่ง2", value: "xxx2" },
{ label: "ตำแหน่ง3", value: "xxx3" },
];
const clearDateExam = () => {
receivedate.value = null;
announceDate.value = null;
@ -141,12 +97,12 @@ watch(props, () => {
episode.value = "";
duty.value = "";
announced.value = "";
// invoice.value = "";
invoiceDate.value = null;
payment.value = "";
if (props.action === "editData") {
fectDataByid(props.personId);
if (props.personId !== undefined) {
if (props.action === "editData") {
fectDataByid(props.personId);
}
}
}
});
@ -205,11 +161,10 @@ const findlist = async (id: string) => {
criterias: data,
})
.then((res) => {
// console.log(res.data.result);
listPerson.value = res.data.result;
})
.catch((e) => {
console.log(e);
messageError($q, e);
})
.finally(() => {
hideLoader();
@ -217,7 +172,9 @@ const findlist = async (id: string) => {
};
const fectDataByid = async (id: string) => {
showLoader();
employeeClass.value = "";
if (props.profileType !== undefined) {
employeeClass.value = props.profileType.toString();
}
await http
.get(config.API.noteByid(id))
.then((res) => {
@ -240,7 +197,6 @@ const fectDataByid = async (id: string) => {
payment.value = data.typePayment;
addressPayment.value = data.address;
status.value = data.status;
employeeClass.value = props.profileType;
})
.catch((err) => {
console.log(err);
@ -264,7 +220,6 @@ const clickSave = async () => {
section: episode.value, //
page: duty.value, //
no: announced.value,
// : invoice.value,
datePayment: invoiceDate.value, //
typePayment: payment.value, //
address: addressPayment.value, //
@ -278,20 +233,21 @@ const clickSave = async () => {
});
};
const addNote = async (body: any) => {
await http
.put(config.API.noteAdd(props.roundId), body)
.then(() => {
success($q, "เพิ่มราชชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close();
});
if (props.roundId !== undefined) {
await http
.put(config.API.noteAdd(props.roundId), body)
.then(() => {
success($q, "เพิ่มราชชื่อสำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
props.close();
});
}
};
const searchcardid = () => {
// console.log(cardid.value);
if (cardid.value.length === 13) {
let data = listPerson.value.find((e: any) => e.citizenId === cardid.value);
if (data) {
@ -314,7 +270,8 @@ const searchcardid = () => {
dense
@click="props.close"
style="color: #ff8080; background-color: #ffdede"
/>
><q-tooltip></q-tooltip></q-btn
>
</q-toolbar>
<q-separator />
@ -368,24 +325,8 @@ const searchcardid = () => {
mask="#############"
@keyup="searchcardid"
/>
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
</div>
<!-- <div class="col-xs-12 col-sm-4">
<q-select
:rules="[(val) => !!val || 'กรุณาเลือกคำนำหน้าชื่อ']"
hide-bottom-space
:options="prefixOp"
class="col-xs-12 col-sm-6 inputgreen"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="prefixId"
:label="`คำนำหน้าชื่อ`"
:disable="disbleStatus"
/>
</div> -->
<div class="col-xs-6 col-sm-4">
<q-input
disable
@ -412,35 +353,10 @@ const searchcardid = () => {
v-model="position"
:label="`ตำเเหน่ง`"
/>
<!-- <q-select
:disable="disbleStatus"
hide-bottom-space
:options="positionOp"
class="col-xs-12 col-sm-6 inputgreen"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="position"
:label="`ตำเเหน่ง`"
/> -->
</div>
<div class="col-6"></div>
<!-- <div class="col-xs-6 col-sm-3 col-md-5">
<q-input
hide-bottom-space
outlined
dense
lazy-rules
borderless
v-model="lastname"
:rules="[(val:string) => !!val || `${'กรุณากรอก นามสกุล'}`]"
:label="`${'นามสกุล'}`"
/>
</div> -->
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดตำเเหน
@ -462,18 +378,6 @@ const searchcardid = () => {
/>
</div>
<div class="col-xs-12 col-sm-6">
<!-- <q-input
:disable="disbleStatus"
:rules="[
(val) => !!val || 'กรุณากรอกชื่อชั้นตราเครื่องราชอิสริยาภรณ์',
]"
hide-bottom-space
dense
borderless
outlined
v-model="brand"
label="ชั้นตราเครื่องราชอิสริยาภรณ์"
/> -->
<q-select
:disable="disbleStatus || status == 'DONE'"
v-model="brand"
@ -563,20 +467,6 @@ const searchcardid = () => {
v-model="affiliationRequest"
label="สังกัด ณ วันที่ขอพระราชทานเครื่องราชอิสริยาภรณ์"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกสังกัด']"
hide-bottom-space
:options="affiliationRequestOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="affiliationRequest"
:label="`สังกัด ณ วันที่ขอพระราชทานเครื่องราชอิสริยาภรณ์`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -591,19 +481,6 @@ const searchcardid = () => {
v-model="affiliationReceived"
label="สังกัด ณ วันที่ได้รับประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์"
/>
<!-- <q-select
:rules="[(val) => !!val || 'กรุณาเลือกสังกัด']"
hide-bottom-space
:options="affiliationReceivedOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="affiliationReceived"
:label="`สังกัด ณ วันที่ได้รับประกาศนียบัตรกำกับเครื่องราชอิสริยาภรณ์`"
/> -->
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
@ -665,21 +542,6 @@ const searchcardid = () => {
:label="`เล่มที่`"
:rules="[(val) => !!val || 'กรุณากรอกเล่มที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกเล่มที่']"
hide-bottom-space
:options="volumeOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
emit-value
v-model="volume"
:label="`เล่มที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-4">
<q-input
@ -694,21 +556,6 @@ const searchcardid = () => {
:label="`ตอนที่`"
:rules="[(val) => !!val || 'กรุณากรอกตอนที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกตอนที่']"
hide-bottom-space
:options="episodeOp"
class="col-xs-12 col-sm-6"
dense
borderless
option-label="label"
option-value="value"
outlined
v-model="episode"
emit-value
:label="`ตอนที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -723,21 +570,6 @@ const searchcardid = () => {
:label="`หน้าที่`"
:rules="[(val) => !!val || 'กรุณากรอกหน้าที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกหน้าที่']"
hide-bottom-space
:options="dutyOp"
class="col-xs-12 col-sm-6"
dense
emit-value
borderless
option-label="label"
option-value="value"
outlined
v-model="duty"
:label="`หน้าที่`"
/> -->
</div>
<div class="col-xs-12 col-sm-6">
<q-input
@ -752,36 +584,11 @@ const searchcardid = () => {
:label="`ลำดับที่`"
:rules="[(val) => !!val || 'กรุณากรอกลำดับที่']"
/>
<!-- <q-select
:disable="disbleStatus"
:rules="[(val) => !!val || 'กรุณาเลือกลำดับที่']"
hide-bottom-space
:options="announcedOp"
class="col-xs-12 col-sm-6"
dense
emit-value
borderless
option-label="label"
option-value="value"
outlined
v-model="announced"
:label="`ลำดับที่`"
/> -->
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
ผลการจายใบกำก
</div>
<!-- <div class="col-xs-12 col-sm-4"> -->
<!-- :rules="[(val) => !!val || 'กรุณากรแกหมายเล่นใบกำกับ']" -->
<!-- <q-input
dense
borderless
outlined
v-model="invoice"
label="หมายเลขใบกํากับ"
/>
</div> -->
<div class="col-xs-12 col-sm-6">
<datepicker
menu-class-name="modalfix"
@ -860,7 +667,9 @@ const searchcardid = () => {
<q-separator />
<div class="q-pa-md">
<div class="row justify-end">
<q-btn label="บันทึก" @click="clickSave" color="public" />
<q-btn label="บันทึก" @click="clickSave" color="public"
><q-tooltip>นท</q-tooltip></q-btn
>
</div>
</div>
</q-card>

View file

@ -1,18 +1,17 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import { useCounterMixin } from '@/stores/mixin'
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
const mixin = useCounterMixin()
const { success, messageError,hideLoader,dialogConfirm } = mixin
const mixin = useCounterMixin();
const { success, messageError, hideLoader, dialogConfirm, showLoader } = mixin;
const fileUpload = ref<any>(null);
const reason = ref<string>("");
const file = ref<string>("");
const documentTitle = ref<string>("");
const $q = useQuasar();
const $q = useQuasar();
const filterKeyword = ref<string>("");
const filterDoc = ref<any>(null);
@ -55,9 +54,9 @@ const colums2 = ref<QTableProps["columns"]>([
const rows2 = ref<any>([]);
interface TypeData {
fileName:string
reason:string
pathName:string
fileName: string;
reason: string;
pathName: string;
}
const props = defineProps({
roundId: {
@ -66,41 +65,39 @@ const props = defineProps({
});
const getRequest = async () => {
showLoader();
await http
.get(config.API.requestDocNote(props.roundId as string))
.then((res:any) =>{
console.log(res)
const data = res.data.result
console.log(data)
data.map((item:TypeData) =>{
rows2.value.push({
fileName:item.fileName,
annotation:item.reason,
file:item.pathName
})
}
)
console.log(rows2.value)
})
.catch((e) => {
.get(config.API.requestDocNote(props.roundId as string))
.then((res: any) => {
const data = res.data.result;
data.map((item: TypeData) => {
rows2.value.push({
fileName: item.fileName,
annotation: item.reason,
file: item.pathName,
});
});
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
};
const putRequest = () => {
const dataAppend = new FormData()
dataAppend.append("Name",documentTitle.value)
dataAppend.append("Reason",reason.value)
dataAppend.append("File",fileUpload.value)
http
.put(config.API.requestDocNote(props.roundId as string),dataAppend)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
const putRequest = 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(() => {
@ -110,10 +107,9 @@ const putRequest = () => {
getRequest();
hideLoader();
});
}
onMounted(async() => {
console.log(props.roundId);
await getRequest()
};
onMounted(async () => {
await getRequest();
});
const resetFilterRef = () => {
filterKeyword.value = "";
@ -126,8 +122,8 @@ const pagination = ref({
rowsPerPage: 10,
});
const save = () => {
dialogConfirm($q,()=>putRequest())
}
dialogConfirm($q, () => putRequest());
};
</script>
<template>
<Transition>
@ -171,7 +167,9 @@ const save = () => {
/>
</div>
<div class="col-12 flex justify-end">
<q-btn label="บันทึก" @click="save" color="public" />
<q-btn label="บันทึก" @click="save" color="public">
<q-tooltip>นท</q-tooltip></q-btn
>
</div>
<div class="row col-12">
<q-space />
@ -238,13 +236,15 @@ const save = () => {
{{ props.row.fileName }}
</q-td>
<q-td key="annotation" :props="props">
{{ props.row.annotation !== null ? props.row.annotation:"-"}}
{{
props.row.annotation !== null ? props.row.annotation : "-"
}}
</q-td>
<q-td auto-width>
<q-btn
type="a"
:href="props.row.file"
target="_blank"
type="a"
:href="props.row.file"
target="_blank"
dense
size="14px"
flat

View file

@ -63,10 +63,9 @@ const fecthRound = async () => {
}));
selectRound.value = data[0].id;
roundYear.value = data[0].year;
// console.log(roundYear.value);
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
};
@ -82,7 +81,7 @@ const fecthInsignia = async () => {
})
.finally(async () => {
insigniaOp.value = await DataStore.insigniaOp.filter(
(x: any) => x.type == tab.value || x.type === ""
(x: any) => x.type == tab.value || x.type === ""
);
});
};
@ -90,16 +89,13 @@ const fecthInsignia = async () => {
const fecthInsigniaType = async () => {
await http(config.API.insigniaType)
.then((res) => {
// console.log(res);
let data = res.data.result;
DataStore.fetchDatainsigniaType(data);
tab.value = DataStore.insigniaType[0].name;
// fecthlistInsignia();
fecthInsignia();
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
};
@ -159,7 +155,6 @@ const columns = ref<QTableProps["columns"]>([
},
]);
watch(tab, () => {
console.log(DataStore.insigniaOp);
insigniaOp.value = DataStore.insigniaOp.filter(
(x: any) => x.type == tab.value || x.type === ""
);
@ -182,7 +177,6 @@ const fecthlistInsignia = async () => {
DataStore.listinsignia(data);
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
@ -542,31 +536,4 @@ const resetFilter = () => {
/>
</template>
<style lang="scss" scoped>
.arrow {
transition: transform 0.5s;
}
.arrow-active {
transition: transform 0.5s;
transform: rotate(-90deg);
}
.bg-base {
background-color: #f3f3f398;
}
.v-enter-active,
.v-leave-active {
transition: opacity 0.5s ease;
}
.v-enter-from,
.v-leave-to {
opacity: 0;
}
.flexsave {
display: flex;
justify-content: flex-end;
}
</style>

View file

@ -1,13 +1,11 @@
<script setup lang="ts">
import { ref, watch, computed } from "vue";
import { ref, watch } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import { useAllocateDataStore } from "@/modules/07_insignia/storeAllocate";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DataOption } from "@/modules/04_registry/components/profileType";
const DataStore = useAllocateDataStore();
const $q = useQuasar();
const myForm = ref<QForm>();
const mixin = useCounterMixin();
@ -32,17 +30,17 @@ const returndate = ref<Date | null>();
const reason = ref<string>("");
const listPerson = ref<any>([]);
const OrgList = ref<DataOption[]>([]);
const insigniaNoteProfileId = ref<string>("")
const insigniaNoteProfileId = ref<string>("");
const clearData = () => {
receivedate.value = null
returndate.value = null
OrganazationId.value = ""
roundNo.value = ""
cardid.value = ""
fullName.value = ""
brand.value = ""
reason.value = ""
receivedate.value = null;
returndate.value = null;
OrganazationId.value = "";
roundNo.value = "";
cardid.value = "";
fullName.value = "";
brand.value = "";
reason.value = "";
};
const props = defineProps({
@ -69,21 +67,21 @@ const props = defineProps({
type: String,
},
selectRoundOption: {
type: Array
type: Array,
},
profileId: {
type: String,
default: ""
}
default: "",
},
});
watch(props, () => {
if (props.modal == true && props.roundId != 'all') {
roundNo.value = props.roundId
fecthlistInsignia()
fetchOrgList()
if (props.action == 'editData') {
fetchData()
if (props.modal == true && props.roundId != "all") {
roundNo.value = props.roundId;
fecthlistInsignia();
fetchOrgList();
if (props.action == "editData") {
fetchData();
}
}
});
@ -98,10 +96,9 @@ const fecthlistInsignia = async () => {
await http
.post(config.API.noteSearch(), data)
.then((res) => {
listPerson.value = res.data.result
listPerson.value = res.data.result;
})
.catch((err) => {
// console.log(err);
messageError($q, err);
})
.finally(() => {
@ -116,17 +113,23 @@ const fetchOrgList = async () => {
.then(async (response: any) => {
const orgArr = response.data.result.map((e: any) => ({
id: e.organizationId,
name: e.organizationName
}))
name: e.organizationName,
}));
if (props.action == 'editData') {
OrgList.value = [{id: "00000000-0000-0000-0000-000000000000", name: 'สำนักนายกรัฐมนตรี'},...orgArr]
if (props.action == "editData") {
OrgList.value = [
{
id: "00000000-0000-0000-0000-000000000000",
name: "สำนักนายกรัฐมนตรี",
},
...orgArr,
];
} else {
OrgList.value = orgArr
OrgList.value = orgArr;
}
})
.catch((err) => {
messageError($q, err)
messageError($q, err);
})
.finally(() => {
hideLoader();
@ -138,10 +141,10 @@ const fetchData = async () => {
await http
.get(config.API.insigniaManageBorrowById(props.profileId))
.then(async (response: any) => {
console.log(response.data.result)
console.log(response.data.result);
})
.catch((err) => {
messageError($q, err)
messageError($q, err);
})
.finally(() => {
hideLoader();
@ -152,12 +155,12 @@ const clickSave = async () => {
await myForm.value!.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, async () => {
if (props.action == 'addData') {
if (props.action == "addData") {
await http
.post(config.API.insigniaManageBorrow(), {
borrowDate: receivedate.value,
borrowOrganizationId: OrganazationId.value,
insigniaNoteProfileId: insigniaNoteProfileId.value
insigniaNoteProfileId: insigniaNoteProfileId.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -166,7 +169,7 @@ const clickSave = async () => {
messageError($q, err);
})
.finally(() => {
clearData()
clearData();
props.closeAndFecth();
});
} else {
@ -174,7 +177,7 @@ const clickSave = async () => {
.put(config.API.insigniaManageBorrowReturn(props.profileId), {
returnDate: returndate.value,
returnOrganizationId: OrganazationId.value,
returnReason: reason.value
returnReason: reason.value,
})
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
@ -183,7 +186,7 @@ const clickSave = async () => {
messageError($q, err);
})
.finally(() => {
clearData()
clearData();
props.closeAndFecth();
});
}
@ -194,21 +197,23 @@ const clickSave = async () => {
const searchcardid = async () => {
if (cardid.value.length === 13) {
const node = await listPerson.value.find((e: any) => e.citizenId === cardid.value);
const node = await listPerson.value.find(
(e: any) => e.citizenId === cardid.value
);
if (node) {
console.log("node", node)
fullName.value = `${node.prefix} ${node.fullName}`
brand.value = node.requestInsignia
insigniaNoteProfileId.value = node.id
console.log("node", node);
fullName.value = `${node.prefix} ${node.fullName}`;
brand.value = node.requestInsignia;
insigniaNoteProfileId.value = node.id;
} else notifyError($q, "ไม่พบข้อมูลการได้รับในรอบนี้");
}
};
const closeDialog = () => {
clearData()
props.close()
}
clearData();
props.close();
};
</script>
<template>
@ -216,39 +221,81 @@ const closeDialog = () => {
<q-card style="min-width: 900px" class="q-pb-md">
<q-toolbar class="q-py-md">
<q-toolbar-title class="text-h6">-นเครองราชฯ </q-toolbar-title>
<q-btn icon="close" unelevated round dense @click="closeDialog"
style="color: #ff8080; background-color: #ffdede" />
<q-btn
icon="close"
unelevated
round
dense
@click="closeDialog"
style="color: #ff8080; background-color: #ffdede"
><q-tooltip></q-tooltip></q-btn
>
</q-toolbar>
<q-separator />
<q-form ref="myForm">
<div class="q-pa-md">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<div v-if="props.action === 'addData'" class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs">
<div
class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"
>
<div
v-if="props.action === 'addData'"
class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs"
>
<div class="col-6">
<q-select v-model="roundNo" dense outlined lazy-rules hide-bottom-space
:label="`${'รอบการขอเครื่องราชฯ'}`" emit-value map-options option-label="name"
:options="selectRoundOption" option-value="id" :readonly="false" :borderless="false"
style="min-width: 150px" :rules="[
(val) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ',
]" @update:model-value="fecthlistInsignia()" />
</div>
<div class="col-12 text-weight-bold text-grey">
อมลผ
<q-select
v-model="roundNo"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'รอบการขอเครื่องราชฯ'}`"
emit-value
map-options
option-label="name"
:options="selectRoundOption"
option-value="id"
:readonly="false"
:borderless="false"
style="min-width: 150px"
:rules="[(val) => !!val || 'กรุณาเลือกรอบการขอเครื่องราชฯ']"
@update:model-value="fecthlistInsignia()"
/>
</div>
<div class="col-12 text-weight-bold text-grey">อมลผ</div>
<div class="col-xs-12 col-sm-6">
<q-input :disable="roundNo == ''" hide-bottom-space outlined class="inputgreen" v-model="cardid" dense
lazy-rules :rules="[
<q-input
:disable="roundNo == ''"
hide-bottom-space
outlined
class="inputgreen"
v-model="cardid"
dense
lazy-rules
:rules="[
(val: string) => !!val || `${'กรุณากรอก เลขบัตรประจำตัวประชาชน'}`,
(val: string) =>
val.length >= 13 ||
`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,
]" label="เลขบตรประจำตวประชาชน" maxlength="13" mask="#############" @keyup="searchcardid" />
<!-- :rules="[(val:any) =>val.length != 13 ||`${'กรุณากรอกเลขบัตรประจำตัวประชาชนให้ครบ'}`,]" -->
]"
label="เลขบัตรประจำตัวประชาชน"
maxlength="13"
mask="#############"
@keyup="searchcardid"
/>
</div>
<div class="col-xs-6 col-sm-6">
<q-input disable hide-bottom-space outlined dense lazy-rules class="inputgreen" borderless
v-model="fullName" :label="`${'ชื่อ-นามสกุล'}`" />
<q-input
disable
hide-bottom-space
outlined
dense
lazy-rules
class="inputgreen"
borderless
v-model="fullName"
:label="`${'ชื่อ-นามสกุล'}`"
/>
</div>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
@ -256,12 +303,26 @@ const closeDialog = () => {
รายละเอยดการยมเครองราชฯ
</div>
<div class="col-xs-12 col-sm-6">
<q-input v-model="brand" disable dense outlined lazy-rules hide-bottom-space
:label="`${'เครื่องราชฯ'}`" />
<q-input
v-model="brand"
disable
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'เครื่องราชฯ'}`"
/>
</div>
<div class="col-xs-12 col-sm-6">
<datepicker menu-class-name="modalfix" v-model="receivedate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<datepicker
menu-class-name="modalfix"
v-model="receivedate"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
@ -269,11 +330,24 @@ const closeDialog = () => {
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input dense borderless outlined :rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space
:model-value="receivedate != null ? date2Thai(receivedate) : undefined
" :label="`${'วันที่ยืม'}`" clearable>
<q-input
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
hide-bottom-space
:model-value="
receivedate != null ? date2Thai(receivedate) : undefined
"
:label="`${'วันที่ยืม'}`"
clearable
>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
@ -282,20 +356,40 @@ const closeDialog = () => {
</div>
<div class="col-xs-12 col-sm-6">
<q-select hide-bottom-space :options="OrgList" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId" :label="`เลือกหน่วยงาน`" />
<q-select
hide-bottom-space
:options="OrgList"
dense
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
v-model="OrganazationId"
:label="`เลือกหน่วยงาน`"
/>
</div>
</div>
<div class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs" v-if="props.action === 'editData'">
<div
class="row col-12 q-col-gutter-x-xs q-col-gutter-y-xs"
v-if="props.action === 'editData'"
>
<div class="col-12 q-my-xs"><q-separator size="2px" /></div>
<div class="col-12 text-weight-bold text-grey">
รายละเอยดการคนเครองราชฯ
</div>
<div class="col-xs-12 col-sm-6">
<datepicker menu-class-name="modalfix" v-model="returndate" :locale="'th'" autoApply borderless
:enableTimePicker="false" week-start="0">
<datepicker
menu-class-name="modalfix"
v-model="returndate"
:locale="'th'"
autoApply
borderless
:enableTimePicker="false"
week-start="0"
>
<template #year="{ year }">
{{ year + 543 }}
</template>
@ -303,11 +397,24 @@ const closeDialog = () => {
{{ parseInt(value + 543) }}
</template>
<template #trigger>
<q-input dense borderless outlined :rules="[(val) => !!val || 'กรุณาเลือกวันที่']" hide-bottom-space
:model-value="returndate != null ? date2Thai(returndate) : undefined
" :label="`${'วันที่คืน'}`" clearable>
<q-input
dense
borderless
outlined
:rules="[(val) => !!val || 'กรุณาเลือกวันที่']"
hide-bottom-space
:model-value="
returndate != null ? date2Thai(returndate) : undefined
"
:label="`${'วันที่คืน'}`"
clearable
>
<template v-slot:prepend>
<q-icon name="event" class="cursor-pointer" color="primary">
<q-icon
name="event"
class="cursor-pointer"
color="primary"
>
</q-icon>
</template>
</q-input>
@ -316,16 +423,37 @@ const closeDialog = () => {
</div>
<div class="col-xs-12 col-sm-6">
<q-select hide-bottom-space :options="OrgList" dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="OrganazationId" :label="`เลือกหน่วยงานที่ส่งคืน`" />
<q-select
hide-bottom-space
:options="OrgList"
dense
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
v-model="OrganazationId"
:label="`เลือกหน่วยงานที่ส่งคืน`"
/>
</div>
<div class="col-12">
<q-input type="textarea" hide-bottom-space dense borderless option-label="name" option-value="id"
emit-value map-options outlined v-model="reason" :label="`สาเหตุที่ส่งคืนเครื่องราชอิสริยาภรณ์`" />
<q-input
type="textarea"
hide-bottom-space
dense
borderless
option-label="name"
option-value="id"
emit-value
map-options
outlined
v-model="reason"
:label="`สาเหตุที่ส่งคืนเครื่องราชอิสริยาภรณ์`"
/>
</div>
</div>
</div>
</div>
</q-form>
@ -333,9 +461,11 @@ const closeDialog = () => {
<q-separator />
<div class="q-pa-md">
<div class="row justify-end">
<q-btn label="บันทึก" @click="clickSave" color="public" />
<q-btn label="บันทึก" @click="clickSave" color="public">
<q-tooltip>นท</q-tooltip>
</q-btn>
</div>
</div>
</q-card>
</q-dialog>
</template>
</template>

View file

@ -11,17 +11,9 @@ import type { OptionDataYear } from "@/modules/07_insignia/interface/index/Main"
import type { QTableProps, QInput } from "quasar";
import { useQuasar } from "quasar";
// const router = useRouter();
const DataStore = useBrrowDataStore();
const mixin = useCounterMixin();
const {
date2Thai,
dialogConfirm,
showLoader,
hideLoader,
messageError,
success,
} = mixin;
const { showLoader, hideLoader, messageError } = mixin;
const $q = useQuasar();
const tab = ref<string>("");
@ -31,10 +23,8 @@ const selectRoundAllOption = ref<OptionDataYear[]>([]);
const modal = ref<boolean>(false);
const action = ref<string>("");
const personId = ref<string>();
const profileId = ref<string>("");
const roundYear = ref<any>();
const insigniaListAll = ref<any>([]);
const insigniaList = ref<any>([]);
onMounted(async () => {
@ -46,8 +36,6 @@ const fecthRound = async () => {
.get(config.API.noteround())
.then((res) => {
let data = res.data.result;
console.log(data);
selectRoundAllOption.value = [
{
name: "ทั้งหมด",
@ -73,7 +61,7 @@ const fecthRound = async () => {
roundYear.value = data[0].year;
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
};
@ -81,7 +69,6 @@ const fecthInsignia = async () => {
await http
.get(config.API.insignia)
.then((res) => {
// console.log(res);
let data = res.data.result;
DataStore.fetchDataInsignia(data);
})
@ -98,7 +85,6 @@ const fecthInsignia = async () => {
const fecthInsigniaType = async () => {
await http(config.API.insigniaType)
.then(async (res) => {
// console.log(res);
let data = res.data.result;
DataStore.fetchDatainsigniaType(data);
tab.value = DataStore.insigniaType[0].name;
@ -316,7 +302,6 @@ const fecthlistInsignia = async () => {
rows.value = DataStore.rows;
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(() => {
@ -514,11 +499,7 @@ const resetFilter = () => {
:modal="modal"
:close="close"
:close-and-fecth="closeAndFecth"
:round-id="
selectRound == '00000000-0000-0000-0000-000000000000'
? 'all'
: selectRound
"
:round-id="selectRound == '0' ? 'all' : selectRound"
:action="action"
:profile-id="profileId"
:select-round-option="selectRoundOption"

View file

@ -1,6 +1,5 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
// import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
@ -13,7 +12,6 @@ import type { OptionData } from "@/modules/07_insignia/interface/index/Main";
import type { QTableProps, QInput } from "quasar";
import { useQuasar } from "quasar";
// const router = useRouter();
const DataStore = useResultDataStore();
const mixin = useCounterMixin();
const {
@ -59,24 +57,22 @@ const fecthInsignia = async () => {
await http
.get(config.API.insignia)
.then((res) => {
console.log(res);
let data = res.data.result;
DataStore.fetchDatainsignia(data);
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
};
const fecthInsigniaType = async () => {
await http(config.API.insigniaType)
.then((res) => {
// console.log(res);
let data = res.data.result;
DataStore.fetchDatainsigniaType(data);
tab.value = DataStore.insigniaType[0].name;
})
.catch((err) => {
console.log(err);
messageError($q, err);
});
};
const visibleColumns = ref<String[]>([
@ -271,7 +267,6 @@ const uploadFile = async (event: any, action: string) => {
success($q, "อัพโหลดไฟล์สำเร็จ");
})
.catch((err) => {
console.log(err);
messageError($q, err);
})
.finally(async () => {
@ -288,43 +283,6 @@ const uploadFile = async (event: any, action: string) => {
"ยืนยันการบันทึกรายการข้อมูล",
"ต้องการยืนยันรายการข้อมูลนี้หรื้อไม่ ?";
}
// console.log(selectRound.value);
// let id = selectRound.value.toString();
// if (action === "result") {
// const formdata = new FormData();
// formdata.append("file", event);
// await http
// .put(config.API.uploadfilereceice(id), formdata)
// .then(() => {
// success($q, "");
// })
// .catch((err) => {
// console.log(err);
// messageError($q, err);
// })
// .finally(async () => {
// await fecthlistInsignia();
// fileResult.value = null;
// });
// } else if (action === "invoice") {
// const formdata = new FormData();
// formdata.append("file", event);
// await http
// .put(config.API.uploadfileinvoice(id), formdata)
// .then(() => {
// success($q, "");
// })
// .catch((err) => {
// console.log(err);
// messageError($q, err);
// })
// .finally(async () => {
// await fecthlistInsignia();
// fileinvoice.value = null;
// });
// }
// }
};
const filterRef = ref<QInput>();
@ -482,7 +440,6 @@ const resetFilter = () => {
icon="mdi-upload"
@click="perviewfile(fileResult, 'receice')"
>
<!-- @click="uploadFile(fileResult, 'result')" -->
<q-tooltip
>พโหลดไฟลนทกผลการไดบพระราชทานเครองราชอสรยาภรณ</q-tooltip
>