ปรับ code บรรจุ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-12-20 10:29:07 +07:00
parent 063db4e245
commit 35a5817db3
16 changed files with 559 additions and 700 deletions

View file

@ -346,6 +346,18 @@ interface PersonData {
statusName: string;
organizationName: string;
id: string;
posTypeOldId: string;
posLevelOldId: string;
positionOld: string;
status: string;
educationOld: string;
organizationPositionOld: string;
positionTypeOld: string;
positionLevelOld: string;
positionNumberOld: number;
positionDate: string;
posTypeNameOld: string;
posLevelNameOld: string;
}
interface AppointTopic {

View file

@ -131,6 +131,22 @@ interface MemBerType {
actFullName: string;
isDirector?: boolean;
}
interface FormDataAppoint {
node: string;
nodeId: number;
orgRevisionId: string;
positionId: string;
posMasterNo: number;
positionName: string;
posTypeId: string;
posTypeName: string;
posLevelId: string;
posLevelName: string;
reportingDate: string;
posmasterId: string;
typeCommand: string;
}
export type {
FormPlacementMainData,
FormOrderPlacementMainData,
@ -146,5 +162,6 @@ export type {
AppointMainRows,
FormAppointData,
MemBerType,
PersonsAppointData
PersonsAppointData,
FormDataAppoint,
};

View file

@ -28,6 +28,10 @@ interface ResponseRow {
positionTypeId: string;
positionLevelId: string;
amountOld: number;
posTypeOldId: string;
posLevelOldId: string;
positionOld: string;
posMasterNo: number;
}
interface ResponseData {

View file

@ -89,8 +89,8 @@ export const useProfileDataStore = defineStore("profilePlacenent", () => {
export const usePlacementDataStore = defineStore("placement", () => {
const mixin = useCounterMixin(); //เรียกฟังก์ชันกลาง
const tabsMain = ref<string>("probation");
const isOfficer = ref<boolean|null>(null);
const isStaff = ref<boolean|null>(null);
const isOfficer = ref<boolean | null>(null);
const isStaff = ref<boolean | null>(null);
const { hideLoader } = mixin;
interface placement {
mappingPosition: { columns: String[] };
@ -113,8 +113,9 @@ export const usePlacementDataStore = defineStore("placement", () => {
let DataMainUpdate = ref<FormPlacementMainData[]>([]); // ข้อมูลเปลี่ยนแปลง
const DataMainYearSet = (val: FormPlacementMainData[]) =>
(DataMainYear.value = val);
const DataMain = (val: FormPlacementMainData[]) => (DataMainOrig.value = val);
const DataUpdateMain = (
const DataMain = async (val: FormPlacementMainData[]) =>
(DataMainOrig.value = val);
const DataUpdateMain = async (
filter_1: number | string,
filter_2: string | null,
filter_3: boolean

View file

@ -17,7 +17,8 @@ import config from "@/app.config";
const DataStore = usePlacementDataStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai,onSearchDataTable } = mixin;
const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
mixin;
const searchYear = ref();
const yearOptions = reactive<DataOption[]>([{ id: 0, name: "ทั้งหมด" }]);
@ -31,10 +32,6 @@ const rowsData = ref<any[]>([]);
/** ค้นหาในตาราง */
const filterKeyword = ref<string>("");
const filterRef = ref<any>(null);
const resetFilter = () => {
filterKeyword.value = "";
filterRef.value.focus();
};
/**ครั้งที่สอบ */
const examTime = ref<number | string>("");
@ -59,19 +56,6 @@ const pagination = ref({
rowsPerPage: 10,
});
/** ส่วนเเสดงผล ตาราง */
const visibleColumns = ref([
"id",
"examRound",
"examOrder",
"examOrder",
"fiscalYear",
"numberOfCandidates",
"examTypeName",
"accountStartDate",
"accountExpirationDate",
]);
/**หัวตาราง */
const columns = ref<QTableProps["columns"]>([
{
@ -151,6 +135,17 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const visibleColumns = ref([
"id",
"examRound",
"examOrder",
"examOrder",
"fiscalYear",
"numberOfCandidates",
"examTypeName",
"accountStartDate",
"accountExpirationDate",
]);
/**
* งชนดงขอมรายการสอบแขงข / ดเลอกตามป
@ -165,8 +160,7 @@ async function fetchPlacementData(val: number) {
const data = await res.data.result;
dataPlacement.value = data;
DataStore.DataMainOrig = dataPlacement.value;
const listData =
DataStore.DataMainOrig.map((e: any) => ({
const listData = DataStore.DataMainOrig.map((e: any) => ({
id: e.id,
examRound: e.examRound,
examOrder: e.examOrder,
@ -178,8 +172,8 @@ async function fetchPlacementData(val: number) {
fiscalYear: e.fiscalYear,
numberOfCandidates: e.numberOfCandidates,
}));
rows.value = listData
rowsData.value = listData
rows.value = listData;
rowsData.value = listData;
filterKeyword.value = "";
examTime.value = "ทั้งหมด";
examType.value = "ทั้งหมด";
@ -199,9 +193,7 @@ async function fetchPlacementData(val: number) {
});
}
/**
* งชนดงขอม ..
*/
/** ฟังชั่นดึงข้อมูล ปี ค.ส. */
async function fetchYearOptions() {
showLoader();
await http
@ -243,9 +235,7 @@ function redirectToPage(examId?: number) {
router.push(`/placement/personal-list/${examId}`);
}
/**
* ลเตอรหาครงทสอบ ตาม
*/
/** ฟิลเตอร์หาครั้งที่สอบ ตาม ปี*/
async function examTimeFilter() {
for (const data of dataPlacement.value) {
const examOrder = data.examOrder;
@ -275,9 +265,7 @@ function examTypeFilter() {
});
}
/**
* งกนคนหาขอม ายการสอบแขงข / ดเลอก
*/
/** ฟังก์ชันค้นหาข้อมูล ายการสอบแข่งขัน / คัดเลือก*/
async function searchFilterTable() {
rows.value = [];
if (examType.value !== undefined && examType.value !== null) {
@ -287,7 +275,7 @@ async function searchFilterTable() {
expiredAccount.value
);
const dataArr: any = [];
await DataStore.DataMainUpdate.map((e: any) => {
DataStore.DataMainUpdate.map((e: any) => {
dataArr.push({
id: e.id,
examRound: e.examRound,
@ -373,11 +361,6 @@ function filterFnYear(val: string, update: any) {
}
}
function paginationLabel(start: number, end: number, total: number) {
if (paging.value == true) return " " + start + "-" + end + " ใน " + total;
else return start + "-" + end + " ใน " + total;
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
@ -386,9 +369,7 @@ function onSearch() {
);
}
/**
* เรยกใชงช เมอเรมหนาน
*/
/** เรียกใช้ฟังชั่น เมื่อเริ่มหน้านี้*/
onMounted(async () => {
await fetchYearOptions();
});
@ -398,9 +379,10 @@ onMounted(async () => {
<div class="toptitle text-dark col-12 row items-center">
รายการสอบแขงข/ดเลอก
</div>
<q-card flat bordered class="col-12 q-mt-sm q-pa-md">
<div class="row q-col-gutter-sm">
<div class="row col-12 q-col-gutter-sm">
<div class="row col-12">
<q-select
class="col-xs-12 col-sm-3 col-md-2"
v-model="searchYear"
@ -432,7 +414,6 @@ onMounted(async () => {
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -442,18 +423,12 @@ onMounted(async () => {
@keydown.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
<!-- <q-icon
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/> -->
<q-icon name="search" />
</template>
</q-input>
<q-select
class="col-xs-12 col-sm-3 col-md-2"
class="q-ml-sm"
v-model="visibleColumns"
multiple
outlined
@ -526,7 +501,11 @@ onMounted(async () => {
hide-selected
fill-input
:clearable="examType !== 'all' && examType !== 'ทั้งหมด'"
@clear="(examType = 'all'), searchFilterTable()"
@clear="
(examTimeOP2 = examTimeOP),
(examType = 'ทั้งหมด'),
searchFilterTable()
"
>
<template v-slot:no-option>
<q-item>
@ -547,8 +526,9 @@ onMounted(async () => {
</div>
</q-card>
</div>
<div class="col-12">
<q-table
<d-table
ref="table"
:rows="rows"
:columns="columns"
@ -556,12 +536,9 @@ onMounted(async () => {
flat
bordered
dense
class="custom-header-table"
:visible-columns="visibleColumns"
:pagination-label="paginationLabel"
v-model:pagination="pagination"
>
<template v-slot:pagination="scope">
<!-- <template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
active-color="primary"
@ -572,7 +549,7 @@ onMounted(async () => {
boundary-links
direction-links
></q-pagination>
</template>
</template> -->
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width />
@ -621,7 +598,7 @@ onMounted(async () => {
</q-td>
</q-tr>
</template>
</q-table>
</d-table>
</div>
</div>
</q-card>
@ -643,35 +620,4 @@ onMounted(async () => {
.icon-color {
color: #4154b3;
}
.custom-header-table {
max-height: 64vh;
.q-table tr:nth-child(odd) td {
background: white;
}
.q-table tr:nth-child(even) td {
background: #f8f8f8;
}
.q-table thead tr {
background: #ecebeb;
}
.q-table thead tr th {
position: sticky;
z-index: 1;
}
/* this will be the loading indicator */
.q-table thead tr:last-child th {
/* height of all previous header rows */
top: 48px;
}
.q-table thead tr:first-child th {
top: 0;
}
}
</style>

View file

@ -18,14 +18,15 @@ const $q = useQuasar();
const router = useRouter();
const mixin = useCounterMixin();
const { statusText } = useTransferDataStore();
const { date2Thai, messageError, showLoader, hideLoader } = mixin;
const { date2Thai, messageError, showLoader, hideLoader, onSearchDataTable } =
mixin;
const modal = ref<boolean>(false); //
const dataTransfer = ref<ResponseData[]>([]); //
//Table
const rows = ref<ResponseData[]>([]); //
const filterMain = ref<string>(""); //
const filter = ref(""); //
const rowsOrder = ref<ResponseData[]>([]); //
const rowsOrderData = ref<ResponseData[]>([]); //
const filterOrder = ref<string>(""); //
@ -118,9 +119,7 @@ const visibleColumns = ref<string[]>([
"createdAt",
]);
/**
* งกนดงขอมรายการขอโอน
*/
/** ฟังก์ชันดึงข้อมูรายการขอโอน*/
async function fetchData() {
showLoader();
await http
@ -140,7 +139,6 @@ async function fetchData() {
/**
* งกนสงไปออกคำส
*
* นหารายชอออกคำสงตามสถานะ อน (APPROVE)
*/
function openModalOrder() {
@ -159,62 +157,34 @@ function openModalOrder() {
modal.value = true;
}
/**
* งกนป popup งไปออกคำส
*
*/
/** ฟังก์ชันปิด popup ส่งไปออกคำสั่ง*/
function closeModal() {
modal.value = false;
filterOrder.value = "";
}
/**
* งกนคนคาตวแปรคนหา
*
* กำหนด filterMain และ filterOrder เปนคาวาง
*/
function resetFilter() {
filterMain.value = "";
filterOrder.value = "";
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
dataTransfer.value,
columns.value ? columns.value : []
);
}
/**
* ทำงานเม Components กเรยกใชงาน
*
* จะเรยกใช fetchData เพอดงขอมลรายการขอโอน
*/
onMounted(async () => {
await fetchData();
});
const filter = ref("");
const filterAndApply = () => {
const searchText = filter.value.trim().toLowerCase();
if (!searchText) {
rows.value = dataTransfer.value; //
return;
}
rows.value = dataTransfer.value.filter((row: any) => {
return columns.value?.some((col: any) => {
const rawValue = row[col.field];
const formattedValue = col.format
? col.format(rawValue, row) // `format`
: rawValue;
return String(formattedValue).toLowerCase().includes(searchText);
});
});
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการขอโอน</div>
<q-card flat bordered class="col-12 q-mt-sm">
<div class="row q-pa-md">
<div class="col-12">
<div class="col-12 q-col-gutter-sm">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@ -229,14 +199,13 @@ const filterAndApply = () => {
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filter"
ref="filterRef"
outlined
placeholder="ค้นหา"
@keyup.enter="filterAndApply"
@keyup.enter="onSearch"
>
<template v-slot:append>
<q-icon name="search" />
@ -244,6 +213,7 @@ const filterAndApply = () => {
</q-input>
<q-select
class="q-ml-sm"
v-model="visibleColumns"
multiple
outlined
@ -255,11 +225,10 @@ const filterAndApply = () => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"

View file

@ -10,6 +10,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import type { QTableProps } from "quasar";
import type { FormDataAppoint } from "@/modules/05_placement/interface/request/Main";
import type {
ResponseData,
ResponseRow,
@ -31,7 +32,7 @@ const {
messageError,
date2Thai,
dialogRemove,
onSearchDataTable
onSearchDataTable,
} = mixin;
const dataRecevice = ref<ResponseData[]>([]); //
@ -149,9 +150,7 @@ const columns = ref<QTableProps["columns"]>([
},
]);
/**
* งกนดงขอมลรายการรบโอน
*/
/** ฟังก์ชันดึงข้อมูลรายการรับโอน*/
async function fecthlistRecevice() {
showLoader();
await http
@ -171,16 +170,12 @@ async function fecthlistRecevice() {
});
}
/**
* ไปหนาเพมขอมลรายการรบโอน
*/
/** ไปหน้าเพิ่มข้อมูลรายการรับโอน*/
function onAddReceive() {
router.push(`/placement/receive/add`);
}
/**
* งกนบนทกการอปโหลดเอกสาร
*/
/** ฟังก์ชันบันทึกการอัปโหลดเอกสาร*/
function onSubmitDoc() {
const formData = new FormData();
formData.append("File", files.value);
@ -199,24 +194,13 @@ function onSubmitDoc() {
});
}
/**
* งกนบรเซตคาในฟลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
/**
* งกนป popup ออกคำส
*/
/** ฟังก์ชันปิด popup ออกคำสั่ง*/
function clickClose() {
modal.value = false;
filterKeyword2.value = "";
}
/**
* งกนป popup ปเดตไฟล
*/
/** ฟังก์ชันปิด popup อัปเดตไฟล์*/
function clickCloseUpload() {
modalupload.value = false;
files.value = null;
@ -224,8 +208,10 @@ function clickCloseUpload() {
/**
* งกนเป popup เลอกหนวยงานทบโอน
* @param id id รายการรบโอนทเลอกหนวยงานทบโอน
* @param data อมลรายการรบโอน
*/
function openModalTree(id: string, data: any) {
function openModalTree(id: string, data: ResponseRow) {
personalId.value = id;
personal.value = dataRecevice.value.filter((e: ResponseData) => e.id === id);
dataRows.value = data;
@ -260,6 +246,8 @@ function openDelete(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
@ -277,12 +265,11 @@ function nextPage(id: string) {
/**
* งกนสงไปออกคำส
*
* นหารายชอออกคำสงตามสถานะ อน (APPROVE)
*/
function openModalOrder() {
const row = filters.value.filter(
(r: any) =>
(r: ResponseRow) =>
(r.status == "WAITTING" ||
r.status == "PENDING" ||
r.status == "APPROVE") &&
@ -299,7 +286,11 @@ function openModalOrder() {
modal.value = true;
}
async function onSave(data: any) {
/**
* งกนบนทกการเลอกหนวยงานทบโอน
* @param data อมลหนวยงานทบโอน
*/
async function onSave(data: FormDataAppoint) {
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
@ -340,19 +331,16 @@ function onSearch() {
);
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
fecthlistRecevice();
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(async () => {
await fecthlistRecevice();
});
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">รายการรบโอน</div>
<q-card flat bordered class="col-12 q-mt-sm">
<div class="row q-pa-md">
<div class="col-12">
<div class="col-12 q-gutter-sm">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsCreate"
@ -377,7 +365,6 @@ onMounted(() => {
</q-btn>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -388,15 +375,10 @@ onMounted(() => {
>
<template v-slot:append>
<q-icon name="search" />
<!-- <q-icon
v-if="filterKeyword !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/> -->
</template>
</q-input>
<q-select
class="q-ml-sm"
v-model="visibleColumns"
multiple
outlined
@ -408,11 +390,10 @@ onMounted(() => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>
<div class="col-12 q-pt-sm">
<div class="col-12">
<d-table
:columns="columns"
:rows="rows"

View file

@ -9,15 +9,11 @@ import { useCounterMixin } from "@/stores/mixin";
import http from "@/plugins/http";
import config from "@/app.config";
/**
* importType
*/
/** importType*/
import type { QTableProps } from "quasar";
import type { officerType } from "@/modules/05_placement/interface/response/officer";
/**
* importComponents
*/
/** importComponents*/
import Dialogbody from "@/modules/05_placement/components/Help-Government/DialogOrders.vue";
const $q = useQuasar();
@ -34,14 +30,11 @@ const {
dialogRemove,
findOrgNameOld,
findPosMasterNoOld,
onSearchDataTable
onSearchDataTable,
} = mixin;
/**
* Table
*/
/** Table*/
const modal = ref<boolean>(false); // popup ;
const filterKeyword = ref<string>(""); //
const filterKeyword2 = ref<string>(""); //
const rows = ref<officerType[]>([]); //
@ -185,9 +178,7 @@ const visibleColumns = ref<string[]>([
"status",
]);
/**
* fetch รายการชวยราชการ
*/
/**fetch รายการช่วยราชการ*/
async function getData() {
showLoader();
await http
@ -210,9 +201,9 @@ async function getData() {
* @param id รายการทองการลบ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(config.API.officerMainDelete(id))
.then(async () => {
await getData();
@ -235,9 +226,7 @@ function openDetail(id: string) {
router.push(`/placement/help-government/detail/${id}`);
}
/**
* เป popup งไปออกคำสงชวยราชการ
*/
/** เปิด popup ส่งไปออกคำสั่งช่วยราชการ*/
function openModalOrder() {
const row = rows.value.filter(
(item: officerType) =>
@ -254,22 +243,12 @@ function openModalOrder() {
modal.value = true;
}
/**
* popup งไปออกคำสงชวยราชการ
*/
/** ปิด popup ส่งไปออกคำสั่งช่วยราชการ*/
function closeModal() {
modal.value = false;
filterKeyword2.value = "";
}
/**
* เซตขอมลในชองฟลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
@ -278,17 +257,15 @@ function onSearch() {
);
}
/**
* ทำงานเมอมการเรยกใช Components
*/
onMounted(() => {
getData();
/** ทำงานเมื่อมีการเรียกใช้ 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-card flat bordered class="col-12">
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
@ -305,7 +282,6 @@ onMounted(() => {
</q-btn>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -320,6 +296,7 @@ onMounted(() => {
</q-input>
<q-select
class="q-ml-sm"
v-model="visibleColumns"
multiple
outlined
@ -331,7 +308,6 @@ onMounted(() => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>

View file

@ -27,7 +27,7 @@ const {
success,
dialogRemove,
findPosMasterNoOld,
onSearchDataTable
onSearchDataTable,
} = useCounterMixin();
const modal = ref<boolean>(false); //
@ -143,16 +143,12 @@ const visibleColumns = ref<string[]>([
"status",
]);
/**
* rediarect ไปหนารายละเอยด
*/
/** rediarect ไปหน้ารายละเอียด*/
function openDetail(id: string) {
router.push(`/placement/repatriate/detail/${id}`);
}
/**
* fetch รายการสงตวกล
*/
/** fetch รายการส่งตัวกลับ*/
async function getData() {
showLoader();
await http
@ -169,9 +165,7 @@ async function getData() {
hideLoader();
});
}
/**
* นยนการลบรายการ
*/
/** ยืนยันการลบรายการ*/
function clickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
@ -190,9 +184,7 @@ function clickDelete(id: string) {
});
}
/**
* เป popup งไปออกคำสงสงตวกล
*/
/** เปิด popup ส่งไปออกคำสั่งส่งตัวกลับ*/
function openModalOrder() {
// filter status
const row = rows.value.filter(
@ -214,22 +206,12 @@ function openModalOrder() {
modal.value = true;
}
/**
* popup งไปออกคำสงสงตวกล
*/
/** ปิด popup ส่งไปออกคำสั่งส่งตัวกลับ*/
function closeModal() {
modal.value = false;
filterKeyword2.value = "";
}
/**
* เซตคาในชอง ลเตอร
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
}
function onSearch() {
rows.value = onSearchDataTable(
filterKeyword.value,
@ -238,9 +220,7 @@ function onSearch() {
);
}
/**
* ทำงานเมอมการเรยกใช Components
*/
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(async () => {
await getData();
});
@ -265,7 +245,6 @@ onMounted(async () => {
</q-btn>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -279,7 +258,7 @@ onMounted(async () => {
</template>
</q-input>
<q-select
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
class="q-ml-sm"
v-model="visibleColumns"
multiple
outlined
@ -338,7 +317,6 @@ onMounted(async () => {
flat
round
dense
@click.stop.prevent="clickDelete(props.row.id)"
>
<q-tooltip>ลบขอม</q-tooltip>

View file

@ -14,6 +14,7 @@ import type { resData } from "@/modules/05_placement/interface/response/AppointM
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import type { QTableProps } from "quasar";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
import type { FormDataAppoint } from "@/modules/05_placement/interface/request/Main";
/** importComponents*/
import Dialogbody from "@/modules/05_placement/components/AppointMent/DialogOrders.vue"; //
@ -30,7 +31,7 @@ const {
messageError,
date2Thai,
dialogRemove,
onSearchDataTable
onSearchDataTable,
} = useCounterMixin();
const modal = ref<boolean>(false); // popup
@ -39,7 +40,7 @@ const posType = ref<string>(""); //ประเภทตำแหน่ง
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const typeModal = ref<string | null>(null); // popup , ,
const dataRows = ref<any[]>([]);
const dataRows = ref<PersonData>();
const personalId = ref<string>("");
const filterRef = ref<any>(null);
@ -154,13 +155,6 @@ const pagination = ref({
rowsPerPage: 10,
});
/** รีเซ็ตคำค้นหารายการ*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
}
/** fetch รายการแต่งตั้ง-เลื่อน-ย้าย*/
async function fecthlistappointment() {
showLoader();
@ -172,8 +166,7 @@ async function fecthlistappointment() {
rows.value = response;
rowsData.value = response;
//
const listData =
rows.value.filter(
const listData = rows.value.filter(
(e: any) =>
e.root !== null &&
e.status !== "REPORT" &&
@ -185,8 +178,8 @@ async function fecthlistappointment() {
e.positionNumberOld &&
e.positionDate
);
rows2.value = listData
rows2Data.value = listData
rows2.value = listData;
rows2Data.value = listData;
})
.catch((e) => {
messageError($q, e);
@ -229,7 +222,7 @@ function nextPage(id: string) {
}
/** เปิด popup เลือกหน่วยงาน*/
function openModalTree(data: any, type: string) {
function openModalTree(data: PersonData, type: string) {
personalId.value = data.id;
typeModal.value = type;
dataRows.value = data;
@ -240,7 +233,7 @@ function openModalTree(data: any, type: string) {
}
/** ยืนยันการเลือกหน่วยงานที่แต่งตั้ง*/
function onSave(data: any) {
async function onSave(data: FormDataAppoint) {
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
@ -258,7 +251,7 @@ function onSave(data: any) {
};
showLoader();
http
await http
.put(config.API.appointmentPosition(personalId.value), dataAppoint)
.then(async () => {
await fecthlistappointment();
@ -268,7 +261,7 @@ function onSave(data: any) {
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
.finally(() => {
hideLoader();
});
}
@ -293,8 +286,8 @@ function onSearch() {
}
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(() => {
fecthlistappointment();
onMounted(async () => {
await fecthlistappointment();
});
</script>

View file

@ -13,6 +13,7 @@ import type { QTableProps } from "quasar";
import type { PersonData } from "@/modules/05_placement/interface/index/Main";
import type { resData } from "@/modules/05_placement/interface/response/AppointMent";
import type { OpType } from "@/modules/05_placement/interface/response/Main";
import type { FormDataAppoint } from "@/modules/05_placement/interface/request/Main";
import DialogOrgSelectEmployee from "@/components/Dialogs/DialogOrgSelectEmployee.vue"; //
import Dialogbody from "@/modules/05_placement/components/AppointEmployee/DialogOrders.vue";
@ -29,7 +30,7 @@ const {
messageError,
date2Thai,
dialogRemove,
onSearchDataTable
onSearchDataTable,
} = mixin;
const personalId = ref<string>("");
@ -39,7 +40,7 @@ const typeModal = ref<string>(""); //ประเภท popup ปรับระ
const posType = ref<string>(""); //
const posLevel = ref<string>(""); //
const position = ref<string>(""); //
const dataRows = ref<any[]>([]);
const dataRows = ref<PersonData>();
const filterRef = ref<any>(null);
const listRecevice = ref<resData[]>([]); //
@ -150,21 +151,10 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
/**
* เซ input
*/
function resetFilter() {
filterKeyword.value = "";
filterKeyword2.value = "";
filterRef.value.focus();
}
/**
* fetch รายการปรบระดบชนงานลกจาง
*/
/** fetch รายการปรับระดับชั้นงานลูกจ้าง*/
async function fecthlistappointment() {
showLoader();
await http
.get(config.API.appointEmployee())
.then(async (res) => {
@ -172,11 +162,9 @@ async function fecthlistappointment() {
listRecevice.value = response;
rows.value = response;
rowsData.value = response;
//
const listData =
rows.value.filter(
(e: any) =>
const listData = rows.value.filter(
(e: PersonData) =>
e.root !== null &&
e.status !== "REPORT" &&
e.status !== "DONE" &&
@ -187,8 +175,8 @@ async function fecthlistappointment() {
e.positionNumberOld &&
e.positionDate
);
rows2.value = listData
rows2Data.value = listData
rows2.value = listData;
rows2Data.value = listData;
})
.catch((e) => {
messageError($q, e);
@ -203,9 +191,9 @@ async function fecthlistappointment() {
* @param id รายการปรบระดบชนงานลกจาง
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(config.API.appointEmployeeByid(id))
.then(async () => {
await fecthlistappointment();
@ -230,17 +218,13 @@ function nextPage(id: string) {
});
}
/**
* เป popup งไปออกคำส
*/
/** เปิด popup ส่งไปออกคำสั่ง*/
function popup() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำส
*/
/** ปิด popup ส่งไปออกคำสั่ง*/
function clickClose() {
modal.value = false;
}
@ -250,7 +234,7 @@ function clickClose() {
* @param data อมลหนวยงาน
* @param type ประเภท าย,ปร
*/
function openModalTree(data: any, type: string) {
function openModalTree(data: PersonData, type: string) {
typeModal.value = type;
personalId.value = data.id;
dataRows.value = data;
@ -260,10 +244,8 @@ function openModalTree(data: any, type: string) {
modalTree.value = true;
}
/**
* นยนการบนทกขอมลเลอกตำแหน
*/
function onSave(data: any) {
/** ยืนยันการบันทึกข้อมูลเลือกตำแหน่ง*/
async function onSave(data: FormDataAppoint) {
const dataAppoint = {
node: data.node,
nodeId: data.nodeId,
@ -280,7 +262,7 @@ function onSave(data: any) {
typeCommand: data.typeCommand,
};
showLoader();
http
await http
.put(config.API.appointmentPosition(personalId.value), dataAppoint)
.then(async () => {
await fecthlistappointment();
@ -303,8 +285,8 @@ function onSearch() {
);
}
onMounted(() => {
fecthlistappointment();
onMounted(async () => {
await fecthlistappointment();
});
</script>
@ -330,7 +312,6 @@ onMounted(() => {
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -356,7 +337,7 @@ onMounted(() => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
class="q-ml-sm"
/>
</div>

View file

@ -33,9 +33,7 @@ const {
const modal = ref<boolean>(false);
/**
* Table
*/
/** Table*/
const rows = ref<listMain[]>([]); //
const rowsData = ref<listMain[]>([]); //
const rows2 = ref<listMain[]>([]); //
@ -131,9 +129,7 @@ const pagination = ref({
rowsPerPage: 10,
});
/**
* fetch รายการอนๆ
*/
/** fetch รายการอื่นๆ*/
async function fecthlistOthet() {
showLoader();
await http
@ -165,17 +161,13 @@ async function fecthlistOthet() {
});
}
/**
* เป popup งไปออกคำสงอนๆ
*/
/** เปิด popup ส่งไปออกคำสั่งอื่นๆ*/
function popup() {
modal.value = true;
filterKeyword2.value = "";
}
/**
* popup งไปออกคำสงอนๆ
*/
/** ปิด popup ส่งไปออกคำสั่งอื่นๆ*/
function clickClose() {
modal.value = false;
}
@ -185,9 +177,9 @@ function clickClose() {
* @param id รายการอนๆ
*/
function clickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
await http
.delete(config.API.otherByid(id))
.then(async () => {
await fecthlistOthet();
@ -243,7 +235,6 @@ onMounted(() => {
</q-btn>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -268,7 +259,7 @@ onMounted(() => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
class="q-ml-sm"
/>
</div>