Merge branch 'develop' into setthawut

This commit is contained in:
setthawutttty 2024-11-12 17:26:09 +07:00
commit 3399f14823
9 changed files with 114 additions and 46 deletions

View file

@ -12,5 +12,7 @@ export default {
msgId: (id: string) => `${message}/my-notifications/${id}`, msgId: (id: string) => `${message}/my-notifications/${id}`,
msgNoread: () => `${message}/my-notifications/noread`, msgNoread: () => `${message}/my-notifications/noread`,
msgInboxDelete: (id: string) => `${message}/my-inboxes/${id}`, msgInboxDelete: (id: string) => `${message}/my-inboxes/${id}`,
replyMessage: (id: string) => `${reply}/${id}`, replyMessage: (id: string) => `${reply}/${id}`,
msgNotiAdmin: `${env.API_URI}/org/profile/noti-admin`,
}; };

View file

@ -10,8 +10,9 @@ export default {
page: number, page: number,
pageSize: number, pageSize: number,
isActive: boolean, isActive: boolean,
commandSysId: string commandSysId: string,
search: string
) => ) =>
`${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}`, `${commandSalary}/admin?page=${page}&pageSize=${pageSize}&isActive=${isActive}&commandSysId=${commandSysId}&search=${search}`,
commandSalaryById:(id:string)=>`${commandSalary}/${id}` commandSalaryById: (id: string) => `${commandSalary}/${id}`,
}; };

View file

