ปรับ code และ ปุม delete รายการรอบการปฏิบัติงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-14 09:20:30 +07:00
parent bcb46fa272
commit 01cbfe6245
17 changed files with 1452 additions and 996 deletions

View file

@ -1,9 +1,14 @@
<script setup lang="ts">
const sizeCard = (val: number) => {
/**
* @param val sizeCard
*/
function sizeCard(val: number) {
if (val === 5) {
return "width:20%;";
}
};
}
/** props ข้อมูลจาก listManager*/
const props = defineProps({
color: {
type: String,

View file

@ -1,21 +1,27 @@
<script setup lang="ts">
import { onMounted, ref, computed, reactive } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar, QForm } from "quasar";
import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import http from "@/plugins/http";
import config from "@/app.config";
import { useRouter } from "vue-router";
/** import Type*/
import type { QTableProps } from "quasar";
/** import components*/
import DialogPopupReason from "@/components/Dialogs/PopupReason.vue";
import DialogInformation from "@/components/Dialogs/Information.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import btnDownloadFile from "./downloadFile.vue";
import btnDownloadFile from "@/modules/07_insignia/components/2_Manage/downloadFile.vue";
const myForm = ref<QForm>();
const router = useRouter();
/** import Stores*/
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useroleUserDataStore } from "@/stores/roleUser";
import { useCounterMixin } from "@/stores/mixin";
/**user stores*/
const DataStore = useInsigniaDataStore();
const roleDataStore = useroleUserDataStore();
const mixin = useCounterMixin();
const {
dialogConfirm,
@ -25,9 +31,10 @@ const {
success,
dialogMessageNotify,
} = mixin;
const myForm = ref<QForm>();
const router = useRouter();
const $q = useQuasar();
const DataStore = useInsigniaDataStore();
const roleDataStore = useroleUserDataStore();
const modelPopupReject = ref<boolean>(false);
const modelPopupDelete = ref<boolean>(false);
@ -35,18 +42,22 @@ const modalAdd = ref<boolean>(false);
const modalEdit = ref<boolean>(false);
const rowid = ref<string>("");
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 dialogWarn = ref<boolean>(false);
const checkboxData = ref<any>([]);
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const filterOrganizationOP = ref<any>([]);
/** หัวตาราง*/
const visibleColumns = ref<string[]>([
"no",
"citizenId",
@ -62,7 +73,6 @@ const visibleColumns = ref<string[]>([
"note",
"warn",
]);
//
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -182,7 +192,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const columns2 = ref<QTableProps["columns"]>([
{
name: "index",
@ -211,31 +220,11 @@ const columns2 = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
// {
// name: "position",
// required: true,
// label: "",
// field: "position",
// align: "left",
// },
// {
// name: "level",
// required: true,
// label: "",
// field: "level",
// align: "left",
// },
// {
// name: "organizationOrganization",
// required: true,
// label: "",
// field: "organizationOrganization",
// align: "left",
// },
]);
const rows2 = ref<any[]>([]);
const person = ref<any>([]);
const props = defineProps({
tab: {
type: String,
@ -260,29 +249,7 @@ const props = defineProps({
},
});
onMounted(async () => {
// organization.value = await (DataStore.agency != null
// ? DataStore.agency
// : DataStore.typeOc);
organizationOptions.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
console.log(organization.value);
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
//
/** เช็คสถานนะแสดงปุ่มเพิ่ม*/
const checkStatus = computed(() => {
if (
roleDataStore.insignia1Role &&
@ -291,8 +258,9 @@ const checkStatus = computed(() => {
return true;
} else return false;
});
//
const changtypeOc = () => {
/** เลือกหน่วยงาน*/
function changtypeOc() {
if (organization.value !== null) {
props.fecthInsigniaByOc?.(
props.roundId,
@ -302,17 +270,22 @@ const changtypeOc = () => {
);
}
DataStore.typeOc = organization.value;
};
//
const clickmodalAdd = async () => {
}
/** function เพิ่มราชชื่อ*/
async function clickmodalAdd() {
let ocId = DataStore.typeOc ? DataStore.typeOc : DataStore.agency;
showLoader();
await fecthInsignia();
await fecthlistperson(ocId);
clearForm();
};
//
const fecthlistperson = async (id: string) => {
}
/**
* function เรยกรายชอขาราชการตามหนวยงานทจะเพ
* @param id หนวยงาน
*/
async function fecthlistperson(id: string) {
let data = [{}];
data = [
{
@ -346,9 +319,10 @@ const fecthlistperson = async (id: string) => {
.finally(() => {
hideLoader();
});
};
//
const clickAdd = async () => {
}
/** function ยืนยันการเพิ่มราชชื่อ*/
async function clickAdd() {
dataPerson.id
? await myForm.value!.validate().then((result: boolean) => {
if (result) {
@ -363,9 +337,13 @@ const clickAdd = async () => {
}
})
: dialogMessageNotify($q, "กรุณาเลือกราชชื่อที่ต้องการเพิ่ม");
};
//
const addlistperson = async (id: string) => {
}
/**
* function เพมรายช
* @param id personId
*/
async function addlistperson(id: string) {
showLoader();
let data = {
profileId: id,
@ -393,16 +371,25 @@ const addlistperson = async (id: string) => {
}
hideLoader();
});
};
// POP
const clickmodalEdit = (props: any) => {
}
/**
* function openPopup แกไขเครองราชฯ
* @param props รายละเอยด
*/
async function clickmodalEdit(props: any) {
insignia.value = props.insigniaSend;
person.value = props;
modalEdit.value = true;
fecthInsignia();
};
// downloadfile
const downloadFile = (response: any, filename: string) => {
await fecthInsignia();
}
/**
* function downloadfile รายชอขาราชการสามญฯ
* @param response 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]));
@ -410,13 +397,13 @@ const downloadFile = (response: any, filename: string) => {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
// file
const downloadFileexcel = async () => {
}
/** function เรียก file รายชื่อข้าราชการสามัญฯ*/
async function downloadFileexcel() {
const findInsigniaId = DataStore.dataInsigniaType.find(
(e: any) => e.name == DataStore.typeinsignia
);
showLoader();
await http
.put(
@ -440,9 +427,10 @@ const downloadFileexcel = async () => {
.finally(() => {
hideLoader();
});
};
//
const clickSave = () => {
}
/*** function ยืนยันการแก้ไขเครื่องราช*/
async function clickSave() {
dialogConfirm(
$q,
async () => {
@ -451,9 +439,13 @@ const clickSave = () => {
"ยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอ",
"ต้องการยืนยันการแก้ไขเครื่องราชฯ ที่ยื่นขอนี้หรือไม่ ?"
);
};
// API
const listEdit = async (profileId: string) => {
}
/**
* function แกไขเครองราช API
* @param profileId
*/
async function listEdit(profileId: string) {
let data: any = {
insigniaId: insignia.value,
};
@ -476,27 +468,41 @@ const listEdit = async (profileId: string) => {
);
}
});
};
// POPUP
const clickReject = (id: string) => {
}
/**
* function openPopup ไมนขอ
* @param id profileId
*/
function clickReject(id: string) {
modelPopupReject.value = true;
rowid.value = id;
};
// POPUP
const closemodelPopupReject = () => {
}
/** function closePopup ไม่ยืนขอ*/
function closemodelPopupReject() {
modelPopupReject.value = false;
};
//
const savaReasonReject = (reason: string) => {
}
/**
* function นยนการไมนขอ
* @param reason หมายเหต
*/
async function savaReasonReject(reason: string) {
dialogConfirm($q, async () => {
await listreject(rowid.value, reason);
if (props.fecthStat) {
await props.fecthStat(DataStore.roundId);
}
});
};
// API
const listreject = async (profileId: string, reason: string) => {
}
/**
* function put นยนการไมนขอ API
* @param profileId profileId
* @param reason หมายเหต
*/
async function listreject(profileId: string, reason: string) {
await http
.put(config.API.insigniaReject(profileId), { reason: reason })
.then(() => {
@ -516,18 +522,24 @@ const listreject = async (profileId: string, reason: string) => {
}
await closemodelPopupReject();
});
};
// POPUP
const clickDelete = (id: string) => {
}
/** function openPopup คนที่ถูกลบ*/
function clickDelete(id: string) {
modelPopupDelete.value = true;
rowid.value = id;
};
// POPUP
const closemodelPopupDelete = () => {
}
/** function closePopup คนที่ถูกลบ*/
function closemodelPopupDelete() {
modelPopupDelete.value = false;
};
//
const savaReasonDelete = (reason: string) => {
}
/**
* function นย การลบคนทกลบ
* @param reason หมายเหต
*/
async function savaReasonDelete(reason: string) {
dialogConfirm(
$q,
async () => {
@ -539,9 +551,14 @@ const savaReasonDelete = (reason: string) => {
"ยืนยันการลบออกข้ออมูล",
"ต้องการยืนยันการลบข้อมูลนี้หรือไม่ ?"
);
};
// API
const listdelete = async (id: string, reason: string) => {
}
/**
* function คนทกลบ API
* @param id profileId
* @param reason หมายเหต
*/
async function listdelete(id: string, reason: string) {
await http
.put(config.API.insigniaDelete(id), { reason: reason })
.then(() => {
@ -561,7 +578,7 @@ const listdelete = async (id: string, reason: string) => {
}
await closemodelPopupDelete();
});
};
}
const dataPerson = reactive({
id: "",
position: "",
@ -569,13 +586,20 @@ const dataPerson = reactive({
level: "",
});
const reason = ref<string>("");
const selectPerson = (person: any) => {
/**
* function เลอกperson
* @paeam person
*/
function selectPerson(person: any) {
dataPerson.id = person.id;
dataPerson.position = person.position;
dataPerson.organizationOrganization = person.organizationOrganization;
dataPerson.level = person.level;
};
const clearForm = () => {
}
/** function clearFormData*/
function clearForm() {
filterKeyword2.value = "";
dataPerson.id = "";
dataPerson.position = "";
@ -583,13 +607,14 @@ const clearForm = () => {
dataPerson.level = "";
reason.value = "";
insigniaType.value = "";
};
}
const insignia = ref<string>("");
const insigniaOptions = ref<any>([]);
const insigniaType = ref<string>("");
//
const fecthInsignia = async () => {
/** function เรียกประเภทเครื่องราช*/
async function fecthInsignia() {
await http
.get(config.API.insignia)
.then((res) => {
@ -598,11 +623,17 @@ const fecthInsignia = async () => {
.catch((e) => {
messageError($q, e);
});
};
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
}
/**
* function redirect to ทะเบยนประว
* @param id profileId
*/
function nextPage(id: string) {
router.push(`/registry/${id}`);
}
/** ค้นหาข้อมุล table*/
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
@ -623,34 +654,39 @@ const pagination2 = ref({
page: 1,
rowsPerPage: 10,
});
const paging = ref<boolean>(true);
const paging2 = ref<boolean>(true);
const paginationLabel = (start: number, end: number, total: number) => {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
const paginationLabel2 = (start: number, end: number, total: number) => {
if (paging2.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
};
const closeModalEdit = () => {
/** function closePopup แก้ไข*/
function closeModalEdit() {
modalEdit.value = false;
};
// popup
const clickShowreson = (name: string, requestNote: string) => {
}
/**
* function openPopup แสดงหมายเหต
* @param name
* @param requestNote หมายเหต
*/
function clickShowreson(name: string, requestNote: string) {
dialogTitle.value = "หมายเหตุ" + name;
dialogDesc.value = requestNote;
dialogNote.value = true;
};
// popup
const clickCloseReson = () => {
}
/** function closePopu หมายเหตุ*/
function clickCloseReson() {
dialogNote.value = false;
};
const clickShowWarn = (
}
/**
* function แสดงแจงเตอน
* @param markDiscipline โทษทางว
* @param markLeave ไมไดเลอนเงนเดอน/ไมไดเลอนข เนองจากลาเก
* @param markRate ผลการประเมนการปฏราชการในรอบ 5 ำกวาระดบด (อยกวารอยละ 70)
*/
function clickShowWarn(
markDiscipline: boolean,
markLeave: boolean,
markRate: boolean
) => {
) {
checkboxData.value = [
{ id: 1, name: "มีโทษทางวินัย", val: markDiscipline },
{
@ -665,9 +701,15 @@ const clickShowWarn = (
},
];
dialogWarn.value = true;
};
}
const filterSelector = (val: any, update: Function, name: any) => {
/**
* function นหาขอม option
* @param val คำคนหา
* @param update function
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
@ -686,9 +728,13 @@ const filterSelector = (val: any, update: Function, name: any) => {
);
}
});
};
}
const clearInsigniaFilters = (name: string) => {
/**
* function clearfilter เครองราช
* @param name selec
*/
function clearInsigniaFilters(name: string) {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
@ -696,7 +742,27 @@ const clearInsigniaFilters = (name: string) => {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
};
}
/** Hook*/
onMounted(async () => {
organizationOptions.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
console.log(organization.value);
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
</script>
<template>
@ -768,7 +834,7 @@ const clearInsigniaFilters = (name: string) => {
<q-card bordered class="q-pa-sm col-12 bg-grey-1 q-mt-sm">
<div class="row col-12 q-col-gutter-sm">
<q-select
:class="roleDataStore.adminRole ? 'col-1':'col-3'"
:class="roleDataStore.adminRole ? 'col-1' : 'col-3'"
v-model="DataStore.typeinsignia"
label="ประเภทเครื่องราชฯ ที่ยืนขอ"
dense
@ -891,7 +957,7 @@ const clearInsigniaFilters = (name: string) => {
</div>
</q-card>
<div class="col-12 q-pt-sm">
<q-table
<d-table
ref="table"
:columns="columns"
:rows="DataStore.rows"
@ -903,7 +969,6 @@ const clearInsigniaFilters = (name: string) => {
dense
class="custom-header-table"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props">
@ -1092,19 +1157,7 @@ const clearInsigniaFilters = (name: string) => {
<q-td v-else auto-width></q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</d-table>
</div>
</div>
</div>
@ -1143,7 +1196,7 @@ const clearInsigniaFilters = (name: string) => {
</template>
</q-input>
</q-toolbar>
<q-table
<d-table
flat
bordered
dense
@ -1152,7 +1205,6 @@ const clearInsigniaFilters = (name: string) => {
:filter="filterKeyword2"
row-key="fullname"
class="custom-header-table"
:pagination-label="paginationLabel2"
v-model:pagination="pagination2"
>
<template v-slot:header="props">
@ -1182,18 +1234,7 @@ const clearInsigniaFilters = (name: string) => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination2.page"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</d-table>
</q-card>
</div>
<div class="col-xs-12 col-sm-5">

View file

@ -1,15 +1,22 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRouter } from "vue-router";
import DialogInformation from "@/components/Dialogs/Information.vue";
import { useroleUserDataStore } from "@/stores/roleUser";
/** import Type*/
import type { QTableProps } from "quasar";
/** import components*/
import DialogInformation from "@/components/Dialogs/Information.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 DataStore = useInsigniaDataStore();
const props = defineProps({
tab: {
type: String,
@ -30,19 +37,8 @@ const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }
const filterOrganizationOP = ref<any>([]);
const typeinsigniaOptions = ref<any>(DataStore.typeinsigniaOptions);
const employeeClassOps = ref<any>(DataStore.employeeClassOps);
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"employeeType",
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
]);
//
/** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -145,29 +141,21 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
// ()
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"employeeType",
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
]);
onMounted(async () => {
organizationOptions.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
// organization.value = await (DataStore.agency != null
// ? DataStore.agency
// : DataStore.typeOc);
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
//
const changtypeOc = () => {
/** function เลือกหน่วยงาน */
function changtypeOc() {
if (organization.value !== null) {
props.fecthInsigniaByOc?.(
props.roundId,
@ -177,11 +165,17 @@ const changtypeOc = () => {
);
}
DataStore.typeOc = organization.value;
};
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
}
/**
* function redirect ทะเบยนประว
* @param id profileId
*/
function nextPage(id: string) {
router.push(`/registry/${id}`);
}
/** filter table*/
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
@ -194,25 +188,34 @@ const pagination = ref({
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;
};
/** หมายเหตุ*/
const dialogNote = ref<boolean>(false);
const dialogTitle = ref<string>("");
const dialogDesc = ref<string>("");
const showReson = (name: string, requestNote: string) => {
/**
* function openPopup แสดง หมายเหต
* @param name
* @param requestNote หมายเหต
*/
function showReson(name: string, requestNote: string) {
dialogTitle.value = "เหตุผลการไม่ยื่นขอ " + name;
dialogDesc.value = requestNote;
dialogNote.value = true;
};
}
const closeReson = () => {
/** function closePopup หมายเหตุ*/
function closeReson() {
dialogNote.value = false;
};
const filterSelector = (val: any, update: Function, name: any) => {
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update funtion
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
@ -231,8 +234,13 @@ const filterSelector = (val: any, update: Function, name: any) => {
);
}
});
};
const clearInsigniaFilters = (name: string) => {
}
/**
* function clearfilter เครองราช
* @param name selec
*/
function clearInsigniaFilters(name: string) {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
@ -240,7 +248,25 @@ const clearInsigniaFilters = (name: string) => {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
};
}
/*** Hook*/
onMounted(async () => {
organizationOptions.value = await DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
</script>
<template>
<div class="col-12 row q-pa-md">
@ -310,101 +336,101 @@ const clearInsigniaFilters = (name: string) => {
</div>
<q-card bordered class="q-pa-sm col-12 bg-grey-1 q-mt-sm">
<div class="row col-12 q-col-gutter-sm">
<q-select
v-model="DataStore.typeinsignia"
label="ประเภทเครื่องราชฯ ที่ยืนขอ"
dense
emit-value
map-options
:options="typeinsigniaOptions"
option-value="id"
option-label="name"
lazy-rules
hide-bottom-space
use-input
:readonly="false"
:borderless="false"
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 180px"
@update:model-value="
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
@filter="(inputValue:any,
<q-select
v-model="DataStore.typeinsignia"
label="ประเภทเครื่องราชฯ ที่ยืนขอ"
dense
emit-value
map-options
:options="typeinsigniaOptions"
option-value="id"
option-label="name"
lazy-rules
hide-bottom-space
use-input
:readonly="false"
:borderless="false"
:outlined="true"
:hide-dropdown-icon="false"
style="min-width: 180px"
@update:model-value="
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'typeinsigniaOptions'
) "
>
<template v-if="DataStore.typeinsignia !== 'all'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
clearInsigniaFilters('typeinsigniaOptions'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
class="cursor-pointer"
/>
</template>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
<q-select
v-model="DataStore.employeeClass"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'สถานภาพ'}`"
emit-value
use-input
map-options
option-label="name"
:options="employeeClassOps"
option-value="id"
:readonly="false"
:borderless="false"
style="width: 300px"
@update:model-value="
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
@filter="(inputValue:any,
>
<template v-if="DataStore.typeinsignia !== 'all'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
clearInsigniaFilters('typeinsigniaOptions'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
class="cursor-pointer"
/>
</template>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
<q-select
v-model="DataStore.employeeClass"
dense
outlined
lazy-rules
hide-bottom-space
:label="`${'สถานภาพ'}`"
emit-value
use-input
map-options
option-label="name"
:options="employeeClassOps"
option-value="id"
:readonly="false"
:borderless="false"
style="width: 300px"
@update:model-value="
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
@filter="(inputValue:any,
doneFn:Function) => filterSelector(inputValue, doneFn,'employeeClassOps'
) "
>
<template v-if="DataStore.employeeClass !== 'all'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
clearInsigniaFilters('employeeClassOps'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
class="cursor-pointer"
/>
</template>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
>
<template v-if="DataStore.employeeClass !== 'all'" v-slot:append>
<q-icon
name="cancel"
@click.stop.prevent="
clearInsigniaFilters('employeeClassOps'),
DataStore.searchDataTable(
DataStore.typeinsignia,
DataStore.employeeClass
)
"
class="cursor-pointer"
/>
</template>
<template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
</div>
</q-card>
<div class="col-12 q-pt-sm">
<q-table
<d-table
ref="table"
:columns="columns"
:rows="DataStore.rows"
@ -416,7 +442,6 @@ const clearInsigniaFilters = (name: string) => {
dense
class="custom-header-table"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props">
@ -479,19 +504,7 @@ const clearInsigniaFilters = (name: string) => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</d-table>
<DialogInformation
:modal="dialogNote"

View file

@ -1,17 +1,24 @@
<script setup lang="ts">
import { onMounted, ref, watch, reactive } from "vue";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useRouter } from "vue-router";
import DialogInformation from "@/components/Dialogs/Information.vue";
import { useroleUserDataStore } from "@/stores/roleUser";
/** import Type*/
import type { QTableProps } from "quasar";
/** import components*/
import DialogInformation from "@/components/Dialogs/Information.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 DataStore = useInsigniaDataStore();
const props = defineProps({
tab: {
type: String,
@ -31,19 +38,8 @@ const employeeClassOps = ref<any>(DataStore.employeeClassOps);
const filterOrganizationOP = ref<any>([]);
const organization = ref<string>("1");
const organizationOptions = ref<any>([{ id: "1", name: "ทั้งหมด" }]);
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"employeeType",
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
]);
//
/** หัวตาราง*/
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -145,26 +141,21 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
onMounted(async () => {
organizationOptions.value = DataStore.optionsTypeOc;
// organization.value = await (DataStore.agency != null
// ? DataStore.agency
// : DataStore.typeOc);
organization.value = await DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
const changtypeOc = async () => {
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"name",
"employeeType",
"position",
"level",
"salary",
"insigniaType",
"insigniaSend",
"insigniaLevel",
]);
/** function เลือกหน่วยงาน */
async function changtypeOc() {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
@ -174,11 +165,17 @@ const changtypeOc = async () => {
);
}
DataStore.typeOc = organization.value;
};
const nextPage = (id: string) => {
router.push(`/registry/${id}`);
};
}
/**
* function redirect ทะเบยนประว
* @param id profileId
*/
function nextPage(id: string) {
router.push(`/registry/${id}`);
}
/** ข้อมูล Table*/
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
@ -191,24 +188,33 @@ const pagination = ref({
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;
};
/** หมายเหตุ*/
const dialogNote = ref<boolean>(false);
const note = ref<string>("");
const noteTitle = ref<string>("");
const showNote = (row: any) => {
/**
* function openPopup แสดง หมายเหต
* @param row รายละเอยดขอม
*/
function showNote(row: any) {
note.value = row.requestNote;
noteTitle.value = "เหตุผลการลบออก " + " " + row.name;
dialogNote.value = true;
};
const closeReson = () => {
}
/** function closePopup หมายเหตุ*/
function closeReson() {
dialogNote.value = false;
};
const filterSelector = (val: any, update: Function, name: any) => {
}
/**
* function นหาขอมลใน option
* @param val คำคนหา
* @param update funtion
* @param name selec
*/
function filterSelector(val: any, update: Function, name: any) {
update(() => {
const needle = val.toLowerCase();
if (name === "typeinsigniaOptions") {
@ -227,8 +233,13 @@ const filterSelector = (val: any, update: Function, name: any) => {
);
}
});
};
const clearInsigniaFilters = (name: string) => {
}
/**
* function clearfilter เครองราช
* @param name selec
*/
function clearInsigniaFilters(name: string) {
if (name === "typeinsigniaOptions") {
DataStore.typeinsignia = "all";
typeinsigniaOptions.value = DataStore.typeinsigniaOptions;
@ -236,7 +247,25 @@ const clearInsigniaFilters = (name: string) => {
DataStore.employeeClass = "all";
employeeClassOps.value = DataStore.employeeClassOps;
}
};
}
/** Hook*/
onMounted(async () => {
organizationOptions.value = DataStore.optionsTypeOc;
organization.value = await DataStore.typeOc;
if (organization.value !== "" || organization.value !== undefined) {
if (props.fecthInsigniaByOc) {
await props.fecthInsigniaByOc(
props.roundId,
organization.value,
"officer",
props.tab
);
DataStore.mainTab = props.tab;
}
}
filterOrganizationOP.value = organizationOptions.value;
});
</script>
<template>
<div class="col-12 row q-pa-md">
@ -400,7 +429,7 @@ const clearInsigniaFilters = (name: string) => {
</div>
</q-card>
<div class="col-12 q-pt-sm">
<q-table
<d-table
ref="table"
:columns="columns"
:rows="DataStore.rows"
@ -412,7 +441,6 @@ const clearInsigniaFilters = (name: string) => {
dense
class="custom-header-table"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props">
@ -475,19 +503,7 @@ const clearInsigniaFilters = (name: string) => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</d-table>
</div>
</div>
</div>

View file

@ -1,16 +1,22 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
const $q = useQuasar();
/** import Type*/
import type { QTableProps } from "quasar";
/** import Stores */
import { useInsigniaDataStore } from "@/modules/07_insignia/store";
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError } = mixin;
const DataStore = useInsigniaDataStore();
const $q = useQuasar();
const props = defineProps({
roundId: {
type: String,
@ -20,8 +26,8 @@ const props = defineProps({
},
});
const visibleColumns = ref<string[]>(["no", "orgName"]);
//
/** ข้อมูลตาราง*/
const rows = ref<any[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -42,15 +48,16 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const rows = ref<any[]>([]);
onMounted(async () => {
await fecthOrg();
DataStore.mainTab = props.tab;
const visibleColumns = ref<string[]>(["no", "orgName"]);
const pagination = ref({
sortBy: "name",
descending: false,
page: 1,
rowsPerPage: 10,
});
//
const fecthOrg = async () => {
/** function เรียกหน่วยงานที่ยังไม่ได้เสนอชื่อ*/
async function fecthOrg() {
showLoader();
await http
.get(config.API.insigniaNosend(props.roundId))
@ -67,25 +74,19 @@ const fecthOrg = async () => {
.finally(() => {
hideLoader();
});
};
}
const pagination = ref({
sortBy: "name",
descending: false,
page: 1,
rowsPerPage: 10,
/** Hook*/
onMounted(async () => {
await fecthOrg();
DataStore.mainTab = props.tab;
});
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;
};
</script>
<template>
<div class="col-12 row q-pa-md">
<div class="row col-12">
<div class="col-12">
<q-table
<d-table
ref="table"
:columns="columns"
:rows="rows"
@ -96,7 +97,6 @@ const paginationLabel = (start: number, end: number, total: number) => {
:paging="true"
class="custom-header-table"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:header="props">
@ -116,19 +116,7 @@ const paginationLabel = (start: number, end: number, total: number) => {
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</d-table>
</div>
</div>
</div>

View file

@ -3,11 +3,18 @@ import { ref } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
const $q = useQuasar();
import type { Optionround } from "@/modules/07_insignia/interface/index/Main";
/**import Stores */
import { useCounterMixin } from "@/stores/mixin";
/** use Store*/
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader } = mixin;
const $q = useQuasar();
/** props*/
const props = defineProps({
profileId: {
type: String,
@ -21,12 +28,12 @@ const props = defineProps({
});
const titleReport = ref<string>("");
interface Optionround {
profileId: string;
id: string;
}
const downloadDocument = async (type: string) => {
/**
* function ดาวนโหลดไฟล
* @param type ประเภท file
*/
async function downloadDocument(type: string) {
let round = [];
if (props.optionRound) {
round = props.optionRound.find((e: Optionround) => e.id === props.round);
@ -54,8 +61,9 @@ const downloadDocument = async (type: string) => {
hideLoader();
});
}
};
const downloadFile = (response: any, filename: string) => {
}
function downloadFile(response: any, filename: string) {
const link = document.createElement("a");
var fileName = filename;
link.href = window.URL.createObjectURL(new Blob([response.data]));
@ -63,7 +71,7 @@ const downloadFile = (response: any, filename: string) => {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
};
}
</script>
<template>
<q-btn

View file

@ -4,21 +4,24 @@ import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
/**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"; //
import tab2 from "@/modules/07_insignia/components/2_Manage/Tab2.vue"; //
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 cardTop from "@/modules/07_insignia/components/2_Manage/StatCard.vue";
import tab1 from "@/modules/07_insignia/components/2_Manage/Tab1.vue";
import tab2 from "@/modules/07_insignia/components/2_Manage/Tab2.vue";
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";
/**use sToer */
const roleDataStore = useroleUserDataStore();
const DataStore = useInsigniaDataStore();
const mixin = useCounterMixin();
const { messageError, dialogConfirm, showLoader, hideLoader, success } = mixin;
const $q = useQuasar(); // noti quasar
const loading = ref<boolean>(false);
@ -37,14 +40,9 @@ const stat = ref<any>({
});
const modalPopupBackToEdit = ref<boolean>(false); //model
onMounted(async () => {
tab.value = DataStore.mainTab;
await fecthlistRound();
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
});
//
const fecthlistRound = async () => {
/** function เรียกรอบการเสนอขอพระราชทานเครื่อง*/
async function fecthlistRound() {
showLoader();
await http
.get(config.API.listRoundInsignia())
.then(async (res: any) => {
@ -70,10 +68,13 @@ const fecthlistRound = async () => {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
};
}
// Stat
/** function เรียกดู Stat ของรอบการเสนอขอพระราชทานเครื่อง*/
const fecthStat = async (id: string) => {
showLoader();
await http
@ -89,8 +90,8 @@ const fecthStat = async (id: string) => {
});
};
//
const fecthAgency = async () => {
/** funcion เช็คหน่วยงาน*/
async function fecthAgency() {
showLoader();
await http
.get(config.API.insigniaAgency())
@ -110,9 +111,10 @@ const fecthAgency = async () => {
loading.value = true;
hideLoader();
});
};
//
const fecthType = async () => {
}
/** funcion เรียกหน่อยวงาน*/
async function fecthType() {
await http
.get(config.API.typeOc())
.then((res) => {
@ -125,9 +127,10 @@ const fecthType = async () => {
.catch((err) => {
messageError($q, err);
});
};
//
const fecthInsignia = async () => {
}
/**function เรียกประเภทเครื่องราช*/
async function fecthInsignia() {
await http
.get(config.API.insignia)
.then((res) => {
@ -137,10 +140,10 @@ const fecthInsignia = async () => {
.catch((err) => {
messageError($q, err);
});
};
}
//
const changround = async () => {
/** function เลือกรอบการแสดง*/
async function changround() {
DataStore.roundId = round.value;
fecthStat(round.value); // Stat
var organization = await (DataStore.agency != null // agency agency Oc
@ -154,19 +157,25 @@ const changround = async () => {
roundName.value = `รอบการเสนอขอพระราชทานเครื่องราชฯ ปี ${
roundFilter.year + 543
}`;
};
}
const requestNote = ref<string>("");
const requestStatus = ref<string>("");
const requestId = ref<string>("");
const document = ref<string>("");
//
const fecthInsigniaByOc = async (
/**
* function เรยกขอมลรายชอขาราชการสามญฯ ทธนขอพระราชทานเครองราชอสรยาภรณ ตามรอบการเสนอขอ
* @param roundId id รอบการเสนอขอ
* @param ocId id หนวยงาน
* @param role ประเภท officer,employee
* @param status สถานะ
*/
async function fecthInsigniaByOc(
roundId: string,
ocId: string,
role: string,
status: string
) => {
) {
if (roundId && ocId && role && status) {
showLoader();
await http
@ -193,10 +202,10 @@ const fecthInsigniaByOc = async (
hideLoader();
});
}
};
}
// requestStatus st1 st4
const sendToDirector = async () => {
/**function ยืนยันการส่งรอบการเสนอขอต่อ เฉพาะ รอบที่ requestStatus st1 และ st4 */
async function sendToDirector() {
dialogConfirm($q, async () => {
showLoader();
await http
@ -218,26 +227,32 @@ const sendToDirector = async () => {
await fecthStat(round.value);
});
});
};
// popup
const popupBackToEdit = async () => {
}
/** function open popup แก้ไข*/
async function popupBackToEdit() {
modalPopupBackToEdit.value = true;
};
// popup
const closeModalPopupBackToEdit = async () => {
}
/** function close popup แก้ไข*/
async function closeModalPopupBackToEdit() {
modalPopupBackToEdit.value = false;
};
}
const modalbackInsignia2Role = ref<boolean>(false);
// popup admin
/**function open popup ตีกลับ admin*/
const popupBackToInsignia2Role = async () => {
modalbackInsignia2Role.value = true;
};
// popup admin
/**function close popup ตีกลับ admin*/
const closepopupBackToInsignia2Role = async () => {
modalbackInsignia2Role.value = false;
};
// requestStatus st3 insignia2Role
const backToEdit = async (reason: string) => {
/**
* funtion นยนการ กลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st3 และ insignia2Role
* @param reason หมายเหตการตกล
*/
async function backToEdit(reason: string) {
dialogConfirm(
$q,
async () => {
@ -269,9 +284,10 @@ const backToEdit = async (reason: string) => {
"ยืนยันการตีกลับ",
"ต้องการยืนยันการตีกลับใช่หรือไม่?"
);
};
// requestStatus st3 insignia2Role
const directorApproved = async () => {
}
/**function ยืนยันการอนุมัติรอบการเสนอขอ เฉพาะ รอบที่ requestStatus st3 และ insignia2Role */
async function directorApproved() {
dialogConfirm(
$q,
async () => {
@ -298,9 +314,13 @@ const directorApproved = async () => {
"ยืนยันการอนุมัติ",
"ต้องการยืนยันการอนุมัติใช่หรือไม่?"
);
};
// requestStatus st5 adminRole
const backToEditinsignia2Role = async (reason: string) => {
}
/**
* function นยนการตกลบรอบการเสนอขอ เฉพาะ รอบท requestStatus st5 และ adminRole
* @param reason หมายเหตการตกล
*/
async function backToEditinsignia2Role(reason: string) {
dialogConfirm($q, async () => {
await http
.put(config.API.rejectRequest(round.value, DataStore.typeOc), {
@ -322,12 +342,10 @@ const backToEditinsignia2Role = async (reason: string) => {
closepopupBackToInsignia2Role();
});
});
};
//
const requestSendNote = async () => {
// var organization = await (DataStore.agency != null
// ? DataStore.agency
// : DataStore.typeOc);
}
/**function ยืนยันการล็อกข้อมูล*/
async function requestSendNote() {
dialogConfirm($q, async () => {
showLoader();
await http
@ -351,10 +369,14 @@ const requestSendNote = async () => {
await fecthStat(round.value);
});
});
};
//
}
const fileUpload = ref<any>(null);
const uploadFile = async (event: any) => {
/**
* function ปโหลดไฟลเจาหนาท
* @param event file
*/
async function uploadFile(event: any) {
dialogConfirm($q, async () => {
const selectedFile = event;
const formdata = new FormData();
@ -377,7 +399,14 @@ const uploadFile = async (event: any) => {
"ยืนยันการอัปโหลดไฟล์",
"ต้องการยืนยันการอัปโหลดไฟล์นี้หรือไม่ ?";
});
};
}
/** hook*/
onMounted(async () => {
tab.value = DataStore.mainTab;
await fecthlistRound();
DataStore.dataInsigniaType.length === 0 && (await fecthInsignia());
});
</script>
<template>
@ -420,6 +449,7 @@ const uploadFile = async (event: any) => {
<div v-if="roleDataStore.adminRole" class="col-12 row bg-white">
<div class="fit q-px-md q-py-sm">
<div class="row col-12 q-col-gutter-sm fit">
<!-- stat -->
<cardTop
:amount="stat.orgAllCount"
label="หน่วยงานทั้งหมด"
@ -491,6 +521,7 @@ const uploadFile = async (event: any) => {
</div>
<q-separator />
<q-tab-panels v-model="tab" animated>
<!-- แทบคนทนขอ -->
<q-tab-panel name="pending" class="q-pa-none">
<tab1
:tab="tab"
@ -501,6 +532,8 @@ const uploadFile = async (event: any) => {
:fecthStat="fecthStat"
/>
</q-tab-panel>
<!-- แทบคนทไมนขอ -->
<q-tab-panel name="reject" class="q-pa-none">
<tab2
:tab="tab"
@ -508,6 +541,8 @@ const uploadFile = async (event: any) => {
:fecthInsigniaByOc="fecthInsigniaByOc"
/>
</q-tab-panel>
<!-- แทบคนทกลบออก -->
<q-tab-panel name="delete" class="q-pa-none">
<tab3
:tab="tab"
@ -515,6 +550,8 @@ const uploadFile = async (event: any) => {
:fecthInsigniaByOc="fecthInsigniaByOc"
/>
</q-tab-panel>
<!-- แทบหนวยงานทงไมไดงรายช -->
<q-tab-panel
v-if="roleDataStore.adminRole"
name="organization"
@ -523,7 +560,6 @@ const uploadFile = async (event: any) => {
<tab4 :tab="tab" :roundId="round" />
</q-tab-panel>
</q-tab-panels>
<!-- :role-user="roleUser" -->
<q-toolbar class="q-py-md text-right">
<q-file
v-if="roleDataStore.insignia1Role"
@ -622,6 +658,7 @@ const uploadFile = async (event: any) => {
/>
</q-toolbar>
<!-- popup หมายเหต -->
<DialogPopupReason
:modal="modalPopupBackToEdit"
title="หมายเหตุการตีกลับ"

View file

@ -1,16 +1,18 @@
<script setup lang="ts">
import { ref, watch, computed } 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";
/** 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";
/** useStore*/
const DataStore = useResultDataStore();
const $q = useQuasar();
const myForm = ref<QForm>();
const mixin = useCounterMixin();
const {
date2Thai,
@ -21,8 +23,11 @@ const {
hideLoader,
notifyError,
} = mixin;
const status = ref<string>("");
const $q = useQuasar();
const myForm = ref<QForm>();
const status = ref<string>("");
const Advertise = ref<string>("");
const issue = ref<string>("");
const brand = ref<string>("");
@ -40,34 +45,31 @@ const affiliationReceived = ref<string>("");
const receivedate = ref<Date | null>();
const announceDate = ref<Date | null>();
const invoiceDate = ref<Date | null>(null);
const filterinsigniaOp2 = ref<any>(DataStore.insigniaOp2)
const filterinsigniaOp2 = ref<any>(DataStore.insigniaOp2);
const employeeClass = ref<string>("");
const employeeClassOps = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการ กทม.สามัญ" },
{ id: "employee", name: "ลูกจ้างประจำ" },
]);
const listPerson = ref<any>([]);
const paymentOp = [
{ label: "จัดส่งทางไปรษณีย์", value: "จัดส่งทางไปรษณีย์" },
{ label: "มารับด้วยตัวเอง", value: "มารับด้วยตัวเอง" },
];
// reset
const clearAnnounceExam = () => {
function clearAnnounceExam() {
announceDate.value = null;
};
}
// reset
const clearDateReceivedate = () => {
/** function reset วันที่ได้รับพระราชทานเครื่องราชอิสริยาภรณ์*/
function clearDateReceivedate() {
receivedate.value = null;
};
}
// reset
const clearDateInvoiceDate = () => {
/** function reset วันที่จ่ายใบกำกับ*/
function clearDateInvoiceDate() {
invoiceDate.value = null;
};
}
const props = defineProps({
modal: Boolean,
@ -90,7 +92,8 @@ const props = defineProps({
type: String,
},
});
// popup
/** callback function จำทำงานเมื่อ props.modal = true เปิด popup เพิ่มราชชื่อบันทึกผล*/
watch(props, () => {
if (props.modal === true) {
employeeClass.value = "";
@ -117,13 +120,17 @@ watch(props, () => {
}
}
});
/** disbleStatus */
const disbleStatus = computed(() => {
if (employeeClass.value !== "") {
return false;
} else return true;
});
//
const selectType = async () => {
/** function เลือกประเภทลูกจ้าง */
async function selectType() {
showLoader();
cardid.value = "";
fullName.value = "";
@ -142,9 +149,10 @@ const selectType = async () => {
invoiceDate.value = null;
payment.value = "";
await fecthlistPerson();
};
//
const fecthlistPerson = async () => {
}
/** function เรียกหน่วยงาน*/
async function fecthlistPerson() {
await http
.get(config.API.profileOrganizRoot)
.then((res) => {
@ -156,9 +164,13 @@ const fecthlistPerson = async () => {
.catch((e) => {
messageError($q, e);
});
};
// id
const findlist = async (id: string) => {
}
/**
* function เรยกราชชอลกจางตาม id หนวยงาน
* @param id id หนวยงาน
*/
async function findlist(id: string) {
let data = [{}];
//
if (employeeClass.value === "officer") {
@ -183,9 +195,13 @@ const findlist = async (id: string) => {
.finally(() => {
hideLoader();
});
};
// id
const fectDataByid = async (id: string) => {
}
/**
* function เรยกขอมลบนทกผลตาม id
* @param id
*/
async function fectDataByid(id: string) {
showLoader();
if (props.profileType !== undefined) {
employeeClass.value = props.profileType.toString();
@ -219,9 +235,10 @@ const fectDataByid = async (id: string) => {
.finally(() => {
hideLoader();
});
};
//
const clickSave = async () => {
}
/** function บักทึกผล*/
async function clickSave() {
let body = {
citizanId: cardid.value, //
insigniaId: brand.value, // insigniaID
@ -247,9 +264,10 @@ const clickSave = async () => {
});
}
});
};
//
const addNote = async (body: any) => {
}
/** function เพิ่มแก้ ข้อมูลบันทึกผล*/
async function addNote(body: any) {
if (props.roundId !== undefined) {
await http
.put(config.API.noteAdd(props.roundId), body)
@ -265,9 +283,10 @@ const addNote = async (body: any) => {
}
});
}
};
//
const searchcardid = () => {
}
/** function หาเลขบัตรประจำตัวประชาชน*/
function searchcardid() {
if (cardid.value.length === 13) {
let data = listPerson.value.find((e: any) => e.citizenId === cardid.value);
if (data) {
@ -275,20 +294,25 @@ const searchcardid = () => {
position.value = data.positionEmployeePosition; //
} else notifyError($q, "ไม่พบข้อมูลเลขบัตรประชาชนนี้");
}
};
}
/**
* function นหาขอม option
* @param val คำคนหา
* @param update function
* @param name selec
*/
const filterSelector = (val: any, update: Function, name: any) => {
update(() => {
const needle = val.toLowerCase();
if (name === 'insigniaOp2') {
brand.value = ''
if (name === "insigniaOp2") {
brand.value = "";
filterinsigniaOp2.value = DataStore.insigniaOp2.filter(
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
(v: any) => v.name.toLowerCase().indexOf(needle) > -1
);
}
}
)
}
});
};
</script>
<template>

View file

@ -1,15 +1,15 @@
<script setup lang="ts">
import { onMounted, ref, watch } from "vue";
import { QForm, useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/** import Type*/
import type { DataOption } from "@/modules/04_registry/components/profileType";
const $q = useQuasar();
const myForm = ref<any>();
/** import Stores */
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
const mixin = useCounterMixin();
const {
date2Thai,
@ -20,6 +20,10 @@ const {
dialogConfirm,
dateToISO,
} = mixin;
const $q = useQuasar();
const myForm = ref<any>();
const files = ref<any>();
const filesReturn = ref<any>();
const OrganazationId = ref<string>("");
@ -32,6 +36,7 @@ const remark = ref<string>("");
const nullii = ref<any>(null);
const filesCheck = ref<string>("");
const filesReturnCheck = ref<string>("");
const props = defineProps({
modal: Boolean,
personId: String,
@ -42,14 +47,19 @@ const props = defineProps({
dataModal: Object,
});
// reset
const clearReceiveDate = () => {
/** function reset วันที่ประกาศราชกิจจานุเบกษา*/
function clearReceiveDate() {
Datereceive.value = null;
};
const clearReturnDate = () => {
}
/** function clearDate */
function clearReturnDate() {
Datereturn.value = null;
};
const close = () => {
}
/** function Colsepopup*/
function close() {
props.close?.();
Datereceive.value = null;
files.value = null;
@ -57,17 +67,28 @@ const close = () => {
Datereturn.value = null;
filesReturn.value = null;
OrganazationId2.value = "";
};
}
const SaveData = async (type: string, id: string) => {
/**
* function นยนการบนทกขอม
* @param type receive,return
* @param id personId
*/
async function SaveData(type: string, id: string) {
await myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, () => dataSave(type, id));
} else {
}
});
};
const dataSave = (type: string, id: string) => {
}
/**
* function นทกขอม
* @param type receive,return
* @param id personId
*/
function dataSave(type: string, id: string) {
const formData = new FormData();
if (props.dateCheckReceive === null) {
formData.append("Date", dateToISO(Datereceive.value ?? nullii));
@ -94,12 +115,14 @@ const dataSave = (type: string, id: string) => {
Datereturn.value = null;
filesReturn.value = null;
OrganazationId2.value = "";
props.fecthlistInsignia?.();
props.close?.();
hideLoader();
props.fecthlistInsignia?.();
});
};
const fetchOrgList = async () => {
}
/** function เรียกหน่วยงาน*/
async function fetchOrgList() {
showLoader();
await http
.get(config.API.typeOc())
@ -123,7 +146,14 @@ const fetchOrgList = async () => {
.finally(() => {
hideLoader();
});
};
}
/** hook*/
onMounted(() => {
fetchOrgList();
});
/** callback function จำทำงานเมื่อ props มีการเปลี่ยนแปลง*/
watch(props, () => {
if (props.dataModal) {
Datereceive.value = props.dataModal.dateReceiveInsignia;
@ -140,10 +170,6 @@ watch(props, () => {
: "-";
}
});
onMounted(() => {
fetchOrgList();
});
</script>
<template>
@ -322,7 +348,7 @@ onMounted(() => {
</div>
<div v-if="filesReturnCheck !== null" class="col-xs-12 col-sm-4">
<q-btn
type="a"
type="a"
outline
ripple
class="full-width"

View file

@ -1,31 +1,29 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import type { QTableProps, QForm } from "quasar";
import { useQuasar } from "quasar";
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 Stores */
import { useCounterMixin } from "@/stores/mixin";
/** useStore*/
const mixin = useCounterMixin();
const { success, messageError, hideLoader, dialogConfirm, showLoader } = mixin;
const $q = useQuasar();
const myForm = ref<any>();
const fileUpload = ref<any>(null);
const reason = ref<string>("");
const documentTitle = ref<string>("");
const $q = useQuasar();
const myForm = ref<any>();
const filterKeyword = ref<string>("");
const filterDoc = ref<any>(null);
const visibleColumnsReference = ref<String[]>([
"no",
"fileName",
"annotation",
"file",
]);
//
/** คอลัมน์ตาราง*/
const colums2 = ref<QTableProps["columns"]>([
{
name: "no",
@ -56,27 +54,22 @@ const colums2 = ref<QTableProps["columns"]>([
sortable: false,
},
]);
const visibleColumnsReference = ref<String[]>([
"no",
"fileName",
"annotation",
"file",
]);
const rows2 = ref<any>([]);
interface TypeData {
fileName: string;
reason: string;
pathName: string;
}
const props = defineProps({
roundId: {
type: String,
},
});
onMounted(async () => {
await getRequest();
});
//
const getRequest = async () => {
/** function ดึงข้อมูลรายการเอกสารอ้างอิง */
async function getRequest() {
showLoader();
await http
.get(config.API.requestDocNote(props.roundId as string))
@ -97,19 +90,19 @@ const getRequest = async () => {
.finally(() => {
hideLoader();
});
};
}
//
const save = () => {
/** function เช็คฟอร์มก่อนบันทึก และยืนยันการบันทึกข้อมูล */
function save() {
myForm.value.validate().then((result: boolean) => {
if (result) {
dialogConfirm($q, () => putRequest());
}
});
};
}
//
const putRequest = async () => {
/** function บันทึกเอกสาร */
async function putRequest() {
showLoader();
const dataAppend = new FormData();
dataAppend.append("Name", documentTitle.value);
@ -124,21 +117,22 @@ const putRequest = async () => {
messageError($q, e);
})
.finally(() => {
documentTitle.value = ""
reason.value = ""
fileUpload.value = null
documentTitle.value = "";
reason.value = "";
fileUpload.value = null;
// reset validate
myForm.value.reset()
myForm.value.reset();
getRequest();
hideLoader();
});
};
}
const resetFilterRef = () => {
/** function resetFilter */
function resetFilterRef() {
filterKeyword.value = "";
filterDoc.value.focus();
};
}
const pagination = ref({
sortBy: "filename",
@ -146,6 +140,11 @@ const pagination = ref({
page: 1,
rowsPerPage: 10,
});
/**hook*/
onMounted(async () => {
await getRequest();
});
</script>
<template>
@ -156,42 +155,104 @@ const pagination = ref({
<q-form ref="myForm">
<div class="row col-12 q-col-gutter-x-sm">
<div class="col-3">
<q-file class="bg-white" outlined dense v-model="fileUpload" label="ไฟล์เอกสาร" hide-bottom-space
lazy-rules accept=".pdf" :rules="[(val) => !!val || `กรุณาเลือกไฟล์เอกสาร`]">
<q-file
class="bg-white"
outlined
dense
v-model="fileUpload"
label="ไฟล์เอกสาร"
hide-bottom-space
lazy-rules
accept=".pdf"
:rules="[(val) => !!val || `กรุณาเลือกไฟล์เอกสาร`]"
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
</q-file>
</div>
<div class="col-3">
<q-input class="bg-white" outlined dense lazy-rules v-model="documentTitle" :label="`${'ชื่อเอกสาร'}`"
hide-bottom-space :rules="[(val) => !!val || `กรุณากรอกชื่อเอกสาร`]" />
<q-input
class="bg-white"
outlined
dense
lazy-rules
v-model="documentTitle"
:label="`${'ชื่อเอกสาร'}`"
hide-bottom-space
:rules="[(val) => !!val || `กรุณากรอกชื่อเอกสาร`]"
/>
</div>
<div class="col-6 row no-wrap">
<q-input class="bg-white full-width" outlined dense lazy-rules v-model="reason" :label="`${'หมายเหตุ'}`"
hide-bottom-space />
<q-btn unelevated dense class="q-ml-sm q-px-md items-center" color="public" label="บันทึก" @click="save" />
<q-input
class="bg-white full-width"
outlined
dense
lazy-rules
v-model="reason"
:label="`${'หมายเหตุ'}`"
hide-bottom-space
/>
<q-btn
unelevated
dense
class="q-ml-sm q-px-md items-center"
color="public"
label="บันทึก"
@click="save"
/>
</div>
</div>
</q-form>
</q-card>
<div class="row col-12">
<q-space />
<q-input class="col-xs-12 col-sm-3 col-md-2" standout dense v-model="filterKeyword" ref="filterDoc" outlined
debounce="300" placeholder="ค้นหา">
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
ref="filterDoc"
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="resetFilterRef" />
<q-icon
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilterRef"
/>
</template>
</q-input>
<q-select v-model="visibleColumnsReference" multiple outlined dense options-dense
:display-value="$q.lang.table.columns" emit-value map-options :options="colums2" option-value="name"
options-cover style="min-width: 150px" class="col-xs-12 col-sm-3 col-md-2 q-ml-sm" />
<q-select
v-model="visibleColumnsReference"
multiple
outlined
dense
options-dense
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="colums2"
option-value="name"
options-cover
style="min-width: 150px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table :columns="colums2" :rows="rows2" :filter="filterKeyword" row-key="fileName"
:visible-columns="visibleColumnsReference" v-model:pagination="pagination">
<d-table
:columns="colums2"
:rows="rows2"
:filter="filterKeyword"
row-key="fileName"
:visible-columns="visibleColumnsReference"
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">
@ -214,8 +275,17 @@ const pagination = ref({
}}
</q-td>
<q-td auto-width>
<q-btn type="a" :href="props.row.file" target="_blank" dense size="14px" flat round
color="deep-orange-6" icon="picture_as_pdf">
<q-btn
type="a"
:href="props.row.file"
target="_blank"
dense
size="14px"
flat
round
color="deep-orange-6"
icon="picture_as_pdf"
>
<q-tooltip>ดาวโหลด PDF</q-tooltip>
</q-btn>
</q-td>