ปรับ dropdown บรรจุ
This commit is contained in:
parent
2175c11ad4
commit
2b99a1459e
8 changed files with 2048 additions and 456 deletions
|
|
@ -2,9 +2,15 @@
|
|||
import { ref, useAttrs, onMounted } from "vue";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store"
|
||||
import { useTransferDataStore } from "@/modules/05_placement/store";
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { FormMainProbation, FormMainProbation2,mapData,OpfillterType,CriteriaType } from "@/modules/05_placement/interface/request/Main";
|
||||
import type {
|
||||
FormMainProbation,
|
||||
FormMainProbation2,
|
||||
mapData,
|
||||
OpfillterType,
|
||||
CriteriaType,
|
||||
} from "@/modules/05_placement/interface/request/Main";
|
||||
|
||||
import DialogHeader from "@/modules/04_registry/components/DialogHeader.vue";
|
||||
import router from "@/router";
|
||||
|
|
@ -18,7 +24,7 @@ const rows2 = ref<FormMainProbation2[]>([]);
|
|||
const modal = ref<boolean>(false);
|
||||
const attrs = ref<any>(useAttrs());
|
||||
const paging = ref<boolean>(true);
|
||||
const fillter = ref<number>(0);
|
||||
const fillter = ref<number | null>(0);
|
||||
const paging2 = ref<boolean>(true);
|
||||
const Opfillter = ref<OpfillterType[]>([{ id: 0, value: "ทั้งหมด" }]);
|
||||
const filterRef = ref<any>(null);
|
||||
|
|
@ -28,10 +34,10 @@ const probationlist = ref<any>([]);
|
|||
const filterKeyword = ref<string>("");
|
||||
const fillterStatus = ref<any>([]);
|
||||
const filterKeyword2 = ref<string>("");
|
||||
|
||||
const storeFn = useTransferDataStore()
|
||||
|
||||
const storeFn = useTransferDataStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { statusProbationMain } = storeFn
|
||||
const { statusProbationMain } = storeFn;
|
||||
const { messageError, success, showLoader, hideLoader, dialogConfirm } = mixin;
|
||||
|
||||
const pagination = ref({
|
||||
|
|
@ -205,6 +211,7 @@ const ProbationMainFilter = () => {
|
|||
}
|
||||
});
|
||||
Opfillter.value.sort((a: any, b: any) => a.id - b.id);
|
||||
Opfillter2.value = Opfillter.value;
|
||||
};
|
||||
|
||||
const updateRows = (body: any) => {
|
||||
|
|
@ -240,7 +247,7 @@ const getpersonalList = async () => {
|
|||
dataUpdate.value = rows.value;
|
||||
ProbationMainFilter();
|
||||
})
|
||||
.catch(() => { })
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -259,7 +266,7 @@ const fecthlistPersonal = async () => {
|
|||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => { });
|
||||
.finally(() => {});
|
||||
};
|
||||
const fecthlistProbation = async (id: string, data: any) => {
|
||||
try {
|
||||
|
|
@ -279,11 +286,11 @@ const fecthlistProbation = async (id: string, data: any) => {
|
|||
};
|
||||
|
||||
const findlist = async (id: string) => {
|
||||
let data:CriteriaType[] = [
|
||||
let data: CriteriaType[] = [
|
||||
{ criteriaType: "is_retire", criteriaValue: "false" },
|
||||
{ criteriaType: "is_probation", criteriaValue: "true" },
|
||||
];
|
||||
let data2:CriteriaType[] = [
|
||||
let data2: CriteriaType[] = [
|
||||
{ criteriaType: "is_retire", criteriaValue: "false" },
|
||||
{ criteriaType: "is_probation", criteriaValue: "false" },
|
||||
];
|
||||
|
|
@ -336,7 +343,6 @@ const clickClose = async () => {
|
|||
modal.value = false;
|
||||
};
|
||||
|
||||
|
||||
const resetFilter = () => {
|
||||
filterKeyword.value = "";
|
||||
filterRef.value.focus();
|
||||
|
|
@ -359,6 +365,22 @@ const paginationLabel2 = (start: string, end: string, total: string) => {
|
|||
onMounted(async () => {
|
||||
getpersonalList();
|
||||
});
|
||||
|
||||
const Opfillter2 = ref<any[]>([]);
|
||||
function filterFn(val: string, update: any) {
|
||||
if (val == "") {
|
||||
update(() => {
|
||||
Opfillter2.value = Opfillter.value;
|
||||
fillter.value = null;
|
||||
});
|
||||
} else {
|
||||
update(() => {
|
||||
Opfillter2.value = Opfillter.value.filter(
|
||||
(e: any) => e.value.search(val) !== -1
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -370,33 +392,103 @@ onMounted(async () => {
|
|||
<div class="row col-12 q-col-gutter-sm">
|
||||
<div class="col-6">
|
||||
<div class="row">
|
||||
<q-select class="col-5 q-mr-sm" v-model="fillter" label="สถานะ" dense map-options option-label="value"
|
||||
:options="Opfillter" option-value="id" lazy-rules hide-bottom-space :readonly="false" :borderless="false"
|
||||
:outlined="true" :hide-dropdown-icon="false" @update:model-value="updateRows(fillter)" />
|
||||
<q-select
|
||||
class="col-5 q-mr-sm"
|
||||
v-model="fillter"
|
||||
label="สถานะ"
|
||||
dense
|
||||
map-options
|
||||
option-label="value"
|
||||
:options="Opfillter2"
|
||||
option-value="id"
|
||||
lazy-rules
|
||||
hide-bottom-space
|
||||
:readonly="false"
|
||||
:borderless="false"
|
||||
:outlined="true"
|
||||
:hide-dropdown-icon="false"
|
||||
@update:model-value="updateRows(fillter)"
|
||||
@filter="filterFn"
|
||||
use-input
|
||||
behavior="menu"
|
||||
>
|
||||
<template v-slot:no-option>
|
||||
<q-item>
|
||||
<q-item-section class="text-grey">
|
||||
ไม่มีข้อมูล
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</template>
|
||||
</q-select>
|
||||
<div>
|
||||
<q-btn @click="fecthlistPersonal" size="12px" flat round color="add" icon="mdi-plus">
|
||||
<q-btn
|
||||
@click="fecthlistPersonal"
|
||||
size="12px"
|
||||
flat
|
||||
round
|
||||
color="add"
|
||||
icon="mdi-plus"
|
||||
>
|
||||
<q-tooltip>เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<q-space />
|
||||
<q-input class="col-xs-12 col-sm-3 col-md-2" standout dense v-model="filterKeyword" ref="filterRef" outlined
|
||||
debounce="300" placeholder="ค้นหา">
|
||||
<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" />
|
||||
<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-select
|
||||
v-model="visibleColumns"
|
||||
multiple
|
||||
outlined
|
||||
dense
|
||||
options-dense
|
||||
:display-value="$q.lang.table.columns"
|
||||
emit-value
|
||||
map-options
|
||||
:options="columns"
|
||||
option-value="name"
|
||||
options-cover
|
||||
style="min-width: 150px"
|
||||
class="col-xs-12 col-sm-3 col-md-2"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<q-table ref="table" :columns="columns" :rows="rows" :filter="filterKeyword" row-key="Order" flat bordered
|
||||
:paging="true" dense class="custom-header-table" v-bind="attrs" :visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel" v-model:pagination="pagination">
|
||||
<q-table
|
||||
ref="table"
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:filter="filterKeyword"
|
||||
row-key="Order"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:visible-columns="visibleColumns"
|
||||
:pagination-label="paginationLabel"
|
||||
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">
|
||||
|
|
@ -405,8 +497,11 @@ onMounted(async () => {
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer"
|
||||
@click="router.push(`/probation/detail/${props.row.personal_id}`)">
|
||||
<q-tr
|
||||
:props="props"
|
||||
class="cursor-pointer"
|
||||
@click="router.push(`/probation/detail/${props.row.personal_id}`)"
|
||||
>
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<div v-if="col.name == 'no'">
|
||||
{{ props.rowIndex + 1 }}
|
||||
|
|
@ -418,8 +513,16 @@ onMounted(async () => {
|
|||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination v-model="pagination.page" active-color="primary" color="dark" :max="scope.pagesNumber"
|
||||
:max-pages="5" size="sm" boundary-links direction-links></q-pagination>
|
||||
<q-pagination
|
||||
v-model="pagination.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="scope.pagesNumber"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
|
|
@ -429,23 +532,55 @@ onMounted(async () => {
|
|||
<q-dialog v-model="modal" persistent>
|
||||
<q-card style="width: 900px; max-width: 80vw">
|
||||
<q-form ref="myForm">
|
||||
<DialogHeader tittle="เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ " :close="clickClose" />
|
||||
<DialogHeader
|
||||
tittle="เพิ่มผู้ทดลองปฏิบัติหน้าที่ราชการ "
|
||||
:close="clickClose"
|
||||
/>
|
||||
<q-separator />
|
||||
<q-card-section class="q-pa-md q-col-gutter-sm">
|
||||
<q-input class="col-12" standout dense v-model="filterKeyword2" ref="filterRef2" outlined debounce="300"
|
||||
placeholder="ค้นหา">
|
||||
<q-input
|
||||
class="col-12"
|
||||
standout
|
||||
dense
|
||||
v-model="filterKeyword2"
|
||||
ref="filterRef2"
|
||||
outlined
|
||||
debounce="300"
|
||||
placeholder="ค้นหา"
|
||||
>
|
||||
<template v-slot:append>
|
||||
<q-icon v-if="filterKeyword2 == ''" name="search" />
|
||||
<q-icon v-if="filterKeyword2 !== ''" name="clear" class="cursor-pointer" @click="resetFilter2" />
|
||||
<q-icon
|
||||
v-if="filterKeyword2 !== ''"
|
||||
name="clear"
|
||||
class="cursor-pointer"
|
||||
@click="resetFilter2"
|
||||
/>
|
||||
</template>
|
||||
</q-input>
|
||||
<div class="col-12">
|
||||
<q-table ref="table2" :columns="columns2" :rows="rows2" :filter="filterKeyword2" row-key="Order" flat bordered
|
||||
:paging="true" dense class="custom-header-table" v-bind="attrs" :pagination-label="paginationLabel2"
|
||||
v-model:pagination="pagination2">
|
||||
<q-table
|
||||
ref="table2"
|
||||
:columns="columns2"
|
||||
:rows="rows2"
|
||||
:filter="filterKeyword2"
|
||||
row-key="Order"
|
||||
flat
|
||||
bordered
|
||||
:paging="true"
|
||||
dense
|
||||
class="custom-header-table"
|
||||
v-bind="attrs"
|
||||
:pagination-label="paginationLabel2"
|
||||
v-model:pagination="pagination2"
|
||||
>
|
||||
<template v-slot:header="props">
|
||||
<q-tr :props="props">
|
||||
<q-th v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<q-th
|
||||
v-for="col in props.cols"
|
||||
:key="col.name"
|
||||
:props="props"
|
||||
>
|
||||
<span class="text-weight-medium">{{ col.label }}</span>
|
||||
</q-th>
|
||||
<q-th auto-width />
|
||||
|
|
@ -453,26 +588,50 @@ onMounted(async () => {
|
|||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-td v-for="col in props.cols" :key="col.name" :props="props">
|
||||
<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 == 'status'" class="text-center">
|
||||
<q-icon v-if="col.value === true" name="mdi-check" color="positive" size="sm" />
|
||||
<q-icon
|
||||
v-if="col.value === true"
|
||||
name="mdi-check"
|
||||
color="positive"
|
||||
size="sm"
|
||||
/>
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ col.value }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td auto-width>
|
||||
<q-btn dense class="q-px-md" outline color="primary" label="เพิ่ม" @click="clickAdd(props.row.id)">
|
||||
<q-btn
|
||||
dense
|
||||
class="q-px-md"
|
||||
outline
|
||||
color="primary"
|
||||
label="เพิ่ม"
|
||||
@click="clickAdd(props.row.id)"
|
||||
>
|
||||
</q-btn>
|
||||
</q-td>
|
||||
</q-tr>
|
||||
</template>
|
||||
<template v-slot:pagination="scope">
|
||||
<q-pagination v-model="pagination2.page" active-color="primary" color="dark" :max="scope.pagesNumber"
|
||||
:max-pages="5" size="sm" boundary-links direction-links></q-pagination>
|
||||
<q-pagination
|
||||
v-model="pagination2.page"
|
||||
active-color="primary"
|
||||
color="dark"
|
||||
:max="scope.pagesNumber"
|
||||
:max-pages="5"
|
||||
size="sm"
|
||||
boundary-links
|
||||
direction-links
|
||||
></q-pagination>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue