เพิ่มฟิล

This commit is contained in:
setthawutttty 2024-11-05 10:36:31 +07:00
parent c29eede844
commit f3a7f92540
2 changed files with 77 additions and 11 deletions

View file

@ -36,6 +36,7 @@ const id = ref<string>(route.params.id as string);
const profileId = ref<string>("");
const isSave = ref<boolean>(false);
const isDirector = ref<boolean>(false);
const isAct = ref<boolean>(false);
const topic = ref<string>("");
const status = ref<string>("");
@ -74,18 +75,22 @@ const rowsDirector = ref<MemBerType[]>([]);
const visibleColumns = ref<string[]>([
"no",
"positionNo",
"role",
"name",
"position",
"positionType",
"positionLevel",
"actFullName",
]);
const visibleColumnsMember = ref<string[]>([
"no",
"posNo",
"name",
"position",
"posLevel",
"posType",
"actFullName",
]);
/** หัวตาราง */
const columns = ref<QTableProps["columns"]>([
@ -98,6 +103,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "positionNo",
align: "left",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "positionNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "role",
align: "left",
@ -143,6 +157,15 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "actFullName",
align: "left",
label: "รักษาการแทน",
sortable: true,
field: "actFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
const columnsMember = ref<QTableProps["columns"]>([
{
@ -154,6 +177,15 @@ const columnsMember = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "posNo",
align: "left",
label: "เลขที่ตำแหน่ง",
sortable: true,
field: "posNo",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "name",
align: "left",
@ -191,14 +223,25 @@ const columnsMember = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
{
name: "actFullName",
align: "left",
label: "รักษาการแทน",
sortable: true,
field: "actFullName",
headerStyle: "font-size: 14px",
style: "font-size: 14px",
},
]);
/** เพิ่ม ประธาน/กรรมการ */
/** เพิ่ม คณะกรรมการ */
function onAdd() {
modal.value = true;
}
function close() {
isAct.value = false;
isDirector.value = false;
modal.value = false;
member.value = "";
selected.value = [];
@ -221,6 +264,8 @@ function onAddPerson() {
position: item.position,
positionType: item.posType,
positionLevel: item.posLevel,
actFullName: item.actFullName,
positionNo: item.posNo,
role: member.value,
}));
rows.value = [...rows.value, ...data];
@ -232,6 +277,7 @@ async function getPerson() {
showLoader();
await http
.post(config.API.orgProfileDirector, {
isAct: isAct.value,
isDirector: isDirector.value,
pageSize: pagination.value.rowsPerPage,
page: pagination.value.page,
@ -241,7 +287,10 @@ async function getPerson() {
const data = await res.data.result.data;
const dataTotal = await res.data.result.total;
rowsDirector.value = data;
rowsDirector.value = data.filter(
(item: MemBerType, index: number, self: any[]) =>
index === self.findIndex((t: any) => t.id === item.id)
);
rowsDirector.value = rowsDirector.value.filter(
(item: MemBerType) =>
!rows.value.some((i: PersonsAppointData) => i.profileId == item.id)
@ -293,7 +342,7 @@ function onSubmit() {
const body = {
topic: topic.value,
persons: rows.value.map(
({ prefix, firstName, lastName, citizenId, ...newData }) => newData
({ prefix, firstName, lastName, citizenId,actFullName,positionNo, ...newData }) => newData
),
};
dialogConfirm($q, () => {
@ -348,6 +397,13 @@ async function getData() {
async function onDirector() {
pagination.value.page = 1;
isAct.value = false;
await getPerson();
selected.value = [];
}
async function onAct() {
pagination.value.page = 1;
isDirector.value = false;
await getPerson();
selected.value = [];
}
@ -441,7 +497,7 @@ onMounted(async () => {
<div
class="col-xs-12 col-sm-12 text-weight-medium bg-grey-1 q-py-xs q-px-md"
>
ประธาน/กรรมการ
คณะกรรมการ
<q-btn
v-if="!checkRoutePermisson && rows.length !== 4"
size="12px"
@ -453,7 +509,7 @@ onMounted(async () => {
@click="onAdd"
icon="mdi-plus"
>
<q-tooltip>เพประธาน/กรรมการ</q-tooltip>
<q-tooltip>เพคณะกรรมการ</q-tooltip>
</q-btn>
</div>
<q-separator />
@ -466,11 +522,8 @@ onMounted(async () => {
flat
:visible-columns="visibleColumns"
bordered
:paging="true"
dense
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
hide-pagination
>
<template v-slot:header="props">
<q-tr :props="props">
@ -537,7 +590,7 @@ onMounted(async () => {
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 80%">
<q-form greedy @submit.prevent @validation-success="onAddPerson">
<DialogHeader tittle="เพิ่มประธาน/กรรมการ" :close="close" />
<DialogHeader tittle="เพิ่มคณะกรรมการ" :close="close" />
<q-separator />
<q-card-section>
<div class="row q-col-gutter-sm">
@ -567,6 +620,15 @@ onMounted(async () => {
>
<q-tooltip>แสดงเฉพาะผอำนวยการ/วหน </q-tooltip>
</q-checkbox>
<q-checkbox
keep-color
v-model="isAct"
label="แสดงเฉพาะรักษาการแทน"
color="primary"
@update:model-value="onAct"
>
<q-tooltip>แสดงเฉพาะรกษาการแทน </q-tooltip>
</q-checkbox>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2 q-mr-sm"
@ -599,7 +661,7 @@ onMounted(async () => {
:display-value="$q.lang.table.columns"
emit-value
map-options
:options="columns"
:options="columnsMember"
option-value="name"
options-cover
style="min-width: 150px"

View file

@ -113,6 +113,8 @@ interface PersonsAppointData {
position: string;
positionType: string;
positionLevel: string;
actFullName: string;
positionNo: string;
role?: string;
}
@ -125,6 +127,8 @@ interface MemBerType {
position: string;
posLevel: string;
posType: string;
posNo: string;
actFullName: string;
isDirector?: boolean;
}
export type {