เพิ่ม UI ทะเบียนประวัติลูกจ้าง Main

This commit is contained in:
AnandaTon 2023-07-04 17:40:05 +07:00
parent 96756dec99
commit ef85c4652d
3 changed files with 605 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/**
* Router }6d0hk' (Registry)
* Router (registryEmployee)
*/
const Main = () => import("@/modules/08_registryEmployee/views/Main.vue");

View file

@ -0,0 +1,602 @@
<template>
<div class="toptitle text-dark col-12 row items-center">
รายชอลกจางชวคราว
</div>
<div>
<div class="q-pa-md" style="min-height: 70vh; overflow-y: scroll">
<div class="col-12 row q-py-sm items-center">
<q-btn flat round color="primary" @click="clickAdd" icon="mdi-plus">
<q-tooltip>เพมขอม</q-tooltip>
</q-btn>
<q-space />
<div class="items-center" style="display: flex">
<!-- นหาขอความใน table -->
<q-input
standout
dense
v-model="filter"
ref="filterRef"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
class="q-ml-sm"
>
<template v-slot:append>
<q-icon v-if="filter == ''" name="search" />
<q-icon
v-if="filter !== ''"
name="clear"
class="cursor-pointer"
@click="resetFilter"
/>
</template>
</q-input>
<!-- แสดงคอลมนใน table -->
<q-select
v-model="visibleColumns"
:display-value="$q.lang.table.columns"
multiple
outlined
dense
:options="columns"
options-dense
option-value="name"
map-options
emit-value
style="min-width: 150px"
class="gt-xs q-ml-sm"
/>
</div>
</div>
<q-table
flat
bordered
dense
:rows="rows"
:columns="columns"
:visible-columns="visibleColumns"
:filter="filter"
row-key="name"
class="custom-header-table"
: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">
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-td key="no" :props="props">
{{ props.rowIndex + 1 }}
</q-td>
<q-td key="positionNum" :props="props">
{{ props.row.positionNum }}
</q-td>
<q-td key="name" :props="props">
{{ props.row.name }}
</q-td>
<q-td key="position" :props="props">
{{ props.row.position }}
</q-td>
<q-td key="path" :props="props">
{{ props.row.path }}
</q-td>
<q-td key="type" :props="props">
{{ props.row.type }}
</q-td>
<q-td key="level" :props="props">
{{ props.row.level }}
</q-td>
<q-td key="affiliation" :props="props">
{{ props.row.affiliation }}
</q-td>
<q-td key="yearly" :props="props">
{{ props.row.yearly }}
</q-td>
<q-td key="pay" :props="props">
{{ props.row.pay }}
</q-td>
<q-td auto-width>
<q-btn
icon="mdi-dots-vertical"
size="12px"
color="grey-7"
flat
round
dense
>
<q-menu transition-show="jump-down" transition-hide="jump-up">
<q-list dense style="min-width: 100px">
<q-item
clickable
v-close-popup
@click="editDetail(props.row, 'wait')"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
</q-item-section>
<q-item-section>กำหนดตำแหน</q-item-section>
</q-item>
<q-separator />
<q-item
clickable
v-close-popup
@click="editDetail(props.row, 'wait')"
>
<q-item-section
style="min-width: 0px"
avatar
class="q-py-sm"
>
</q-item-section>
<q-item-section>ลบ</q-item-section>
</q-item>
<q-separator />
</q-list>
</q-menu>
</q-btn>
</q-td>
</q-tr>
</template>
<template v-slot:pagination="scope">
<q-pagination
v-model="pagination.page"
color="primary"
:max="scope.pagesNumber"
:max-pages="5"
size="sm"
boundary-links
direction-links
></q-pagination>
</template>
</q-table>
</div>
<q-separator />
</div>
</template>
<script setup lang="ts">
import { ref, onMounted } from "vue";
import { useQuasar } from "quasar";
import { useCounterMixin } from "@/stores/mixin";
import type { QInput, QForm } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
const props = defineProps({
next: {
type: Function,
default: () => console.log("not function"),
},
previous: {
type: Function,
default: () => console.log("not function"),
},
});
const $q = useQuasar();
const mixin = useCounterMixin(); //
const { dialogMessage, messageError, showLoader, hideLoader } = mixin;
const myForm = ref<QForm>();
const filterRef = ref<QInput>();
const filter = ref<string>("");
const mutiselect = ref([]);
const modal = ref<boolean>(false);
const search = ref<string>("");
const expanded = ref<string[]>([]);
const nodesTree = ref<treeTab[]>([]);
const send = ref<String[]>([]);
const selectedModal = ref([]);
const filterModal = ref<string>("");
const visibleColumnsModal = ref<String[]>(["no", "positionNum", "name"]);
const columnsModal = [
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
{
name: "positionNum",
align: "left",
label: "เลขประจำตัวประชาชน",
field: "positionNum",
sortable: true,
},
{
name: "name",
align: "left",
label: "ชื่อ-สกุล",
field: "name",
sortable: true,
},
];
const rowsModal = [
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
];
const paginationModal = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const pagination = ref({
sortBy: "desc",
descending: false,
page: 1,
rowsPerPage: 10,
});
const visibleColumns = ref<String[]>([
"no",
"positionNum",
"name",
"position",
"path",
"type",
"level",
"affiliation",
"yearly",
"pay",
]);
const columns = [
{ name: "no", align: "left", label: "ลำดับ", field: "no", sortable: true },
{
name: "name",
align: "left",
label: "ชื่อ-สกุล",
field: "name",
sortable: true,
},
{
name: "positionNum",
align: "left",
label: "ตำแหน่งเลขที่",
field: "positionNum",
sortable: true,
},
{
name: "position",
align: "left",
label: "ตำแหน่ง",
field: "position",
sortable: true,
},
{
name: "path",
align: "left",
label: "สายงาน",
field: "path",
sortable: true,
},
{
name: "type",
align: "left",
label: "ประเภท",
field: "type",
sortable: true,
},
{
name: "level",
align: "left",
label: "ระดับชั้นงาน",
field: "level",
sortable: true,
},
{
name: "affiliation",
align: "left",
label: "สังกัด",
field: "affiliation",
sortable: true,
},
{
name: "yearly",
align: "left",
label: "ปีงบประมาณ",
field: "yearly",
sortable: true,
},
{
name: "pay",
align: "left",
label: "ค่าจ้าง",
field: "pay",
sortable: true,
},
];
const rows = [
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
{
no: "0ac56905-1a74-4606-a120-233340adde95",
name: "นางนัทธ์ เหล่าสกุล",
positionNum: "สกก.3",
position: "นักบริหาร",
path: "บริหาร",
type: "บริหาร",
level: "ชำนาญการพิเศษ",
affiliation: "ฝ่ายบริหารงานทั่วไป",
yearly: 2565,
pay: "40,000",
},
];
onMounted(async () => {
await nodeTree();
});
const paginationLabel = (start: number, end: number, total: number) => {
// if (props.paging == true)
// return " " + start + " " + end + " " + total + " ";
// else
return start + "-" + end + " ใน " + total;
};
const resetFilter = () => {
// reset X
filter.value = "";
filterRef.value!.focus();
};
const getClass = (val: boolean) => {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
const clickClose = async () => {
// if (editRow.value == true) {
// dialogMessage(
// $q,
// "",
// "?",
// "mdi-help-circle-outline",
// "",
// "orange",
// () => (modal.value = false),
// undefined
// );
// } else {
modal.value = false;
// next.value = false;
// previous.value = false;
// }
};
const clickAdd = () => {
modal.value = true;
};
const clickDelete = (id: string) => {
dialogMessage(
$q,
"ยืนยันการลบข้อมูล",
"ต้องการลบข้อมูลนี้ใช่หรือไม่?",
"mdi-help-circle-outline",
"ตกลง",
"red",
() => deleteData(id),
undefined
);
};
const nodeTree = async () => {
showLoader();
await http
.get(config.API.profileOrganizRoot)
.then((res: any) => {
const data = res.data.result;
nodesTree.value = data;
if (data.length > 0) {
expanded.value = [data[0].id];
}
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
};
const onSelected = async (id: string) => {
// await fetchPositionNumber(id);
};
const deleteData = async (id: string) => {};
</script>
<style lang="scss">
.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>