Refactoring code module 05_placement

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-09-19 15:02:44 +07:00
parent 202fbf27b6
commit 4678ead38e
75 changed files with 3110 additions and 10795 deletions

View file

@ -312,8 +312,6 @@ async function expiredAccountFilter() {
await DataStore.DataMain(updatedRows);
}
/** filter ใน dropdown ครั้งที่ */
/**
* งช กรอกขอมลเพ นหา
* @param val าทกรอก
@ -376,7 +374,9 @@ function paginationLabel(start: number, end: number, total: number) {
else return start + "-" + end + " ใน " + total;
}
/** เรียกใช้ฟังชั่น เมื่อเริ่มหน้านี้ */
/**
* เรยกใชงช เมอเรมหนาน
*/
onMounted(async () => {
await fetchYearOptions();
});

View file

@ -21,14 +21,13 @@ const { statusText } = useTransferDataStore();
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const modal = ref<boolean>(false); //
const rowsOrder = ref<ResponseData[]>([]);
const filterOrder = ref<string>("");
const filterMain = ref<string>(""); //
const rows = ref<ResponseData[]>([]);
const dataTransfer = ref<ResponseData[]>([]);
const dataTransfer = ref<ResponseData[]>([]); //
//Table
const rows = ref<ResponseData[]>([]); //
const filterMain = ref<string>(""); //
const rowsOrder = ref<ResponseData[]>([]); //
const filterOrder = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "no",

View file

@ -15,8 +15,8 @@ import type {
ResponseRow,
} from "@/modules/05_placement/interface/response/Receive";
import Dialogbody from "@/modules/05_placement/components/Receive/Dialogbody.vue";
import DialogHeader from "@/modules/05_placement/components/Receive/DialogHeader.vue";
import Dialogbody from "@/modules/05_placement/components/Receive/DialogOrders.vue";
import DialogHeader from "@/components/DialogHeader.vue";
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue";
const $q = useQuasar();
@ -34,27 +34,27 @@ const {
} = mixin;
const dataRecevice = ref<ResponseData[]>([]); //
const filters = ref<ResponseRow[]>([]); //
const dataRows = ref<ResponseRow>(); //
const modal = ref<boolean>(false); // popup
const modalupload = ref<boolean>(false); // popup
const modalTree = ref<boolean>(false); // popup
const dataRows = ref<any[]>([]);
const rows2 = ref<ResponseRow[]>([]);
const modal = ref<boolean>(false);
const modalupload = ref<boolean>(false);
const modalTree = ref<boolean>(false);
const myForm = ref<any>();
const personal = ref<ResponseData[]>([]);
const personalId = ref<string>("");
const filterKeyword = ref<string>("");
const filterKeyword2 = ref<string>("");
const filterRef = ref<any>(null);
const files = ref<any>();
const filters = ref<ResponseRow[]>([]);
const rows = ref<ResponseRow[]>([]);
const posType = ref<string>("");
const posLevel = ref<string>("");
const position = ref<string>("");
const personal = ref<ResponseData[]>([]); //
const personalId = ref<string>(""); //
const files = ref<any>(); //
const posType = ref<string>(""); //
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const type = ref<string | null>(null);
//Table
const rows = ref<ResponseRow[]>([]); //
const rows2 = ref<ResponseRow[]>([]); //
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
"citizenId",
@ -143,6 +143,9 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* งกนดงขอมลรายการรบโอน
*/
async function fecthlistRecevice() {
showLoader();
await http
@ -189,45 +192,58 @@ function onSubmitDoc() {
});
}
//
const resetFilter = () => {
/**
* งกนบรเซตคาในฟลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
};
//
const clickClose = () => {
}
/**
* งกนป popup ออกคำส
*/
function clickClose() {
modal.value = false;
filterKeyword2.value = "";
};
//
const clickCloseUpload = () => {
}
/**
* งกนป popup ปเดตไฟล
*/
function clickCloseUpload() {
modalupload.value = false;
files.value = null;
};
//
const openModalTree = (id: string, data: any) => {
}
/**
* งกนเป popup เลอกหนวยงานทบโอน
*/
function openModalTree(id: string, data: any) {
personalId.value = id;
personal.value = dataRecevice.value.filter((e: ResponseData) => e.id === id);
dataRows.value = data;
modalTree.value = true;
type.value = null;
dataRows.value = data;
// console.log("data===>", data);
posType.value = data.posTypeOldId;
posLevel.value = data.posLevelOldId;
position.value = data.positionOld;
};
//
const openUpload = (id: string) => {
}
/**
* งกนเป popup ปเดตไฟล
* @param id รายการทองการอปเดตไฟล
*/
function openUpload(id: string) {
personalId.value = id;
modalupload.value = true;
};
//
const openDelete = (id: string) => {
}
/**
* งกนยนยนการลบขอม
* @param id รายการทองการลบ
*/
function openDelete(id: string) {
dialogRemove($q, async () => {
showLoader();
await http
@ -241,16 +257,24 @@ const openDelete = (id: string) => {
hideLoader();
});
});
};
}
//
const nextPage = (id: string) => {
/**
* งกนไปหนารายละเอยด
* @param id รายการทองการดรายละเอยก
*/
function nextPage(id: string) {
router.push({
path: `/placement/receive/${id}`,
});
};
}
const popup = () => {
/**
* งกนสงไปออกคำส
*
* นหารายชอออกคำสงตามสถานะ อน (APPROVE)
*/
function openModalOrder() {
const row = filters.value.filter(
(r: any) =>
(r.status == "WAITTING" ||
@ -267,10 +291,9 @@ const popup = () => {
rows2.value = row;
modal.value = true;
};
}
function onSave(data: any) {
console.log("not save", data);
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
@ -303,6 +326,9 @@ function onSave(data: any) {
});
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
fecthlistRecevice();
});
@ -331,7 +357,7 @@ onMounted(() => {
round
color="add"
icon="mdi-account-arrow-right"
@click="popup()"
@click="openModalOrder()"
>
<q-tooltip>งไปออกคำสงรบโอน</q-tooltip>
</q-btn>
@ -550,34 +576,23 @@ onMounted(() => {
</div>
</q-card>
<!-- ออกคำส -->
<Dialogbody
v-model:Modal="modal"
:clickClose="clickClose"
:rows2="rows2"
v-model:filterKeyword2="filterKeyword2"
:fecthlistRecevice="fecthlistRecevice"
:nextPage="nextPage"
/>
<!-- ปโหลดเอกสาร -->
<q-dialog v-model="modalupload">
<q-card style="width: 600px">
<q-form greedy @submit.prevent @validation-success="onSubmitDoc">
<DialogHeader title="อัปโหลดเอกสาร" :close="clickCloseUpload" />
<DialogHeader tittle="อัปโหลดเอกสาร" :close="clickCloseUpload" />
<q-separator />
<q-card-section class="q-py-sm">
<div class="col-12 row items-center q-col-gutter-sm">
<div class="col-12">
<q-file
ref="myForm"
outlined
dense
v-model="files"
label="อัปโหลดเอกสาร"
lazy-rules
:rules="[
(val) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
(val:string) => val || 'กรุณาเลือกไฟล์หนังสือถึงหน่วยงานที่รับโอน',
]"
hide-bottom-space
>
@ -599,6 +614,16 @@ onMounted(() => {
</q-card>
</q-dialog>
<!-- ออกคำส -->
<Dialogbody
v-model:modal="modal"
v-model:filter-keyword2="filterKeyword2"
:click-close="clickClose"
:rows2="rows2"
:fecthlist-recevice="fecthlistRecevice"
:next-page="nextPage"
/>
<!-- เลอกหนวยงานทบโอน -->
<DialogOrgSelect
:title="`เลือกหน่วยงานที่รับโอน`"

View file

@ -0,0 +1,415 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRouter } from "vue-router";
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type { officerType } from "@/modules/05_placement/interface/response/officer";
/**
* importComponents
*/
import Dialogbody from "@/modules/05_placement/components/Help-Government/DialogOrders.vue";
const $q = useQuasar();
const router = useRouter();
const transferStore = useTransferDataStore();
const { statusText } = transferStore;
const mixin = useCounterMixin();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogRemove,
findOrgNameOld,
findPosMasterNoOld,
} = mixin;
/**
* Table
*/
const modal = ref<boolean>(false); // popup ;
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const rows = ref<officerType[]>([]); //
const rows2 = ref<officerType[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "name",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
},
{
name: "posMasterNoOld",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posMasterNoOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return findPosMasterNoOld(row);
},
},
{
name: "positionOld",
align: "left",
label: "ตำแหน่งในสายงาน",
sortable: true,
field: "positionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionLevel",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
let name = "";
if (row.posTypeNameOld && row.posLevelNameOld) {
name = `${row.posTypeNameOld} (${row.posLevelNameOld})`;
} else if (row.posTypeNameOld) {
name = `${row.posTypeNameOld}`;
} else if (row.posLevelNameOld) {
name = `(${row.posLevelNameOld})`;
} else name = "-";
return name;
},
},
{
name: "organizationPositionOld",
align: "left",
label: "สังกัด",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val, row) => findOrgNameOld(row),
},
{
name: "organization",
align: "left",
label: "หน่วยงานที่ให้ช่วยราชการ",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateStart",
align: "left",
label: "วันเริ่มช่วยราชการ",
sortable: true,
field: "dateStart",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "dateEnd",
align: "left",
label: "วันสิ้นสุดการช่วยราชการ",
sortable: true,
field: "dateEnd",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "createdAt",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => statusText(val),
},
]);
const visibleColumns = ref<string[]>([
"no",
"name",
"posMasterNoOld",
"positionOld",
"positionLevel",
"organizationPositionOld",
"organization",
"dateStart",
"dateEnd",
"createdAt",
"status",
]);
/**
* fetch รายการชวยราชการ
*/
async function getData() {
showLoader();
await http
.get(config.API.officerMain())
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* นยนการลบรายการชวยราชการ
* @param id รายการทองการลบ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.officerMainDelete(id))
.then(async () => {
await getData();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* rediarect หนารายละเอยดขอม
* @param id รายการชวยราชการทองการดรายละเอยด
*/
function openDetail(id: string) {
router.push(`/placement/help-government/detail/${id}`);
}
/**
* เป popup งไปออกคำสงชวยราชการ
*/
function openModalOrder() {
const row = rows.value.filter(
(item: officerType) =>
(item.status == "WAITTING" ||
item.status == "PENDING" ||
item.status == "APPROVE") &&
item.organizationPositionOld &&
item.organization &&
item.dateStart &&
item.dateEnd
);
rows2.value = row;
modal.value = true;
}
/**
* popup งไปออกคำสงชวยราชการ
*/
function closeModal() {
modal.value = false;
filterKeyword2.value = "";
}
/**
* เซตขอมลในชองฟลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการชวยราชการ</div>
<q-card flat bordered class="col-12 q-mt-sm">
<q-separator />
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="openModalOrder"
size="14px"
flat
round
color="add"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำสงชวยราชการ</q-tooltip>
</q-btn>
<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 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
dense
round
color="info"
icon="mdi-eye"
@click.stop.prevent="openDetail(props.row.id)"
>
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE' &&
checkPermission($route)?.attrIsDelete
"
icon="delete"
flat
round
dense
color="red"
@click.stop.prevent="clickDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="
col.name === 'organizationPositionOld' ||
col.name === 'organization'
? 'table_ellipsis'
: ''
"
>
{{
col.value == null ? "" : col.value == "" ? "-" : col.value
}}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
:get-data="getData"
:close-modal="closeModal"
:rows2="rows2"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -0,0 +1,378 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type { QTableProps } from "quasar";
import type { officerType } from "@/modules/05_placement/interface/response/officer";
/**
* importComponents
*/
import Dialogbody from "@/modules/05_placement/components/Repatriate/DialogOrders.vue"; //popup
const $q = useQuasar();
const router = useRouter();
const { statusText } = useTransferDataStore();
const {
date2Thai,
messageError,
showLoader,
hideLoader,
success,
dialogRemove,
findPosMasterNoOld,
} = useCounterMixin();
const modal = ref<boolean>(false); //
// Table
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const rows = ref<officerType[]>([]); //
const rows2 = ref<officerType[]>([]); //
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "naem",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.prefix}${row.firstName} ${row.lastName}`;
},
},
{
name: "posMasterNoOld",
align: "left",
label: "ตำแหน่งเลขที่",
sortable: true,
field: "posMasterNoOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return findPosMasterNoOld(row);
},
},
{
name: "positionLevel",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
let name = "";
if (row.positionTypeOld && row.positionLevelOld) {
name = `${row.positionTypeOld} (${row.positionLevelOld})`;
} else if (row.positionTypeOld) {
name = `${row.positionTypeOld}`;
} else if (row.positionLevelOld) {
name = `(${row.positionLevelOld})`;
} else name = "-";
return name;
},
},
{
name: "organizationPositionOld",
align: "left",
label: "ตำแหน่ง/สังกัดเดิม",
sortable: true,
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organization",
align: "left",
label: "หน่วยงานที่ให้ช่วยราชการ",
sortable: true,
field: "organization",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdAt",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => statusText(val),
},
]);
const visibleColumns = ref<string[]>([
"no",
"name",
"posMasterNoOld",
"positionLevel",
"organizationPositionOld",
"organization",
"createdAt",
"status",
]);
/**
* rediarect ไปหนารายละเอยด
*/
function openDetail(id: string) {
router.push(`/placement/repatriate/detail/${id}`);
}
/**
* fetch รายการสงตวกล
*/
async function getData() {
showLoader();
await http
.get(config.API.repatriationMain())
.then(async (res) => {
const data = await res.data.result;
rows.value = data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* นยนการลบรายการ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.repatriationMainDelete(id))
.then(async () => {
await getData();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* เป popup งไปออกคำสงสงตวกล
*/
function openModalOrder() {
// filter status
const row = rows.value.filter(
(item: officerType) =>
(item.status == "WAITTING" ||
item.status == "PENDING" ||
item.status == "APPROVE") &&
item.organizationPositionOld &&
item.positionTypeOld &&
item.positionLevelOld &&
item.positionNumberOld &&
item.salary !== null &&
item.organization &&
item.date &&
item.dateRepatriation
);
rows2.value = row;
modal.value = true;
}
/**
* popup งไปออกคำสงสงตวกล
*/
function closeModal() {
modal.value = false;
filterKeyword2.value = "";
}
/**
* เซตคาในชอง ลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(async () => {
await getData();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการสงตวกล</div>
<q-card flat bordered class="col-12 q-mt-sm">
<q-separator />
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
flat
round
size="14px"
color="add"
icon="mdi-account-arrow-right"
@click="openModalOrder"
>
<q-tooltip>งไปออกคำสงสงตวกล</q-tooltip>
</q-btn>
<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
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
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"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
:visible-columns="visibleColumns"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
dense
round
color="info"
icon="mdi-eye"
@click.stop.prevent="openDetail(props.row.id)"
>
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE' &&
checkPermission($route)?.attrIsDelete
"
icon="delete"
flat
round
dense
color="red"
@click.stop.prevent="clickDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="
col.name === 'organizationPositionOld' ||
col.name === 'organization'
? 'table_ellipsis'
: ''
"
>
{{ col.value == null ? "" : col.value }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
:get-data="getData"
:close-modal="closeModal"
:rows2="rows2"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -0,0 +1,601 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
import type {
listAppointType,
resData,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import type { QTableProps } from "quasar";
/**
* importComponents
*/
import Dialogbody from "@/modules/05_placement/components/AppointMent/DialogOrders.vue"; //
import DialogOrgSelect from "@/components/Dialogs/DialogOrgSelect.vue"; //
const $q = useQuasar();
const router = useRouter();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const {
showLoader,
hideLoader,
success,
messageError,
date2Thai,
dialogRemove,
} = useCounterMixin();
const modal = ref<boolean>(false); // popup
const modalTree = ref<boolean>(false); // popup - -
const posType = ref<string>(""); //
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const typeModal = ref<string | null>(null); // popup , ,
const dataRows = ref<any[]>([]);
const personalId = ref<string>("");
const filterRef = ref<any>(null);
const listRecevice = ref<resData[]>([]); //--
const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
/**
* Table
*/
const rows = ref<listAppointType[]>([]); //--
const rows2 = ref<listAppointType[]>([]); //
const filterKeyword = ref<string>(""); //--
const filterKeyword2 = ref<string>(""); //
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizationName",
align: "left",
label: "หน่วยงานที่รับการแต่งตั้ง-เลื่อน-ย้าย",
sortable: true,
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateOfBirth",
align: "left",
label: "วัน/เดือน/ปี เกิด",
sortable: true,
field: "dateOfBirth",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "typeCommand",
align: "left",
label: "ประเภทคำสั่ง",
sortable: true,
field: "typeCommand",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val: string) => {
return val === "APPOINT"
? "แต่งตั้ง"
: val === "SLIP"
? "เลื่อน"
: val === "MOVE"
? "ย้าย"
: "-";
},
},
{
name: "createdAt",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"typeCommand",
"dateOfBirth",
"createdAt",
"status",
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
/**
* เซตคำคนหารายการ
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
}
/**
* fetch รายการแตงต-เลอน-าย
*/
async function fecthlistappointment() {
showLoader();
await http
.get(config.API.appointmentMain())
.then((res) => {
let response = res.data.result;
listRecevice.value = response;
rows.value = response;
//
rows2.value = rows.value.filter(
(e: any) =>
e.root !== null &&
e.status !== "REPORT" &&
e.status !== "DONE" &&
e.educationOld &&
e.organizationPositionOld &&
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
e.salary !== null &&
e.positionDate
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* นยนการลบรายการแตงต-เลอน-าย
* @param id รายการแตงต-เลอน-าย
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.appointmentDelete(id))
.then(async () => {
await fecthlistappointment();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* redirect ไปหนารายละเอยด
* @param id
*/
function nextPage(id: string) {
router.push({
path: `appoint-promote/detail/${id}`,
});
}
/**
* เป popup เลอกหนวยงาน
*/
function openModalTree(data: any, type: string) {
personalId.value = data.id;
typeModal.value = type;
dataRows.value = data;
posType.value = data.posTypeOldId;
posLevel.value = data.posLevelOldId;
position.value = data.positionOld;
modalTree.value = true;
}
/**
* นยนการเลอกหนวยงานทแตงต
*/
function onSave(data: any) {
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
orgRevisionId: data.orgRevisionId,
positionId: data.positionId,
posMasterNo: data.posMasterNo,
positionName: data.positionName,
posTypeId: data.posTypeId,
posTypeName: data.posTypeName,
posLevelId: data.posLevelId,
posLevelName: data.posLevelName,
reportingDate: data.reportingDate,
posmasterId: data.posmasterId,
typeCommand: data.typeCommand,
};
showLoader();
http
.put(config.API.appointmentPosition(personalId.value), dataAppoint)
.then(async () => {
await fecthlistappointment();
await success($q, "บันทึกข้อมูลสำเร็จ");
modalTree.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
/**
* เป popup งไปออกคำส
*/
function sendToCommand() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำส
*/
function clickClose() {
modal.value = false;
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
fecthlistappointment();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายการแตงต-เลอน-าย
</div>
<q-card flat bordered class="col-12 q-mt-sm">
<q-separator />
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="sendToCommand()"
size="14px"
flat
round
color="add"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำสงแตงต-เลอน-าย</q-tooltip>
</q-btn>
<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 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="citizenId"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="
(props.row.status !== 'REPORT' &&
props.row.status !== 'DONE' &&
checkPermission($route)?.attrIsGet) ||
(checkPermission($route)?.attrIsDelete &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE') ||
(checkPermission($route)?.attrIsGet &&
checkPermission($route)?.attrIsDelete) ||
checkPermission($route)?.attrIsGet
"
icon="mdi-dots-horizontal-circle-outline"
color="secondary"
flat
round
dense
>
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list dense style="min-width: 250px">
<q-item
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="openModalTree(props.row, 'APPOINT')"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบแตงต</q-item-section
>
</q-item>
<q-item
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="openModalTree(props.row, 'SLIP')"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบเลอน</q-item-section
>
</q-item>
<q-item
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="openModalTree(props.row, 'MOVE')"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบยาย</q-item-section
>
</q-item>
<q-item
v-if="checkPermission($route)?.attrIsGet"
clickable
v-close-popup
@click="nextPage(props.row.id)"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon color="info" size="xs" name="mdi-eye" />
</q-item-section>
<q-item-section>รายละเอยด</q-item-section>
</q-item>
<q-item
v-if="
checkPermission($route)?.attrIsDelete &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="clickDelete(props.row.id)"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
<q-item-section>ลบ</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null ? props.row.nodeName : ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:next-page="nextPage"
:fetch-data="fecthlistappointment"
/>
<DialogOrgSelect
:title="`เลือกหน่วยงานที่แต่งตั้ง - เลื่อน - ย้าย`"
v-model:modal="modalTree"
v-model:type="typeModal"
:pos-type="posType"
:pos-level="posLevel"
:position="position"
:data-rows="dataRows"
:onSubmit="onSave"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -0,0 +1,546 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useTransferDataStore } from "@/modules/05_placement/store";
import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type {
listAppointType,
resData,
} from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import DialogOrgSelectEmployee from "@/components/Dialogs/DialogOrgSelectEmployee.vue"; //
import Dialogbody from "@/modules/05_placement/components/AppointEmployee/DialogOrders.vue";
const $q = useQuasar();
const router = useRouter();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const mixin = useCounterMixin(); //
const {
showLoader,
hideLoader,
success,
messageError,
date2Thai,
dialogRemove,
} = mixin;
const personalId = ref<string>("");
const modal = ref<boolean>(false); // popup
const modalTree = ref<boolean>(false); // popup
const typeModal = ref<string>(""); // popup ,
const posType = ref<string>(""); //
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const dataRows = ref<any[]>([]);
const filterRef = ref<any>(null);
const listRecevice = ref<resData[]>([]); //
const optionsType = ref<OpType[]>([]);
const type = ref<string>("");
// Table
const rows = ref<listAppointType[]>([]); //
const rows2 = ref<listAppointType[]>([]); //
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
"citizenId",
"fullname",
"organizationName",
"dateOfBirth",
"createdAt",
"status",
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "citizenId",
align: "left",
label: "เลขประจำตัวประชาชน",
sortable: true,
field: "citizenId",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "organizationName",
align: "left",
label: "หน่วยงานที่รับปรับระดับชั้นงาน-ย้าย",
sortable: true,
field: "organizationName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "dateOfBirth",
align: "left",
label: "วัน/เดือน/ปี เกิด",
sortable: true,
field: "dateOfBirth",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdAt",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/**
* เซ input
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
}
/**
* fetch รายการปรบระดบชนงานลกจาง
*/
async function fecthlistappointment() {
showLoader();
await http
.get(config.API.appointEmployee())
.then(async (res) => {
let response = await res.data.result;
listRecevice.value = response;
rows.value = response;
//
rows2.value = rows.value.filter(
(e: any) =>
e.root !== null &&
e.status !== "REPORT" &&
e.status !== "DONE" &&
e.educationOld &&
e.organizationPositionOld &&
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
e.salary !== null &&
e.positionDate
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* นยนลบรายการปรบระดบชนงานลกจาง
* @param id รายการปรบระดบชนงานลกจาง
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.appointEmployeeByid(id))
.then(async () => {
await fecthlistappointment();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* redialect รายละเอยดการปรบระดบชนงานลกจาง
* @param id รายการปรบระดบชนงานลกจาง
*/
function nextPage(id: string) {
router.push({
path: `appoint-employee/detail/${id}`,
});
}
/**
* เป popup งไปออกคำส
*/
function popup() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำส
*/
function clickClose() {
modal.value = false;
}
/**
* เป popup เลอกหนวยงาน
* @param data อมลหนวยงาน
* @param type ประเภท าย,ปร
*/
function openModalTree(data: any, type: string) {
typeModal.value = type;
personalId.value = data.id;
dataRows.value = data;
posType.value = data.posTypeNameOld;
posLevel.value = data.posLevelNameOld;
position.value = data.positionOld;
modalTree.value = true;
}
/**
* นยนการบนทกขอมลเลอกตำแหน
*/
function onSave(data: any) {
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
orgRevisionId: data.orgRevisionId,
positionId: data.positionId,
posMasterNo: data.posMasterNo,
positionName: data.positionName,
posTypeId: data.posTypeId,
posTypeName: data.posTypeName,
posLevelId: data.posLevelId,
posLevelName: data.posLevelName,
reportingDate: data.reportingDate,
posmasterId: data.posmasterId,
typeCommand: data.typeCommand,
};
showLoader();
http
.put(config.API.appointmentPosition(personalId.value), dataAppoint)
.then(async () => {
await fecthlistappointment();
await success($q, "บันทึกสำเร็จ");
modalTree.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
fecthlistappointment();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
รายการปรบระดบชนงานลกจาง
</div>
<q-card flat bordered class="col-12 q-mt-sm">
<q-separator />
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="popup()"
size="14px"
flat
round
color="add"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำส</q-tooltip>
</q-btn>
<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 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="citizenId"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="
(props.row.status !== 'REPORT' &&
props.row.status !== 'DONE' &&
checkPermission($route)?.attrIsGet) ||
(checkPermission($route)?.attrIsDelete &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE') ||
(checkPermission($route)?.attrIsGet &&
checkPermission($route)?.attrIsDelete) ||
checkPermission($route)?.attrIsGet
"
icon="mdi-dots-horizontal-circle-outline"
color="secondary"
flat
round
dense
>
<q-menu
transition-show="jump-down"
transition-hide="jump-up"
>
<q-list dense style="min-width: 200px">
<q-item
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="openModalTree(props.row, 'SLIP')"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบปรบระดบชนงาน</q-item-section
>
</q-item>
<q-item
v-if="
checkPermission($route)?.attrIsUpdate &&
checkPermission($route)?.attrIsGet &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="openModalTree(props.row, 'MOVE')"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon
color="primary"
size="xs"
name="mdi-bookmark-outline"
/>
</q-item-section>
<q-item-section
>เลอกหนวยงานทบยาย</q-item-section
>
</q-item>
<q-item
v-if="checkPermission($route)?.attrIsGet"
clickable
v-close-popup
@click="nextPage(props.row.id)"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon color="info" size="xs" name="mdi-eye" />
</q-item-section>
<q-item-section>รายละเอยด</q-item-section>
</q-item>
<q-item
v-if="
checkPermission($route)?.attrIsDelete &&
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE'
"
clickable
v-close-popup
@click="clickDelete(props.row.id)"
>
<q-item-section style="min-width: 0px" avatar>
<q-icon color="red" size="xs" name="mdi-delete" />
</q-item-section>
<q-item-section>ลบ</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{ props.rowIndex + 1 }}
</div>
<div v-else-if="col.name == 'fullname'">
{{
props.row.firstName
? `${props.row.prefix ?? ""}${
props.row.firstName ?? ""
} ${props.row.lastName ?? ""}`
: "-"
}}
</div>
<div v-else-if="col.name == 'status'">
{{ props.row.status ? statusText(props.row.status) : "-" }}
</div>
<div v-else-if="col.name == 'dateOfBirth'">
{{
props.row.dateOfBirth
? date2Thai(props.row.dateOfBirth)
: "-"
}}
</div>
<div v-else-if="col.name == 'organizationName'">
<div class="col-4">
<div class="text-weight-medium">
{{ props.row.root !== null ? props.row.root : "-" }}
{{
props.row.rootShortName !== null
? `(${props.row.rootShortName})`
: ""
}}
</div>
<div class="text-weight-light">
{{
props.row.nodeName !== null ? props.row.nodeName : ""
}}
{{
props.row.nodeShortName !== null
? `(${props.row.nodeShortName}${props.row.posMasterNo})`
: ""
}}
</div>
</div>
</div>
<div v-else-if="col.name == 'createdAt'">
{{
props.row.createdAt ? date2Thai(props.row.createdAt) : "-"
}}
</div>
<div v-else>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:next-page="nextPage"
:fetch-data="fecthlistappointment"
/>
<DialogOrgSelectEmployee
:title="`เลือกหน่วยงานที่รับการปรับระดับชั้นงาน`"
v-model:modal="modalTree"
v-model:type="typeModal"
:pos-type="posType"
:pos-level="posLevel"
:position="position"
:data-rows="dataRows"
:onSubmit="onSave"
/>
</template>
<style scoped lang="scss"></style>

View file

@ -0,0 +1,391 @@
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useRouter } from "vue-router";
import { checkPermission } from "@/utils/permissions";
import { useTransferDataStore } from "@/modules/05_placement/store";
import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/** importType*/
import type { QTableProps } from "quasar";
import type { listMain } from "@/modules/05_placement/interface/response/OhterMain";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
/** importcomopnents*/
import Dialogbody from "@/modules/05_placement/components/Other/DialogOrders.vue";
/** use*/
const $q = useQuasar();
const router = useRouter();
const storeFn = useTransferDataStore();
const { statusText } = storeFn;
const {
showLoader,
hideLoader,
success,
messageError,
date2Thai,
dialogRemove,
} = useCounterMixin();
const modal = ref<boolean>(false);
const type = ref<string>("");
const optionsType = ref<OpType[]>([]);
/**
* Table
*/
const rows = ref<listMain[]>([]); //
const rows2 = ref<listMain[]>([]); //
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const visibleColumns = ref<string[]>([
"no",
"fullname",
"positionLevel",
"organizationPositionOld",
"createdAt",
"status",
]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
align: "left",
label: "ลำดับ",
sortable: false,
field: "no",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "fullname",
align: "left",
label: "ชื่อ-นามสกุล",
sortable: true,
field: "fullname",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
return `${row.prefix === null ? "" : row.prefix}${row.firstName} ${
row.lastName
}`;
},
},
{
name: "positionLevel",
align: "left",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionLevel",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format(val, row) {
let name = "";
if (row.positionTypeOld && row.positionLevelOld) {
name = `${row.positionTypeOld} (${row.positionLevelOld})`;
} else if (row.positionTypeOld) {
name = `${row.positionTypeOld}`;
} else if (row.positionLevelOld) {
name = `(${row.positionLevelOld})`;
} else name = "-";
return name;
},
},
{
name: "organizationPositionOld",
align: "left",
label: "ตำแหน่ง/สังกัดเดิม",
sortable: true,
field: "organizationPositionOld",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "createdAt",
align: "left",
label: "วันที่ดำเนินการ",
sortable: true,
field: "createdAt",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => date2Thai(val),
},
{
name: "status",
align: "left",
label: "สถานะ",
sortable: true,
field: "status",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
format: (val) => statusText(val),
},
]);
const pagination = ref({
sortBy: "createdAt",
descending: true,
page: 1,
rowsPerPage: 10,
});
/**
* fetch รายการอนๆ
*/
async function fecthlistOthet() {
showLoader();
await http
.get(config.API.otherMain())
.then((res) => {
let response = res.data.result;
rows.value = response;
//
rows2.value = rows.value.filter(
(e: listMain) =>
e.status !== "REPORT" &&
e.status !== "DONE" &&
e.organizationPositionOld &&
e.positionTypeOld &&
e.positionLevelOld &&
e.positionNumberOld &&
e.amountOld !== null &&
e.positionDate &&
e.leaveDate !== null
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* fetch รายการขอมลประเภทคำส
*/
function fecthTypeOption() {
showLoader();
type.value = "";
http
.get(config.API.typeOrder())
.then((res) => {
// C-PM-08 C-PM-09
optionsType.value = res.data.result.filter(
(e: OpType) =>
e.commandCode === "C-PM-08" || e.commandCode === "C-PM-09"
);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
/**
* เซตขอมลในชอง input
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
/**
* เป popup งไปออกคำสงอนๆ
*/
function popup() {
modal.value = true;
filterKeyword2.value = "";
type.value = "";
// fetch
fecthTypeOption();
}
/**
* popup งไปออกคำสงอนๆ
*/
function clickClose() {
modal.value = false;
}
/**
* นยนการลบรายการอนๆ
* @param id รายการอนๆ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.otherByid(id))
.then(async () => {
await fecthlistOthet();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
}
/**
* redialect รายละเอยดรายการอนๆ
* @param id รายการอนๆ
*/
function nextPage(id: string) {
router.push({
path: `/placement/other/detail/${id}`,
});
}
onMounted(() => {
fecthlistOthet();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการอนๆ</div>
<q-card flat bordered class="col-12 q-mt-sm">
<q-separator />
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="popup()"
size="14px"
flat
round
color="add"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำสงรายการอนๆ</q-tooltip>
</q-btn>
<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 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<d-table
:columns="columns"
:rows="rows"
:filter="filterKeyword"
row-key="id"
:visible-columns="visibleColumns"
v-model:pagination="pagination"
>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsGet"
flat
round
dense
icon="mdi-eye"
color="info"
@click.stop.prevent="nextPage(props.row.id)"
>
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="
props.row.status !== 'REPORT' &&
props.row.status !== 'DONE' &&
checkPermission($route)?.attrIsDelete
"
flat
round
dense
color="red"
icon="mdi-delete"
@click.stop="clickDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>
</q-btn>
</q-td>
<q-td v-for="col in props.cols" :key="col.id">
<div v-if="col.name === 'no'">
{{ props.rowIndex + 1 }}
</div>
<div
v-else
:class="
col.name === 'organizationPositionOld' ||
col.name === 'organization'
? 'table_ellipsis'
: ''
"
>
{{ col.value ? col.value : "-" }}
</div>
</q-td>
</q-tr>
</template>
</d-table>
</div>
</div>
</div>
</q-card>
<Dialogbody
v-model:Modal="modal"
v-model:filter-keyword2="filterKeyword2"
v-model:type="type"
:click-close="clickClose"
:options-type="optionsType"
:rows2="rows2"
:fecthlistOthet="fecthlistOthet"
/>
</template>
<style scoped lang="scss"></style>