@ -45,13 +45,14 @@ function onSubmit() {
showLoader(); showLoader();
const pathAPI = const pathAPI =
props.type === "Administrator" props.type === "Administrator"
? config.API.replyMessage(props.idInbox) ? config.API.msgNotiAdmin
: config.API.replyMessage(props.idInbox); : config.API.replyMessage(props.idInbox);
await http const method = props.type === "Administrator" ? http.post : http.put;
.put(pathAPI, {
subject: subject.value, await method(pathAPI, {
body: body.value, subject: subject.value,
}) body: body.value,
})
.then(() => { .then(() => {
success($q, "ส่งข้อความสำเร็จ"); success($q, "ส่งข้อความสำเร็จ");
onClose(); onClose();

View file

@ -10,6 +10,7 @@ import { useCounterMixin } from "@/stores/mixin";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
DataOption,
ItemsMenu, ItemsMenu,
Pagination, Pagination,
} from "@/modules/02_users/interface/index/Main"; } from "@/modules/02_users/interface/index/Main";
@ -37,6 +38,7 @@ const currentPage = ref<number>(1); // หน้า
const total = ref<number>(0); // const total = ref<number>(0); //
const maxPage = ref<number>(0); // const maxPage = ref<number>(0); //
const pageSize = ref<number>(10); // const pageSize = ref<number>(10); //
const employeeClass = ref<string>("officer");
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -149,24 +151,28 @@ const itemMenu = ref<ItemsMenu[]>([
}, },
]); ]);
const employeeClassMain = ref<DataOption[]>([
{ id: "officer", name: "ข้าราชการกรุงเทพมหานครสามัญ" },
{ id: "employee", name: "ลูกจ้างประจำกรุงเทพมหานคร" },
]);
const employeeClassOption = ref<DataOption[]>(employeeClassMain.value);
/** /**
* งกนดงขอมลรายชอผใชงาน * งกนดงขอมลรายชอผใชงาน
*/ */
async function fetchListUsers() { async function fetchListUsers() {
let max = pageSize.value;
let first = (currentPage.value - 1) * pageSize.value;
showLoader(); showLoader();
await http await http
.get( .get(
config.API.managementUser + config.API.managementUser +
`?max=${max}&first=${first}&search=${keyword.value}` `?pageSize=${pageSize.value}&page=${currentPage.value}&keyword=${keyword.value}&type=${employeeClass.value}`
) )
.then(async (res) => { .then(async (res) => {
const data = await res.data.data; const data = await res.data.result;
total.value = data.total;
total.value = res.data.total;
maxPage.value = Math.ceil(total.value / pageSize.value); maxPage.value = Math.ceil(total.value / pageSize.value);
rows.value = data.map((e: Users) => ({ rows.value = data.data.map((e: Users) => ({
...e, ...e,
roles: Array.isArray(e.roles) roles: Array.isArray(e.roles)
? e.roles.filter( ? e.roles.filter(
@ -288,6 +294,24 @@ function updatePagination(initialPagination: Pagination) {
pageSize.value = initialPagination.rowsPerPage; pageSize.value = initialPagination.rowsPerPage;
} }
/**
* function นหาขอม Option
* @param val คำคนหา
* @param update function
* @param type ประเภท option
*/
function filterFnOptions(val: string, update: Function, type: string) {
switch (type) {
case "employeeClass":
update(() => {
employeeClassOption.value = employeeClassMain.value.filter(
(v: DataOption) => v.name.indexOf(val) > -1
);
});
break;
}
}
/** /**
* การเปลยนแปลงของจำนวนขอมลตอหน * การเปลยนแปลงของจำนวนขอมลตอหน
* *
@ -318,8 +342,38 @@ onMounted(async () => {
</div> </div>
<q-card flast bordered class="q-pa-md"> <q-card flast bordered class="q-pa-md">
<div class="items-center col-12 row q-col-gutter-sm q-mb-sm"> <div class="items-center col-12 row q-col-gutter-sm">
<q-btn flat round dense color="primary" icon="add" @click="openDialog()"> <q-select
outlined
dense
v-model="employeeClass"
:options="employeeClassOption"
label="สถานภาพ"
emit-value
map-options
option-label="name"
option-value="id"
use-input
style="width: 300px"
@update:model-value="(currentPage = 1), fetchListUsers()"
@filter="(inputValue: string,
doneFn: Function) => filterFnOptions(inputValue, doneFn,'employeeClass')"
><template v-slot:no-option>
<q-item>
<q-item-section class="text-grey"> ไมอม </q-item-section>
</q-item>
</template>
</q-select>
<q-btn
class="q-ml-sm"
flat
round
dense
color="primary"
icon="add"
@click="openDialog()"
>
<q-tooltip>เพมผใชงาน </q-tooltip> <q-tooltip>เพมผใชงาน </q-tooltip>
</q-btn> </q-btn>
<q-space /> <q-space />

View file

@ -41,7 +41,7 @@ async function fatchOrg() {
nodeTree.value = data; nodeTree.value = data;
if (data.length === 1) { if (data.length === 1) {
selectedOrg(data[0].id); selectedOrg(data[0].id);
} else { } else if (data.length > 1) {
await fetchListPerson(); // await fetchListPerson(); //
} }
}) })

View file

@ -29,12 +29,12 @@ defineProps<{
<q-separator /> <q-separator />
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn
label="ส่งออกเป็นไฟล์ TXT" label="ดาวน์โหลด (.TXT)"
color="blue" color="blue"
type="submit" type="submit"
icon-right="send" icon="download"
@click="onSend" @click="onSend"
><q-tooltip>งออกเปนไฟล TXT</q-tooltip></q-btn ><q-tooltip>ดาวนโหลด (.TXT)</q-tooltip></q-btn
> >
</q-card-actions> </q-card-actions>
</q-card> </q-card>

View file

@ -564,12 +564,13 @@ onMounted(async () => {
</q-btn-dropdown> </q-btn-dropdown>
</div> </div>
<q-btn <q-btn
label="ส่งออกเป็นไฟล์ CSV" dense
flat
color="green" color="green"
type="submit" type="submit"
icon-right="send" icon-right="download"
@click="onSendCSV" @click="onSendCSV"
><q-tooltip>งออกเปนไฟล CSV</q-tooltip></q-btn ><q-tooltip>ดาวนโหลด (.CSV)</q-tooltip></q-btn
> >
</div> </div>

View file

@ -97,6 +97,11 @@ const menuList = ref<{ icon: string; label: string; path: string }[]>([
label: "ระบบ Admin", label: "ระบบ Admin",
path: "/logs?system=admin", path: "/logs?system=admin",
}, },
{
icon: "mdi-account-arrow-right",
label: "การเข้าใช้งานและการออกจากระบบ",
path: "/logs?system=inout",
},
]); ]);
onMounted(async () => { onMounted(async () => {

View file

@ -75,7 +75,7 @@ const columns = ref<QTableProps["columns"]>([
{ {
name: "name", name: "name",
align: "left", align: "left",
label: "ข้อความต้นแบบสำหรับลงในตำแหน่ง/เงินเดือน (ต้นแบบ)", label: "ข้อความต้นแบบสำหรับลงในตำแหน่ง/เงินเดือน",
sortable: true, sortable: true,
field: "name", field: "name",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
@ -116,21 +116,21 @@ function onDialogEdit(data: ListTemplateSalary) {
* ลบ คำส * ลบ คำส
* @param id id คำส * @param id id คำส
*/ */
function onDelete(id: string) { async function onDelete(id: string) {
dialogRemove($q, () => { dialogRemove($q, async () => {
showLoader(); showLoader();
http await http
.delete(config.API.commandSalaryById(id)) .delete(config.API.commandSalaryById(id))
.then(async (res) => { .then(async () => {
success($q, "ลบข้อมูลเสร็จสิ้น");
await fetchSalaryList(); await fetchSalaryList();
hideLoader(); success($q, "ลบข้อมูลเสร็จสิ้น");
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
hideLoader();
}) })
.finally(() => {}); .finally(() => {
hideLoader();
});
}); });
} }
@ -146,33 +146,34 @@ function closeDialog() {
/** บันทึกข้อมูล dialog */ /** บันทึกข้อมูล dialog */
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, async () => {
const url = isEdit.value const url = isEdit.value
? config.API.commandSalaryById(dataForm.id) ? config.API.commandSalaryById(dataForm.id)
: config.API.commandSalary; : config.API.commandSalary;
showLoader(); showLoader();
http[isEdit.value ? "put" : "post"](url, { await http[isEdit.value ? "put" : "post"](url, {
name: dataForm.name, name: dataForm.name,
commandSysId: activeOrderId.value, commandSysId: activeOrderId.value,
isActive: dataForm.isActive, isActive: dataForm.isActive,
}) })
.then(async (res) => { .then(async () => {
closeDialog();
success($q, "บันทึกข้อมูลสำเร็จ");
await fetchSalaryList(); await fetchSalaryList();
hideLoader(); success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
hideLoader();
}) })
.finally(() => {}); .finally(() => {
hideLoader();
});
}); });
} }
/** เก็บ id list คำสั่งที่เลือก เพื่อใช้ class */ /** เก็บ id list คำสั่งที่เลือก เพื่อใช้ class */
function selectInbox(data: CommandSysType) { function selectInbox(data: CommandSysType) {
activeOrderId.value = data.id; activeOrderId.value = data.id;
pagination.value.page = 1;
fetchSalaryList(); fetchSalaryList();
} }
@ -181,13 +182,15 @@ function selectInbox(data: CommandSysType) {
*/ */
async function fetchSalaryList() { async function fetchSalaryList() {
showLoader(); showLoader();
rows.value = [];
await http await http
.get( .get(
config.API.commandSalaryDetail( config.API.commandSalaryDetail(
pagination.value.page, pagination.value.page,
pagination.value.rowsPerPage, pagination.value.rowsPerPage,
isActive.value, isActive.value,
activeOrderId.value activeOrderId.value,
filter.value
) )
) )
.then(async (res) => { .then(async (res) => {
@ -239,6 +242,7 @@ watch(
watch( watch(
() => isActive.value, () => isActive.value,
async () => { async () => {
pagination.value.page = 1;
await fetchSalaryList(); await fetchSalaryList();
} }
); );
@ -321,6 +325,7 @@ onMounted(() => {
outlined outlined
v-model="filter" v-model="filter"
placeholder="ค้นหา" placeholder="ค้นหา"
@keydown.enter="(pagination.page = 1), fetchSalaryList()"
> >
<template v-slot:append> <template v-slot:append>
<q-icon name="search" v-if="filter == ''" /> <q-icon name="search" v-if="filter == ''" />
@ -352,13 +357,12 @@ onMounted(() => {
ref="table" ref="table"
:columns="columns" :columns="columns"
:rows="rows" :rows="rows"
:filter="filter"
row-key="id" row-key="id"
flat flat
bordered bordered
:paging="true" :paging="true"
dense dense
:rows-per-page-options="[1, 25, 50, 100]" :rows-per-page-options="[25, 50, 100]"
@update:pagination="updatePagination" @update:pagination="updatePagination"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
> >
@ -466,7 +470,7 @@ onMounted(() => {
<Header <Header
:tittle="`${ :tittle="`${
isEdit ? 'แก้ไข' : 'เพิ่ม' isEdit ? 'แก้ไข' : 'เพิ่ม'
}นแบบสำหรบลงในตำแหน/เงนเดอน (นแบบ)`" }นแบบสำหรบลงในตำแหน/เงนเดอน`"
:close="closeDialog" :close="closeDialog"
/> />
<q-separator /> <q-separator />