ปรับ code รายชื่อผู้ถูกพักราชการ

This commit is contained in:
setthawutttty 2023-12-07 10:52:37 +07:00
parent 4068fd8b74
commit 7668b4f002
6 changed files with 125 additions and 167 deletions

View file

@ -35,13 +35,6 @@ const {
const myForm = ref<QForm | null>(null);
const roleAdmin = ref<boolean>(false);
const edit = ref<boolean>(false);
const organizationPositionOld = ref<string>("");
const positionTypeOld = ref<string>("");
const positionLevelOld = ref<string>("");
const posNo = ref<string>("");
const organization = ref<string>("");
const date = ref<Date | null>(null);
const reason = ref<string>("");
const data = reactive<dataDetail>({
id: "",
@ -67,16 +60,8 @@ const data = reactive<dataDetail>({
disciplinaryCaseFault: "",
});
/** Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
}
await getData();
});
// API
const getData = async () => {
/**นำข้อมูลจาก API มาแสดง */
async function getData(){
showLoader();
await http
.get(config.API.suspendById(dataId))
@ -117,7 +102,7 @@ const getData = async () => {
/**
* งก Cancle
*/
const clickCancel = async () => {
async function clickCancel(){
await getData();
edit.value = false;
};
@ -125,7 +110,7 @@ const clickCancel = async () => {
/**
* งก Save
*/
const conditionSave = async () => {
async function conditionSave(){
if (myForm.value !== null) {
myForm.value.validate().then((success) => {
if (success) {
@ -147,7 +132,7 @@ const conditionSave = async () => {
/**
* งก Saveจาก API
*/
const saveData = async () => {
async function saveData(){
const body = {
organization: data.organization,
position: data.position,
@ -178,12 +163,21 @@ const saveData = async () => {
* Function เพ Class เวลา Edit
* @param val เมอเปนEdit จะเปลยน Class
*/
const getClass = (val: boolean) => {
function getClass(val: boolean){
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
/** Hook */
onMounted(async () => {
if (keycloak.tokenParsed != null) {
roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1");
}
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">

View file

@ -2,9 +2,11 @@
import { ref, computed, watch } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import DialogHeader from "@/components/DialogHeader.vue";
import type { QTableProps } from "quasar";
import type { ResponseItems } from "@/modules/06_retirement/interface/response/Main";
import DialogHeader from "@/components/DialogHeader.vue";
import http from "@/plugins/http";
import config from "@/app.config";
@ -12,8 +14,12 @@ import config from "@/app.config";
const $q = useQuasar();
const selected = ref<any>([]);
const mixin = useCounterMixin();
const { showLoader, success, messageError, dialogConfirm, hideLoader } = mixin;
const { success, dialogConfirm } = mixin;
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
"returnPerson",
]);
/** คอลัมน์ */
const columns2 = ref<QTableProps["columns"]>([
{
@ -92,9 +98,6 @@ const props = defineProps({
filterKeyword2: String,
});
/**
* งกนการ Selected Data
*/
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
@ -102,29 +105,31 @@ const checkSelected = computed(() => {
});
//popup
const saveOrder = () => {
function saveOrder() {
dialogConfirm(
$q,
async () => {
success($q, `ส่งข้อมูลไปออกคำสั่งสำเร็จ`);
emit("returnPerson", selected.value);
props.closeModal?.();
},
`ยืนยันการส่งไปออกคำสั่ง`,
`ต้องการยืนยันการส่งไปออกคำสั่งหรือไม่`
);
};
$q,
async () => {
success($q, `ส่งข้อมูลไปออกคำสั่งสำเร็จ`);
emit("returnPerson", selected.value);
props.closeModal?.();
},
`ยืนยันการส่งไปออกคำสั่ง`,
`ต้องการยืนยันการส่งไปออกคำสั่งหรือไม่`
);
}
const emit = defineEmits(["update:filterKeyword2", "update:selected",'returnPerson']);
const updateInput = (value: any) => {
/**
* งคากลบไปหนาหล
* @param value าทบจาก input
*/
function updateInput(value: any) {
emit("update:filterKeyword2", value);
};
}
//
const Reset = () => {
function Reset() {
emit("update:filterKeyword2", "");
};
}
// watch([()=>props.modal],() => {
// selected.value = props.modal ? [] : [];
// if (props.modal === true) {
@ -161,6 +166,7 @@ const Reset = () => {
/>
</template>
</q-input>
<q-select
v-model="visibleColumns2"
multiple
@ -189,7 +195,7 @@ const Reset = () => {
selection="multiple"
v-model:selected="selected"
>
<template v-slot:header="props">
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width>
<!-- <q-checkbox

View file

@ -1,31 +1,29 @@
<script setup lang="ts">
import { ref, onMounted, watch } from "vue";
import type { QTableProps } from "quasar";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore";
import type { dataType } from '@/modules/11_discipline/interface/response/suspend'
import type { QTableProps } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import DialogSendToCommand from "@/modules/11_discipline/components/7_ListSuspend/DialogSendToCommand.vue";
import type { dataType } from '@/modules/11_discipline/interface/response/suspend'
import { useDisciplineSuspendStore } from "@/modules/11_discipline/store/SuspendStore";
/** use */
const dataStore = useDisciplineSuspendStore();
const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin();
const transferStore = useTransferDataStore();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogMessage,
} = mixin;
const { statusText } = transferStore;
const modal = ref<boolean>(false);
/** คอลัมน์ที่แสดง */
@ -121,23 +119,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
onMounted(async () => {
await getList();
});
function openModalOrder(){
openModal();
const dataMap = dataStore.rows.filter((r: dataType) =>
r.statusEn == "PENDING" &&
r.name &&
r.organization &&
r.position &&
r.positionLevel &&
r.posNo &&
r.organization
)
rows2.value = dataMap;
};
const openModal = () => (modal.value = true);
const closeModal = () => (modal.value = false);
@ -162,22 +143,20 @@ const pagination = ref({
rowsPerPage: rowsPerPage.value,
});
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
/** เปิด popup ส่งไปออกคำสั่ง โดย PENDING*/
function openModalOrder(){
openModal();
const dataMap = dataStore.rows.filter((r: dataType) =>
r.statusEn == "PENDING" &&
r.name &&
r.organization &&
r.position &&
r.positionLevel &&
r.posNo &&
r.organization
)
rows2.value = dataMap;
};
/** ดึงข้อมูลหน้าหลัก */
async function getList() {
@ -203,6 +182,10 @@ async function getList() {
});
}
/**
* นย งไปออกคำส
* @param data อมลรายบคคล
*/
function onSubmit(data:dataType[]){
console.log(data)
const dataMapId = data.map((item: dataType) => item.id);
@ -221,11 +204,31 @@ function onSubmit(data:dataType[]){
getList()
});
}
watch(
() => currentPage.value,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
getList();
}
);
watch(
() => pagination.value.rowsPerPage,
() => {
rowsPerPage.value = pagination.value.rowsPerPage;
currentPage.value = 1;
getList();
}
);
/** เรียกใช้งานเมื่อเริ่มหน้าเว็ป */
onMounted(() => {
getList();
dataStore.columns = columns.value;
dataStore.visibleColumns = visibleColumns.value;
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
@ -246,8 +249,8 @@ onMounted(() => {
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout

View file

@ -1,12 +1,5 @@
<script setup lang="ts">
import {
ref,
computed,
watchEffect,
watch,
onMounted,
type PropType,
} from "vue";
import { ref, computed, watchEffect, watch, type PropType } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar";
@ -123,17 +116,19 @@ const props = defineProps({
},
});
/** แสดงจำนวนในตาราง */
const pagination = ref({
descending: true,
page: Number(props.page),
rowsPerPage: props.rowsPerPage,
});
const checkSelected = computed(() => {
if (selected.value.length === 0) {
return true;
}
});
/** เลือกกรรมการ */
async function directorSave() {
emit("returnDirector", selected.value);
}
const emit = defineEmits([
"update:filterKeyword2",
"update:selected",
@ -141,6 +136,11 @@ const emit = defineEmits([
"returnDirector",
]);
/** เลือกกรรมการ */
async function directorSave() {
emit("returnDirector", selected.value);
}
function updateInput(value: any) {
emit("update:filterKeyword2", value);
}
@ -150,6 +150,11 @@ function Reset() {
emit("update:filterKeyword2", "");
}
function updateProp(newPagination: any, page: number) {
// event parent component props
emit("update:pagination", newPagination, page);
}
/** เช็คค่า props.Modal === true */
watchEffect(() => {
if (props.Modal === true) {
@ -158,18 +163,6 @@ watchEffect(() => {
}
});
/** แสดงจำนวนในตาราง */
const pagination = ref({
descending: true,
page: Number(props.page),
rowsPerPage: props.rowsPerPage,
});
const updateProp = (newPagination: any, page: number) => {
// event parent component props
emit("update:pagination", newPagination, page);
};
watch(
() => currentPage.value,
() => {

View file

@ -1,15 +1,10 @@
<script setup lang="ts">
import { ref, useAttrs } from "vue";
import type { Pagination } from "@/modules/04_registry/interface/index/Main";
const attrs = ref<any>(useAttrs());
const table = ref<any>(null);
const filterRef = ref<any>(null);
const initialPagination = ref<Pagination>({
rowsPerPage: 0,
});
/** รับ props มาจากหน้าหลัก */
const props = defineProps({
count: Number,
@ -49,14 +44,6 @@ const emit = defineEmits([
"update:editvisible",
]);
function updateInput(value: string | number | null){
emit("update:inputfilter", value);
};
function updateVisible(value: []){
emit("update:inputvisible", value);
};
const pagination = ref({
sortBy: "desc",
descending: false,
@ -69,16 +56,6 @@ const paginationLabel = (start: string, end: string, total: string) => {
return " " + start + " ใน " + end + " จากจำนวน " + total + " รายการ";
else return start + "-" + end + " ใน " + total;
};
const checkAdd = () => {
props.add();
};
const resetFilter = () => {
// reset X
emit("update:inputfilter", "");
filterRef.value.focus();
};
</script>
<template>
<div class="q-pb-sm row q-col-gutter-sm">

View file

@ -4,12 +4,11 @@ import { useQuasar } from "quasar";
import DialogHeader from "@/components/DialogHeader.vue";
import { useCounterMixin } from "@/stores/mixin";
import { useComplainstDataStore } from "@/modules/11_discipline/store/ComplaintsStore";
const mixin = useCounterMixin();
const $q = useQuasar();
const { dialogConfirm,dialogMessageNotify } = mixin;
const { dialogConfirm, dialogMessageNotify } = mixin;
const props = defineProps({
title: {
@ -60,20 +59,21 @@ const initialPagination = ref<any>({
});
function onclickSend() {
if(selected.value.length === 0){
dialogMessageNotify($q,'กรุณาเลือกอย่างน้อย 1 บุคคล')
}else{
dialogConfirm(
$q,
async () => {
// success($q, `${props.title}`);
emit("returnPerson", selected.value);
props.close?.();
},
`ยืนยันการ${props.title}`,
`ต้องการยืนยันการ${props.title}หรือไม่`
);
}}
if (selected.value.length === 0) {
dialogMessageNotify($q, "กรุณาเลือกอย่างน้อย 1 บุคคล");
} else {
dialogConfirm(
$q,
async () => {
// success($q, `${props.title}`);
emit("returnPerson", selected.value);
props.close?.();
},
`ยืนยันการ${props.title}`,
`ต้องการยืนยันการ${props.title}หรือไม่`
);
}
}
function onClickClose() {
props.close?.();
@ -194,21 +194,6 @@ watch([() => props.modal], () => {
</q-tr>
</template>
</d-table>
<!-- <div class="col-xs-12 col-sm-12 q-mt-sm">
<q-input
for="inputInspectionResults"
ref="inputRef"
dense
outlined
hide-bottom-space
v-model="inspectionResults"
:rules="[(val) => !!val || 'กรุณากรอกผลการตรวจสอบเรื่องร้องเรียน']"
lazy-rules
label="ผลการตรวจสอบเรื่องร้องเรียน"
type="textarea"
rows="5"
/>
</div> -->
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">